mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-10 16:12:25 +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;
|
NPC *cur = nullptr;
|
||||||
uint16 count = 0;
|
uint16 count = 0;
|
||||||
|
std::list<NPC *> npc_sub_list;
|
||||||
auto it = npc_list.begin();
|
auto it = npc_list.begin();
|
||||||
while (it != npc_list.end()) {
|
while (it != npc_list.end()) {
|
||||||
cur = it->second;
|
cur = it->second;
|
||||||
@ -3025,11 +3026,13 @@ void EntityList::AddHealAggro(Mob *target, Mob *caster, uint16 thedam)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!cur->IsMezzed() && !cur->IsStunned() && !cur->IsFeared()) {
|
if (!cur->IsMezzed() && !cur->IsStunned() && !cur->IsFeared()) {
|
||||||
|
npc_sub_list.push_back(cur);
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (thedam > 1) {
|
if (thedam > 1) {
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
thedam /= count;
|
thedam /= count;
|
||||||
@ -3039,32 +3042,26 @@ void EntityList::AddHealAggro(Mob *target, Mob *caster, uint16 thedam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur = nullptr;
|
cur = nullptr;
|
||||||
it = npc_list.begin();
|
auto sit = npc_sub_list.begin();
|
||||||
while (it != npc_list.end()) {
|
while (sit != npc_sub_list.end()) {
|
||||||
cur = it->second;
|
cur = *sit;
|
||||||
if (!cur->CheckAggro(target)) {
|
|
||||||
++it;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!cur->IsMezzed() && !cur->IsStunned() && !cur->IsFeared()) {
|
if (cur->IsPet()) {
|
||||||
if (cur->IsPet()) {
|
if (caster) {
|
||||||
if (caster) {
|
if (cur->CheckAggro(caster)) {
|
||||||
if (cur->CheckAggro(caster)) {
|
cur->AddToHateList(caster, thedam);
|
||||||
cur->AddToHateList(caster, thedam);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
if (caster) {
|
} else {
|
||||||
if (cur->CheckAggro(caster)) {
|
if (caster) {
|
||||||
cur->AddToHateList(caster, thedam);
|
if (cur->CheckAggro(caster)) {
|
||||||
} else {
|
cur->AddToHateList(caster, thedam);
|
||||||
cur->AddToHateList(caster, thedam * 0.33);
|
} else {
|
||||||
}
|
cur->AddToHateList(caster, thedam * 0.33);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++it;
|
++sit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user