本文整理汇总了C++中CMonster::OnSpawn方法的典型用法代码示例。如果您正苦于以下问题:C++ CMonster::OnSpawn方法的具体用法?C++ CMonster::OnSpawn怎么用?C++ CMonster::OnSpawn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMonster
的用法示例。
在下文中一共展示了CMonster::OnSpawn方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddAdrenaMonster
CMonster* CMap::AddAdrenaMonster( UINT montype, fPoint position, int team)
{
// 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, 0, 0 );
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=true;
monster->suicide=false;
monster->team = team;
monster->owner = 0;
//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;
}
//broken by some monsters (Turak boss)
if(monster->Stats->HP>MAXHPMOB)
{
monster->Stats->HP=(long long) MAXHPMOB;
}
MonsterList.push_back( monster );
//LMA: daynight
monster->daynight=0;
monster->sp_aip=0;
//LMA: team:
monster->team=team;
monster->SpawnTime = clock( );
monster->lastDegenTime=clock();
monster->OnSpawn( false );
monster->lastAiUpdate = clock();
monster->nextAi_attacked=clock();
monster->hitcount = 0xFF;
monster->owner = 0;
monster->hitcount=0;
monster->maxhitcount=0;
if(thisnpc->wspeed == 0)
{
monster->stay_still=true;
}
else
{
monster->stay_still=false;
}
monster->bonushp=0;
monster->bonusmp=0;
monster->maxvalue=0;
monster->minvalue=0;
monster->skillid=0;
monster->range=0;
monster->buffid=0;
monster->char_montype=montype;
//Log(MSG_INFO,"XCID, Addmonster %i in map %i",montype,monster->Position->Map);
return monster;
}
示例2: 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 )
{
// 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->SetStats( );
monster->Stats->HP = monster->Stats->MaxHP;
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 );
if(spawnid!=0)
{
CSpawnArea* thisspawn = GServer->GetSpawnArea( spawnid, this->id );
if(thisspawn!=NULL)
thisspawn->amon++;
}
monster->SpawnTime = clock( );
monster->OnSpawn( false );
//LMA BEGIN
//20070621-211100/test
//The bug still exists, I activate it...
//solves 99.99% this problem.
//We search if a player is nearby and we force the refresh
/*
CPlayer* player = monster->GetNearPlayer( );
if(player!=NULL)
{
player->ForceRefreshMonster(false,monster->clientid);
}
*/
//LMA END
monster->hitcount=0;
monster->maxhitcount=0;
monster->stay_still=false;
if(monster->thisnpc->id==659)
{
monster->maxhitcount=3; //LMA: MoonChild
monster->stay_still=true;
}
if(monster->thisnpc->id==201)
{
monster->maxhitcount=1; //LMA: Worm dragon
}
//Sunrise, Sunset and Dusk Crystal in Junon Cartel
if (monster->thisnpc->id>=431&&monster->thisnpc->id<=433)
monster->stay_still=true;
//LMA: bonfire (and salamender...) don't move and don't attack ;)
if (monster->IsBonfire())
{
monster->stay_still=true;
monster->Battle->target=owner;
}
monster->bonushp=0;
monster->bonusmp=0;
monster->maxvalue=0;
monster->minvalue=0;
monster->skillid=0;
monster->range=0;
monster->buffid=0;
return monster;
}
示例3: AddMonster
//.........这里部分代码省略.........
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)
{
//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->nextAi_attacked=clock();
monster->hitcount = 0xFF;
monster->hitcount=0;
monster->maxhitcount=0;
monster->stay_still=false;
if(monster->thisnpc->id==659)
{
monster->maxhitcount=3; //LMA: MoonChild
monster->stay_still=true;
}
if(monster->thisnpc->id==201)
{
monster->maxhitcount=1; //LMA: Worm dragon
}
if(monster->thisnpc->id==1572)
{
monster->maxhitcount=1; //rl2171: Cursed Ant Vagabond
}
if(monster->thisnpc->id==662 || monster->thisnpc->id==667 || monster->thisnpc->id==673 || monster->thisnpc->id==678)
{
monster->maxhitcount=3; //rl2171: Dragon Egg for Clan Wars - 662, 667, 673, 678
monster->stay_still=true;
}
if(monster->thisnpc->id==558)
{
示例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)
//.........这里部分代码省略.........