mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +00:00
refactor(Scripts/BlackrockMountain): Spell Scripts registry macros (#19186)
* boss_garr aura:spell_garr_separation_nexiety_aura * boss_garr spell:spell_garr_frenzy * molten_core aura:spell_mc_play_dead_aura * boss_magmadar spell:spell_magmadar_lava_bomb * boss_majordomo_executus spell:spell_hate_to_zero * boss_majordomo_executus aura:spell_majordomo_separation_nexiety_aura * boss_majordomo_executus spell:spell_summon_ragnaros * boss_shazzrah spell:spell_shazzrah_gate_dummy * boss_baron_geddon aura:spell_geddon_inferno_aura * boss_baron_geddon aura:spell_geddon_armageddon_aura * boss_razorgore spell:spell_egg_event * instance_blackwing_lair spell:spell_bwl_shadowflame * fixup! boss_majordomo_executus aura:spell_majordomo_separation_nexiety_aura * fixup! boss_garr aura:spell_garr_separation_nexiety_aura * fixup! fixup! boss_garr aura:spell_garr_separation_nexiety_aura
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
--
|
||||||
|
UPDATE `spell_script_names` SET `ScriptName`='spell_garr_separation_anxiety_aura' WHERE `spell_id`=23487;
|
||||||
|
UPDATE `spell_script_names` SET `ScriptName`='spell_mc_play_dead_aura' WHERE `spell_id`=19822;
|
||||||
|
UPDATE `spell_script_names` SET `ScriptName`='spell_majordomo_separation_anxiety_aura' WHERE `spell_id`=21094;
|
||||||
|
UPDATE `spell_script_names` SET `ScriptName`='spell_geddon_inferno_aura' WHERE `spell_id`=19695;
|
||||||
|
UPDATE `spell_script_names` SET `ScriptName`='spell_geddon_armageddon_aura' WHERE `spell_id`=20478;
|
||||||
@@ -303,43 +303,32 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class spell_egg_event : public SpellScriptLoader
|
class spell_egg_event : public SpellScript
|
||||||
{
|
{
|
||||||
public:
|
PrepareSpellScript(spell_egg_event);
|
||||||
spell_egg_event() : SpellScriptLoader("spell_egg_event") { }
|
|
||||||
|
|
||||||
class spell_egg_eventSpellScript : public SpellScript
|
void HandleOnHit()
|
||||||
{
|
{
|
||||||
PrepareSpellScript(spell_egg_eventSpellScript);
|
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
|
||||||
|
|
||||||
void HandleOnHit()
|
|
||||||
{
|
{
|
||||||
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
|
instance->SetData(DATA_EGG_EVENT, SPECIAL);
|
||||||
{
|
|
||||||
instance->SetData(DATA_EGG_EVENT, SPECIAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Creature* razorgore = GetCaster()->ToCreature())
|
|
||||||
{
|
|
||||||
if (GameObject* egg = GetHitGObj())
|
|
||||||
{
|
|
||||||
razorgore->AI()->DoAction(TALK_EGG_BROKEN_RAND);
|
|
||||||
egg->SetLootState(GO_READY);
|
|
||||||
egg->UseDoorOrButton(10000);
|
|
||||||
egg->SetRespawnTime(WEEK);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Register() override
|
if (Creature* razorgore = GetCaster()->ToCreature())
|
||||||
{
|
{
|
||||||
OnHit += SpellHitFn(spell_egg_eventSpellScript::HandleOnHit);
|
if (GameObject* egg = GetHitGObj())
|
||||||
|
{
|
||||||
|
razorgore->AI()->DoAction(TALK_EGG_BROKEN_RAND);
|
||||||
|
egg->SetLootState(GO_READY);
|
||||||
|
egg->UseDoorOrButton(10000);
|
||||||
|
egg->SetRespawnTime(WEEK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
SpellScript* GetSpellScript() const override
|
void Register() override
|
||||||
{
|
{
|
||||||
return new spell_egg_eventSpellScript();
|
OnHit += SpellHitFn(spell_egg_event::HandleOnHit);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -347,6 +336,6 @@ void AddSC_boss_razorgore()
|
|||||||
{
|
{
|
||||||
new boss_razorgore();
|
new boss_razorgore();
|
||||||
new go_orb_of_domination();
|
new go_orb_of_domination();
|
||||||
new spell_egg_event();
|
RegisterSpellScript(spell_egg_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -478,37 +478,26 @@ enum ShadowFlame
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 22539 - Shadowflame (used in Blackwing Lair)
|
// 22539 - Shadowflame (used in Blackwing Lair)
|
||||||
class spell_bwl_shadowflame : public SpellScriptLoader
|
class spell_bwl_shadowflame : public SpellScript
|
||||||
{
|
{
|
||||||
public:
|
PrepareSpellScript(spell_bwl_shadowflame);
|
||||||
spell_bwl_shadowflame() : SpellScriptLoader("spell_bwl_shadowflame") { }
|
|
||||||
|
|
||||||
class spell_bwl_shadowflame_SpellScript : public SpellScript
|
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||||
{
|
{
|
||||||
PrepareSpellScript(spell_bwl_shadowflame_SpellScript);
|
return ValidateSpellInfo({ SPELL_ONYXIA_SCALE_CLOAK, SPELL_SHADOW_FLAME_DOT });
|
||||||
|
}
|
||||||
|
|
||||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
void HandleEffectScriptEffect(SpellEffIndex /*effIndex*/)
|
||||||
{
|
|
||||||
return ValidateSpellInfo({ SPELL_ONYXIA_SCALE_CLOAK, SPELL_SHADOW_FLAME_DOT });
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleEffectScriptEffect(SpellEffIndex /*effIndex*/)
|
|
||||||
{
|
|
||||||
// If the victim of the spell does not have "Onyxia Scale Cloak" - add the Shadow Flame DoT (22682)
|
|
||||||
if (Unit* victim = GetHitUnit())
|
|
||||||
if (!victim->HasAura(SPELL_ONYXIA_SCALE_CLOAK))
|
|
||||||
victim->AddAura(SPELL_SHADOW_FLAME_DOT, victim);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Register() override
|
|
||||||
{
|
|
||||||
OnEffectHitTarget += SpellEffectFn(spell_bwl_shadowflame_SpellScript::HandleEffectScriptEffect, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
SpellScript* GetSpellScript() const override
|
|
||||||
{
|
{
|
||||||
return new spell_bwl_shadowflame_SpellScript;
|
// If the victim of the spell does not have "Onyxia Scale Cloak" - add the Shadow Flame DoT (22682)
|
||||||
|
if (Unit* victim = GetHitUnit())
|
||||||
|
if (!victim->HasAura(SPELL_ONYXIA_SCALE_CLOAK))
|
||||||
|
victim->AddAura(SPELL_SHADOW_FLAME_DOT, victim);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Register() override
|
||||||
|
{
|
||||||
|
OnEffectHitTarget += SpellEffectFn(spell_bwl_shadowflame::HandleEffectScriptEffect, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -539,7 +528,7 @@ public:
|
|||||||
void AddSC_instance_blackwing_lair()
|
void AddSC_instance_blackwing_lair()
|
||||||
{
|
{
|
||||||
new instance_blackwing_lair();
|
new instance_blackwing_lair();
|
||||||
new spell_bwl_shadowflame();
|
RegisterSpellScript(spell_bwl_shadowflame);
|
||||||
new at_orb_of_command();
|
new at_orb_of_command();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -128,118 +128,96 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 19695 Inferno
|
// 19695 Inferno
|
||||||
class spell_geddon_inferno : public SpellScriptLoader
|
class spell_geddon_inferno_aura : public AuraScript
|
||||||
{
|
{
|
||||||
public:
|
PrepareAuraScript(spell_geddon_inferno_aura);
|
||||||
spell_geddon_inferno() : SpellScriptLoader("spell_geddon_inferno") { }
|
|
||||||
|
|
||||||
class spell_geddon_inferno_AuraScript : public AuraScript
|
bool Validate(SpellInfo const* /*spell*/) override
|
||||||
{
|
{
|
||||||
PrepareAuraScript(spell_geddon_inferno_AuraScript);
|
return ValidateSpellInfo({ SPELL_INFERNO_DUMMY_EFFECT });
|
||||||
|
}
|
||||||
|
|
||||||
bool Validate(SpellInfo const* /*spell*/) override
|
void HandleAfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||||
{
|
|
||||||
return ValidateSpellInfo({ SPELL_INFERNO_DUMMY_EFFECT });
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleAfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
|
||||||
{
|
|
||||||
if (Creature* pCreatureTarget = GetTarget()->ToCreature())
|
|
||||||
{
|
|
||||||
pCreatureTarget->SetReactState(REACT_PASSIVE);
|
|
||||||
pCreatureTarget->AttackStop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleAfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
|
||||||
{
|
|
||||||
if (Creature* pCreatureTarget = GetTarget()->ToCreature())
|
|
||||||
{
|
|
||||||
pCreatureTarget->SetReactState(REACT_AGGRESSIVE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PeriodicTick(AuraEffect const* aurEff)
|
|
||||||
{
|
|
||||||
PreventDefaultAction();
|
|
||||||
|
|
||||||
if (Unit* caster = GetUnitOwner())
|
|
||||||
{
|
|
||||||
//The pulses come about 1 second apart and last for 10 seconds. Damage starts at 500 damage per pulse and increases by 500 every other pulse (500, 500, 1000, 1000, 1500, etc.). (Source: Wowwiki)
|
|
||||||
int32 multiplier = 1;
|
|
||||||
switch (aurEff->GetTickNumber())
|
|
||||||
{
|
|
||||||
case 3:
|
|
||||||
case 4:
|
|
||||||
multiplier = 2;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
case 6:
|
|
||||||
multiplier = 4;
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
multiplier = 6;
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
multiplier = 10;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
caster->CastCustomSpell(SPELL_INFERNO_DUMMY_EFFECT, SPELLVALUE_BASE_POINT0, 500 * multiplier, (Unit*)nullptr, TRIGGERED_NONE, nullptr, aurEff);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Register() override
|
|
||||||
{
|
|
||||||
AfterEffectApply += AuraEffectApplyFn(spell_geddon_inferno_AuraScript::HandleAfterApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
|
|
||||||
AfterEffectRemove += AuraEffectRemoveFn(spell_geddon_inferno_AuraScript::HandleAfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
|
|
||||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_geddon_inferno_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
AuraScript* GetAuraScript() const override
|
|
||||||
{
|
{
|
||||||
return new spell_geddon_inferno_AuraScript();
|
if (Creature* pCreatureTarget = GetTarget()->ToCreature())
|
||||||
|
{
|
||||||
|
pCreatureTarget->SetReactState(REACT_PASSIVE);
|
||||||
|
pCreatureTarget->AttackStop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleAfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||||
|
{
|
||||||
|
if (Creature* pCreatureTarget = GetTarget()->ToCreature())
|
||||||
|
{
|
||||||
|
pCreatureTarget->SetReactState(REACT_AGGRESSIVE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PeriodicTick(AuraEffect const* aurEff)
|
||||||
|
{
|
||||||
|
PreventDefaultAction();
|
||||||
|
|
||||||
|
if (Unit* caster = GetUnitOwner())
|
||||||
|
{
|
||||||
|
//The pulses come about 1 second apart and last for 10 seconds. Damage starts at 500 damage per pulse and increases by 500 every other pulse (500, 500, 1000, 1000, 1500, etc.). (Source: Wowwiki)
|
||||||
|
int32 multiplier = 1;
|
||||||
|
switch (aurEff->GetTickNumber())
|
||||||
|
{
|
||||||
|
case 3:
|
||||||
|
case 4:
|
||||||
|
multiplier = 2;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
case 6:
|
||||||
|
multiplier = 4;
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
multiplier = 6;
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
multiplier = 10;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
caster->CastCustomSpell(SPELL_INFERNO_DUMMY_EFFECT, SPELLVALUE_BASE_POINT0, 500 * multiplier, (Unit*)nullptr, TRIGGERED_NONE, nullptr, aurEff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Register() override
|
||||||
|
{
|
||||||
|
AfterEffectApply += AuraEffectApplyFn(spell_geddon_inferno_aura::HandleAfterApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
|
||||||
|
AfterEffectRemove += AuraEffectRemoveFn(spell_geddon_inferno_aura::HandleAfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
|
||||||
|
OnEffectPeriodic += AuraEffectPeriodicFn(spell_geddon_inferno_aura::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 20478 Armageddon
|
// 20478 Armageddon
|
||||||
class spell_geddon_armageddon : public SpellScriptLoader
|
class spell_geddon_armageddon_aura : public AuraScript
|
||||||
{
|
{
|
||||||
public:
|
PrepareAuraScript(spell_geddon_armageddon_aura);
|
||||||
spell_geddon_armageddon() : SpellScriptLoader("spell_geddon_armageddon") { }
|
|
||||||
|
|
||||||
class spell_geddon_armageddon_AuraScript : public AuraScript
|
void HandleAfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||||
{
|
{
|
||||||
PrepareAuraScript(spell_geddon_armageddon_AuraScript);
|
if (Creature* pCreatureTarget = GetTarget()->ToCreature())
|
||||||
|
|
||||||
void HandleAfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
|
||||||
{
|
{
|
||||||
if (Creature* pCreatureTarget = GetTarget()->ToCreature())
|
pCreatureTarget->SetReactState(REACT_PASSIVE);
|
||||||
{
|
pCreatureTarget->AttackStop();
|
||||||
pCreatureTarget->SetReactState(REACT_PASSIVE);
|
|
||||||
pCreatureTarget->AttackStop();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void HandleAfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
void HandleAfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||||
{
|
|
||||||
if (Creature* pCreatureTarget = GetTarget()->ToCreature())
|
|
||||||
{
|
|
||||||
pCreatureTarget->SetReactState(REACT_AGGRESSIVE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Register() override
|
|
||||||
{
|
|
||||||
AfterEffectApply += AuraEffectApplyFn(spell_geddon_armageddon_AuraScript::HandleAfterApply, EFFECT_1, SPELL_AURA_MOD_PACIFY, AURA_EFFECT_HANDLE_REAL);
|
|
||||||
AfterEffectRemove += AuraEffectRemoveFn(spell_geddon_armageddon_AuraScript::HandleAfterRemove, EFFECT_1, SPELL_AURA_MOD_PACIFY, AURA_EFFECT_HANDLE_REAL);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
AuraScript* GetAuraScript() const override
|
|
||||||
{
|
{
|
||||||
return new spell_geddon_armageddon_AuraScript();
|
if (Creature* pCreatureTarget = GetTarget()->ToCreature())
|
||||||
|
{
|
||||||
|
pCreatureTarget->SetReactState(REACT_AGGRESSIVE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Register() override
|
||||||
|
{
|
||||||
|
AfterEffectApply += AuraEffectApplyFn(spell_geddon_armageddon_aura::HandleAfterApply, EFFECT_1, SPELL_AURA_MOD_PACIFY, AURA_EFFECT_HANDLE_REAL);
|
||||||
|
AfterEffectRemove += AuraEffectRemoveFn(spell_geddon_armageddon_aura::HandleAfterRemove, EFFECT_1, SPELL_AURA_MOD_PACIFY, AURA_EFFECT_HANDLE_REAL);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -248,7 +226,7 @@ void AddSC_boss_baron_geddon()
|
|||||||
new boss_baron_geddon();
|
new boss_baron_geddon();
|
||||||
|
|
||||||
// Spells
|
// Spells
|
||||||
new spell_geddon_inferno();
|
RegisterSpellScript(spell_geddon_inferno_aura);
|
||||||
new spell_geddon_armageddon();
|
RegisterSpellScript(spell_geddon_armageddon_aura);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -172,75 +172,52 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 23487 Separation Anxiety (server side)
|
// 23487 Separation Anxiety (server side)
|
||||||
class spell_garr_separation_nexiety : public SpellScriptLoader
|
class spell_garr_separation_anxiety_aura : public AuraScript
|
||||||
{
|
{
|
||||||
public:
|
PrepareAuraScript(spell_garr_separation_anxiety_aura);
|
||||||
spell_garr_separation_nexiety() : SpellScriptLoader("spell_garr_separation_nexiety") {}
|
|
||||||
|
|
||||||
class spell_garr_separation_nexiety_AuraScript : public AuraScript
|
bool Validate(SpellInfo const* /*spell*/) override
|
||||||
{
|
{
|
||||||
PrepareAuraScript(spell_garr_separation_nexiety_AuraScript);
|
return ValidateSpellInfo({ SPELL_SEPARATION_ANXIETY_MINION });
|
||||||
|
}
|
||||||
|
|
||||||
bool Validate(SpellInfo const* /*spell*/) override
|
void HandlePeriodic(AuraEffect const* aurEff)
|
||||||
{
|
|
||||||
return ValidateSpellInfo({ SPELL_SEPARATION_ANXIETY_MINION });
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandlePeriodic(AuraEffect const* aurEff)
|
|
||||||
{
|
|
||||||
Unit const* caster = GetCaster();
|
|
||||||
Unit* target = GetTarget();
|
|
||||||
if (caster && target && target->GetDistance(caster) > 40.0f && !target->HasAura(SPELL_SEPARATION_ANXIETY_MINION))
|
|
||||||
{
|
|
||||||
target->CastSpell(target, SPELL_SEPARATION_ANXIETY_MINION, true, nullptr, aurEff);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Register() override
|
|
||||||
{
|
|
||||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_garr_separation_nexiety_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Should return a fully valid AuraScript pointer.
|
|
||||||
AuraScript* GetAuraScript() const override
|
|
||||||
{
|
{
|
||||||
return new spell_garr_separation_nexiety_AuraScript();
|
Unit const* caster = GetCaster();
|
||||||
|
Unit* target = GetTarget();
|
||||||
|
if (caster && target && target->GetDistance(caster) > 40.0f && !target->HasAura(SPELL_SEPARATION_ANXIETY_MINION))
|
||||||
|
{
|
||||||
|
target->CastSpell(target, SPELL_SEPARATION_ANXIETY_MINION, true, nullptr, aurEff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Register() override
|
||||||
|
{
|
||||||
|
OnEffectPeriodic += AuraEffectPeriodicFn(spell_garr_separation_anxiety_aura::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//19515 Frenzy (SERVERSIDE)
|
//19515 Frenzy (SERVERSIDE)
|
||||||
class spell_garr_frenzy : public SpellScriptLoader
|
class spell_garr_frenzy : public SpellScript
|
||||||
{
|
{
|
||||||
public:
|
PrepareSpellScript(spell_garr_frenzy);
|
||||||
spell_garr_frenzy() : SpellScriptLoader("spell_garr_frenzy") {}
|
|
||||||
|
|
||||||
class spell_garr_frenzy_SpellScript : public SpellScript
|
bool Validate(SpellInfo const* /*spell*/) override
|
||||||
{
|
{
|
||||||
PrepareSpellScript(spell_garr_frenzy_SpellScript);
|
return ValidateSpellInfo({ SPELL_FRENZY });
|
||||||
|
}
|
||||||
|
|
||||||
bool Validate(SpellInfo const* /*spell*/) override
|
void HandleHit(SpellEffIndex /*effIndex*/)
|
||||||
{
|
|
||||||
return ValidateSpellInfo({ SPELL_FRENZY });
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleHit(SpellEffIndex /*effIndex*/)
|
|
||||||
{
|
|
||||||
if (Unit* target = GetHitUnit())
|
|
||||||
{
|
|
||||||
target->CastSpell(target, SPELL_FRENZY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Register() override
|
|
||||||
{
|
|
||||||
OnEffectHitTarget += SpellEffectFn(spell_garr_frenzy_SpellScript::HandleHit, EFFECT_0, SPELL_EFFECT_DUMMY);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
SpellScript* GetSpellScript() const override
|
|
||||||
{
|
{
|
||||||
return new spell_garr_frenzy_SpellScript();
|
if (Unit* target = GetHitUnit())
|
||||||
|
{
|
||||||
|
target->CastSpell(target, SPELL_FRENZY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Register() override
|
||||||
|
{
|
||||||
|
OnEffectHitTarget += SpellEffectFn(spell_garr_frenzy::HandleHit, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -250,7 +227,7 @@ void AddSC_boss_garr()
|
|||||||
new npc_garr_firesworn();
|
new npc_garr_firesworn();
|
||||||
|
|
||||||
// Spells
|
// Spells
|
||||||
new spell_garr_separation_nexiety();
|
RegisterSpellScript(spell_garr_separation_anxiety_aura);
|
||||||
new spell_garr_frenzy();
|
RegisterSpellScript(spell_garr_frenzy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,55 +119,44 @@ public:
|
|||||||
|
|
||||||
// 19411 Lava Bomb
|
// 19411 Lava Bomb
|
||||||
// 20474 Lava Bomb
|
// 20474 Lava Bomb
|
||||||
class spell_magmadar_lava_bomb : public SpellScriptLoader
|
class spell_magmadar_lava_bomb : public SpellScript
|
||||||
{
|
{
|
||||||
public:
|
PrepareSpellScript(spell_magmadar_lava_bomb);
|
||||||
spell_magmadar_lava_bomb() : SpellScriptLoader("spell_magmadar_lava_bomb") {}
|
|
||||||
|
|
||||||
class spell_magmadar_lava_bomb_SpellScript : public SpellScript
|
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||||
{
|
{
|
||||||
PrepareSpellScript(spell_magmadar_lava_bomb_SpellScript);
|
return ValidateSpellInfo({ SPELL_LAVA_BOMB_EFFECT, SPELL_LAVA_BOMB_RANGED_EFFECT });
|
||||||
|
}
|
||||||
|
|
||||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||||
|
{
|
||||||
|
if (Unit* target = GetHitUnit())
|
||||||
{
|
{
|
||||||
return ValidateSpellInfo({ SPELL_LAVA_BOMB_EFFECT, SPELL_LAVA_BOMB_RANGED_EFFECT });
|
uint32 spellId = 0;
|
||||||
}
|
switch (m_scriptSpellId)
|
||||||
|
|
||||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
|
||||||
{
|
|
||||||
if (Unit* target = GetHitUnit())
|
|
||||||
{
|
{
|
||||||
uint32 spellId = 0;
|
case SPELL_LAVA_BOMB:
|
||||||
switch (m_scriptSpellId)
|
|
||||||
{
|
{
|
||||||
case SPELL_LAVA_BOMB:
|
spellId = SPELL_LAVA_BOMB_EFFECT;
|
||||||
{
|
break;
|
||||||
spellId = SPELL_LAVA_BOMB_EFFECT;
|
}
|
||||||
break;
|
case SPELL_LAVA_BOMB_RANGED:
|
||||||
}
|
{
|
||||||
case SPELL_LAVA_BOMB_RANGED:
|
spellId = SPELL_LAVA_BOMB_RANGED_EFFECT;
|
||||||
{
|
break;
|
||||||
spellId = SPELL_LAVA_BOMB_RANGED_EFFECT;
|
}
|
||||||
break;
|
default:
|
||||||
}
|
{
|
||||||
default:
|
return;
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
target->CastSpell(target, spellId, true, nullptr, nullptr, GetCaster()->GetGUID());
|
|
||||||
}
|
}
|
||||||
|
target->CastSpell(target, spellId, true, nullptr, nullptr, GetCaster()->GetGUID());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Register() override
|
void Register() override
|
||||||
{
|
|
||||||
OnEffectHitTarget += SpellEffectFn(spell_magmadar_lava_bomb_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
SpellScript* GetSpellScript() const override
|
|
||||||
{
|
{
|
||||||
return new spell_magmadar_lava_bomb_SpellScript();
|
OnEffectHitTarget += SpellEffectFn(spell_magmadar_lava_bomb::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -176,6 +165,6 @@ void AddSC_boss_magmadar()
|
|||||||
new boss_magmadar();
|
new boss_magmadar();
|
||||||
|
|
||||||
// Spells
|
// Spells
|
||||||
new spell_magmadar_lava_bomb();
|
RegisterSpellScript(spell_magmadar_lava_bomb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -581,108 +581,74 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 20538 Hate to Zero (SERVERSIDE)
|
// 20538 Hate to Zero (SERVERSIDE)
|
||||||
class spell_hate_to_zero : public SpellScriptLoader
|
class spell_hate_to_zero : public SpellScript
|
||||||
{
|
{
|
||||||
public:
|
PrepareSpellScript(spell_hate_to_zero);
|
||||||
spell_hate_to_zero() : SpellScriptLoader("spell_hate_to_zero") {}
|
|
||||||
|
|
||||||
class spell_hate_to_zero_SpellScript : public SpellScript
|
bool Load() override
|
||||||
{
|
{
|
||||||
PrepareSpellScript(spell_hate_to_zero_SpellScript);
|
return GetCaster()->GetTypeId() == TYPEID_UNIT;
|
||||||
|
}
|
||||||
|
|
||||||
bool Load() override
|
void HandleHit(SpellEffIndex /*effIndex*/)
|
||||||
|
{
|
||||||
|
if (Unit* caster = GetCaster())
|
||||||
{
|
{
|
||||||
return GetCaster()->GetTypeId() == TYPEID_UNIT;
|
if (Creature* creatureCaster = caster->ToCreature())
|
||||||
}
|
|
||||||
|
|
||||||
void HandleHit(SpellEffIndex /*effIndex*/)
|
|
||||||
{
|
|
||||||
if (Unit* caster = GetCaster())
|
|
||||||
{
|
{
|
||||||
if (Creature* creatureCaster = caster->ToCreature())
|
creatureCaster->GetThreatMgr().ResetAllThreat();
|
||||||
{
|
|
||||||
creatureCaster->GetThreatMgr().ResetAllThreat();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Register() override
|
void Register() override
|
||||||
{
|
|
||||||
OnEffectHitTarget += SpellEffectFn(spell_hate_to_zero_SpellScript::HandleHit, EFFECT_0, SPELL_EFFECT_DUMMY);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
SpellScript* GetSpellScript() const override
|
|
||||||
{
|
{
|
||||||
return new spell_hate_to_zero_SpellScript();
|
OnEffectHitTarget += SpellEffectFn(spell_hate_to_zero::HandleHit, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 21094 Separation Anxiety (server side)
|
// 21094 Separation Anxiety (server side)
|
||||||
class spell_majordomo_separation_nexiety : public SpellScriptLoader
|
class spell_majordomo_separation_anxiety_aura : public AuraScript
|
||||||
{
|
{
|
||||||
public:
|
PrepareAuraScript(spell_majordomo_separation_anxiety_aura);
|
||||||
spell_majordomo_separation_nexiety() : SpellScriptLoader("spell_majordomo_separation_nexiety") {}
|
|
||||||
|
|
||||||
class spell_majordomo_separation_nexiety_AuraScript : public AuraScript
|
bool Validate(SpellInfo const* /*spell*/) override
|
||||||
{
|
{
|
||||||
PrepareAuraScript(spell_majordomo_separation_nexiety_AuraScript);
|
return ValidateSpellInfo({ SPELL_SEPARATION_ANXIETY_MINION });
|
||||||
|
}
|
||||||
|
|
||||||
bool Validate(SpellInfo const* /*spell*/) override
|
void HandlePeriodic(AuraEffect const* aurEff)
|
||||||
{
|
|
||||||
return ValidateSpellInfo({ SPELL_SEPARATION_ANXIETY_MINION });
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandlePeriodic(AuraEffect const* aurEff)
|
|
||||||
{
|
|
||||||
Unit const* caster = GetCaster();
|
|
||||||
Unit* target = GetTarget();
|
|
||||||
if (caster && target && target->GetDistance(caster) > 40.0f && !target->HasAura(SPELL_SEPARATION_ANXIETY_MINION))
|
|
||||||
{
|
|
||||||
target->CastSpell(target, SPELL_SEPARATION_ANXIETY_MINION, true, nullptr, aurEff);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Register() override
|
|
||||||
{
|
|
||||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_majordomo_separation_nexiety_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Should return a fully valid AuraScript pointer.
|
|
||||||
AuraScript* GetAuraScript() const override
|
|
||||||
{
|
{
|
||||||
return new spell_majordomo_separation_nexiety_AuraScript();
|
Unit const* caster = GetCaster();
|
||||||
|
Unit* target = GetTarget();
|
||||||
|
if (caster && target && target->GetDistance(caster) > 40.0f && !target->HasAura(SPELL_SEPARATION_ANXIETY_MINION))
|
||||||
|
{
|
||||||
|
target->CastSpell(target, SPELL_SEPARATION_ANXIETY_MINION, true, nullptr, aurEff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Register() override
|
||||||
|
{
|
||||||
|
OnEffectPeriodic += AuraEffectPeriodicFn(spell_majordomo_separation_anxiety_aura::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 19774 Summon Ragnaros
|
// 19774 Summon Ragnaros
|
||||||
class spell_summon_ragnaros : public SpellScriptLoader
|
class spell_summon_ragnaros : public SpellScript
|
||||||
{
|
{
|
||||||
public:
|
PrepareSpellScript(spell_summon_ragnaros);
|
||||||
spell_summon_ragnaros() : SpellScriptLoader("spell_summon_ragnaros") {}
|
|
||||||
|
|
||||||
class spell_summon_ragnaros_SpellScript : public SpellScript
|
void HandleHit()
|
||||||
{
|
{
|
||||||
PrepareSpellScript(spell_summon_ragnaros_SpellScript);
|
if (Unit* caster = GetCaster())
|
||||||
|
|
||||||
void HandleHit()
|
|
||||||
{
|
{
|
||||||
if (Unit* caster = GetCaster())
|
caster->SummonCreature(NPC_RAGNAROS, RagnarosSummonPos, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 2 * HOUR * IN_MILLISECONDS);
|
||||||
{
|
|
||||||
caster->SummonCreature(NPC_RAGNAROS, RagnarosSummonPos, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 2 * HOUR * IN_MILLISECONDS);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Register() override
|
void Register() override
|
||||||
{
|
|
||||||
AfterCast += SpellCastFn(spell_summon_ragnaros_SpellScript::HandleHit);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
SpellScript* GetSpellScript() const override
|
|
||||||
{
|
{
|
||||||
return new spell_summon_ragnaros_SpellScript();
|
AfterCast += SpellCastFn(spell_summon_ragnaros::HandleHit);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -691,8 +657,8 @@ void AddSC_boss_majordomo()
|
|||||||
new boss_majordomo();
|
new boss_majordomo();
|
||||||
|
|
||||||
// Spells
|
// Spells
|
||||||
new spell_hate_to_zero();
|
RegisterSpellScript(spell_hate_to_zero);
|
||||||
new spell_majordomo_separation_nexiety();
|
RegisterSpellScript(spell_majordomo_separation_anxiety_aura);
|
||||||
new spell_summon_ragnaros();
|
RegisterSpellScript(spell_summon_ragnaros);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -109,85 +109,74 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 23138 - Gate of Shazzrah
|
// 23138 - Gate of Shazzrah
|
||||||
class spell_shazzrah_gate_dummy : public SpellScriptLoader
|
class spell_shazzrah_gate_dummy : public SpellScript
|
||||||
{
|
{
|
||||||
public:
|
PrepareSpellScript(spell_shazzrah_gate_dummy);
|
||||||
spell_shazzrah_gate_dummy() : SpellScriptLoader("spell_shazzrah_gate_dummy") {}
|
|
||||||
|
|
||||||
class spell_shazzrah_gate_dummy_SpellScript : public SpellScript
|
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||||
{
|
{
|
||||||
PrepareSpellScript(spell_shazzrah_gate_dummy_SpellScript);
|
return ValidateSpellInfo({ SPELL_SHAZZRAH_GATE });
|
||||||
|
}
|
||||||
|
|
||||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
void FilterTargets(std::list<WorldObject*>& targets)
|
||||||
|
{
|
||||||
|
Unit* caster = GetCaster();
|
||||||
|
if (!targets.empty())
|
||||||
{
|
{
|
||||||
return ValidateSpellInfo({ SPELL_SHAZZRAH_GATE });
|
targets.remove_if([caster](WorldObject const* target) -> bool
|
||||||
}
|
|
||||||
|
|
||||||
void FilterTargets(std::list<WorldObject*>& targets)
|
|
||||||
{
|
|
||||||
Unit* caster = GetCaster();
|
|
||||||
if (!targets.empty())
|
|
||||||
{
|
{
|
||||||
targets.remove_if([caster](WorldObject const* target) -> bool
|
Player const* plrTarget = target->ToPlayer();
|
||||||
|
// Should not target non player targets
|
||||||
|
if (!plrTarget)
|
||||||
{
|
{
|
||||||
Player const* plrTarget = target->ToPlayer();
|
return true;
|
||||||
// Should not target non player targets
|
|
||||||
if (!plrTarget)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Should skip current victim
|
|
||||||
if (caster->GetVictim() == plrTarget)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Should not target enemies within melee range
|
|
||||||
if (plrTarget->IsWithinMeleeRange(caster))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!targets.empty())
|
|
||||||
{
|
|
||||||
Acore::Containers::RandomResize(targets, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
|
||||||
{
|
|
||||||
Unit* caster = GetCaster();
|
|
||||||
Unit* target = GetHitUnit();
|
|
||||||
|
|
||||||
if (caster && target)
|
|
||||||
{
|
|
||||||
target->CastSpell(caster, SPELL_SHAZZRAH_GATE, true);
|
|
||||||
caster->CastSpell(nullptr, SPELL_ARCANE_EXPLOSION);
|
|
||||||
|
|
||||||
if (Creature* creatureCaster = caster->ToCreature())
|
|
||||||
{
|
|
||||||
creatureCaster->GetThreatMgr().ResetAllThreat();
|
|
||||||
creatureCaster->GetThreatMgr().AddThreat(target, 1);
|
|
||||||
creatureCaster->AI()->AttackStart(target); // Attack the target which caster will teleport to.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Should skip current victim
|
||||||
|
if (caster->GetVictim() == plrTarget)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Should not target enemies within melee range
|
||||||
|
if (plrTarget->IsWithinMeleeRange(caster))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!targets.empty())
|
||||||
|
{
|
||||||
|
Acore::Containers::RandomResize(targets, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||||
|
{
|
||||||
|
Unit* caster = GetCaster();
|
||||||
|
Unit* target = GetHitUnit();
|
||||||
|
|
||||||
|
if (caster && target)
|
||||||
|
{
|
||||||
|
target->CastSpell(caster, SPELL_SHAZZRAH_GATE, true);
|
||||||
|
caster->CastSpell(nullptr, SPELL_ARCANE_EXPLOSION);
|
||||||
|
|
||||||
|
if (Creature* creatureCaster = caster->ToCreature())
|
||||||
|
{
|
||||||
|
creatureCaster->GetThreatMgr().ResetAllThreat();
|
||||||
|
creatureCaster->GetThreatMgr().AddThreat(target, 1);
|
||||||
|
creatureCaster->AI()->AttackStart(target); // Attack the target which caster will teleport to.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Register() override
|
void Register() override
|
||||||
{
|
|
||||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_shazzrah_gate_dummy_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
|
||||||
OnEffectHitTarget += SpellEffectFn(spell_shazzrah_gate_dummy_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
SpellScript* GetSpellScript() const override
|
|
||||||
{
|
{
|
||||||
return new spell_shazzrah_gate_dummy_SpellScript();
|
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_shazzrah_gate_dummy::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||||
|
OnEffectHitTarget += SpellEffectFn(spell_shazzrah_gate_dummy::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -196,6 +185,6 @@ void AddSC_boss_shazzrah()
|
|||||||
new boss_shazzrah();
|
new boss_shazzrah();
|
||||||
|
|
||||||
// Spells
|
// Spells
|
||||||
new spell_shazzrah_gate_dummy();
|
RegisterSpellScript(spell_shazzrah_gate_dummy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,101 +118,95 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 19822 Play Dead
|
// 19822 Play Dead
|
||||||
class spell_mc_play_dead : public SpellScriptLoader
|
class spell_mc_play_dead_aura : public AuraScript
|
||||||
{
|
{
|
||||||
public:
|
PrepareAuraScript(spell_mc_play_dead_aura);
|
||||||
spell_mc_play_dead() : SpellScriptLoader("spell_mc_play_dead") { }
|
|
||||||
|
|
||||||
class spell_mc_play_dead_AuraScript : public AuraScript
|
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||||
{
|
{
|
||||||
PrepareAuraScript(spell_mc_play_dead_AuraScript);
|
return ValidateSpellInfo({ SPELL_PLAY_DEAD_PACIFY, SPELL_PLAY_DEAD });
|
||||||
|
}
|
||||||
|
|
||||||
bool Load() override
|
bool Load() override
|
||||||
{
|
|
||||||
return GetCaster()->GetTypeId() == TYPEID_UNIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
|
||||||
{
|
|
||||||
Creature* creatureTarget = GetTarget()->ToCreature();
|
|
||||||
if (!creatureTarget)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
creatureTarget->CastSpell(creatureTarget, SPELL_PLAY_DEAD_PACIFY, true);
|
|
||||||
creatureTarget->SetDynamicFlag(UNIT_DYNFLAG_DEAD);
|
|
||||||
creatureTarget->SetUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
|
|
||||||
//creatureTarget->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
|
|
||||||
creatureTarget->SetReactState(REACT_PASSIVE);
|
|
||||||
creatureTarget->SetControlled(true, UNIT_STATE_ROOT);
|
|
||||||
|
|
||||||
creatureTarget->AttackStop();
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
|
||||||
{
|
|
||||||
Creature* creatureTarget = GetTarget()->ToCreature();
|
|
||||||
if (!creatureTarget)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
creatureTarget->RemoveAurasDueToSpell(SPELL_PLAY_DEAD_PACIFY);
|
|
||||||
creatureTarget->RemoveDynamicFlag(UNIT_DYNFLAG_DEAD);
|
|
||||||
creatureTarget->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
|
|
||||||
//creatureTarget->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
|
|
||||||
creatureTarget->SetControlled(false, UNIT_STATE_ROOT);
|
|
||||||
creatureTarget->SetReactState(REACT_AGGRESSIVE);
|
|
||||||
|
|
||||||
if (!creatureTarget->IsInCombat())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool shouldDie = true;
|
|
||||||
std::list<Creature*> hounds;
|
|
||||||
creatureTarget->GetCreaturesWithEntryInRange(hounds, 80.0f, NPC_CORE_HOUND);
|
|
||||||
|
|
||||||
// Perform lambda based check to find if there is any nearby
|
|
||||||
if (!hounds.empty())
|
|
||||||
{
|
|
||||||
// Alive hound been found within 80 yards -> cancel suicide
|
|
||||||
if (std::find_if(hounds.begin(), hounds.end(), [creatureTarget](Creature const* hound)
|
|
||||||
{
|
|
||||||
return creatureTarget != hound && creatureTarget->IsWithinLOSInMap(hound) && hound->IsAlive() && hound->IsInCombat() && !hound->HasAura(SPELL_PLAY_DEAD);
|
|
||||||
}) != hounds.end())
|
|
||||||
{
|
|
||||||
shouldDie = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!shouldDie)
|
|
||||||
{
|
|
||||||
if (CreatureAI* targetAI = creatureTarget->AI())
|
|
||||||
{
|
|
||||||
targetAI->DoCastSelf(SPELL_FIRE_NOVA_VISUAL, true);
|
|
||||||
targetAI->DoCastSelf(SPELL_FULL_HEALTH, true);
|
|
||||||
targetAI->Talk(EMOTE_IGNITE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Unit::Kill(creatureTarget, creatureTarget);
|
|
||||||
creatureTarget->DespawnOrUnsummon(14000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Register() override
|
|
||||||
{
|
|
||||||
AfterEffectApply += AuraEffectApplyFn(spell_mc_play_dead_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_FEIGN_DEATH, AURA_EFFECT_HANDLE_REAL);
|
|
||||||
AfterEffectRemove += AuraEffectApplyFn(spell_mc_play_dead_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_FEIGN_DEATH, AURA_EFFECT_HANDLE_REAL);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
AuraScript* GetAuraScript() const override
|
|
||||||
{
|
{
|
||||||
return new spell_mc_play_dead_AuraScript();
|
return GetCaster()->GetTypeId() == TYPEID_UNIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||||
|
{
|
||||||
|
Creature* creatureTarget = GetTarget()->ToCreature();
|
||||||
|
if (!creatureTarget)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
creatureTarget->CastSpell(creatureTarget, SPELL_PLAY_DEAD_PACIFY, true);
|
||||||
|
creatureTarget->SetDynamicFlag(UNIT_DYNFLAG_DEAD);
|
||||||
|
creatureTarget->SetUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
|
||||||
|
//creatureTarget->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
|
||||||
|
creatureTarget->SetReactState(REACT_PASSIVE);
|
||||||
|
creatureTarget->SetControlled(true, UNIT_STATE_ROOT);
|
||||||
|
|
||||||
|
creatureTarget->AttackStop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||||
|
{
|
||||||
|
Creature* creatureTarget = GetTarget()->ToCreature();
|
||||||
|
if (!creatureTarget)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
creatureTarget->RemoveAurasDueToSpell(SPELL_PLAY_DEAD_PACIFY);
|
||||||
|
creatureTarget->RemoveDynamicFlag(UNIT_DYNFLAG_DEAD);
|
||||||
|
creatureTarget->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
|
||||||
|
//creatureTarget->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
|
||||||
|
creatureTarget->SetControlled(false, UNIT_STATE_ROOT);
|
||||||
|
creatureTarget->SetReactState(REACT_AGGRESSIVE);
|
||||||
|
|
||||||
|
if (!creatureTarget->IsInCombat())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool shouldDie = true;
|
||||||
|
std::list<Creature*> hounds;
|
||||||
|
creatureTarget->GetCreaturesWithEntryInRange(hounds, 80.0f, NPC_CORE_HOUND);
|
||||||
|
|
||||||
|
// Perform lambda based check to find if there is any nearby
|
||||||
|
if (!hounds.empty())
|
||||||
|
{
|
||||||
|
// Alive hound been found within 80 yards -> cancel suicide
|
||||||
|
if (std::find_if(hounds.begin(), hounds.end(), [creatureTarget](Creature const* hound)
|
||||||
|
{
|
||||||
|
return creatureTarget != hound && creatureTarget->IsWithinLOSInMap(hound) && hound->IsAlive() && hound->IsInCombat() && !hound->HasAura(SPELL_PLAY_DEAD);
|
||||||
|
}) != hounds.end())
|
||||||
|
{
|
||||||
|
shouldDie = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!shouldDie)
|
||||||
|
{
|
||||||
|
if (CreatureAI* targetAI = creatureTarget->AI())
|
||||||
|
{
|
||||||
|
targetAI->DoCastSelf(SPELL_FIRE_NOVA_VISUAL, true);
|
||||||
|
targetAI->DoCastSelf(SPELL_FULL_HEALTH, true);
|
||||||
|
targetAI->Talk(EMOTE_IGNITE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Unit::Kill(creatureTarget, creatureTarget);
|
||||||
|
creatureTarget->DespawnOrUnsummon(14000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Register() override
|
||||||
|
{
|
||||||
|
AfterEffectApply += AuraEffectApplyFn(spell_mc_play_dead_aura::HandleEffectApply, EFFECT_0, SPELL_AURA_FEIGN_DEATH, AURA_EFFECT_HANDLE_REAL);
|
||||||
|
AfterEffectRemove += AuraEffectApplyFn(spell_mc_play_dead_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_FEIGN_DEATH, AURA_EFFECT_HANDLE_REAL);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -272,6 +266,6 @@ void AddSC_molten_core()
|
|||||||
RegisterCreatureAI(npc_lava_spawn);
|
RegisterCreatureAI(npc_lava_spawn);
|
||||||
|
|
||||||
// Spells
|
// Spells
|
||||||
new spell_mc_play_dead();
|
RegisterSpellScript(spell_mc_play_dead_aura);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user