fix(Core/Combat): Pets should put their owners in combat only on init… (#14682)

This commit is contained in:
UltraNix
2023-01-28 10:57:52 +01:00
committed by GitHub
parent 44226e4754
commit 4e01b95777

View File

@@ -1064,7 +1064,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage
if (attacker) if (attacker)
{ {
if (spellProto && !victim->IsInCombatWith(attacker)) if (spellProto && victim->CanHaveThreatList() && !victim->HasUnitState(UNIT_STATE_EVADE) && !victim->IsInCombatWith(attacker))
{ {
victim->CombatStart(attacker, !(spellProto->AttributesEx3 & SPELL_ATTR3_SUPRESS_TARGET_PROCS)); victim->CombatStart(attacker, !(spellProto->AttributesEx3 & SPELL_ATTR3_SUPRESS_TARGET_PROCS));
} }
@@ -13585,14 +13585,19 @@ void Unit::CombatStart(Unit* victim, bool initialAggro)
} }
} }
bool alreadyInCombat = IsInCombat();
SetInCombatWith(victim); SetInCombatWith(victim);
victim->SetInCombatWith(this); victim->SetInCombatWith(this);
// Xinef: If pet started combat - put owner in combat // Xinef: If pet started combat - put owner in combat
if (Unit* owner = GetOwner()) if (!alreadyInCombat && IsInCombat())
{ {
owner->SetInCombatWith(victim); if (Unit* owner = GetOwner())
victim->SetInCombatWith(owner); {
owner->SetInCombatWith(victim);
victim->SetInCombatWith(owner);
}
} }
} }