diff options
| author | Vincent-Michael <Vincent_Michael@gmx.de> | 2012-11-30 18:27:34 +0100 |
|---|---|---|
| committer | Vincent-Michael <Vincent_Michael@gmx.de> | 2012-11-30 18:27:34 +0100 |
| commit | ddb6c95042b5fc5ca424f821a90bc370a977dc5e (patch) | |
| tree | c009cf7a38e011eff7728520d4d1950e2d37f9ad /src/server/scripts/Spells | |
| parent | d6aee0862147e41764d35f982fc387d780c42c5b (diff) | |
Core/Spells: Convert Replenishment in spell script
Diffstat (limited to 'src/server/scripts/Spells')
| -rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 026a0c7b280..2e36d3811f6 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -3305,6 +3305,61 @@ class spell_gen_gift_of_naaru : public SpellScriptLoader } }; +enum Replenishment +{ + SPELL_REPLENISHMENT = 57669, + SPELL_INFINITE_REPLENISHMENT = 61782 +}; + +class spell_gen_replenishment : public SpellScriptLoader +{ + public: + spell_gen_replenishment() : SpellScriptLoader("spell_gen_replenishment") { } + + class spell_gen_replenishment_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_replenishment_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_REPLENISHMENT) || + !sSpellMgr->GetSpellInfo(SPELL_INFINITE_REPLENISHMENT)) + return false; + return true; + } + + bool Load() + { + return GetUnitOwner()->GetPower(POWER_MANA); + } + + void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + switch (GetSpellInfo()->Id) + { + case SPELL_REPLENISHMENT: + amount = GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.002f; + break; + case SPELL_INFINITE_REPLENISHMENT: + amount = GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.0025f; + break; + default: + break; + } + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_replenishment_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_ENERGIZE); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_gen_replenishment_AuraScript(); + } +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -3381,4 +3436,5 @@ void AddSC_generic_spell_scripts() new spell_gen_upper_deck_create_foam_sword(); new spell_gen_bonked(); new spell_gen_gift_of_naaru(); + new spell_gen_replenishment(); } |
