From f2049d5f0d25dc9de478822b2afa22ec2cd56fce Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Tue, 16 Apr 2019 19:32:16 +0200 Subject: [PATCH] Core/Spells: updated Beacon of Light to Cataclysm --- .../custom/custom_2019_04_16_00_world.sql | 14 +++ src/server/scripts/Spells/spell_paladin.cpp | 105 ++++++++---------- 2 files changed, 60 insertions(+), 59 deletions(-) create mode 100644 sql/updates/world/custom/custom_2019_04_16_00_world.sql diff --git a/sql/updates/world/custom/custom_2019_04_16_00_world.sql b/sql/updates/world/custom/custom_2019_04_16_00_world.sql new file mode 100644 index 00000000000..e22552578df --- /dev/null +++ b/sql/updates/world/custom/custom_2019_04_16_00_world.sql @@ -0,0 +1,14 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName` IN +('spell_pal_light_s_beacon', +'spell_pal_lights_beacon'); + +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(53651, 'spell_pal_lights_beacon'); + +SET @FAMILY_FLAGS0 := 0 | 0x00200000 | 0x40000000 | 0x80000000; +SET @FAMILY_FLAGS1 := 0; +SET @FAMILY_FLAGS2 := 0 | 0x00000400 | 0x00004000 | 0x00040000; + +DELETE FROM `spell_proc` WHERE `SpellId`= 53651; +INSERT INTO `spell_proc` (`SpellId`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `ProcFlags`, `SpellTypeMask`, `SpellPhaseMask`, `HitMask`, `AttributesMask`) VALUES +(53651, 10, @FAMILY_FLAGS0, @FAMILY_FLAGS1, @FAMILY_FLAGS2, 0, 2, 2, 0, 0); diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index de092d55a7f..319c531c272 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -962,64 +962,6 @@ class spell_pal_lay_on_hands : public SpellScriptLoader } }; -// 53651 - Light's Beacon - Beacon of Light -class spell_pal_light_s_beacon : public SpellScriptLoader -{ - public: - spell_pal_light_s_beacon() : SpellScriptLoader("spell_pal_light_s_beacon") { } - - class spell_pal_light_s_beacon_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_light_s_beacon_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_PALADIN_BEACON_OF_LIGHT, SPELL_PALADIN_BEACON_OF_LIGHT_HEAL, SPELL_PALADIN_HOLY_LIGHT }); - } - - bool CheckProc(ProcEventInfo& eventInfo) - { - if (eventInfo.GetActionTarget()->HasAura(SPELL_PALADIN_BEACON_OF_LIGHT, eventInfo.GetActor()->GetGUID())) - return false; - return true; - } - - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); - - int32 heal = eventInfo.GetHealInfo()->GetHeal(); - - if (eventInfo.GetDamageInfo()->GetSpellInfo()->Id != SPELL_PALADIN_HOLY_LIGHT) - heal = int32(CalculatePct(heal, aurEff->GetAmount())); - - Unit::AuraList const& auras = GetCaster()->GetSingleCastAuras(); - for (Aura* const& aura : auras) - { - if (aura->GetId() == SPELL_PALADIN_BEACON_OF_LIGHT) - { - std::list applications; - aura->GetApplicationList(applications); - if (!applications.empty()) - eventInfo.GetActor()->CastCustomSpell(SPELL_PALADIN_BEACON_OF_LIGHT_HEAL, SPELLVALUE_BASE_POINT0, heal, applications.front()->GetTarget(), true); - return; - } - } - } - - void Register() override - { - DoCheckProc += AuraCheckProcFn(spell_pal_light_s_beacon_AuraScript::CheckProc); - OnEffectProc += AuraEffectProcFn(spell_pal_light_s_beacon_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; - - AuraScript* GetAuraScript() const override - { - return new spell_pal_light_s_beacon_AuraScript(); - } -}; - // 31789 - Righteous Defense class spell_pal_righteous_defense : public SpellScriptLoader { @@ -2072,6 +2014,51 @@ private: } }; +// 53651 - Light's Beacon +class spell_pal_lights_beacon : public AuraScript +{ + PrepareAuraScript(spell_pal_lights_beacon); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( + { + SPELL_PALADIN_BEACON_OF_LIGHT_HEAL, + SPELL_PALADIN_BEACON_OF_LIGHT, + SPELL_PALADIN_HOLY_LIGHT + }); + } + + bool CheckProc(ProcEventInfo& eventInfo) + { + return eventInfo.GetHealInfo(); + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + + // Affected healing spells heal for 50% of the amount + HealInfo* heal = eventInfo.GetHealInfo(); + int32 bp = CalculatePct(heal->GetHeal(), aurEff->GetAmount()); + + // Holy Light heals for 100% of the amount + if (heal->GetSpellInfo()->Id == SPELL_PALADIN_HOLY_LIGHT) + bp *= 2; + + if (Unit* caster = GetCaster()) + if (Aura* aura = caster->GetAura(SPELL_PALADIN_BEACON_OF_LIGHT)) + if (Unit* originalCaster = aura->GetCaster()) + originalCaster->CastCustomSpell(SPELL_PALADIN_BEACON_OF_LIGHT_HEAL, SPELLVALUE_BASE_POINT0, bp, caster, true, nullptr, aurEff); + } + + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_pal_lights_beacon::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_pal_lights_beacon::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } +}; + void AddSC_paladin_spell_scripts() { RegisterAuraScript(spell_pal_ardent_defender); @@ -2107,7 +2094,7 @@ void AddSC_paladin_spell_scripts() new spell_pal_judgement(); RegisterAuraScript(spell_pal_judgements); new spell_pal_lay_on_hands(); - new spell_pal_light_s_beacon(); + RegisterAuraScript(spell_pal_lights_beacon); RegisterSpellScript(spell_pal_light_of_dawn); RegisterAuraScript(spell_pal_long_arm_of_the_law); new spell_pal_righteous_defense();