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
-31
@@ -515,36 +515,6 @@ public:
|
||||
|
||||
};
|
||||
|
||||
class spell_spinning_pain_spike : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_spinning_pain_spike() : SpellScriptLoader("spell_spinning_pain_spike") {}
|
||||
|
||||
class spell_spinning_pain_spike_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_spinning_pain_spike_SpellScript);
|
||||
|
||||
void HandleScript(SpellEffIndex /*eff*/)
|
||||
{
|
||||
Unit* target = GetHitUnit();
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
if (target->isAlive())
|
||||
SetHitDamage(target->CountPctFromMaxHealth(50));
|
||||
}
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_spinning_pain_spike_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_spinning_pain_spike_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_boss_jaraxxus()
|
||||
{
|
||||
new boss_jaraxxus();
|
||||
@@ -553,5 +523,4 @@ void AddSC_boss_jaraxxus()
|
||||
new mob_fel_infernal();
|
||||
new mob_nether_portal();
|
||||
new mob_mistress_of_pain();
|
||||
new spell_spinning_pain_spike();
|
||||
}
|
||||
@@ -947,13 +947,19 @@ class spell_xt002_tympanic_tantrum : public SpellScriptLoader
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
{
|
||||
unitList.remove_if (PlayerOrPetCheck());
|
||||
unitList.remove_if(PlayerOrPetCheck());
|
||||
}
|
||||
|
||||
void RecalculateDamage()
|
||||
{
|
||||
SetHitDamage(GetHitUnit()->CountPctFromMaxHealth(GetHitDamage()));
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_xt002_tympanic_tantrum_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_xt002_tympanic_tantrum_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnHit += SpellHitFn(spell_xt002_tympanic_tantrum_SpellScript::RecalculateDamage);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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