Core/Spells: reworked and fixed Fulmination proc and damage calculation

This commit is contained in:
Ovahlord committed 2018-08-22 01:24:39 +02:00
1 parent ab5edf703e
commit d2de2791fe
2 files changed
+69 -59

No files matched your search

+59 -59
View File
@@ -52,7 +52,7 @@ enum ShamanSpells
SPELL_SHAMAN_FLAMETONGUE_WEAPON = 8024,
SPELL_SHAMAN_FOCUSED_INSIGHT = 77800,
SPELL_SHAMAN_FREEZE = 63685,
SPELL_SHAMAN_FULMINATION_VISUAL = 95774,
SPELL_SHAMAN_FULMINATION_PROC = 95774,
SPELL_SHAMAN_FULMINATION_DAMAGE = 88767,
SPELL_SHAMAN_GLYPH_OF_EARTH_SHIELD = 63279,
SPELL_SHAMAN_GLYPH_OF_HEALING_STREAM_TOTEM = 55456,
@@ -101,7 +101,8 @@ enum ShamanSpellIcons
SHAMAN_ICON_ID_SOOTHING_RAIN = 2011,
SHAMAN_ICON_ID_SHAMAN_LAVA_FLOW = 3087,
SHAMAN_ICON_ID_CLEANSING_WATERS = 2020,
SHAMAN_ICON_ID_BLESSING_OF_THE_ETERNALS = 3157
SHAMAN_ICON_ID_BLESSING_OF_THE_ETERNALS = 3157,
SHAMAN_ICON_ID_FULMINATION = 2010
};
enum MiscSpells
@@ -1129,22 +1130,23 @@ class spell_sha_rolling_thunder : public SpellScriptLoader
return ValidateSpellInfo(
{
SPELL_SHAMAN_LIGHTNING_SHIELD,
SPELL_SHAMAN_FULMINATION_VISUAL
SPELL_SHAMAN_FULMINATION_PROC
});
}
void HandleEffectProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
{
if (Aura* aura = GetTarget()->GetAura(SPELL_SHAMAN_LIGHTNING_SHIELD))
Unit* target = GetTarget();
if (Aura* aura = target->GetAura(SPELL_SHAMAN_LIGHTNING_SHIELD))
{
aura->SetCharges(std::min(aura->GetCharges() + 1, aurEff->GetAmount()));
aura->RefreshDuration();
// Fulmination
if (AuraEffect const* fulAurEff = GetTarget()->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 2010, EFFECT_0))
if (AuraEffect const* fulAurEff = target->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, SHAMAN_ICON_ID_FULMINATION, EFFECT_0))
if (aura->GetCharges() - fulAurEff->GetAmount() > 0)
if (!GetTarget()->HasAura(SPELL_SHAMAN_FULMINATION_VISUAL))
GetTarget()->CastSpell(GetTarget(), SPELL_SHAMAN_FULMINATION_VISUAL, true, nullptr, aurEff);
target->CastSpell(GetTarget(), SPELL_SHAMAN_FULMINATION_PROC, true, nullptr, aurEff);
}
}
@@ -1575,57 +1577,6 @@ class spell_sha_cleanse_spirit : public SpellScriptLoader
}
};
// 8042 - Earth Shock
class spell_sha_earth_shock : public SpellScriptLoader
{
public:
spell_sha_earth_shock() : SpellScriptLoader("spell_sha_earth_shock") { }
class spell_sha_earth_shock_SpellScript : public SpellScript
{
PrepareSpellScript(spell_sha_earth_shock_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo(
{
SPELL_SHAMAN_LIGHTNING_SHIELD,
SPELL_SHAMAN_FULMINATION_VISUAL,
SPELL_SHAMAN_FULMINATION_DAMAGE,
SPELL_SHAMAN_LIGHTNING_SHIELD_DAMAGE
});
}
void HandleFulmination(SpellEffIndex /*effIndex*/)
{
if (Unit* caster = GetCaster())
if (caster->HasAura(SPELL_SHAMAN_FULMINATION_VISUAL))
if (Aura* aura = caster->GetAura(SPELL_SHAMAN_LIGHTNING_SHIELD))
if (AuraEffect const* fulAurEff = caster->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 2010, EFFECT_0))
if (uint8 surplousCharges = aura->GetCharges() - fulAurEff->GetAmount())
if (SpellInfo const* shieldDamageSpell = sSpellMgr->GetSpellInfo(SPELL_SHAMAN_LIGHTNING_SHIELD_DAMAGE))
{
aura->SetCharges(fulAurEff->GetAmount());
caster->RemoveAurasDueToSpell(SPELL_SHAMAN_FULMINATION_VISUAL);
int32 bp = shieldDamageSpell->Effects[EFFECT_0].CalcValue() * surplousCharges;
if (Unit* target = GetExplTargetUnit())
caster->CastCustomSpell(SPELL_SHAMAN_FULMINATION_DAMAGE, SPELLVALUE_BASE_POINT0, bp, target, true);
}
}
void Register() override
{
OnEffectLaunch += SpellEffectFn(spell_sha_earth_shock_SpellScript::HandleFulmination, EFFECT_1, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_sha_earth_shock_SpellScript();
}
};
// 73920 - Healing Rain
class spell_sha_healing_rain : public SpellScriptLoader
{
@@ -2018,6 +1969,55 @@ class spell_sha_frozen_power : public AuraScript
}
};
// 95774 - Fulmination
class spell_sha_fulmination : public AuraScript
{
PrepareAuraScript(spell_sha_fulmination);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo(
{
SPELL_SHAMAN_FULMINATION_DAMAGE,
SPELL_SHAMAN_LIGHTNING_SHIELD_DAMAGE
});
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
Unit* caster = GetTarget();
Unit* target = eventInfo.GetProcSpell()->m_targets.GetUnitTarget();
if (!target)
return;
Aura* lightningShieldAura = caster->GetAura(SPELL_SHAMAN_LIGHTNING_SHIELD);
if (!lightningShieldAura)
return;
AuraEffect const* fulminationEffect = caster->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, SHAMAN_ICON_ID_FULMINATION, EFFECT_0);
if (!fulminationEffect)
return;
if (uint8 surplousCharges = std::max(0, (lightningShieldAura->GetCharges() - fulminationEffect->GetAmount())))
{
if (SpellInfo const* shieldDamageSpell = sSpellMgr->GetSpellInfo(SPELL_SHAMAN_LIGHTNING_SHIELD_DAMAGE))
{
lightningShieldAura->SetCharges(fulminationEffect->GetAmount());
int32 basepoints = (shieldDamageSpell->Effects[EFFECT_0].CalcValue() + caster->SpellDamageBonusDone(target, shieldDamageSpell, 0, SPELL_DIRECT_DAMAGE, EFFECT_0)) * surplousCharges;
caster->CastCustomSpell(SPELL_SHAMAN_FULMINATION_DAMAGE, SPELLVALUE_BASE_POINT0, basepoints, target, true);
}
}
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_sha_fulmination::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
void AddSC_shaman_spell_scripts()
{
new spell_sha_ancestral_awakening();
@@ -2031,7 +2031,6 @@ void AddSC_shaman_spell_scripts()
new spell_sha_earthbind_totem();
new spell_sha_earthen_power();
new spell_sha_earthliving_weapon();
new spell_sha_earth_shock();
new spell_sha_elemental_overload();
new spell_sha_feedback();
new spell_sha_fire_nova();
@@ -2039,6 +2038,7 @@ void AddSC_shaman_spell_scripts()
RegisterAuraScript(spell_sha_flametongue_weapon);
new spell_sha_focused_insight();
RegisterAuraScript(spell_sha_frozen_power);
RegisterAuraScript(spell_sha_fulmination);
new spell_sha_glyph_of_healing_wave();
new spell_sha_healing_rain();
new spell_sha_healing_rain_triggered();