Core/Spells: Immortal specialization series part 3 - fixed Warlock Mastery: Chaotic Energies damage taken portion

Closes #20195
This commit is contained in:
Shauren
2017-09-01 23:41:55 +02:00
parent f487ae12bd
commit 32f18d05ae
2 changed files with 32 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_warl_chaotic_energies';
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(77220,'spell_warl_chaotic_energies');

View File

@@ -162,6 +162,34 @@ class spell_warl_conflagrate : public SpellScriptLoader
}
};
// 77220 - Mastery: Chaotic Energies
class spell_warl_chaotic_energies : public AuraScript
{
PrepareAuraScript(spell_warl_chaotic_energies);
void HandleAbsorb(AuraEffect* /*aurEff*/, DamageInfo& dmgInfo, uint32& absorbAmount)
{
AuraEffect const* effect1 = GetEffect(EFFECT_1);
if (!effect1 || !GetTargetApplication()->HasEffect(EFFECT_1))
{
PreventDefaultAction();
return;
}
// You take ${$s2/3}% reduced damage
float damageReductionPct = float(effect1->GetAmount()) / 3;
// plus a random amount of up to ${$s2/3}% additional reduced damage
damageReductionPct += frand(0.0f, damageReductionPct);
absorbAmount = CalculatePct(dmgInfo.GetDamage(), damageReductionPct);
}
void Register() override
{
OnEffectAbsorb += AuraEffectAbsorbFn(spell_warl_chaotic_energies::HandleAbsorb, EFFECT_2);
}
};
// 6201 - Create Healthstone
class spell_warl_create_healthstone : public SpellScriptLoader
{
@@ -1454,6 +1482,7 @@ void AddSC_warlock_spell_scripts()
{
new spell_warl_bane_of_doom();
new spell_warl_banish();
RegisterAuraScript(spell_warl_chaotic_energies);
new spell_warl_conflagrate();
new spell_warl_create_healthstone();
new spell_warl_demonic_circle_summon();