mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-21 15:27:47 -04:00
Core/Spells: convert some spell effects to SpellScripts
This commit is contained in:
@@ -37,6 +37,8 @@ enum WarlockSpells
|
||||
WARLOCK_DEMONIC_CIRCLE_SUMMON = 48018,
|
||||
WARLOCK_DEMONIC_CIRCLE_TELEPORT = 48020,
|
||||
WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST = 62388,
|
||||
WARLOCK_HAUNT_HEAL = 48210,
|
||||
WARLOCK_UNSTABLE_AFFLICTION_DISPEL = 31117,
|
||||
};
|
||||
|
||||
class spell_warl_banish : public SpellScriptLoader
|
||||
@@ -523,6 +525,106 @@ class spell_warl_demonic_circle_teleport : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
class spell_warl_haunt : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warl_haunt() : SpellScriptLoader("spell_warl_haunt") { }
|
||||
|
||||
class spell_warl_haunt_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warl_haunt_SpellScript);
|
||||
|
||||
void HandleOnHit()
|
||||
{
|
||||
if (Aura* aura = GetHitAura())
|
||||
if (AuraEffect* aurEff = aura->GetEffect(EFFECT_1))
|
||||
aurEff->SetAmount(CalculatePctN(aurEff->GetAmount(), GetHitDamage()));
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnHit += SpellHitFn(spell_warl_haunt_SpellScript::HandleOnHit);
|
||||
}
|
||||
};
|
||||
|
||||
class spell_warl_haunt_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_warl_haunt_AuraScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spell*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(WARLOCK_HAUNT_HEAL))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
int32 amount = aurEff->GetAmount();
|
||||
GetTarget()->CastCustomSpell(caster, WARLOCK_HAUNT_HEAL, &amount, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectRemove += AuraEffectApplyFn(spell_warl_haunt_AuraScript::HandleRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warl_haunt_SpellScript();
|
||||
}
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_warl_haunt_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_warl_unstable_affliction : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warl_unstable_affliction() : SpellScriptLoader("spell_warl_unstable_affliction") { }
|
||||
|
||||
class spell_warl_unstable_affliction_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_warl_unstable_affliction_AuraScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spell*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(WARLOCK_UNSTABLE_AFFLICTION_DISPEL))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDispel(DispelInfo* dispelInfo)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
if (AuraEffect const* aurEff = GetEffect(EFFECT_0))
|
||||
{
|
||||
int32 damage = aurEff->GetAmount() * 9;
|
||||
// backfire damage and silence
|
||||
caster->CastCustomSpell(dispelInfo->GetDispeller(), WARLOCK_UNSTABLE_AFFLICTION_DISPEL, &damage, NULL, NULL, true, NULL, aurEff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
AfterDispel += AuraDispelFn(spell_warl_unstable_affliction_AuraScript::HandleDispel);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_warl_unstable_affliction_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_warlock_spell_scripts()
|
||||
{
|
||||
new spell_warl_banish();
|
||||
@@ -535,4 +637,6 @@ void AddSC_warlock_spell_scripts()
|
||||
new spell_warl_life_tap();
|
||||
new spell_warl_demonic_circle_summon();
|
||||
new spell_warl_demonic_circle_teleport();
|
||||
new spell_warl_haunt();
|
||||
new spell_warl_unstable_affliction();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user