From 98d09ec74b3a861ae7c1810fa39cc2390dcb20a8 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Sat, 14 Jul 2018 19:39:21 +0200 Subject: [PATCH] Core/Spells: fixed Divine Purpose proc and add handling for the buff in Word of Glory spell script --- .../custom/custom_2018_07_14_03_world.sql | 15 +++++ src/server/scripts/Spells/spell_paladin.cpp | 56 +++++++++++++++++-- 2 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 sql/updates/world/custom/custom_2018_07_14_03_world.sql diff --git a/sql/updates/world/custom/custom_2018_07_14_03_world.sql b/sql/updates/world/custom/custom_2018_07_14_03_world.sql new file mode 100644 index 00000000000..29c5aacfc09 --- /dev/null +++ b/sql/updates/world/custom/custom_2018_07_14_03_world.sql @@ -0,0 +1,15 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName` IN +('spell_pal_divine_purpose'); + +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(-85117, 'spell_pal_divine_purpose'); + +SET @FAMILY_FLAGS1 := 0 | 0x00800000; +SET @FAMILY_FLAGS2 := 0 | 0x00000002 | 0x00200000 | 0x00000080; +SET @FAMILY_FLAGS3 := 0 | 0x00002000 | 0x00008000; +SET @PROC_FLAGS := 0 | 0x00000010 | 0x00000400| 0x00004000 | 0x00010000 | 0x00800000; + +DELETE FROM `spell_proc` WHERE `SpellId` IN (-85117, 90174); +INSERT INTO `spell_proc` (`SpellId`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `ProcFlags`, `SpellTypeMask`, `SpellPhaseMask`, `HitMask`, `AttributesMask`, `Cooldown`, `Charges`, `Chance`) VALUES +(-85117, 10, @FAMILY_FLAGS1, @FAMILY_FLAGS2, @FAMILY_FLAGS3, @PROC_FLAGS, 7, 1, 0, 0, 0, 0, 100), +(90174, 10, 0, 0, 0, @PROC_FLAGS, 7, 1, 0, 8, 0, 1, 100); diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index b51e8ad53d2..eb9a396bac2 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -1141,7 +1141,6 @@ class spell_pal_shield_of_the_righteous : public SpellScriptLoader return true; } - void ChangeDamage(SpellEffIndex /*effIndex*/) { int32 damage = GetHitDamage(); @@ -1152,7 +1151,7 @@ class spell_pal_shield_of_the_righteous : public SpellScriptLoader int32 hp = GetCaster()->GetPower(POWER_HOLY_POWER); // Holy Power Scaling: 3 times damage at 2 HP, 6 times at 3 HP - damage *= 0.5*hp*hp + 1.5*hp + 1; + damage *= 0.5 * hp * hp + 1.5 * hp + 1; SetHitDamage(damage); } @@ -1610,6 +1609,11 @@ class spell_pal_word_of_glory: public SpellScript return true; } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PALADIN_DIVINE_PURPOSE_PROC }); + } + void ChangeHeal(SpellEffIndex /*effIndex*/) { Unit* caster = GetCaster(); @@ -1617,7 +1621,11 @@ class spell_pal_word_of_glory: public SpellScript return; int32 heal = GetHitHeal(); - heal += heal * caster->GetPower(POWER_HOLY_POWER); + + if (caster->HasAura(SPELL_PALADIN_DIVINE_PURPOSE_PROC)) + heal += heal * 2; + else + heal += heal * caster->GetPower(POWER_HOLY_POWER); if (caster != GetHitUnit()) if (AuraEffect* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PALADIN, PALADIN_ICOM_ID_SELFLESS_HEALER, EFFECT_0)) @@ -1636,13 +1644,21 @@ class spell_pal_word_of_glory_AuraScript : public AuraScript { PrepareAuraScript(spell_pal_word_of_glory_AuraScript); + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PALADIN_DIVINE_PURPOSE_PROC }); + } + void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) { Unit* caster = GetCaster(); if (!caster) return; - amount += amount * caster->GetPower(POWER_HOLY_POWER); + if (caster->HasAura(SPELL_PALADIN_DIVINE_PURPOSE_PROC)) + amount += amount * 2; + else + amount += amount * caster->GetPower(POWER_HOLY_POWER); if (caster != GetUnitOwner()) if (AuraEffect* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PALADIN, PALADIN_ICOM_ID_SELFLESS_HEALER, EFFECT_0)) @@ -1684,6 +1700,37 @@ class spell_pal_selfless_healer : public AuraScript } }; +// -85117 - Divine Purpose +class spell_pal_divine_purpose : public AuraScript +{ + PrepareAuraScript(spell_pal_divine_purpose); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PALADIN_DIVINE_PURPOSE_PROC }); + } + + bool CheckProc(ProcEventInfo& eventInfo) + { + if (AuraEffect* aurEff = GetEffect(EFFECT_0)) + return roll_chance_i(aurEff->GetAmount()); + + return false; + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) + { + PreventDefaultAction(); + GetTarget()->CastSpell(GetTarget(), SPELL_PALADIN_DIVINE_PURPOSE_PROC, true, nullptr, aurEff); + } + + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_pal_divine_purpose::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_pal_divine_purpose::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } +}; + void AddSC_paladin_spell_scripts() { //new spell_pal_ardent_defender(); @@ -1693,6 +1740,7 @@ void AddSC_paladin_spell_scripts() new spell_pal_blessing_of_faith(); RegisterAuraScript(spell_pal_communion); new spell_pal_consecration(); + RegisterAuraScript(spell_pal_divine_purpose); new spell_pal_divine_sacrifice(); new spell_pal_divine_storm(); new spell_pal_divine_storm_dummy();