diff options
| author | Vincent-Core <Vincent_Michael@gmx.de> | 2012-04-07 12:17:21 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2012-04-21 12:17:45 +0200 |
| commit | 408c78dcd7311588d7ceeb0f0e98d0831b500632 (patch) | |
| tree | a45cf908a35b3b15a64b27b59bb8ac249e3d4e09 /src/server/scripts/Spells | |
| parent | 9559a488771eec4f6ea7826df6ad459ca44fa21f (diff) | |
Core/Spells
* Converted percent based damage dealing spell effects to scripts
* Fix Leviroth Self-Impale damage
Closes #6085
Signed-off-by: Shauren <shauren.trinity@gmail.com>
Diffstat (limited to 'src/server/scripts/Spells')
| -rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 035f9ec98b2..2d431331691 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -2618,6 +2618,44 @@ class spell_gen_wg_water : public SpellScriptLoader } }; +class spell_gen_count_pct_from_max_hp : public SpellScriptLoader +{ + public: + spell_gen_count_pct_from_max_hp(char const* name, int32 damagePct = 0) : SpellScriptLoader(name), _damagePct(damagePct) { } + + class spell_gen_count_pct_from_max_hp_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_count_pct_from_max_hp_SpellScript) + + public: + spell_gen_count_pct_from_max_hp_SpellScript(int32 damagePct) : SpellScript(), _damagePct(damagePct) { } + + void RecalculateDamage() + { + if (!_damagePct) + _damagePct = GetHitDamage(); + + SetHitDamage(GetHitUnit()->CountPctFromMaxHealth(_damagePct)); + } + + void Register() + { + OnHit += SpellHitFn(spell_gen_count_pct_from_max_hp_SpellScript::RecalculateDamage); + } + + private: + int32 _damagePct; + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_count_pct_from_max_hp_SpellScript(_damagePct); + } + + private: + int32 _damagePct; +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -2669,4 +2707,6 @@ void AddSC_generic_spell_scripts() new spell_gen_chaos_blast(); new spell_gen_ds_flush_knockback(); new spell_gen_wg_water(); + new spell_gen_count_pct_from_max_hp("spell_gen_default_count_pct_from_max_hp"); + new spell_gen_count_pct_from_max_hp("spell_gen_50pct_count_pct_from_max_hp", 50); } |
