From 447ec2bc74f898a55b83bfd6fee1dafdedf962a8 Mon Sep 17 00:00:00 2001 From: Hondacrx Date: Sun, 18 Aug 2024 21:29:21 -0400 Subject: [PATCH] Scripts/Spells: Add new script for spells with feign death with all flags except uninteractible Port From (https://github.com/TrinityCore/TrinityCore/commit/f4ef6f769b8c51d99bea040b95beb2eb0d6c8fd0) --- Source/Scripts/Spells/Generic.cs | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Source/Scripts/Spells/Generic.cs b/Source/Scripts/Spells/Generic.cs index fda59b727..5fc492d6e 100644 --- a/Source/Scripts/Spells/Generic.cs +++ b/Source/Scripts/Spells/Generic.cs @@ -1550,6 +1550,42 @@ namespace Scripts.Spells.Generic } } + [Script] // 96733 - Permanent Feign Death (Stun) + class spell_gen_feign_death_all_flags_no_uninteractible : AuraScript + { + void HandleEffectApply(AuraEffect aurEff, AuraEffectHandleModes mode) + { + Unit target = GetTarget(); + target.SetUnitFlag3(UnitFlags3.FakeDead); + target.SetUnitFlag2(UnitFlags2.FeignDeath); + target.SetUnitFlag(UnitFlags.PreventEmotesFromChatText); + target.SetImmuneToAll(true); + + Creature creature = target.ToCreature(); + if (creature != null) + creature.SetReactState(ReactStates.Passive); + } + + void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode) + { + Unit target = GetTarget(); + target.RemoveUnitFlag3(UnitFlags3.FakeDead); + target.RemoveUnitFlag2(UnitFlags2.FeignDeath); + target.RemoveUnitFlag(UnitFlags.PreventEmotesFromChatText); + target.SetImmuneToAll(false); + + Creature creature = target.ToCreature(); + if (creature != null) + creature.InitializeReactState(); + } + + public override void Register() + { + OnEffectApply.Add(new(HandleEffectApply, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + OnEffectRemove.Add(new(OnRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + } + } + // 35357 - Spawn Feign Death [Script] // 51329 - Feign Death class spell_gen_feign_death_no_dyn_flag : AuraScript