Core/Spells&GOs: Fix Ritual of Doom.

Thanks QAston and Shocker for helping.
Closes #2535
This commit is contained in:
Nay
2011-09-15 17:51:17 +01:00
parent e70676a8f6
commit 791acfebac
4 changed files with 97 additions and 52 deletions

View File

@@ -36,6 +36,57 @@ enum WarlockSpells
WARLOCK_IMPROVED_HEALTHSTONE_R2 = 18693,
};
class spell_warl_banish : public SpellScriptLoader
{
public:
spell_warl_banish() : SpellScriptLoader("spell_warl_banish") { }
class spell_warl_banish_SpellScript : public SpellScript
{
PrepareSpellScript(spell_warl_banish_SpellScript);
bool Load()
{
_removed = false;
return true;
}
void HandleBanish()
{
if (Unit* target = GetHitUnit())
{
if (target->GetAuraEffect(SPELL_AURA_SCHOOL_IMMUNITY, SPELLFAMILY_WARLOCK, 0, 0x08000000, 0))
{
//No need to remove old aura since its removed due to not stack by current Banish aura
PreventHitDefaultEffect(EFFECT_0);
PreventHitDefaultEffect(EFFECT_1);
PreventHitDefaultEffect(EFFECT_2);
_removed = true;
}
}
}
void RemoveAura()
{
if (_removed)
PreventHitAura();
}
void Register()
{
BeforeHit += SpellHitFn(spell_warl_banish_SpellScript::HandleBanish);
AfterHit += SpellHitFn(spell_warl_banish_SpellScript::RemoveAura);
}
bool _removed;
};
SpellScript* GetSpellScript() const
{
return new spell_warl_banish_SpellScript();
}
};
// 47193 Demonic Empowerment
class spell_warl_demonic_empowerment : public SpellScriptLoader
{
@@ -204,6 +255,33 @@ class spell_warl_everlasting_affliction : public SpellScriptLoader
}
};
// 18541 Ritual of Doom Effect
class spell_warl_ritual_of_doom_effect : public SpellScriptLoader
{
public:
spell_warl_ritual_of_doom_effect() : SpellScriptLoader("spell_warl_ritual_of_doom_effect") { }
class spell_warl_ritual_of_doom_effect_SpellScript : public SpellScript
{
PrepareSpellScript(spell_warl_ritual_of_doom_effect_SpellScript);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
GetCaster()->CastSpell(GetHitUnit(), GetEffectValue(), true);
}
void Register()
{
OnEffect += SpellEffectFn(spell_warl_ritual_of_doom_effect_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_warl_ritual_of_doom_effect_SpellScript();
}
};
class spell_warl_seed_of_corruption : public SpellScriptLoader
{
public:
@@ -230,62 +308,12 @@ class spell_warl_seed_of_corruption : public SpellScriptLoader
}
};
class spell_warl_banish : public SpellScriptLoader
{
public:
spell_warl_banish() : SpellScriptLoader("spell_warl_banish") { }
class spell_warl_banish_SpellScript : public SpellScript
{
PrepareSpellScript(spell_warl_banish_SpellScript);
bool Load()
{
_removed = false;
return true;
}
void HandleBanish()
{
if (Unit* target = GetHitUnit())
{
if (target->GetAuraEffect(SPELL_AURA_SCHOOL_IMMUNITY, SPELLFAMILY_WARLOCK, 0, 0x08000000, 0))
{
//No need to remove old aura since its removed due to not stack by current Banish aura
PreventHitDefaultEffect(EFFECT_0);
PreventHitDefaultEffect(EFFECT_1);
PreventHitDefaultEffect(EFFECT_2);
_removed = true;
}
}
}
void RemoveAura()
{
if (_removed)
PreventHitAura();
}
void Register()
{
BeforeHit += SpellHitFn(spell_warl_banish_SpellScript::HandleBanish);
AfterHit += SpellHitFn(spell_warl_banish_SpellScript::RemoveAura);
}
bool _removed;
};
SpellScript* GetSpellScript() const
{
return new spell_warl_banish_SpellScript();
}
};
void AddSC_warlock_spell_scripts()
{
new spell_warl_banish();
new spell_warl_demonic_empowerment();
new spell_warl_create_healthstone();
new spell_warl_everlasting_affliction();
new spell_warl_ritual_of_doom_effect();
new spell_warl_seed_of_corruption();
new spell_warl_banish();
}