Core/Spells: unclusterfuck weapon damage spell effect handler

* weapon effect values can now be manipulated via spell scripts
* moved Kill Shot attack power bonus to spell_bonus_data
* converted Warrior's Devastate effect handler hack to spell script
This commit is contained in:
Ovahlord
2019-11-08 03:38:11 +01:00
parent 4215720f8d
commit c949e12f80
5 changed files with 97 additions and 91 deletions

View File

@@ -1196,6 +1196,35 @@ class spell_warr_shockwave : public SpellScript
}
};
class spell_warr_devastate : public SpellScript
{
PrepareSpellScript(spell_warr_devastate);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_WARRIOR_SUNDER_ARMOR });
}
void HandleDamageBonus(SpellEffIndex /*effIndex*/)
{
if (Unit* caster = GetCaster())
if (Aura* sunder = GetHitUnit()->GetAura(SPELL_WARRIOR_SUNDER_ARMOR, caster->GetGUID()))
SetEffectValue(GetEffectValue() + GetEffectValue() * sunder->GetStackAmount());
}
void HandleSunderArmor(SpellEffIndex /*effIndex*/)
{
if (Unit* caster = GetCaster())
caster->CastSpell(GetHitUnit(), SPELL_WARRIOR_SUNDER_ARMOR, true);
}
void Register() override
{
OnEffectLaunchTarget += SpellEffectFn(spell_warr_devastate::HandleDamageBonus, EFFECT_1, SPELL_EFFECT_NORMALIZED_WEAPON_DMG);
OnEffectHitTarget += SpellEffectFn(spell_warr_devastate::HandleSunderArmor, EFFECT_1, SPELL_EFFECT_NORMALIZED_WEAPON_DMG);
}
};
void AddSC_warrior_spell_scripts()
{
RegisterAuraScript(spell_warr_blood_craze);
@@ -1204,6 +1233,7 @@ void AddSC_warrior_spell_scripts()
new spell_warr_charge();
RegisterSpellScript(spell_warr_concussion_blow);
new spell_warr_deep_wounds();
RegisterSpellScript(spell_warr_devastate);
new spell_warr_execute();
new spell_warr_glyph_of_sunder_armor();
new spell_warr_intimidating_shout();