mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Combat: Fixed issues with creatures sometimes entering combat with friendly targets
Close #19980
(cherry picked from commit 07593f6c34)
This commit is contained in:
@@ -407,6 +407,15 @@ void ThreatManager::AddThreat(Unit* victim, float amount, SpellInfo const* spell
|
||||
(void)ignoreModifiers; (void)ignoreRedirection;
|
||||
if (!iOwner->CanHaveThreatList() || iOwner->HasUnitState(UNIT_STATE_EVADE))
|
||||
return;
|
||||
|
||||
if (iOwner->IsControlledByPlayer() || victim->IsControlledByPlayer())
|
||||
{
|
||||
if (iOwner->IsFriendlyTo(victim) || victim->IsFriendlyTo(iOwner))
|
||||
return;
|
||||
}
|
||||
else if (!iOwner->IsHostileTo(victim) && !victim->IsHostileTo(iOwner))
|
||||
return;
|
||||
|
||||
iOwner->SetInCombatWith(victim);
|
||||
victim->SetInCombatWith(iOwner);
|
||||
addThreat(victim, amount, spell ? spell->GetSchoolMask() : victim->GetMeleeDamageSchoolMask(), spell);
|
||||
|
||||
Reference in New Issue
Block a user