Core/Creatures: Implemented CREATURE_STATIC_FLAG_2_IGNORE_SANCTUARY (ignore SPELL_EFFECT_SANCTUARY, used by Vanish)

Port From (https://github.com/TrinityCore/TrinityCore/commit/1369b8708458fb5020b6ab7a9608123459d4eb26)
This commit is contained in:
hondacrx
2024-03-05 18:33:31 -05:00
parent 83bd8b255b
commit 536f72d077
6 changed files with 69 additions and 33 deletions
+10 -3
View File
@@ -2840,16 +2840,23 @@ namespace Game.Spells
if (unitTarget == null)
return;
var isAffectedBySanctuary = bool (Unit attacker) =>
{
Creature attackerCreature = attacker.ToCreature();
return attackerCreature == null || !attackerCreature.IsIgnoringSanctuarySpellEffect();
};
if (unitTarget.IsPlayer() && !unitTarget.GetMap().IsDungeon())
{
// stop all pve combat for players outside dungeons, suppress pvp combat
unitTarget.CombatStop(false, false);
unitTarget.CombatStop(false, false, isAffectedBySanctuary);
}
else
{
// in dungeons (or for nonplayers), reset this unit on all enemies' threat lists
foreach (var pair in unitTarget.GetThreatManager().GetThreatenedByMeList())
pair.Value.ScaleThreat(0.0f);
foreach (var (_, refe) in unitTarget.GetThreatManager().GetThreatenedByMeList())
if (isAffectedBySanctuary(refe.GetOwner()))
refe.ScaleThreat(0.0f);
}
// makes spells cast before this time fizzle