mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-04 15:43:52 +00:00
Optimized EntityList::AddHealAggro
This commit is contained in:
parent
a67aed9538
commit
057e4603db
@ -3016,6 +3016,7 @@ void EntityList::AddHealAggro(Mob *target, Mob *caster, uint16 thedam)
|
||||
{
|
||||
NPC *cur = nullptr;
|
||||
uint16 count = 0;
|
||||
std::list<NPC *> npc_sub_list;
|
||||
auto it = npc_list.begin();
|
||||
while (it != npc_list.end()) {
|
||||
cur = it->second;
|
||||
@ -3025,11 +3026,13 @@ void EntityList::AddHealAggro(Mob *target, Mob *caster, uint16 thedam)
|
||||
continue;
|
||||
}
|
||||
if (!cur->IsMezzed() && !cur->IsStunned() && !cur->IsFeared()) {
|
||||
npc_sub_list.push_back(cur);
|
||||
++count;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
|
||||
|
||||
if (thedam > 1) {
|
||||
if (count > 0)
|
||||
thedam /= count;
|
||||
@ -3039,32 +3042,26 @@ void EntityList::AddHealAggro(Mob *target, Mob *caster, uint16 thedam)
|
||||
}
|
||||
|
||||
cur = nullptr;
|
||||
it = npc_list.begin();
|
||||
while (it != npc_list.end()) {
|
||||
cur = it->second;
|
||||
if (!cur->CheckAggro(target)) {
|
||||
++it;
|
||||
continue;
|
||||
}
|
||||
auto sit = npc_sub_list.begin();
|
||||
while (sit != npc_sub_list.end()) {
|
||||
cur = *sit;
|
||||
|
||||
if (!cur->IsMezzed() && !cur->IsStunned() && !cur->IsFeared()) {
|
||||
if (cur->IsPet()) {
|
||||
if (caster) {
|
||||
if (cur->CheckAggro(caster)) {
|
||||
cur->AddToHateList(caster, thedam);
|
||||
}
|
||||
if (cur->IsPet()) {
|
||||
if (caster) {
|
||||
if (cur->CheckAggro(caster)) {
|
||||
cur->AddToHateList(caster, thedam);
|
||||
}
|
||||
} else {
|
||||
if (caster) {
|
||||
if (cur->CheckAggro(caster)) {
|
||||
cur->AddToHateList(caster, thedam);
|
||||
} else {
|
||||
cur->AddToHateList(caster, thedam * 0.33);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (caster) {
|
||||
if (cur->CheckAggro(caster)) {
|
||||
cur->AddToHateList(caster, thedam);
|
||||
} else {
|
||||
cur->AddToHateList(caster, thedam * 0.33);
|
||||
}
|
||||
}
|
||||
}
|
||||
++it;
|
||||
++sit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user