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.
This commit is contained in:
parent
9c0b57213a
commit
b8ad5c671d
80 changed files with 201 additions and 406 deletions
|
|
@ -43,8 +43,6 @@ namespace Server.Spells.First
|
|||
|
||||
HarmfulSpell(m);
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
|
|
|
|||
|
|
@ -45,8 +45,6 @@ namespace Server.Spells.First
|
|||
|
||||
HarmfulSpell(m);
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
|
|
|
|||
|
|
@ -69,8 +69,6 @@ namespace Server.Spells.First
|
|||
m.FixedParticles(0x376A, 9, 32, 5005, EffectLayer.Waist);
|
||||
m.PlaySound(0x1F2);
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
public override bool CheckCast()
|
||||
|
|
|
|||
|
|
@ -64,8 +64,6 @@ namespace Server.Spells.First
|
|||
|
||||
SpellHelper.Damage(this, m, damage, 0, 100, 0, 0, 0);
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
|
|
|
|||
|
|
@ -1,80 +1,58 @@
|
|||
using System;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.First
|
||||
namespace Server.Spells.First;
|
||||
|
||||
public class NightSightSpell : MagerySpell, ISpellTargetingMobile
|
||||
{
|
||||
public class NightSightSpell : MagerySpell
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Night Sight",
|
||||
"In Lor",
|
||||
236,
|
||||
9031,
|
||||
Reagent.SulfurousAsh,
|
||||
Reagent.SpidersSilk
|
||||
);
|
||||
|
||||
public NightSightSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Night Sight",
|
||||
"In Lor",
|
||||
236,
|
||||
9031,
|
||||
Reagent.SulfurousAsh,
|
||||
Reagent.SpidersSilk
|
||||
);
|
||||
}
|
||||
|
||||
public NightSightSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
|
||||
public override SpellCircle Circle => SpellCircle.First;
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Beneficial, 12);
|
||||
}
|
||||
|
||||
public void Target(Mobile m)
|
||||
{
|
||||
if (CheckBSequence(m))
|
||||
{
|
||||
}
|
||||
SpellHelper.Turn(Caster, m);
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.First;
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new NightSightTarget(this);
|
||||
}
|
||||
|
||||
private class NightSightTarget : Target
|
||||
{
|
||||
private readonly Spell m_Spell;
|
||||
|
||||
public NightSightTarget(Spell spell) : base(12, false, TargetFlags.Beneficial) => m_Spell = spell;
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
if (m.BeginAction<LightCycle>())
|
||||
{
|
||||
if (targeted is Mobile targ && m_Spell.CheckBSequence(targ))
|
||||
{
|
||||
SpellHelper.Turn(m_Spell.Caster, targ);
|
||||
new LightCycle.NightSightTimer(m).Start();
|
||||
|
||||
if (targ.BeginAction<LightCycle>())
|
||||
{
|
||||
new LightCycle.NightSightTimer(targ).Start();
|
||||
var level =
|
||||
(int)(LightCycle.DungeonLevel *
|
||||
((Core.AOS
|
||||
? targ.Skills.Magery.Value
|
||||
: from.Skills.Magery.Value) / 100));
|
||||
var skill = (Core.AOS ? m.Skills.Magery.Value : Caster.Skills.Magery.Value) / 100;
|
||||
var level = (int)(LightCycle.DungeonLevel * skill);
|
||||
|
||||
targ.LightLevel = Math.Max(level, 0);
|
||||
m.LightLevel = Math.Max(level, 0);
|
||||
|
||||
targ.FixedParticles(0x376A, 9, 32, 5007, EffectLayer.Waist);
|
||||
targ.PlaySound(0x1E3);
|
||||
m.FixedParticles(0x376A, 9, 32, 5007, EffectLayer.Waist);
|
||||
m.PlaySound(0x1E3);
|
||||
|
||||
BuffInfo.AddBuff(
|
||||
targ,
|
||||
new BuffInfo(BuffIcon.NightSight, 1075643)
|
||||
); // Night Sight/You ignore lighting effects
|
||||
}
|
||||
else
|
||||
{
|
||||
if (from == targ)
|
||||
{
|
||||
from.SendMessage("You already have nightsight.");
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage("They already have nightsight.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_Spell.FinishSequence();
|
||||
// Night Sight/You ignore lighting effects
|
||||
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.NightSight, 1075643));
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
else if (m == Caster)
|
||||
{
|
||||
m_Spell.FinishSequence();
|
||||
m.SendMessage("You already have nightsight.");
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendMessage("They already have nightsight.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,8 +43,6 @@ namespace Server.Spells.First
|
|||
|
||||
HarmfulSpell(m);
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue