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>
This commit is contained in:
1 parent
9559a48877
commit
408c78dcd7
5 files changed
+61
-49
No files matched your search
@@ -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);
|
||||
}
|
||||
Reference in new issue
Block a user