本文整理汇总了C++中CMonster::OnDie方法的典型用法代码示例。如果您正苦于以下问题:C++ CMonster::OnDie方法的具体用法?C++ CMonster::OnDie怎么用?C++ CMonster::OnDie使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMonster
的用法示例。
在下文中一共展示了CMonster::OnDie方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MapProcess
//.........这里部分代码省略.........
if(!monster->UpdateValues( )) continue;
monster->UpdatePosition( true );
if(monster->IsOnBattle( ))
{
monster->DoAttack( ); // why was this commented? Monsters were not attacking
//monster->DoAi(monster->thisnpc->AI, 2); //don't use thisnpc->AI any more.
if(etime >= monster->AITimer)
{
monster->DoAi(monster->MonAI, 2);
monster->lastAiUpdate = clock();
}
//Log(MSG_INFO,"Monster type: %i current HP: %i",monster->montype, monster->Stats->HP);
}
else
{
//monster->DoAi(monster->thisnpc->AI, 1);
if(etime >= monster->AITimer)
{
monster->DoAi(monster->MonAI, 1);
monster->lastAiUpdate = clock();
}
}
monster->RefreshBuff( );
if (monster->IsSummon())
{
monster->SummonUpdate(monster,map, j);
continue;
}
if(monster->IsDead())
{
if(clock() - monster->DeathDelayTimer > GServer->Config.DeathDelay)
{
//Log(MSG_DEBUG,"Found dead monster montype %i",monster->montype);
monster->OnDie( ); //all this does is give exp
//Log(MSG_DEBUG,"back from giving exp");
monster->DoAi(monster->MonAI, 5);
//Log(MSG_DEBUG,"ran AI");
map->DeleteMonster( monster, true, j );
//Log(MSG_DEBUG,"deleted monster");
continue;
}
else
{
//Log(MSG_DEBUG,"Dead monster found. waiting for death delay timer");
}
}
}
//LMA: was there any summons in this map?
if(only_summon&&nb_summons_map==0)
{
map->nb_summons=0;
}
}
if(only_npc&&!only_summon)
{
pthread_mutex_lock( &map->MonsterMutex );
}
//LMA: AIP for NPC.
for(UINT j=0;j<map->NPCList.size();j++)
{
CNPC* npc = map->NPCList.at(j);
示例2: MapProcess
//.........这里部分代码省略.........
//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)
{
//Log( MSG_WARNING, "Invalid AI script for AI %i", npc->thisnpc->AI );
continue;
}
UINT thistimer = script->minTime * 1000; //seems to be set in seconds in AIP
if(thistimer<(UINT)GServer->round((clock( ) - npc->lastAiUpdate))) //check AIP conditions when the timer calls for it
{
CNPCData* thisnpc = GServer->GetNPCDataByID( npc->npctype );
if(thisnpc == NULL)
{