本文整理汇总了C++中CMonster::IsSummon方法的典型用法代码示例。如果您正苦于以下问题:C++ CMonster::IsSummon方法的具体用法?C++ CMonster::IsSummon怎么用?C++ CMonster::IsSummon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMonster
的用法示例。
在下文中一共展示了CMonster::IsSummon方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddMonster
// add a new monster to this map
CMonster* CMap::AddMonster( UINT montype, fPoint position, UINT owner, CMDrops* MonsterDrop, CMDrops* MapDrop, UINT spawnid , bool GetDropData, bool is_tactic)
{
// check if is a valid monster
CNPCData* thisnpc = GServer->GetNPCDataByID( montype );
if(thisnpc==NULL)
{
Log( MSG_WARNING, "Add Monster:: Invalid montype %u", montype );
return NULL;
}
CMonster* monster = new (nothrow) CMonster( position, montype, this->id, owner, spawnid );
if(monster==NULL)
{
Log( MSG_WARNING, "Add Monster %u:: Error allocing memory",montype);
return NULL;
}
monster->thisnpc = thisnpc;
monster->life_time=0;
monster->SetStats( );
monster->Stats->HP = monster->Stats->MaxHP;
monster->Stats->MP = monster->Stats->MaxMP;
monster->is_tactical=is_tactic;
monster->suicide=false;
//LMA: test for quest hack (stackable).
#ifdef QHACK
monster->die_quest=thisnpc->die_quest;
#endif
//LMA END
for(int i=0;i<20;i++)
{
monster->AIVar[i] = 0;
}
//LMA: no agressivity in Santa's planetoid ;)
if(monster->Position->Map==38)
{
monster->thisnpc->aggresive=0;
monster->thisnpc->helpless=1;
//Log( MSG_WARNING, "Add Monster %u:: to Santa's planetoid",montype); // PY code added to read out monsters spawning on Santa's planetoid
}
//LMA: Little check, for now we "only" have a DWORD for monster's HP so there is a limit
//broken by some monsters (Turak boss)
if(monster->Stats->HP>MAXHPMOB)
{
monster->Stats->HP=(long long) MAXHPMOB;
}
monster->Status->spawnid = spawnid; //this way we can easily find which spawn a mob belongs to
if(GetDropData && owner==0)
{
monster->MonsterDrop->mobdrop = GServer->GetDropData( monster->thisnpc->dropid );
monster->MonsterDrop->mapdrop = GServer->GetDropData( id );
}
else
{
monster->MonsterDrop->mobdrop = MonsterDrop;
monster->MonsterDrop->mapdrop = MapDrop;
}
MonsterList.push_back( monster );
//LMA: daynight
monster->daynight=0;
monster->sp_aip=0;
//LMA: team:
monster->team=0;
if(monster->IsSummon()&&owner!=0)
{
//Trying to get the owner.
CPlayer* tempplayer=GServer->GetClientByID(owner,monster->Position->Map);
if (tempplayer!=NULL)
{
monster->team=tempplayer->pvp_id;
Log(MSG_INFO,"ADDMONSTER, overwriting team with owner's pvp_id %i",tempplayer->pvp_id);
//Tomiz : Get Owner lvl For Summon (the one from job, setup to fix normal atk formula because summon got lvl <= 100 in STB)
UINT ownerlevel = 0;
ownerlevel += tempplayer->Stats->Level;
monster->Stats->Level = ownerlevel;
Log(MSG_INFO,"Summon %i, got lvl %i by this owner",thisnpc->id,ownerlevel);
}
//LMA: adding a summon :)
if (monster->IsSummon())
{
nb_summons++;
Log(MSG_INFO,"Adding a summon in map %i (now %u)",id,nb_summons);
}
}
//Log( MSG_WARNING, "AddMonster:: about to do some crap with groups" );
/* if(spawnid!=0) //PY: commenting out this bit cuz it crashes with my new IFO spawns
{
CMobGroup* thisgroup = GServer->GetMobGroup( spawnid, this->id );
if(thisgroup!=NULL)
//.........这里部分代码省略.........
示例2: MapProcess
//.........这里部分代码省略.........
// Monster update //------------------------
pthread_mutex_lock( &map->MonsterMutex );
//spawn TD monsters
unsigned nextmon = map->TDMobList[map->TDNextSpawn];
if(nextmon != 0)
{
//Log(MSG_DEBUG,"Spawning TD mobs");
clock_t etime = clock() - map->lastTDSpawnTime;
if(etime >= map->TDMobDelay) // check if elapsed time is greater than spawn delay
{
//spawn the next monster on the list
//Log(MSG_DEBUG,"Spawning TD mob of type %i at position %i in the list for map %i",nextmon, map->TDNextSpawn, map->id);
map->AddMonster(nextmon, GServer->WPList[map->id][1].pos, 0, 0, 0, 1, 0, 999 ); //spawn a TD mob with no AI
//Log(MSG_DEBUG,"Spawned mob in addmonster");
map->TDMobList[map->TDNextSpawn] = 0; //clear the spawn
//Log(MSG_DEBUG,"cleared the spawn");
map->TDNextSpawn++; //move the pointer
//Log(MSG_DEBUG,"moved the pointer");
if(map->TDNextSpawn > 100)map->TDNextSpawn = 0;
map->lastTDSpawnTime = clock();
}
}
//TD spawn end
for(UINT j=0;j<map->MonsterList.size();j++)
{
CMonster* monster = map->MonsterList.at(j);
//UINT thistimer = monster->AItimer;
clock_t etime = clock() - monster->lastAiUpdate;
//LMA: only summon ?
if (only_summon&&!monster->IsSummon())
{
continue;
}
else if(only_summon)
{
nb_summons_map++;
}
if(monster->hitcount == 0xFF)//this is a delay for new monster spawns this might olso fix invisible monsters(if they attack directly on spawning the client dosn't get the attack packet(its not in it's visible list yet))
{
monster->hitcount = 0;
//monster->DoAi(monster->thisnpc->AI, 0);
monster->DoAi(monster->MonAI, 0); //AI on spawn
monster->lastAiUpdate=clock();
}
//PY handling day only or night only monsters.
if(!map->IsNight( ) && monster->Status->nightonly)// if day, delete all night time monsters
{
//Log( MSG_INFO, "Night Only monster deleted. Type %i", monster->montype);
map->DeleteMonster( monster, true, j );
continue;
}
if(map->IsNight() && monster->Status->dayonly)
{
//Log( MSG_INFO, "Day Only monster deleted. Type %i", monster->montype);
map->DeleteMonster( monster, true, j );
continue;
}
//Do TD stuff
示例3: AoeSkill
//arnold
// do AoE skill
bool CCharacter::AoeSkill( CSkills* skill, CCharacter* Enemy )
{
Position->destiny = Position->current;
//Log(MSG_INFO,"Doing AOE Skill");
//if(Battle->castTime == 0)
//{
BEGINPACKET( pak, 0x7bb );
ADDWORD ( pak, clientid );
GServer->SendToVisible( &pak, (CCharacter*)this );
// Battle->castTime = clock();
// return true;
//}
//else
//{
// clock_t etime = clock() - Battle->castTime;
// if(etime < SKILL_DELAY)
// return true;
//}
//Battle->castTime = 0;
CMap* map = GServer->MapList.Index[Position->Map];
//PY replacement code
if(IsPlayer() || IsSummon())
{
for(UINT i=0;i<map->MonsterList.size();i++)
{
CMonster* monster = map->MonsterList.at(i);
if(monster == NULL) continue;
if(monster->clientid == clientid) continue;
if(monster->IsSummon( ) && (map->allowpvp == 0 || monster->owner == clientid)) continue;
if(GServer->IsMonInCircle( Position->skilltargetpos, monster->Position->current,(float)skill->aoeradius + 1))
UseAtkSkill( (CCharacter*) monster, skill );
}
}
if(IsMonster() && !IsSummon())
{
for(UINT i=0;i<map->PlayerList.size();i++)
{
CPlayer* player = map->PlayerList.at(i);
if(player == NULL)continue;
if(player->clientid == clientid) continue;
if(GServer->IsMonInCircle( Position->skilltargetpos,player->Position->current,(float)skill->aoeradius+1))
UseAtkSkill( (CCharacter*) player, skill );
}
}
//PY end
// this code appears to me to be completely wrong replaced with code above
/*
for(UINT i=0;i<map->MonsterList.size();i++)
{
CMonster* monster = map->MonsterList.at(i);
if(monster->clientid == clientid) continue;
if(IsSummon( ) || IsPlayer( ))
{
if(monster->IsSummon( ) && (map->allowpvp==0 || monster->owner == clientid)) continue;
}
else
{
if(!monster->IsSummon( )) continue;
}
if(GServer->IsMonInCircle( Position->skilltargetpos, monster->Position->current,(float)skill->aoeradius + 1))
UseAtkSkill( (CCharacter*) monster, skill );
}
if(map->allowpvp!=0 || (IsMonster( ) && !IsSummon( )))
{
for(UINT i=0;i<map->PlayerList.size();i++)
{
CPlayer* player = map->PlayerList.at(i);
if(player->clientid==clientid) continue;
if(GServer->IsMonInCircle( Position->skilltargetpos,player->Position->current,(float)skill->aoeradius+1))
UseAtkSkill( (CCharacter*) player, skill );
}
}*/
Battle->iscasting = 1;
//Log(MSG_DEBUG,"Cast a skill. Iscasting set to true");
if(Enemy != NULL)
{
if(Enemy->IsDead( ))
ClearBattle( Battle );
}
else
ClearBattle( Battle );
Stats->MP -= (skill->mp - (skill->mp * Stats->MPReduction / 100));
if(Stats->MP < 0) Stats->MP = 0;
Battle->lastAtkTime = clock( );
return true;
}
示例4: AddMonster
// add a new monster to this map
CMonster* CMap::AddMonster( UINT montype, fPoint position, UINT owner, CMDrops* MonsterDrop, CMDrops* MapDrop, UINT spawnid , bool GetDropData, bool is_tactic)
{
// check if is a valid monster
CNPCData* thisnpc = GServer->GetNPCDataByID( montype );
if(thisnpc==NULL)
{
Log( MSG_WARNING, "Invalid montype %i", montype );
return NULL;
}
CMonster* monster = new (nothrow) CMonster( position, montype, this->id, owner, spawnid );
if(monster==NULL)
{
Log( MSG_WARNING, "Error allocing memory" );
return NULL;
}
monster->thisnpc = thisnpc;
monster->life_time=0;
monster->SetStats( );
monster->Stats->HP = monster->Stats->MaxHP;
monster->Stats->MP = monster->Stats->MaxMP;
monster->is_tactical=is_tactic;
monster->suicide=false;
//LMA: no agressivity in Santa's planetoid ;)
if(monster->Position->Map==38)
{
monster->thisnpc->aggresive=0;
monster->thisnpc->helpless=1;
}
//LMA: Little check, for now we "only" have a DWORD for monster's HP so there is a limit
//broken by some monsters (Turak boss)
if(monster->Stats->HP>MAXHPMOB)
{
monster->Stats->HP=(long long) MAXHPMOB;
}
monster->Status->spawnid = spawnid; //this way we can easily find which spawn a mob belongs to
if(GetDropData && owner==0)
{
monster->MonsterDrop->mobdrop = GServer->GetDropData( monster->thisnpc->dropid );
monster->MonsterDrop->mapdrop = GServer->GetDropData( id );
}
else
{
monster->MonsterDrop->mobdrop = MonsterDrop;
monster->MonsterDrop->mapdrop = MapDrop;
}
MonsterList.push_back( monster );
//LMA: daynight
monster->daynight=0;
monster->sp_aip=0;
//LMA: team:
monster->team=0;
if(monster->IsSummon()&&owner!=0)
{
//Trying to get the owner.
CPlayer* tempplayer=GServer->GetClientByID(owner,monster->Position->Map);
if (tempplayer!=NULL)
{
monster->team=tempplayer->pvp_id;
Log(MSG_INFO,"ADDMONSTER, overwriting team with owner's pvp_id",tempplayer->pvp_id);
}
}
if(spawnid!=0)
{
CMobGroup* thisgroup = GServer->GetMobGroup( spawnid, this->id );
if(thisgroup!=NULL)
{
//LMA: only if not a tactical.
if(!monster->is_tactical)
{
thisgroup->active++;
}
}
//LMA: daynight
monster->daynight=thisgroup->daynight;
}
monster->SpawnTime = clock( );
monster->lastDegenTime=clock();
monster->OnSpawn( false );
monster->lastAiUpdate = clock();
monster->hitcount = 0xFF;
monster->hitcount=0;
monster->maxhitcount=0;
monster->stay_still=false;
if(monster->thisnpc->id==659)
//.........这里部分代码省略.........
示例5: MapProcess
//.........这里部分代码省略.........
map->DeleteMonster( monster, true, j );
continue;
}
if(!monster->PlayerInRange( )) continue;
if(!monster->UpdateValues( )) continue;
monster->UpdatePosition( );
if(monster->IsOnBattle( ))
{
//monster->DoAttack( );
if(thistimer<(UINT)GServer->round((clock( ) - monster->lastAiUpdate)))
{
//monster->DoAi(monster->thisnpc->AI, 2);
monster->DoAi(monster->monAI, 2);
monster->lastAiUpdate = clock();
//Log(MSG_INFO,"Monster type: %i current HP: %i",monster->montype, monster->Stats->HP);
}
else
{
//Log(MSG_INFO,"Monster doing attack");
monster->DoAttack( );
}
}
else if(!monster->IsOnBattle() && !monster->IsDead( ))
{
if(thistimer<(UINT)GServer->round((clock( ) - monster->lastAiUpdate)))
{
//monster->DoAi(monster->thisnpc->AI, 1);
monster->DoAi(monster->monAI, 1);
monster->lastAiUpdate = clock();
}
}
monster->RefreshBuff( );
if (monster->IsSummon())
{
monster->SummonUpdate(monster,map, j);
continue;
}
if(monster->IsDead( ))
{
//monster->DoAi(monster->thisnpc->AI, 5);
monster->DoAi(monster->monAI, 5);
monster->OnDie( );
}
}
}
if(only_npc)
pthread_mutex_lock( &map->MonsterMutex );
//AIP for NPCs
for(UINT j=0;j<map->NPCList.size();j++)
{
CNPC* npc = map->NPCList.at(j);
if(npc->thisnpc->AI != 0)
{
CAip* script = NULL;
for(unsigned j=0; j < GServer->AipList.size(); j++)
{
if (GServer->AipList.at(j)->AInumber == npc->thisnpc->AI)
{
script = GServer->AipList.at(j);
break;
}
}
if(script == NULL)
{