ModernUO/Projects/UOContent/Spells/Sixth/MassCurse.cs
Kamron Batman b8ad5c671d
fix: Fixes double calls with Target cancel and spell sequences (#1840)
### Summary
- Cleans up target cancellation being called incorrectly.
- An invalid target type (which should never happen), now calls `OnTargetUntargetable` instead of `OnTargetCanceled`
- Removes double calls to `FinishSequence` in Spells.
2024-06-17 15:19:06 -07:00

64 lines
2 KiB
C#

namespace Server.Spells.Sixth
{
public class MassCurseSpell : MagerySpell, ISpellTargetingPoint3D
{
private static readonly SpellInfo _info = new(
"Mass Curse",
"Vas Des Sanct",
218,
9031,
false,
Reagent.Garlic,
Reagent.Nightshade,
Reagent.MandrakeRoot,
Reagent.SulfurousAsh
);
public MassCurseSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
{
}
public override SpellCircle Circle => SpellCircle.Sixth;
public void Target(IPoint3D p)
{
if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
{
SpellHelper.Turn(Caster, p);
SpellHelper.GetSurfaceTop(ref p);
var map = Caster.Map;
if (map != null)
{
foreach (var m in map.GetMobilesInRange(new Point3D(p), 2))
{
if (Core.AOS && (m == Caster || !SpellHelper.ValidIndirectTarget(Caster, m) || !Caster.CanSee(m) ||
!Caster.CanBeHarmful(m, false)))
{
continue;
}
Caster.DoHarmful(m);
var length = SpellHelper.GetDuration(Caster, m);
SpellHelper.AddStatCurse(Caster, m, StatType.Str, length, false);
SpellHelper.AddStatCurse(Caster, m, StatType.Dex, length);
SpellHelper.AddStatCurse(Caster, m, StatType.Int, length);
m.FixedParticles(0x374A, 10, 15, 5028, EffectLayer.Waist);
m.PlaySound(0x1FB);
HarmfulSpell(m);
}
}
}
}
public override void OnCast()
{
Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12);
}
}
}