mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-15 12:42:43 -04:00
Properly stop attacking after player leaves ffa area (like Gurubashi Arena) (#18952)
This commit is contained in:
@@ -5874,6 +5874,24 @@ bool Unit::AttackStop()
|
||||
return true;
|
||||
}
|
||||
|
||||
void Unit::ValidateAttackersAndOwnTarget()
|
||||
{
|
||||
// iterate attackers
|
||||
UnitVector toRemove;
|
||||
AttackerSet const& attackers = getAttackers();
|
||||
for (Unit* attacker : attackers)
|
||||
if (!attacker->IsValidAttackTarget(this))
|
||||
toRemove.push_back(attacker);
|
||||
|
||||
for (Unit* attacker : toRemove)
|
||||
attacker->AttackStop();
|
||||
|
||||
// remove our own victim
|
||||
if (Unit* victim = GetVictim())
|
||||
if (!IsValidAttackTarget(victim))
|
||||
AttackStop();
|
||||
}
|
||||
|
||||
void Unit::CombatStop(bool includingCast)
|
||||
{
|
||||
if (includingCast && IsNonMeleeSpellCast(false))
|
||||
|
||||
Reference in New Issue
Block a user