Core/Spells: Cleanup spell effects

Port From (https://github.com/TrinityCore/TrinityCore/commit/8a4e1119ac21e2d1112d1717337597fe073e495f)
This commit is contained in:
hondacrx
2021-09-08 17:40:50 -04:00
parent 2af5cad79f
commit 5c4a7511ff
41 changed files with 2378 additions and 1987 deletions
+6 -8
View File
@@ -127,12 +127,12 @@ namespace Scripts.Spells.DeathKnight
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.RunicPowerEnergize, SpellIds.VolatileShielding);
return ValidateSpellInfo(SpellIds.RunicPowerEnergize, SpellIds.VolatileShielding) && spellInfo.GetEffects().Count > 1;
}
public override bool Load()
{
absorbPct = GetSpellInfo().GetEffect(1).CalcValue(GetCaster());
absorbPct = GetEffectInfo(1).CalcValue(GetCaster());
maxHealth = GetCaster().GetMaxHealth();
absorbedAmount = 0;
return true;
@@ -427,7 +427,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.GetEffect(1) != null && spellInfo.GetEffect(2) != null;
&& spellInfo.GetEffects().Count > 2;
}
void HandleDummy(uint effIndex)
@@ -437,12 +437,10 @@ namespace Scripts.Spells.DeathKnight
AuraEffect enabler = caster.GetAuraEffect(SpellIds.DeathStrikeEnabler, 0, GetCaster().GetGUID());
if (enabler != null)
{
SpellInfo spellInfo = GetSpellInfo();
// Heals you for 25% of all damage taken in the last 5 sec,
int heal = MathFunctions.CalculatePct(enabler.CalculateAmount(GetCaster()), spellInfo.GetEffect(1).CalcValue(GetCaster()));
int heal = MathFunctions.CalculatePct(enabler.CalculateAmount(GetCaster()), GetEffectInfo(1).CalcValue(GetCaster()));
// minimum 7.0% of maximum health.
int pctOfMaxHealth = MathFunctions.CalculatePct(spellInfo.GetEffect(2).CalcValue(GetCaster()), caster.GetMaxHealth());
int pctOfMaxHealth = MathFunctions.CalculatePct(GetEffectInfo(2).CalcValue(GetCaster()), caster.GetMaxHealth());
heal = Math.Max(heal, pctOfMaxHealth);
caster.CastSpell(caster, SpellIds.DeathStrikeHeal, new CastSpellExtraArgs(TriggerCastFlags.FullMask).AddSpellMod(SpellValueMod.BasePoint0, heal));
@@ -530,7 +528,7 @@ namespace Scripts.Spells.DeathKnight
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.CorpseExplosionTriggered);
return ValidateSpellInfo(SpellIds.CorpseExplosionTriggered) && spellInfo.GetEffects().Count > 2;
}
void HandleDamage(uint effIndex)
+4 -5
View File
@@ -410,7 +410,7 @@ namespace Scripts.Spells.Druid
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.IncarnationKingOfTheJungle)
&& Global.SpellMgr.GetSpellInfo(SpellIds.IncarnationKingOfTheJungle, Difficulty.None).GetEffect(1) != null;
&& Global.SpellMgr.GetSpellInfo(SpellIds.IncarnationKingOfTheJungle, Difficulty.None).GetEffects().Count > 1;
}
void HandleHitTargetBurn(uint effIndex)
@@ -1570,8 +1570,7 @@ namespace Scripts.Spells.Druid
public override bool Validate(SpellInfo spellInfo)
{
SpellEffectInfo effectInfo = spellInfo.GetEffect(2);
if (effectInfo == null || effectInfo.IsEffect() || effectInfo.CalcValue() <= 0)
if (spellInfo.GetEffects().Count <= 2 || spellInfo.GetEffect(2).IsEffect() || spellInfo.GetEffect(2).CalcValue() <= 0)
return false;
return true;
}
@@ -1587,7 +1586,7 @@ namespace Scripts.Spells.Druid
return true;
});
int maxTargets = GetSpellInfo().GetEffect(2).CalcValue(GetCaster());
int maxTargets = GetEffectInfo(2).CalcValue(GetCaster());
if (targets.Count > maxTargets)
{
@@ -1626,7 +1625,7 @@ namespace Scripts.Spells.Druid
return;
// calculate from base damage, not from aurEff.GetAmount() (already modified)
float damage = caster.CalculateSpellDamage(GetUnitOwner(), GetSpellInfo(), aurEff.GetEffIndex());
float damage = caster.CalculateSpellDamage(GetUnitOwner(), aurEff.GetSpellEffectInfo());
// Wild Growth = first tick gains a 6% bonus, reduced by 2% each tick
float reduction = 2.0f;
+41 -27
View File
@@ -529,7 +529,7 @@ namespace Scripts.Spells.Generic
public override bool Validate(SpellInfo spellInfo)
{
if (!spellInfo.GetEffect(0).IsAura() || spellInfo.GetEffect(0).ApplyAuraName != AuraType.ModPowerRegen)
if (spellInfo.GetEffects().Empty() || !spellInfo.GetEffect(0).IsAura(AuraType.ModPowerRegen))
{
Log.outError(LogFilter.Spells, "Aura {GetId()} structure has been changed - first aura is no longer SPELL_AURA_MOD_POWER_REGEN");
return false;
@@ -625,7 +625,7 @@ namespace Scripts.Spells.Generic
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(spellInfo.GetEffect(0).TriggerSpell);
return !spellInfo.GetEffects().Empty() && ValidateSpellInfo(spellInfo.GetEffect(0).TriggerSpell);
}
void PeriodicTick(AuraEffect aurEff)
@@ -634,7 +634,7 @@ namespace Scripts.Spells.Generic
if (!RandomHelper.randChance(GetSpellInfo().ProcChance))
return;
GetTarget().CastSpell((Unit)null, GetSpellInfo().GetEffect(aurEff.GetEffIndex()).TriggerSpell, true);
GetTarget().CastSpell(null, aurEff.GetSpellEffectInfo().TriggerSpell, true);
}
public override void Register()
@@ -896,19 +896,19 @@ namespace Scripts.Spells.Generic
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo((uint)spellInfo.GetEffect(2).CalcValue());
return spellInfo.GetEffects().Count > 2 && ValidateSpellInfo((uint)spellInfo.GetEffect(2).CalcValue());
}
void HandleApply(AuraEffect aurEff, AuraEffectHandleModes mode)
{
Unit caster = GetCaster();
if (caster)
caster.CastSpell(GetTarget(), (uint)GetSpellInfo().GetEffect(2).CalcValue());
caster.CastSpell(GetTarget(), (uint)GetEffectInfo(2).CalcValue());
}
void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode)
{
GetTarget().RemoveAurasDueToSpell((uint)GetSpellInfo().GetEffect(2).CalcValue(), GetCasterGUID());
GetTarget().RemoveAurasDueToSpell((uint)GetEffectInfo(2).CalcValue(), GetCasterGUID());
}
public override void Register()
@@ -1565,19 +1565,20 @@ namespace Scripts.Spells.Generic
[Script]
class spell_gen_gift_of_naaru : AuraScript
{
public override bool Validate(SpellInfo spellInfo)
{
return spellInfo.GetEffects().Count > 1;
}
void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
{
if (!GetCaster() || aurEff.GetTotalTicks() == 0)
return;
SpellEffectInfo eff1 = GetSpellInfo().GetEffect(1);
if (eff1 != null)
{
float healPct = eff1.CalcValue() / 100.0f;
float heal = healPct * GetCaster().GetMaxHealth();
int healTick = (int)Math.Floor(heal / aurEff.GetTotalTicks());
amount += healTick;
}
float healPct = GetEffectInfo(1).CalcValue() / 100.0f;
float heal = healPct * GetCaster().GetMaxHealth();
int healTick = (int)Math.Floor(heal / aurEff.GetTotalTicks());
amount += healTick;
}
public override void Register()
@@ -1785,7 +1786,7 @@ namespace Scripts.Spells.Generic
if (spell.HasEffect(SpellEffectName.ScriptEffect))
OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, SpellConst.EffectFirstFound, SpellEffectName.ScriptEffect));
if (spell.GetEffect(0).Effect == SpellEffectName.Charge)
if (spell.GetEffect(0).IsEffect(SpellEffectName.Charge))
OnEffectHitTarget.Add(new EffectHandler(HandleChargeEffect, 0, SpellEffectName.Charge));
}
}
@@ -1816,7 +1817,7 @@ namespace Scripts.Spells.Generic
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(spellInfo.GetEffect(0).TriggerSpell);
return !spellInfo.GetEffects().Empty() && ValidateSpellInfo(spellInfo.GetEffect(0).TriggerSpell);
}
void PeriodicTick(AuraEffect aurEff)
@@ -1825,7 +1826,7 @@ namespace Scripts.Spells.Generic
CastSpellExtraArgs args = new(aurEff);
args.AddSpellMod(SpellValueMod.MaxTargets, (int)aurEff.GetTickNumber() / 10 + 1);
GetTarget().CastSpell((Unit)null, GetSpellInfo().GetEffect(aurEff.GetEffIndex()).TriggerSpell, args);
GetTarget().CastSpell((Unit)null, aurEff.GetSpellEffectInfo().TriggerSpell, args);
}
public override void Register()
@@ -1980,6 +1981,11 @@ namespace Scripts.Spells.Generic
[Script]
class spell_gen_oracle_wolvar_reputation : SpellScript
{
public override bool Validate(SpellInfo spellInfo)
{
return spellInfo.GetEffects().Count > 1;
}
public override bool Load()
{
return GetCaster().IsTypeId(TypeId.Player);
@@ -1988,7 +1994,7 @@ namespace Scripts.Spells.Generic
void HandleDummy(uint effIndex)
{
Player player = GetCaster().ToPlayer();
uint factionId = (uint)GetEffectInfo(effIndex).CalcValue();
uint factionId = (uint)GetEffectInfo().CalcValue();
int repChange = GetEffectInfo(1).CalcValue();
FactionRecord factionEntry = CliDB.FactionStorage.LookupByKey(factionId);
@@ -2291,11 +2297,16 @@ namespace Scripts.Spells.Generic
[Script] // 62418 Impale
class spell_gen_remove_on_health_pct : AuraScript
{
public override bool Validate(SpellInfo spellInfo)
{
return spellInfo.GetEffects().Count > 1;
}
void PeriodicTick(AuraEffect aurEff)
{
// they apply damage so no need to check for ticks here
if (GetTarget().HealthAbovePct(GetSpellInfo().GetEffect(1).CalcValue()))
if (GetTarget().HealthAbovePct(GetEffectInfo(1).CalcValue()))
{
Remove(AuraRemoveMode.EnemySpell);
PreventDefaultAction();
@@ -2318,7 +2329,7 @@ namespace Scripts.Spells.Generic
void PeriodicTick(AuraEffect aurEff)
{
// if it has only periodic effect, allow 1 tick
bool onlyEffect = GetSpellInfo().GetEffects().Length == 1;
bool onlyEffect = GetSpellInfo().GetEffects().Count == 1;
if (onlyEffect && aurEff.GetTickNumber() <= 1)
return;
@@ -3042,9 +3053,12 @@ namespace Scripts.Spells.Generic
{
public override bool Validate(SpellInfo spellInfo)
{
SpellEffectInfo effect = spellInfo.GetEffect(0);
if (effect == null || effect.CalcValue() < 1)
if (spellInfo.GetEffects().Empty())
return false;
if (spellInfo.GetEffect(0).CalcValue() < 1)
return false;
return true;
}
@@ -3236,7 +3250,7 @@ namespace Scripts.Spells.Generic
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo((uint)RequiredMixologySpells.Mixology);
return ValidateSpellInfo((uint)RequiredMixologySpells.Mixology) && !spellInfo.GetEffects().Empty();
}
public override bool Load()
@@ -3252,7 +3266,7 @@ namespace Scripts.Spells.Generic
void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
{
if (GetCaster().HasAura((uint)RequiredMixologySpells.Mixology) && GetCaster().HasSpell(GetSpellInfo().GetEffect(0).TriggerSpell))
if (GetCaster().HasAura((uint)RequiredMixologySpells.Mixology) && GetCaster().HasSpell(GetEffectInfo(0).TriggerSpell))
{
switch ((RequiredMixologySpells)GetId())
{
@@ -3596,14 +3610,14 @@ namespace Scripts.Spells.Generic
[Script] // 99947 - Face Rage
class spell_gen_face_rage : AuraScript
{
public override bool Validate(SpellInfo spell)
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.FaceRage);
return ValidateSpellInfo(SpellIds.FaceRage) && spellInfo.GetEffects().Count > 2;
}
void OnRemove(AuraEffect effect, AuraEffectHandleModes mode)
{
GetTarget().RemoveAurasDueToSpell(GetSpellInfo().GetEffect(2).TriggerSpell);
GetTarget().RemoveAurasDueToSpell(GetEffectInfo(2).TriggerSpell);
}
public override void Register()
+1 -1
View File
@@ -134,7 +134,7 @@ namespace Scripts.Spells.Hunter
{
public override bool Validate(SpellInfo spellInfo)
{
return spellInfo.GetEffect(0) != null && ValidateSpellInfo(SpellIds.MastersCallTriggered, (uint)spellInfo.GetEffect(0).CalcValue());
return !spellInfo.GetEffects().Empty() && ValidateSpellInfo(SpellIds.MastersCallTriggered, (uint)spellInfo.GetEffect(0).CalcValue());
}
public override bool Load()
+6 -11
View File
@@ -380,11 +380,6 @@ namespace Scripts.Spells.Items
public const uint JomGabbar = 29602;
public const uint BattleTrance = 45040;
public const uint WorldQuellerFocus = 90900;
public const uint AzureWaterStrider = 118089;
public const uint CrimsonWaterStrider = 127271;
public const uint OrangeWaterStrider = 127272;
public const uint JadeWaterStrider = 127274;
public const uint GoldenWaterStrider = 127278;
public const uint BrutalKinship1 = 144671;
public const uint BrutalKinship2 = 145738;
}
@@ -1302,7 +1297,7 @@ namespace Scripts.Spells.Items
{
public override bool Validate(SpellInfo spellInfo)
{
return spellInfo.GetEffect(0) != null;
return !spellInfo.GetEffects().Empty();
}
bool CheckProc(ProcEventInfo eventInfo)
@@ -3346,7 +3341,7 @@ namespace Scripts.Spells.Items
{
public override bool Validate(SpellInfo spellInfo)
{
return spellInfo.GetEffect(1) != null;
return spellInfo.GetEffects().Count > 1;
}
public override bool Load()
@@ -3358,7 +3353,7 @@ namespace Scripts.Spells.Items
{
Item artifact = GetOwner().ToPlayer().GetItemByGuid(GetAura().GetCastItemGUID());
if (artifact)
amount = (int)(GetSpellInfo().GetEffect(1).BasePoints * artifact.GetTotalPurchasedArtifactPowers() / 100);
amount = (int)(GetEffectInfo(1).BasePoints * artifact.GetTotalPurchasedArtifactPowers() / 100);
}
public override void Register()
@@ -3372,7 +3367,7 @@ namespace Scripts.Spells.Items
{
public override bool Validate(SpellInfo spellInfo)
{
return spellInfo.GetEffect(1) != null;
return spellInfo.GetEffects().Count > 1;
}
public override bool Load()
@@ -3476,9 +3471,9 @@ namespace Scripts.Spells.Items
[Script] // 127278 - Golden Water Strider
class spell_item_water_strider : AuraScript
{
public override bool Validate(SpellInfo spell)
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.AzureWaterStrider, SpellIds.CrimsonWaterStrider, SpellIds.OrangeWaterStrider, SpellIds.JadeWaterStrider, SpellIds.GoldenWaterStrider);
return spellInfo.GetEffects().Count > 1;
}
void OnRemove(AuraEffect effect, AuraEffectHandleModes mode)
+13 -15
View File
@@ -151,7 +151,7 @@ namespace Scripts.Spells.Mage
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.ArcaneBarrageR3, SpellIds.ArcaneBarrageEnergize) && spellInfo.GetEffect(1) != null;
return ValidateSpellInfo(SpellIds.ArcaneBarrageR3, SpellIds.ArcaneBarrageEnergize) && spellInfo.GetEffects().Count > 1;
}
void ConsumeArcaneCharges()
@@ -214,8 +214,10 @@ namespace Scripts.Spells.Mage
if (!ValidateSpellInfo(SpellIds.ArcaneMage, SpellIds.Reverberate))
return false;
SpellEffectInfo damageEffect = spellInfo.GetEffect(1);
return damageEffect != null && damageEffect.IsEffect(SpellEffectName.SchoolDamage);
if (spellInfo.GetEffects().Count <= 1)
return false;
return spellInfo.GetEffect(1).IsEffect(SpellEffectName.SchoolDamage);
}
void CheckRequiredAuraForBaselineEnergize(uint effIndex)
@@ -319,7 +321,7 @@ namespace Scripts.Spells.Mage
{
public override bool Validate(SpellInfo spellInfo)
{
return spellInfo.GetEffect(2) != null && ValidateSpellInfo(SpellIds.CauterizeDot, SpellIds.Cauterized, spellInfo.GetEffect(2).TriggerSpell);
return spellInfo.GetEffects().Count > 2 && ValidateSpellInfo(SpellIds.CauterizeDot, SpellIds.Cauterized, spellInfo.GetEffect(2).TriggerSpell);
}
void HandleAbsorb(AuraEffect aurEff, DamageInfo dmgInfo, ref uint absorbAmount)
@@ -335,7 +337,7 @@ namespace Scripts.Spells.Mage
}
GetTarget().SetHealth(GetTarget().CountPctFromMaxHealth(effectInfo.GetAmount()));
GetTarget().CastSpell(GetTarget(), GetSpellInfo().GetEffect(2).TriggerSpell, new CastSpellExtraArgs(TriggerCastFlags.FullMask));
GetTarget().CastSpell(GetTarget(), GetEffectInfo(2).TriggerSpell, new CastSpellExtraArgs(TriggerCastFlags.FullMask));
GetTarget().CastSpell(GetTarget(), SpellIds.CauterizeDot, new CastSpellExtraArgs(TriggerCastFlags.FullMask));
GetTarget().CastSpell(GetTarget(), SpellIds.Cauterized, new CastSpellExtraArgs(TriggerCastFlags.FullMask));
}
@@ -517,15 +519,11 @@ namespace Scripts.Spells.Mage
{
// Thermal Void
Aura thermalVoid = caster.GetAura(SpellIds.ThermalVoid);
if (thermalVoid != null)
if (!thermalVoid.GetSpellInfo().GetEffects().Empty())
{
SpellEffectInfo thermalVoidEffect = thermalVoid.GetSpellInfo().GetEffect(0);
if (thermalVoidEffect != null)
{
Aura icyVeins = caster.GetAura(SpellIds.IcyVeins);
if (icyVeins != null)
icyVeins.SetDuration(icyVeins.GetDuration() + thermalVoidEffect.CalcValue(caster) * Time.InMilliseconds);
}
Aura icyVeins = caster.GetAura(SpellIds.IcyVeins);
if (icyVeins != null)
icyVeins.SetDuration(icyVeins.GetDuration() + thermalVoid.GetSpellInfo().GetEffect(0).CalcValue(caster) * Time.InMilliseconds);
}
// Chain Reaction
@@ -750,7 +748,7 @@ namespace Scripts.Spells.Mage
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.RingOfFrostSummon, SpellIds.RingOfFrostFreeze);
return ValidateSpellInfo(SpellIds.RingOfFrostSummon, SpellIds.RingOfFrostFreeze) && !Global.SpellMgr.GetSpellInfo(SpellIds.RingOfFrostSummon, GetCastDifficulty()).GetEffects().Empty();
}
void HandleEffectPeriodic(AuraEffect aurEff)
@@ -806,7 +804,7 @@ namespace Scripts.Spells.Mage
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.RingOfFrostSummon, SpellIds.RingOfFrostFreeze);
return ValidateSpellInfo(SpellIds.RingOfFrostSummon, SpellIds.RingOfFrostFreeze) && !Global.SpellMgr.GetSpellInfo(SpellIds.RingOfFrostSummon, GetCastDifficulty()).GetEffects().Empty();
}
void FilterTargets(List<WorldObject> targets)
+8 -6
View File
@@ -20,6 +20,7 @@ using Game.Entities;
using Game.Scripting;
using Game.Spells;
using System;
using System.Collections.Generic;
namespace Scripts.Spells.Monk
{
@@ -304,14 +305,15 @@ namespace Scripts.Spells.Monk
{
float _period;
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.StaggerDamageAura)
&& !Global.SpellMgr.GetSpellInfo(SpellIds.StaggerDamageAura, Difficulty.None).GetEffects().Empty();
}
public override bool Load()
{
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.StaggerDamageAura, GetCastDifficulty());
SpellEffectInfo effInfo = spellInfo?.GetEffect(0);
if (effInfo == null)
return false;
_period = (float)effInfo.ApplyAuraPeriod;
_period = (float)Global.SpellMgr.GetSpellInfo(SpellIds.StaggerDamageAura, GetCastDifficulty()).GetEffect(0).ApplyAuraPeriod;
return true;
}
+11 -20
View File
@@ -115,7 +115,7 @@ namespace Scripts.Spells.Priest
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.AtonementHeal);
return ValidateSpellInfo(SpellIds.AtonementHeal) && spellInfo.GetEffects().Count > 1;
}
bool CheckProc(ProcEventInfo eventInfo)
@@ -133,7 +133,7 @@ namespace Scripts.Spells.Priest
Unit target = Global.ObjAccessor.GetUnit(GetTarget(), targetGuid);
if (target)
{
if (target.GetExactDist(GetTarget()) < GetSpellInfo().GetEffect(1).CalcValue())
if (target.GetExactDist(GetTarget()) < GetEffectInfo(1).CalcValue())
GetTarget().CastSpell(target, SpellIds.AtonementHeal, args);
return false;
@@ -242,12 +242,12 @@ namespace Scripts.Spells.Priest
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.GuardianSpiritHeal);
return ValidateSpellInfo(SpellIds.GuardianSpiritHeal) && spellInfo.GetEffects().Count > 1;
}
public override bool Load()
{
healPct = (uint)GetSpellInfo().GetEffect(1).CalcValue();
healPct = (uint)GetEffectInfo(1).CalcValue();
return true;
}
@@ -285,10 +285,9 @@ 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).GetEffect(1) != null
&& Global.SpellMgr.GetSpellInfo(SpellIds.HolyWordSanctify, Difficulty.None).GetEffect(2) != null
&& Global.SpellMgr.GetSpellInfo(SpellIds.HolyWordSanctify, Difficulty.None).GetEffect(3) != null
&& Global.SpellMgr.GetSpellInfo(SpellIds.HolyWordChastise, Difficulty.None).GetEffect(1) != null;
&& 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;
}
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
@@ -480,16 +479,12 @@ namespace Scripts.Spells.Priest
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.Atonement, SpellIds.AtonementTriggered, SpellIds.Trinity);
return ValidateSpellInfo(SpellIds.Atonement, SpellIds.AtonementTriggered, SpellIds.Trinity) && spellInfo.GetEffects().Count > 3;
}
void OnTargetSelect(List<WorldObject> targets)
{
SpellEffectInfo eff2 = GetEffectInfo(2);
if (eff2 == null)
return;
uint maxTargets = (uint)(eff2.CalcValue(GetCaster()) + 1); // adding 1 for explicit target unit
uint maxTargets = (uint)(GetEffectInfo(2).CalcValue(GetCaster()) + 1); // adding 1 for explicit target unit
if (targets.Count > maxTargets)
{
Unit explTarget = GetExplTargetUnit();
@@ -516,11 +511,7 @@ namespace Scripts.Spells.Priest
if (caster.HasAura(SpellIds.Trinity))
return;
SpellEffectInfo effect3 = GetEffectInfo(3);
if (effect3 == null)
return;
int durationPct = effect3.CalcValue(caster);
int durationPct = GetEffectInfo(3).CalcValue(caster);
if (caster.HasAura(SpellIds.Atonement))
caster.CastSpell(GetHitUnit(), SpellIds.AtonementTriggered, new CastSpellExtraArgs(SpellValueMod.DurationPct, durationPct).SetTriggerFlags(TriggerCastFlags.FullMask));
}
@@ -622,7 +613,7 @@ namespace Scripts.Spells.Priest
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.PrayerOfMendingHeal, SpellIds.PrayerOfMendingAura)
&& Global.SpellMgr.GetSpellInfo(SpellIds.PrayerOfMendingHeal, Difficulty.None).GetEffect(0) != null;
&& !Global.SpellMgr.GetSpellInfo(SpellIds.PrayerOfMendingHeal, Difficulty.None).GetEffects().Empty();
}
public override bool Load()
+9 -4
View File
@@ -673,14 +673,19 @@ namespace Scripts.Spells.Quest
[Script]
class spell_q12683_take_sputum_sample : SpellScript
{
public override bool Validate(SpellInfo spellInfo)
{
return spellInfo.GetEffects().Count > 1;
}
void HandleDummy(uint effIndex)
{
uint reqAuraId = (uint)GetSpellInfo().GetEffect(1).CalcValue();
uint reqAuraId = (uint)GetEffectInfo(1).CalcValue();
Unit caster = GetCaster();
if (caster.HasAuraEffect(reqAuraId, 0))
{
uint spellId = (uint)GetSpellInfo().GetEffect(0).CalcValue();
uint spellId = (uint)GetEffectInfo(0).CalcValue();
caster.CastSpell(caster, spellId, true);
}
}
@@ -1451,7 +1456,7 @@ namespace Scripts.Spells.Quest
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue());
return !spellInfo.GetEffects().Empty() && ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue());
}
void HandleEffectDummy(uint effIndex)
@@ -1612,7 +1617,7 @@ namespace Scripts.Spells.Quest
{
void ModDest(ref SpellDestination dest)
{
float dist = GetSpellInfo().GetEffect(0).CalcRadius(GetCaster());
float dist = GetEffectInfo(0).CalcRadius(GetCaster());
float angle = RandomHelper.FRand(0.75f, 1.25f) * MathFunctions.PI;
Position pos = GetCaster().GetNearPosition(dist, angle);
+11 -15
View File
@@ -199,26 +199,22 @@ namespace Scripts.Spells.Warlock
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.GlyphOfDemonTraining, SpellIds.DevourMagicHeal);
return ValidateSpellInfo(SpellIds.GlyphOfDemonTraining, SpellIds.DevourMagicHeal) && spellInfo.GetEffects().Count > 1;
}
void OnSuccessfulDispel(uint effIndex)
{
SpellEffectInfo effect = GetSpellInfo().GetEffect(1);
if (effect != null)
{
Unit caster = GetCaster();
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
args.AddSpellMod(SpellValueMod.BasePoint0, effect.CalcValue(caster));
Unit caster = GetCaster();
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
args.AddSpellMod(SpellValueMod.BasePoint0, GetEffectInfo(1).CalcValue(caster));
caster.CastSpell(caster, SpellIds.DevourMagicHeal, args);
caster.CastSpell(caster, SpellIds.DevourMagicHeal, args);
// Glyph of Felhunter
Unit owner = caster.GetOwner();
if (owner)
if (owner.GetAura(SpellIds.GlyphOfDemonTraining) != null)
owner.CastSpell(owner, SpellIds.DevourMagicHeal, args);
}
// Glyph of Felhunter
Unit owner = caster.GetOwner();
if (owner)
if (owner.GetAura(SpellIds.GlyphOfDemonTraining) != null)
owner.CastSpell(owner, SpellIds.DevourMagicHeal, args);
}
public override void Register()
@@ -370,7 +366,7 @@ namespace Scripts.Spells.Warlock
if (caster == null)
return;
amount = caster.SpellBaseDamageBonusDone(GetSpellInfo().GetSchoolMask()) * GetSpellInfo().GetEffect(0).CalcValue(caster) / 100;
amount = caster.SpellBaseDamageBonusDone(GetSpellInfo().GetSchoolMask()) * GetEffectInfo(0).CalcValue(caster) / 100;
}
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
+5 -5
View File
@@ -302,7 +302,7 @@ namespace Scripts.Spells.Warrior
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.Stoicism);
return ValidateSpellInfo(SpellIds.Stoicism) && spellInfo.GetEffects().Count > 1;
}
void HandleProc(ProcEventInfo eventInfo)
@@ -310,7 +310,7 @@ namespace Scripts.Spells.Warrior
PreventDefaultAction();
Unit target = eventInfo.GetActionTarget();
int bp0 = (int)MathFunctions.CalculatePct(target.GetMaxHealth(), GetSpellInfo().GetEffect(1).CalcValue());
int bp0 = (int)MathFunctions.CalculatePct(target.GetMaxHealth(), GetEffectInfo(1).CalcValue());
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
args.AddSpellMod(SpellValueMod.BasePoint0, bp0);
target.CastSpell((Unit)null, SpellIds.Stoicism, args);
@@ -378,7 +378,7 @@ namespace Scripts.Spells.Warrior
if (!ValidateSpellInfo(SpellIds.Shockwave, SpellIds.ShockwaveStun))
return false;
return spellInfo.GetEffect(0) != null && spellInfo.GetEffect(3) != null;
return spellInfo.GetEffects().Count > 3;
}
public override bool Load()
@@ -395,8 +395,8 @@ namespace Scripts.Spells.Warrior
// Cooldown reduced by 20 sec if it strikes at least 3 targets.
void HandleAfterCast()
{
if (_targetCount >= (uint)GetSpellInfo().GetEffect(0).CalcValue())
GetCaster().ToPlayer().GetSpellHistory().ModifyCooldown(GetSpellInfo().Id, TimeSpan.FromSeconds(-GetSpellInfo().GetEffect(3).CalcValue()));
if (_targetCount >= (uint)GetEffectInfo(0).CalcValue())
GetCaster().ToPlayer().GetSpellHistory().ModifyCooldown(GetSpellInfo().Id, TimeSpan.FromSeconds(-GetEffectInfo(3).CalcValue()));
}
public override void Register()