本文整理汇总了C++中CMobEntity::GetMLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ CMobEntity::GetMLevel方法的具体用法?C++ CMobEntity::GetMLevel怎么用?C++ CMobEntity::GetMLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMobEntity
的用法示例。
在下文中一共展示了CMobEntity::GetMLevel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SpawnMOBs
void CZone::SpawnMOBs(CCharEntity* PChar)
{
for (EntityList_t::const_iterator it = m_mobList.begin() ; it != m_mobList.end() ; ++it)
{
CMobEntity* PCurrentMob = (CMobEntity*)it->second;
SpawnIDList_t::iterator MOB = PChar->SpawnMOBList.lower_bound(PCurrentMob->id);
float CurrentDistance = distance(PChar->loc.p, PCurrentMob->loc.p);
if (PCurrentMob->status == STATUS_UPDATE &&
CurrentDistance < 50)
{
if( MOB == PChar->SpawnMOBList.end() ||
PChar->SpawnMOBList.key_comp()(PCurrentMob->id, MOB->first))
{
PChar->SpawnMOBList.insert(MOB, SpawnIDList_t::value_type(PCurrentMob->id, PCurrentMob));
PChar->pushPacket(new CEntityUpdatePacket(PCurrentMob, ENTITY_SPAWN));
}
if (PChar->isDead() || PChar->nameflags.flags & FLAG_GM || PCurrentMob->PMaster != NULL)
continue;
// проверка ночного/дневного сна монстров уже учтена в проверке CurrentAction, т.к. во сне монстры не ходят ^^
uint16 expGain = (uint16)charutils::GetRealExp(PChar->GetMLevel(),PCurrentMob->GetMLevel());
CAIMobDummy* PAIMob = (CAIMobDummy*)PCurrentMob->PBattleAI;
bool validAggro = expGain > 50 || PChar->animation == ANIMATION_HEALING || PCurrentMob->getMobMod(MOBMOD_ALWAYS_AGGRO);
if(validAggro && PAIMob->CanAggroTarget(PChar))
{
PCurrentMob->PEnmityContainer->AddBaseEnmity(PChar);
}
}
else
{
if( MOB != PChar->SpawnMOBList.end() &&
!(PChar->SpawnMOBList.key_comp()(PCurrentMob->id, MOB->first)))
{
PChar->SpawnMOBList.erase(MOB);
PChar->pushPacket(new CEntityUpdatePacket(PCurrentMob,ENTITY_DESPAWN));
}
}
}
}
示例2: SpawnMOBs
void CZoneEntities::SpawnMOBs(CCharEntity* PChar)
{
for (EntityList_t::const_iterator it = m_mobList.begin(); it != m_mobList.end(); ++it)
{
CMobEntity* PCurrentMob = (CMobEntity*)it->second;
SpawnIDList_t::iterator MOB = PChar->SpawnMOBList.lower_bound(PCurrentMob->id);
float CurrentDistance = distance(PChar->loc.p, PCurrentMob->loc.p);
if (PCurrentMob->status != STATUS_DISAPPEAR &&
CurrentDistance < 50)
{
if (MOB == PChar->SpawnMOBList.end() ||
PChar->SpawnMOBList.key_comp()(PCurrentMob->id, MOB->first))
{
PChar->SpawnMOBList.insert(MOB, SpawnIDList_t::value_type(PCurrentMob->id, PCurrentMob));
PChar->pushPacket(new CEntityUpdatePacket(PCurrentMob, ENTITY_SPAWN, UPDATE_ALL_MOB));
}
if (PChar->isDead() || PChar->nameflags.flags & FLAG_GM || PCurrentMob->PMaster != nullptr)
continue;
// проверка ночного/дневного сна монстров уже учтена в проверке CurrentAction, т.к. во сне монстры не ходят ^^
uint16 expGain = (uint16)charutils::GetRealExp(PChar->GetMLevel(), PCurrentMob->GetMLevel());
CMobController* PController = static_cast<CMobController*>(PCurrentMob->PAI->GetController());
bool validAggro = expGain > 50 || PChar->isSitting() || PCurrentMob->getMobMod(MOBMOD_ALWAYS_AGGRO);
if (validAggro && PController->CanAggroTarget(PChar))
{
PCurrentMob->PEnmityContainer->AddBaseEnmity(PChar);
}
}
else
{
if (MOB != PChar->SpawnMOBList.end() &&
!(PChar->SpawnMOBList.key_comp()(PCurrentMob->id, MOB->first)))
{
PChar->SpawnMOBList.erase(MOB);
PChar->pushPacket(new CEntityUpdatePacket(PCurrentMob, ENTITY_DESPAWN, UPDATE_NONE));
}
}
}
}