Core/Auras: Feign death will no longer cause creatures immune to it to drop combat (and then reenter it because the unit feigning death is considered valid)

Port From (https://github.com/TrinityCore/TrinityCore/commit/0c32277139a173c31043706d72e1cfe8830aaade)
This commit is contained in:
hondacrx
2024-03-05 18:37:35 -05:00
parent 536f72d077
commit e697a32f23
2 changed files with 18 additions and 6 deletions
+13 -3
View File
@@ -1698,6 +1698,12 @@ namespace Game.Spells
if (apply)
{
var isAffectedByFeignDeath = bool (Unit attacker) =>
{
Creature attackerCreature = attacker.ToCreature();
return attackerCreature == null || !attackerCreature.IsIgnoringFeignDeath();
};
List<Unit> targets = new();
var u_check = new AnyUnfriendlyUnitInObjectRangeCheck(target, target, target.GetMap().GetVisibilityRange());
var searcher = new UnitListSearcher(target, targets, u_check);
@@ -1708,6 +1714,9 @@ namespace Game.Spells
if (!unit.HasUnitState(UnitState.Casting))
continue;
if (!isAffectedByFeignDeath(unit))
continue;
for (var i = CurrentSpellTypes.Generic; i < CurrentSpellTypes.Max; i++)
{
if (unit.GetCurrentSpell(i) != null
@@ -1718,8 +1727,9 @@ namespace Game.Spells
}
}
foreach (var pair in target.GetThreatManager().GetThreatenedByMeList())
pair.Value.ScaleThreat(0.0f);
foreach (var (_, refe) in target.GetThreatManager().GetThreatenedByMeList())
if (isAffectedByFeignDeath(refe.GetOwner()))
refe.ScaleThreat(0.0f);
if (target.GetMap().IsDungeon()) // feign death does not remove combat in dungeons
{
@@ -1729,7 +1739,7 @@ namespace Game.Spells
targetPlayer.SendAttackSwingCancelAttack();
}
else
target.CombatStop(false, false);
target.CombatStop(false, false, isAffectedByFeignDeath);
// prevent interrupt message
if (GetCasterGUID() == target.GetGUID() && target.GetCurrentSpell(CurrentSpellTypes.Generic) != null)