[Bug Fix] Proximity Aggro for Frustrated and Undead (#4411)

* [Bug Fix] Prox aggro for frustrated and undead.

If mob is frustrated (Rooted and has no one to kill or is undead will add prox aggro to hate list.

* Update aggro.cpp

---------

Co-authored-by: Kinglykrab <kinglykrab@gmail.com>
This commit is contained in:
Fryguy 2024-07-22 07:01:12 -04:00 committed by GitHub
parent 3b0fa015a7
commit 1e5abc456b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -452,8 +452,26 @@ bool Mob::CheckWillAggro(Mob *mob) {
return false;
}
// Don't aggro new clients if we are already engaged unless SpecialAbility::ProximityAggro is set
if (IsEngaged() && (!GetSpecialAbility(SpecialAbility::ProximityAggro) || (GetSpecialAbility(SpecialAbility::ProximityAggro) && !CombatRange(mob)))) {
// Don't aggro new clients if we are already engaged unless PROX_AGGRO is set
// Frustrated mobs (all rooted up with no one to kill)
// will engage without PROX_AGGRO ability if someone new is close now.
const bool is_frustrated = IsRooted() && !CombatRange(target);
if (
!is_frustrated &&
IsEngaged() &&
(
(
!GetSpecialAbility(SpecialAbility::ProximityAggro) &&
GetBodyType() != BodyType::Undead
) ||
(
GetSpecialAbility(SpecialAbility::ProximityAggro) &&
!CombatRange(mob)
)
)
) {
LogAggro(
"[{}] is in combat, and does not have prox_aggro, or does and is out of combat range with [{}]",
GetName(),