diff options
author | Aqua Deus <95978183+aquadeus@users.noreply.github.com> | 2024-04-21 14:51:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-21 14:51:07 +0200 |
commit | f4ef6f769b8c51d99bea040b95beb2eb0d6c8fd0 (patch) | |
tree | d872276c2e389b6f51a2396c5d9b552aedc0b2a4 | |
parent | a28facb95633435f89f134eec55a4a545251be9b (diff) |
Scripts/Spells: Add new script for spells with feign death with all flags except uninteractible (#29922)
-rw-r--r-- | sql/updates/world/master/2024_04_21_00_world.sql | 5 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 36 |
2 files changed, 41 insertions, 0 deletions
diff --git a/sql/updates/world/master/2024_04_21_00_world.sql b/sql/updates/world/master/2024_04_21_00_world.sql new file mode 100644 index 00000000000..7f5335eb4e3 --- /dev/null +++ b/sql/updates/world/master/2024_04_21_00_world.sql @@ -0,0 +1,5 @@ +-- Spells +DELETE FROM `spell_script_names` WHERE `spell_id`=96733 AND `ScriptName` LIKE 'spell_gen_feign_death_%'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_gen_feign_death_all_flags_no_uninteractible'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(96733, 'spell_gen_feign_death_all_flags_no_uninteractible'); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 8486d30ca9a..1f41f053c67 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1570,6 +1570,7 @@ and UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT. Some auras can apply only 2 flags spell_gen_feign_death_all_flags applies all 3 flags spell_gen_feign_death_all_flags_uninteractible applies all 3 flags and additionally sets UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_UNINTERACTIBLE +spell_gen_feign_death_all_flags_no_uninteractible applies all 3 flags and additionally sets UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC spell_gen_feign_death_no_dyn_flag applies no UNIT_DYNFLAG_DEAD (does not make the creature appear dead) spell_gen_feign_death_no_prevent_emotes applies no UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT @@ -1644,6 +1645,40 @@ class spell_gen_feign_death_all_flags_uninteractible : public AuraScript } }; +// 96733 - Permanent Feign Death (Stun) +class spell_gen_feign_death_all_flags_no_uninteractible : public AuraScript +{ + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const + { + Unit* target = GetTarget(); + target->SetUnitFlag3(UNIT_FLAG3_FAKE_DEAD); + target->SetUnitFlag2(UNIT_FLAG2_FEIGN_DEATH); + target->SetUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT); + target->SetImmuneToAll(true); + + if (Creature* creature = target->ToCreature()) + creature->SetReactState(REACT_PASSIVE); + } + + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const + { + Unit* target = GetTarget(); + target->RemoveUnitFlag3(UNIT_FLAG3_FAKE_DEAD); + target->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH); + target->RemoveUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT); + target->SetImmuneToAll(false); + + if (Creature* creature = target->ToCreature()) + creature->InitializeReactState(); + } + + void Register() override + { + OnEffectApply += AuraEffectApplyFn(spell_gen_feign_death_all_flags_no_uninteractible::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_gen_feign_death_all_flags_no_uninteractible::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } +}; + // 35357 - Spawn Feign Death // 51329 - Feign Death class spell_gen_feign_death_no_dyn_flag : public AuraScript @@ -5388,6 +5423,7 @@ void AddSC_generic_spell_scripts() RegisterSpellScript(spell_gen_feast); RegisterSpellScript(spell_gen_feign_death_all_flags); RegisterSpellScript(spell_gen_feign_death_all_flags_uninteractible); + RegisterSpellScript(spell_gen_feign_death_all_flags_no_uninteractible); RegisterSpellScript(spell_gen_feign_death_no_dyn_flag); RegisterSpellScript(spell_gen_feign_death_no_prevent_emotes); RegisterSpellScript(spell_gen_furious_rage); |