本文整理汇总了C++中CBattleEntity::GetMaxHP方法的典型用法代码示例。如果您正苦于以下问题:C++ CBattleEntity::GetMaxHP方法的具体用法?C++ CBattleEntity::GetMaxHP怎么用?C++ CBattleEntity::GetMaxHP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBattleEntity
的用法示例。
在下文中一共展示了CBattleEntity::GetMaxHP方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TryHeal
//.........这里部分代码省略.........
}
threshold = dsp_cap(threshold + PAutomaton->getMod(Mod::AUTO_HEALING_THRESHOLD), 30, 90);
CBattleEntity* PCastTarget = nullptr;
bool haveHate = false;
EnmityList_t* enmityList;
auto PMob = dynamic_cast<CMobEntity*>(PTarget);
if (PMob)
{
enmityList = PMob->PEnmityContainer->GetEnmityList();
auto masterEnmity_obj = enmityList->find(PAutomaton->PMaster->id);
auto selfEnmity_obj = enmityList->find(PAutomaton->id);
if (masterEnmity_obj == enmityList->end())
haveHate = true;
else if (selfEnmity_obj == enmityList->end())
haveHate = false;
else
{
uint16 selfEnmity = selfEnmity_obj->second.CE + selfEnmity_obj->second.VE;
uint16 masterEnmity = masterEnmity_obj->second.CE + masterEnmity_obj->second.VE;
haveHate = selfEnmity > masterEnmity ? true : false;
}
}
// Prioritize hate
if (haveHate)
{
if (PAutomaton->GetHPP() <= 50) // Automaton only heals itself when <= 50%
PCastTarget = PAutomaton;
else if (PAutomaton->PMaster->GetHPP() <= threshold && distance(PAutomaton->loc.p, PAutomaton->PMaster->loc.p) < 20)
PCastTarget = PAutomaton->PMaster;
}
else
{
if (PAutomaton->PMaster->GetHPP() <= threshold)
PCastTarget = PAutomaton->PMaster;
else if (PAutomaton->GetHPP() <= 50) // Automaton only heals itself when <= 50%
PCastTarget = PAutomaton;
}
if (maneuvers.light && !PCastTarget && PAutomaton->getHead() == HEAD_SOULSOOTHER && PAutomaton->PMaster->PParty) // Light + Soulsoother head -> Heal party
{
if (PMob)
{
uint16 highestEnmity = 0;
for (uint8 i = 0; i < PAutomaton->PMaster->PParty->members.size(); ++i)
{
CBattleEntity* member = PAutomaton->PMaster->PParty->members.at(i);
if (member->id != PAutomaton->PMaster->id)
{
auto enmity_obj = enmityList->find(member->id);
if (enmity_obj != enmityList->end() && highestEnmity < enmity_obj->second.CE + enmity_obj->second.VE &&
member->GetHPP() <= threshold && distance(PAutomaton->loc.p, PAutomaton->PMaster->loc.p) < 20)
{
highestEnmity = enmity_obj->second.CE + enmity_obj->second.VE;
PCastTarget = member;
}
}
}
}
else
{
for (uint8 i = 0; i < PAutomaton->PMaster->PParty->members.size(); ++i)
{
CBattleEntity* member = PAutomaton->PMaster->PParty->members.at(i);
if (member->id != PAutomaton->PMaster->id && distance(PAutomaton->loc.p, PAutomaton->PMaster->loc.p) < 20)
{
if (member->GetHPP() <= threshold)
{
PCastTarget = member;
break;
}
}
}
}
}
// This might be wrong
if (PCastTarget)
{
float missinghp = PCastTarget->GetMaxHP() - PCastTarget->health.hp;
if (missinghp > 850 && Cast(PCastTarget->targid, SpellID::Cure_VI ))
return true;
else if (missinghp > 600 && Cast(PCastTarget->targid, SpellID::Cure_V))
return true;
else if (missinghp > 350 && Cast(PCastTarget->targid, SpellID::Cure_IV))
return true;
else if (missinghp > 190 && Cast(PCastTarget->targid, SpellID::Cure_III))
return true;
else if (missinghp > 120 && Cast(PCastTarget->targid, SpellID::Cure_II))
return true;
else if (Cast(PCastTarget->targid, SpellID::Cure))
return true;
}
return false;
}