[Bug Fix] Fix Issue With Bot Raid Aggro (#4222)

# Notes
- Bots were reportedly being bypassed by NPCs due to not taking into consideration their raid group's damage.
- Must have been missed when bot raids were implemented.
This commit is contained in:
Alex King 2024-03-31 12:56:12 -04:00 committed by GitHub
parent b638795f9b
commit 3ae7979a67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -108,46 +108,48 @@ void HateList::SetHateAmountOnEnt(Mob* other, int64 in_hate, uint64 in_damage)
Mob* HateList::GetDamageTopOnHateList(Mob* hater) Mob* HateList::GetDamageTopOnHateList(Mob* hater)
{ {
Mob* current = nullptr; Mob* c = nullptr;
Group* grp = nullptr; Mob* m = nullptr;
Group* g = nullptr;
Raid* r = nullptr; Raid* r = nullptr;
uint64 dmg_amt = 0;
auto iterator = list.begin(); uint64 damage = 0;
while (iterator != list.end())
{ for (const auto& e : list) {
grp = nullptr; c = e->entity_on_hatelist;
if (!c) {
continue;
}
g = nullptr;
r = nullptr; r = nullptr;
if ((*iterator)->entity_on_hatelist && (*iterator)->entity_on_hatelist->IsClient()){ if (c->IsBot()) {
r = entity_list.GetRaidByClient((*iterator)->entity_on_hatelist->CastToClient()); r = entity_list.GetRaidByBot(c->CastToBot());
} else if (c->IsClient()) {
r = entity_list.GetRaidByClient(c->CastToClient());
} }
grp = entity_list.GetGroupByMob((*iterator)->entity_on_hatelist); g = entity_list.GetGroupByMob(c);
if ((*iterator)->entity_on_hatelist && r){ if (r) {
if (r->GetTotalRaidDamage(hater) >= dmg_amt) if (r->GetTotalRaidDamage(hater) >= damage) {
{ m = c;
current = (*iterator)->entity_on_hatelist; damage = r->GetTotalRaidDamage(hater);
dmg_amt = r->GetTotalRaidDamage(hater); }
} else if (g) {
if (g->GetTotalGroupDamage(hater) >= damage) {
m = c;
damage = g->GetTotalGroupDamage(hater);
}
} else if (static_cast<uint64>(e->hatelist_damage) >= damage) {
m = c;
damage = static_cast<uint64>(e->hatelist_damage);
} }
} }
else if ((*iterator)->entity_on_hatelist != nullptr && grp != nullptr)
{ return m;
if (grp->GetTotalGroupDamage(hater) >= dmg_amt)
{
current = (*iterator)->entity_on_hatelist;
dmg_amt = grp->GetTotalGroupDamage(hater);
}
}
else if ((*iterator)->entity_on_hatelist != nullptr && (uint64)(*iterator)->hatelist_damage >= dmg_amt)
{
current = (*iterator)->entity_on_hatelist;
dmg_amt = (*iterator)->hatelist_damage;
}
++iterator;
}
return current;
} }
Mob* HateList::GetClosestEntOnHateList(Mob *hater, bool skip_mezzed, EntityFilterType filter_type) { Mob* HateList::GetClosestEntOnHateList(Mob *hater, bool skip_mezzed, EntityFilterType filter_type) {