From add72a063b1203e2be6eef57ea037ce4842fb38c Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sun, 24 Dec 2017 17:17:50 -0500 Subject: [PATCH] Core/Spells: Implemented spells causing Forbearance --- Source/Game/Spells/Auras/Aura.cs | 28 ----- Source/Game/Spells/Spell.cs | 14 --- Source/Scripts/Spells/Paladin.cs | 100 +++++++++++++++--- .../world/master/2017_12_23_00_world.sql | 15 +++ .../world/master/2017_12_23_01_world.sql | 7 ++ 5 files changed, 107 insertions(+), 57 deletions(-) create mode 100644 sql/updates/world/master/2017_12_23_00_world.sql create mode 100644 sql/updates/world/master/2017_12_23_01_world.sql diff --git a/Source/Game/Spells/Auras/Aura.cs b/Source/Game/Spells/Auras/Aura.cs index e02810e47..c66c41e0f 100644 --- a/Source/Game/Spells/Auras/Aura.cs +++ b/Source/Game/Spells/Auras/Aura.cs @@ -1263,29 +1263,6 @@ namespace Game.Spells { switch (GetSpellInfo().SpellFamilyName) { - case SpellFamilyNames.Generic: - switch (GetId()) - { - case 61987: // Avenging Wrath - // Remove the immunity shield marker on Avenging Wrath removal if Forbearance is not present - if (target.HasAura(61988) && !target.HasAura(25771)) - target.RemoveAura(61988); - break; - case 72368: // Shared Suffering - case 72369: - if (caster != null) - { - AuraEffect aurEff = GetEffect(0); - if (aurEff != null) - { - int remainingDamage = (int)(aurEff.GetAmount() * (aurEff.GetTotalTicks() - aurEff.GetTickNumber())); - if (remainingDamage > 0) - caster.CastCustomSpell(caster, 72373, 0, remainingDamage, 0, true); - } - } - break; - } - break; case SpellFamilyNames.Mage: switch (GetId()) { @@ -1339,11 +1316,6 @@ namespace Game.Spells if (GetId() == 1784) target.RemoveAurasWithFamily(SpellFamilyNames.Rogue, new FlagArray128(0x0000800, 0, 0), target.GetGUID()); break; - case SpellFamilyNames.Paladin: - // Remove the immunity shield marker on Forbearance removal if AW marker is not present - if (GetId() == 25771 && target.HasAura(61988) && !target.HasAura(61987)) - target.RemoveAura(61988); - break; case SpellFamilyNames.Hunter: // Glyph of Freezing Trap if (GetSpellInfo().SpellFamilyFlags[0].HasAnyFlag(0x00000008u)) diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index 103528464..2557ff7d7 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -2291,20 +2291,6 @@ namespace Game.Spells /// @todo move this code to scripts if (m_preCastSpell != 0) { - // Paladin immunity shields - if (m_preCastSpell == 61988) - { - // Cast Forbearance - m_caster.CastSpell(unit, 25771, true); - // Cast Avenging Wrath Marker - unit.CastSpell(unit, 61987, true); - } - - // Avenging Wrath - if (m_preCastSpell == 61987) - // Cast the serverside immunity shield marker - m_caster.CastSpell(unit, 61988, true); - if (Global.SpellMgr.GetSpellInfo(m_preCastSpell) != null) // Blizz seems to just apply aura without bothering to cast m_caster.AddAura(m_preCastSpell, unit); diff --git a/Source/Scripts/Spells/Paladin.cs b/Source/Scripts/Spells/Paladin.cs index 9aa68d84b..2c5eb69be 100644 --- a/Source/Scripts/Spells/Paladin.cs +++ b/Source/Scripts/Spells/Paladin.cs @@ -47,6 +47,8 @@ namespace Scripts.Spells.Paladin public const uint EnduringJudgement = 40472; public const uint EyeForAnEyeRank1 = 9799; public const uint EyeForAnEyeDamage = 25997; + public const uint FinalStand = 204077; + public const uint FinalStandEffect = 204079; public const uint Forbearance = 25771; public const uint HandOfSacrifice = 6940; public const uint HolyMending = 64891; @@ -154,6 +156,42 @@ namespace Scripts.Spells.Paladin } } + // 1022 - Blessing of Protection + [Script] // 204018 - Blessing of Spellwarding + class spell_pal_blessing_of_protection : SpellScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.Forbearance) //, SPELL_PALADIN_IMMUNE_SHIELD_MARKER) // uncomment when we have serverside only spells + && spellInfo.ExcludeTargetAuraSpell == SpellIds.ImmuneShieldMarker; + } + + SpellCastResult CheckForbearance() + { + Unit target = GetExplTargetUnit(); + if (!target || target.HasAura(SpellIds.Forbearance)) + return SpellCastResult.TargetAurastate; + + return SpellCastResult.SpellCastOk; + } + + void TriggerForbearance() + { + Unit target = GetHitUnit(); + if (target) + { + GetCaster().CastSpell(target, SpellIds.Forbearance, true); + GetCaster().CastSpell(target, SpellIds.ImmuneShieldMarker, true); + } + } + + public override void Register() + { + OnCheckCast.Add(new CheckCastHandler(CheckForbearance)); + AfterHit.Add(new HitHandler(TriggerForbearance)); + } + } + [Script] // 115750 - Blinding Light class spell_pal_blinding_light : SpellScript { @@ -175,6 +213,44 @@ namespace Scripts.Spells.Paladin } } + [Script] // 642 - Divine Shield + class spell_pal_divine_shield : SpellScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.FinalStand, SpellIds.FinalStandEffect, SpellIds.Forbearance) //, SPELL_PALADIN_IMMUNE_SHIELD_MARKER // uncomment when we have serverside only spells + && spellInfo.ExcludeCasterAuraSpell == SpellIds.ImmuneShieldMarker; + } + + SpellCastResult CheckForbearance() + { + if (GetCaster().HasAura(SpellIds.Forbearance)) + return SpellCastResult.TargetAurastate; + + return SpellCastResult.SpellCastOk; + } + + void HandleFinalStand() + { + if (GetCaster().HasAura(SpellIds.FinalStand)) + GetCaster().CastSpell((Unit)null, SpellIds.FinalStandEffect, true); + } + + void TriggerForbearance() + { + Unit caster = GetCaster(); + caster.CastSpell(caster, SpellIds.Forbearance, true); + caster.CastSpell(caster, SpellIds.ImmuneShieldMarker, true); + } + + public override void Register() + { + OnCheckCast.Add(new CheckCastHandler(CheckForbearance)); + AfterCast.Add(new CastHandler(HandleFinalStand)); + AfterCast.Add(new CastHandler(TriggerForbearance)); + } + } + [Script] // 190784 - Divine Steed class spell_pal_divine_steed : SpellScript { @@ -541,28 +617,22 @@ namespace Scripts.Spells.Paladin [Script] class spell_pal_lay_on_hands : SpellScript { - public override bool Validate(SpellInfo spell) + public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.Forbearance, SpellIds.ImmuneShieldMarker); + return ValidateSpellInfo(SpellIds.Forbearance)//, SpellIds.ImmuneShieldMarker); + && spellInfo.ExcludeTargetAuraSpell == SpellIds.ImmuneShieldMarker; } - SpellCastResult CheckCast() + SpellCastResult CheckForbearance() { - Unit caster = GetCaster(); Unit target = GetExplTargetUnit(); - if (target) - { - if (caster == target) - { - if (target.HasAura(SpellIds.Forbearance) || target.HasAura(SpellIds.ImmuneShieldMarker)) - return SpellCastResult.TargetAurastate; - } - } + if (!target || target.HasAura(SpellIds.Forbearance)) + return SpellCastResult.TargetAurastate; return SpellCastResult.SpellCastOk; } - void HandleScript() + void TriggerForbearance() { Unit caster = GetCaster(); if (caster == GetHitUnit()) @@ -574,8 +644,8 @@ namespace Scripts.Spells.Paladin public override void Register() { - OnCheckCast.Add(new CheckCastHandler(CheckCast)); - AfterHit.Add(new HitHandler(HandleScript)); + OnCheckCast.Add(new CheckCastHandler(CheckForbearance)); + AfterHit.Add(new HitHandler(TriggerForbearance)); } } diff --git a/sql/updates/world/master/2017_12_23_00_world.sql b/sql/updates/world/master/2017_12_23_00_world.sql new file mode 100644 index 000000000..bcf641d66 --- /dev/null +++ b/sql/updates/world/master/2017_12_23_00_world.sql @@ -0,0 +1,15 @@ +-- Quest 25039: Have You Seen Anything Weird Out There? +UPDATE `quest_template` SET `RewardNextQuest`=24993 WHERE `ID`=25039; + +-- add ExclusiveGroup 24992 - only one of the quests must be available +DELETE FROM `quest_template_addon` WHERE `ID` IN (24992,25039); +INSERT INTO `quest_template_addon` (`ID`,`MaxLevel`,`AllowableClasses`,`SourceSpellID`,`PrevQuestID`,`NextQuestID`,`ExclusiveGroup`,`RewardMailTemplateID`,`RewardMailDelay`,`RequiredSkillID`,`RequiredSkillPoints`,`RequiredMinRepFaction`,`RequiredMaxRepFaction`,`RequiredMinRepValue`,`RequiredMaxRepValue`,`ProvidedItemCount`,`SpecialFlags`,`ScriptName`) VALUES +(24992, 0, 0, 0, 0, 24993, 24992, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''), +(25039, 0, 0, 0, 0, 24993, 24992, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''); + +-- add missing quest_offer_reward entries for 24992/24993/25039 +DELETE FROM `quest_offer_reward` WHERE `ID` IN (24992,25039,24993); +INSERT INTO `quest_offer_reward` (`ID`,`Emote1`,`Emote2`,`Emote3`,`Emote4`,`EmoteDelay1`,`EmoteDelay2`,`EmoteDelay3`,`EmoteDelay4`,`RewardText`,`VerifiedBuild`) VALUES +(24992, 0, 0, 0, 0, 0, 0, 0, 0, 'Hmm... yes, that makes sense. Since the worgen have come streaming out of Gilneas, I knew it would only be a matter of time before they arrived here in Tirisfal.', 0), +(25039, 0, 0, 0, 0, 0, 0, 0, 0, 'Hmm... yes, that makes sense. Since the worgen have come streaming out of Gilneas, I knew it would only be a matter of time before they arrived here in Tirisfal.', 0), +(24993, 0, 0, 0, 0, 0, 0, 0, 0, "To think, they've been right under our noses! I'll put my deathguards on alert... this will NOT happen again.", 0); diff --git a/sql/updates/world/master/2017_12_23_01_world.sql b/sql/updates/world/master/2017_12_23_01_world.sql new file mode 100644 index 000000000..849901121 --- /dev/null +++ b/sql/updates/world/master/2017_12_23_01_world.sql @@ -0,0 +1,7 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName` IN ( +'spell_pal_blessing_of_protection', +'spell_pal_divine_shield'); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(1022, 'spell_pal_blessing_of_protection'), +(204018, 'spell_pal_blessing_of_protection'), +(642, 'spell_pal_divine_shield');