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
+6 -1
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,16 +13585,21 @@ 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 (!alreadyInCombat && IsInCombat())
{
if (Unit* owner = GetOwner()) if (Unit* owner = GetOwner())
{ {
owner->SetInCombatWith(victim); owner->SetInCombatWith(victim);
victim->SetInCombatWith(owner); victim->SetInCombatWith(owner);
} }
} }
}
Unit* who = victim->GetCharmerOrOwnerOrSelf(); Unit* who = victim->GetCharmerOrOwnerOrSelf();
if (who->GetTypeId() == TYPEID_PLAYER) if (who->GetTypeId() == TYPEID_PLAYER)