From b7146a011e47d901f272e64065e0404950699213 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Tue, 13 Jun 2023 03:59:41 -0400 Subject: [PATCH] Scripts/Spells: Added spell effect validation helper Port From (https://github.com/TrinityCore/TrinityCore/commit/f8a6a9b01713a5dbe5ed38bd3d1b1c72191cf288) --- Source/Game/Scripting/SpellScript.cs | 29 ++++++++++++++++++++++++++++ Source/Scripts/Spells/Azerite.cs | 4 ++-- Source/Scripts/Spells/DeathKnight.cs | 10 +++++----- Source/Scripts/Spells/Druid.cs | 4 ++-- Source/Scripts/Spells/Generic.cs | 12 ++++++------ Source/Scripts/Spells/Items.cs | 10 +++++----- Source/Scripts/Spells/Mage.cs | 8 ++++---- Source/Scripts/Spells/Paladin.cs | 3 +-- Source/Scripts/Spells/Priest.cs | 13 +++++-------- Source/Scripts/Spells/Quest.cs | 2 +- Source/Scripts/Spells/Rogue.cs | 4 ++-- Source/Scripts/Spells/Shaman.cs | 14 +++++++------- Source/Scripts/Spells/Warlock.cs | 2 +- Source/Scripts/Spells/Warrior.cs | 9 +++------ 14 files changed, 73 insertions(+), 51 deletions(-) diff --git a/Source/Game/Scripting/SpellScript.cs b/Source/Game/Scripting/SpellScript.cs index c2a4be3ee..770e2917b 100644 --- a/Source/Game/Scripting/SpellScript.cs +++ b/Source/Game/Scripting/SpellScript.cs @@ -45,6 +45,35 @@ namespace Game.Scripting return allValid; } + public bool ValidateSpellEffect(params (uint spellId, uint effectIndex)[] pairs) + { + bool allValid = true; + foreach (var (spellId, effectIndex) in pairs) + { + if (!ValidateSpellEffect(spellId, effectIndex)) + allValid = false; + } + return allValid; + } + + public bool ValidateSpellEffect(uint spellId, uint effectIndex) + { + SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, Difficulty.None); + if (spellInfo == null) + { + Log.outError(LogFilter.Scripts, $"BaseSpellScript::ValidateSpellEffect: Spell {spellId} does not exist."); + return false; + } + + if (spellInfo.GetEffects().Count <= effectIndex) + { + Log.outError(LogFilter.Scripts, $"BaseSpellScript::ValidateSpellEffect: Spell {spellId} does not have EFFECT_{effectIndex}."); + return false; + } + + return true; + } + public void _Register() { m_currentScriptState = (byte)SpellScriptState.Registration; diff --git a/Source/Scripts/Spells/Azerite.cs b/Source/Scripts/Spells/Azerite.cs index 17b031ce0..0c4061fc9 100644 --- a/Source/Scripts/Spells/Azerite.cs +++ b/Source/Scripts/Spells/Azerite.cs @@ -55,7 +55,7 @@ namespace Scripts.Spells.Azerite { public override bool Validate(SpellInfo spellInfo) { - return spellInfo.GetEffects().Count > 1 && ValidateSpellInfo(spellInfo.GetEffect(1).TriggerSpell); + return ValidateSpellEffect(spellInfo.Id, 1) && ValidateSpellInfo(spellInfo.GetEffect(1).TriggerSpell); } void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated) @@ -420,7 +420,7 @@ namespace Scripts.Spells.Azerite public override bool Validate(SpellInfo spellInfo) { return ValidateSpellInfo(SpellIds.EchoingBladesTrait) - && Global.SpellMgr.GetSpellInfo(SpellIds.EchoingBladesTrait, Difficulty.None).GetEffects().Count > 2; + && ValidateSpellEffect(SpellIds.EchoingBladesTrait, 2); } void CalculateDamage(uint effIndex) diff --git a/Source/Scripts/Spells/DeathKnight.cs b/Source/Scripts/Spells/DeathKnight.cs index b35c0a914..532b9266d 100644 --- a/Source/Scripts/Spells/DeathKnight.cs +++ b/Source/Scripts/Spells/DeathKnight.cs @@ -118,7 +118,7 @@ namespace Scripts.Spells.DeathKnight public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.RunicPowerEnergize, SpellIds.VolatileShielding) && spellInfo.GetEffects().Count > 1; + return ValidateSpellInfo(SpellIds.RunicPowerEnergize, SpellIds.VolatileShielding) && ValidateSpellEffect(spellInfo.Id, 1); } public override bool Load() @@ -418,7 +418,7 @@ namespace Scripts.Spells.DeathKnight public override bool Validate(SpellInfo spellInfo) { return ValidateSpellInfo(SpellIds.DeathStrikeEnabler, SpellIds.DeathStrikeHeal, SpellIds.BloodShieldMastery, SpellIds.BloodShieldAbsorb, SpellIds.RecentlyUsedDeathStrike, SpellIds.Frost, SpellIds.DeathStrikeOffhand) - && spellInfo.GetEffects().Count > 2; + && ValidateSpellEffect(spellInfo.Id, 2); } void HandleDummy(uint effIndex) @@ -519,7 +519,7 @@ namespace Scripts.Spells.DeathKnight { public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.CorpseExplosionTriggered) && spellInfo.GetEffects().Count > 2; + return ValidateSpellInfo(SpellIds.CorpseExplosionTriggered) && ValidateSpellEffect(spellInfo.Id, 2); } void HandleDamage(uint effIndex) @@ -648,7 +648,7 @@ namespace Scripts.Spells.DeathKnight public override bool Validate(SpellInfo spellInfo) { return ValidateSpellInfo(SpellIds.Obliteration, SpellIds.ObliterationRuneEnergize, SpellIds.KillingMachineProc) - && Global.SpellMgr.GetSpellInfo(SpellIds.Obliteration, Difficulty.None).GetEffects().Count > 1; + && ValidateSpellEffect(SpellIds.Obliteration, 1); } void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo) @@ -779,7 +779,7 @@ namespace Scripts.Spells.DeathKnight { public override bool Validate(SpellInfo spellInfo) { - return spellInfo.GetEffects().Count > 1 && ValidateSpellInfo(SpellIds.FrostScythe); + return ValidateSpellEffect(spellInfo.Id, 1) && ValidateSpellInfo(SpellIds.FrostScythe); } bool CheckProc(AuraEffect aurEff, ProcEventInfo eventInfo) diff --git a/Source/Scripts/Spells/Druid.cs b/Source/Scripts/Spells/Druid.cs index ac1fcd502..b20735cbe 100644 --- a/Source/Scripts/Spells/Druid.cs +++ b/Source/Scripts/Spells/Druid.cs @@ -394,7 +394,7 @@ namespace Scripts.Spells.Druid public override bool Validate(SpellInfo spellInfo) { return ValidateSpellInfo(SpellIds.IncarnationKingOfTheJungle) - && Global.SpellMgr.GetSpellInfo(SpellIds.IncarnationKingOfTheJungle, Difficulty.None).GetEffects().Count > 1; + && ValidateSpellEffect(SpellIds.IncarnationKingOfTheJungle, 1); } void HandleHitTargetBurn(uint effIndex) @@ -1445,7 +1445,7 @@ namespace Scripts.Spells.Druid public override bool Validate(SpellInfo spellInfo) { - if (spellInfo.GetEffects().Count <= 2 || spellInfo.GetEffect(2).IsEffect() || spellInfo.GetEffect(2).CalcValue() <= 0) + if (!ValidateSpellEffect(spellInfo.Id, 2) || spellInfo.GetEffect(2).IsEffect() || spellInfo.GetEffect(2).CalcValue() <= 0) return false; return true; } diff --git a/Source/Scripts/Spells/Generic.cs b/Source/Scripts/Spells/Generic.cs index 98de50586..7c2a4154a 100644 --- a/Source/Scripts/Spells/Generic.cs +++ b/Source/Scripts/Spells/Generic.cs @@ -1103,7 +1103,7 @@ namespace Scripts.Spells.Generic { public override bool Validate(SpellInfo spellInfo) { - return spellInfo.GetEffects().Count > 2 && ValidateSpellInfo((uint)spellInfo.GetEffect(2).CalcValue()); + return ValidateSpellEffect(spellInfo.Id, 2) && ValidateSpellInfo((uint)spellInfo.GetEffect(2).CalcValue()); } void HandleApply(AuraEffect aurEff, AuraEffectHandleModes mode) @@ -2115,7 +2115,7 @@ namespace Scripts.Spells.Generic { public override bool Validate(SpellInfo spellInfo) { - return spellInfo.GetEffects().Count > 1; + return ValidateSpellEffect(spellInfo.Id, 1); } void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated) @@ -2602,7 +2602,7 @@ namespace Scripts.Spells.Generic { public override bool Validate(SpellInfo spellInfo) { - return spellInfo.GetEffects().Count > 1; + return ValidateSpellEffect(spellInfo.Id, 1); } public override bool Load() @@ -3002,7 +3002,7 @@ namespace Scripts.Spells.Generic { public override bool Validate(SpellInfo spellInfo) { - return spellInfo.GetEffects().Count > 1; + return ValidateSpellEffect(spellInfo.Id, 1); } void PeriodicTick(AuraEffect aurEff) @@ -4582,11 +4582,11 @@ namespace Scripts.Spells.Generic { public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.FaceRage) && spellInfo.GetEffects().Count > 2; + return ValidateSpellInfo(SpellIds.FaceRage) && ValidateSpellEffect(spellInfo.Id, 2); } void OnRemove(AuraEffect effect, AuraEffectHandleModes mode) - { + { GetTarget().RemoveAurasDueToSpell(GetEffectInfo(2).TriggerSpell); } diff --git a/Source/Scripts/Spells/Items.cs b/Source/Scripts/Spells/Items.cs index 0a09307ab..f51309956 100644 --- a/Source/Scripts/Spells/Items.cs +++ b/Source/Scripts/Spells/Items.cs @@ -3694,7 +3694,7 @@ namespace Scripts.Spells.Items { public override bool Validate(SpellInfo spellInfo) { - return spellInfo.GetEffects().Count > 1; + return ValidateSpellEffect(spellInfo.Id, 1); } public override bool Load() @@ -3720,7 +3720,7 @@ namespace Scripts.Spells.Items { public override bool Validate(SpellInfo spellInfo) { - return spellInfo.GetEffects().Count > 1; + return ValidateSpellEffect(spellInfo.Id, 1); } public override bool Load() @@ -3826,7 +3826,7 @@ namespace Scripts.Spells.Items { public override bool Validate(SpellInfo spellInfo) { - return spellInfo.GetEffects().Count > 1; + return ValidateSpellEffect(spellInfo.Id, 1); } void OnRemove(AuraEffect effect, AuraEffectHandleModes mode) @@ -4106,7 +4106,7 @@ namespace Scripts.Spells.Items { public override bool Validate(SpellInfo spellInfo) { - return spellInfo.GetEffects().Count > 1 + return ValidateSpellEffect(spellInfo.Id, 1) && ValidateSpellInfo(spellInfo.GetEffect(1).TriggerSpell); } @@ -4210,7 +4210,7 @@ namespace Scripts.Spells.Items { public override bool Validate(SpellInfo spellInfo) { - return spellInfo.GetEffects().Count > 1; + return ValidateSpellEffect(spellInfo.Id, 1); } bool CheckHealth(AuraEffect aurEff, ProcEventInfo eventInfo) diff --git a/Source/Scripts/Spells/Mage.cs b/Source/Scripts/Spells/Mage.cs index 31395d148..d43181467 100644 --- a/Source/Scripts/Spells/Mage.cs +++ b/Source/Scripts/Spells/Mage.cs @@ -142,7 +142,7 @@ namespace Scripts.Spells.Mage public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.ArcaneBarrageR3, SpellIds.ArcaneBarrageEnergize) && spellInfo.GetEffects().Count > 1; + return ValidateSpellInfo(SpellIds.ArcaneBarrageR3, SpellIds.ArcaneBarrageEnergize) && ValidateSpellEffect(spellInfo.Id, 1); } void ConsumeArcaneCharges() @@ -205,7 +205,7 @@ namespace Scripts.Spells.Mage if (!ValidateSpellInfo(SpellIds.ArcaneMage, SpellIds.Reverberate)) return false; - if (spellInfo.GetEffects().Count <= 1) + if (!ValidateSpellEffect(spellInfo.Id, 1)) return false; return spellInfo.GetEffect(1).IsEffect(SpellEffectName.SchoolDamage); @@ -357,7 +357,7 @@ namespace Scripts.Spells.Mage { public override bool Validate(SpellInfo spellInfo) { - return spellInfo.GetEffects().Count > 2 && ValidateSpellInfo(SpellIds.CauterizeDot, SpellIds.Cauterized, spellInfo.GetEffect(2).TriggerSpell); + return ValidateSpellEffect(spellInfo.Id, 2) && ValidateSpellInfo(SpellIds.CauterizeDot, SpellIds.Cauterized, spellInfo.GetEffect(2).TriggerSpell); } void HandleAbsorb(AuraEffect aurEff, DamageInfo dmgInfo, ref uint absorbAmount) @@ -611,7 +611,7 @@ namespace Scripts.Spells.Mage { return ValidateSpellInfo(SpellIds.FireBlast) && CliDB.SpellCategoryStorage.HasRecord(Global.SpellMgr.GetSpellInfo(SpellIds.FireBlast, Difficulty.None).ChargeCategoryId) - && spellInfo.GetEffects().Count > 2; + && ValidateSpellEffect(spellInfo.Id, 2); } void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated) diff --git a/Source/Scripts/Spells/Paladin.cs b/Source/Scripts/Spells/Paladin.cs index e114a3229..5a67ebb73 100644 --- a/Source/Scripts/Spells/Paladin.cs +++ b/Source/Scripts/Spells/Paladin.cs @@ -184,8 +184,7 @@ namespace Scripts.Spells.Paladin { public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.AvengingWrath) - && spellInfo.GetEffects().Count >= 1; + return ValidateSpellInfo(SpellIds.AvengingWrath) && ValidateSpellEffect(spellInfo.Id, 1); } bool CheckProc(AuraEffect aurEff, ProcEventInfo eventInfo) diff --git a/Source/Scripts/Spells/Priest.cs b/Source/Scripts/Spells/Priest.cs index aa6ff99cd..5d50d1839 100644 --- a/Source/Scripts/Spells/Priest.cs +++ b/Source/Scripts/Spells/Priest.cs @@ -206,8 +206,7 @@ namespace Scripts.Spells.Priest public override bool Validate(SpellInfo spellInfo) { return ValidateSpellInfo(SpellIds.AtonementHeal, SpellIds.SinsOfTheMany) - && spellInfo.GetEffects().Count > 1 - && Global.SpellMgr.GetSpellInfo(SpellIds.SinsOfTheMany, Difficulty.None).GetEffects().Count > 2; + && ValidateSpellEffect((spellInfo.Id, 1), (SpellIds.SinsOfTheMany, 2)); } bool CheckProc(ProcEventInfo eventInfo) @@ -483,7 +482,7 @@ namespace Scripts.Spells.Priest public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.GuardianSpiritHeal) && spellInfo.GetEffects().Count > 1; + return ValidateSpellInfo(SpellIds.GuardianSpiritHeal) && ValidateSpellEffect(spellInfo.Id, 1); } public override bool Load() @@ -564,9 +563,7 @@ namespace Scripts.Spells.Priest public override bool Validate(SpellInfo spellInfo) { return ValidateSpellInfo(SpellIds.Heal, SpellIds.FlashHeal, SpellIds.PrayerOfHealing, SpellIds.Renew, SpellIds.Smite, SpellIds.HolyWordChastise, SpellIds.HolyWordSanctify, SpellIds.HolyWordSerenity) - && Global.SpellMgr.GetSpellInfo(SpellIds.HolyWordSerenity, Difficulty.None).GetEffects().Count > 1 - && Global.SpellMgr.GetSpellInfo(SpellIds.HolyWordSanctify, Difficulty.None).GetEffects().Count > 3 - && Global.SpellMgr.GetSpellInfo(SpellIds.HolyWordChastise, Difficulty.None).GetEffects().Count > 1; + && ValidateSpellEffect((SpellIds.HolyWordSerenity, 1), (SpellIds.HolyWordSanctify, 3), (SpellIds.HolyWordChastise, 1)); } void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo) @@ -907,7 +904,7 @@ namespace Scripts.Spells.Priest { public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.Atonement, SpellIds.AtonementTriggered, SpellIds.Trinity) && spellInfo.GetEffects().Count > 3; + return ValidateSpellInfo(SpellIds.Atonement, SpellIds.AtonementTriggered, SpellIds.Trinity) && ValidateSpellEffect(spellInfo.Id, 3); } void OnTargetSelect(List targets) @@ -1270,7 +1267,7 @@ namespace Scripts.Spells.Priest public override bool Validate(SpellInfo spellInfo) { return ValidateSpellInfo(SpellIds.PurgeTheWickedPeriodic, SpellIds.RevelInPurity) - && Global.SpellMgr.GetSpellInfo(SpellIds.RevelInPurity, Difficulty.None)?.GetEffects().Count > 1; + && ValidateSpellEffect(SpellIds.RevelInPurity, 1); } void FilterTargets(List targets) diff --git a/Source/Scripts/Spells/Quest.cs b/Source/Scripts/Spells/Quest.cs index 1b4d96141..3548c9f76 100644 --- a/Source/Scripts/Spells/Quest.cs +++ b/Source/Scripts/Spells/Quest.cs @@ -1349,7 +1349,7 @@ namespace Scripts.Spells.Quest { public override bool Validate(SpellInfo spellInfo) { - return spellInfo.GetEffects().Count > 1 + return ValidateSpellEffect(spellInfo.Id, 1) && ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue()) && Global.ObjectMgr.GetQuestTemplate((uint)spellInfo.GetEffect(1).CalcValue()) != null; } diff --git a/Source/Scripts/Spells/Rogue.cs b/Source/Scripts/Spells/Rogue.cs index 37319cecc..920cd67f9 100644 --- a/Source/Scripts/Spells/Rogue.cs +++ b/Source/Scripts/Spells/Rogue.cs @@ -62,7 +62,7 @@ namespace Scripts.Spells.Rogue { public override bool Validate(SpellInfo spellInfo) { - return spellInfo.GetEffects().Count > 3; + return ValidateSpellEffect(spellInfo.Id, 3); } void HandleHitDamage(uint effIndex) @@ -615,7 +615,7 @@ namespace Scripts.Spells.Rogue public override bool Validate(SpellInfo spellInfo) { return ValidateSpellInfo(SpellIds.PremeditationAura, SpellIds.SliceAndDice, SpellIds.PremeditationPassive) - && Global.SpellMgr.GetSpellInfo(SpellIds.PremeditationPassive, Difficulty.None).GetEffects().Count > 0; + && ValidateSpellEffect(SpellIds.PremeditationPassive, 0); } SpellCastResult HandleCheckCast() diff --git a/Source/Scripts/Spells/Shaman.cs b/Source/Scripts/Spells/Shaman.cs index 9f59ef97e..5f5dedba8 100644 --- a/Source/Scripts/Spells/Shaman.cs +++ b/Source/Scripts/Spells/Shaman.cs @@ -190,7 +190,7 @@ namespace Scripts.Spells.Shaman public override bool Validate(SpellInfo spellInfo) { return ValidateSpellInfo(SpellIds.ChainLightningEnergize, SpellIds.MaelstromController) - && Global.SpellMgr.GetSpellInfo(SpellIds.MaelstromController, Difficulty.None).GetEffects().Count > 4; + && ValidateSpellEffect(SpellIds.MaelstromController, 4); } void HandleScript(uint effIndex) @@ -213,7 +213,7 @@ namespace Scripts.Spells.Shaman public override bool Validate(SpellInfo spellInfo) { return ValidateSpellInfo(SpellIds.ChainLightningOverloadEnergize, SpellIds.MaelstromController) - && Global.SpellMgr.GetSpellInfo(SpellIds.MaelstromController, Difficulty.None).GetEffects().Count > 5; + && ValidateSpellEffect(SpellIds.MaelstromController, 5); } void HandleScript(uint effIndex) @@ -273,7 +273,7 @@ namespace Scripts.Spells.Shaman public override bool Validate(SpellInfo spellInfo) { - return spellInfo.GetEffects().Count > 1; + return ValidateSpellEffect(spellInfo.Id, 1); } void FilterTargets(List targets) @@ -447,7 +447,7 @@ namespace Scripts.Spells.Shaman { public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.EarthquakeKnockingDown) && spellInfo.GetEffects().Count > 1; + return ValidateSpellInfo(SpellIds.EarthquakeKnockingDown) && ValidateSpellEffect(spellInfo.Id, 1); } void HandleDamageCalc(uint effIndex) @@ -491,7 +491,7 @@ namespace Scripts.Spells.Shaman public override bool Validate(SpellInfo spellInfo) { return ValidateSpellInfo(SpellIds.ElementalBlastCrit, SpellIds.ElementalBlastHaste, SpellIds.ElementalBlastMastery, SpellIds.MaelstromController) - && Global.SpellMgr.GetSpellInfo(SpellIds.MaelstromController, Difficulty.None).GetEffects().Count > 10; + && ValidateSpellEffect(SpellIds.MaelstromController, 10); } void HandleEnergize(uint effIndex) @@ -988,7 +988,7 @@ namespace Scripts.Spells.Shaman public override bool Validate(SpellInfo spellInfo) { return ValidateSpellInfo(SpellIds.LightningBoltEnergize, SpellIds.MaelstromController) - && Global.SpellMgr.GetSpellInfo(SpellIds.MaelstromController, Difficulty.None).GetEffects().Count > 0; + && ValidateSpellEffect(SpellIds.MaelstromController, 0); } void HandleScript(uint effIndex) @@ -1011,7 +1011,7 @@ namespace Scripts.Spells.Shaman public override bool Validate(SpellInfo spellInfo) { return ValidateSpellInfo(SpellIds.LightningBoltOverloadEnergize, SpellIds.MaelstromController) - && Global.SpellMgr.GetSpellInfo(SpellIds.MaelstromController, Difficulty.None).GetEffects().Count > 1; + && ValidateSpellEffect(SpellIds.MaelstromController, 1); } void HandleScript(uint effIndex) diff --git a/Source/Scripts/Spells/Warlock.cs b/Source/Scripts/Spells/Warlock.cs index f93eeffeb..083e5ac0f 100644 --- a/Source/Scripts/Spells/Warlock.cs +++ b/Source/Scripts/Spells/Warlock.cs @@ -219,7 +219,7 @@ namespace Scripts.Spells.Warlock { public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.GlyphOfDemonTraining, SpellIds.DevourMagicHeal) && spellInfo.GetEffects().Count > 1; + return ValidateSpellInfo(SpellIds.GlyphOfDemonTraining, SpellIds.DevourMagicHeal) && ValidateSpellEffect(spellInfo.Id, 1); } void OnSuccessfulDispel(uint effIndex) diff --git a/Source/Scripts/Spells/Warrior.cs b/Source/Scripts/Spells/Warrior.cs index 36f7c0730..918c4364c 100644 --- a/Source/Scripts/Spells/Warrior.cs +++ b/Source/Scripts/Spells/Warrior.cs @@ -191,7 +191,7 @@ namespace Scripts.Spells.Warrior public override bool Validate(SpellInfo spellInfo) { return ValidateSpellInfo(SpellIds.ColossusSmashAura, SpellIds.InForTheKill, SpellIds.InForTheKillHaste) - && Global.SpellMgr.GetSpellInfo(SpellIds.InForTheKill, Difficulty.None).GetEffects().Count > 2; + && ValidateSpellEffect(SpellIds.InForTheKill, 2); } void HandleHit() @@ -412,7 +412,7 @@ namespace Scripts.Spells.Warrior { public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.Stoicism) && spellInfo.GetEffects().Count > 1; + return ValidateSpellInfo(SpellIds.Stoicism) && ValidateSpellEffect(spellInfo.Id, 1); } void HandleProc(ProcEventInfo eventInfo) @@ -523,10 +523,7 @@ namespace Scripts.Spells.Warrior { public override bool Validate(SpellInfo spellInfo) { - if (!ValidateSpellInfo(SpellIds.Shockwave, SpellIds.ShockwaveStun)) - return false; - - return spellInfo.GetEffects().Count > 3; + return !ValidateSpellInfo(SpellIds.Shockwave, SpellIds.ShockwaveStun) && ValidateSpellEffect(spellInfo.Id, 3); } public override bool Load()