Spells/Generic: Implemented generic feign death spell with UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_UNINTERACTIBLE

This commit is contained in:
ModoX authored and Ovahlord committed 2025-03-12 19:04:05 +01:00
1 parent 4d3b24251d
commit a04920122a
1 file changed
+33
@@ -1747,6 +1747,7 @@ There are only 3 possible flags Feign Death auras can apply: UNIT_DYNFLAG_DEAD,
and UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT. Some auras can apply only 2 flags 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 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_no_dyn_flag applies no UNIT_DYNFLAG_DEAD (does not make the creature appear dead) 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 spell_gen_feign_death_no_prevent_emotes applies no UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT
@@ -1786,6 +1787,37 @@ class spell_gen_feign_death_all_flags : public AuraScript
} }
}; };
class spell_gen_feign_death_all_flags_uninteractible : public AuraScript
{
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH);
target->SetImmuneToAll(true);
target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_NOT_SELECTABLE);
if (Creature* creature = target->ToCreature())
creature->SetReactState(REACT_PASSIVE);
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH);
target->SetImmuneToAll(false);
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT| UNIT_FLAG_NOT_SELECTABLE);
if (Creature* creature = target->ToCreature())
creature->InitializeReactState();
}
void Register() override
{
OnEffectApply.Register(&spell_gen_feign_death_all_flags_uninteractible::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove.Register(&spell_gen_feign_death_all_flags_uninteractible::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
// 35357 - Spawn Feign Death // 35357 - Spawn Feign Death
// 51329 - Feign Death // 51329 - Feign Death
class spell_gen_feign_death_no_dyn_flag : public AuraScript class spell_gen_feign_death_no_dyn_flag : public AuraScript
@@ -5302,6 +5334,7 @@ void AddSC_generic_spell_scripts()
new spell_gen_elune_candle(); new spell_gen_elune_candle();
RegisterSpellScript(spell_gen_flurry_of_claws); RegisterSpellScript(spell_gen_flurry_of_claws);
RegisterSpellScript(spell_gen_feign_death_all_flags); RegisterSpellScript(spell_gen_feign_death_all_flags);
RegisterSpellScript(spell_gen_feign_death_all_flags_uninteractible);
RegisterSpellScript(spell_gen_feign_death_no_dyn_flag); RegisterSpellScript(spell_gen_feign_death_no_dyn_flag);
RegisterSpellScript(spell_gen_feign_death_no_prevent_emotes); RegisterSpellScript(spell_gen_feign_death_no_prevent_emotes);
new spell_gen_gadgetzan_transporter_backfire(); new spell_gen_gadgetzan_transporter_backfire();