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
+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);