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
|
|
@ -51,12 +51,10 @@ public class AnimatedWeaponSpell : MysticSpell, ISpellTargetingPoint3D
|
|||
|
||||
Effects.SendTargetParticles(summon, 0x3728, 10, 10, 0x13AA, (EffectLayer)255);
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetPoint3D(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,63 +26,61 @@ public class BombardSpell : MysticSpell, ISpellTargetingMobile
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful);
|
||||
}
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful);
|
||||
}
|
||||
|
||||
public void Target(Mobile m)
|
||||
{
|
||||
if (CheckHSequence(m))
|
||||
if (CheckHSequence(m))
|
||||
{
|
||||
SpellHelper.Turn(Caster, m);
|
||||
|
||||
if (HasDelayedDamageContext(m))
|
||||
{
|
||||
SpellHelper.Turn(Caster, m);
|
||||
DoHurtFizzle();
|
||||
return;
|
||||
}
|
||||
|
||||
if (HasDelayedDamageContext(m))
|
||||
var source = Caster;
|
||||
|
||||
if (SpellHelper.CheckReflect(6, ref source, ref m))
|
||||
{
|
||||
Timer.StartTimer(TimeSpan.FromSeconds(0.5), () =>
|
||||
{
|
||||
DoHurtFizzle();
|
||||
return;
|
||||
}
|
||||
|
||||
var source = Caster;
|
||||
|
||||
if (SpellHelper.CheckReflect(6, ref source, ref m))
|
||||
{
|
||||
Timer.StartTimer(TimeSpan.FromSeconds(0.5), () =>
|
||||
{
|
||||
source.MovingEffect(m, 0x1363, 12, 1, false, true, 0, 0);
|
||||
source.PlaySound(0x64B);
|
||||
});
|
||||
}
|
||||
|
||||
Caster.MovingEffect(m, 0x1363, 12, 1, false, true, 0, 0);
|
||||
Caster.PlaySound(0x64B);
|
||||
|
||||
SpellHelper.Damage(this, m, GetNewAosDamage(40, 1, 5, m), 100, 0, 0, 0, 0);
|
||||
|
||||
Timer.StartTimer(TimeSpan.FromSeconds(1.2), () =>
|
||||
{
|
||||
if (CheckResisted(m))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var damageSkill = GetDamageSkill(Caster);
|
||||
var resist = GetResistSkill(m);
|
||||
|
||||
int secs = Math.Max(0, (int)(damageSkill / 10 - resist / 10));
|
||||
|
||||
if (secs > 0)
|
||||
{
|
||||
m.Paralyze(TimeSpan.FromSeconds(secs));
|
||||
}
|
||||
|
||||
// Up to 12% chance by checking mysticism + imbuing/focus against resist
|
||||
var knockBackChance = (GetBaseSkill(Caster) + damageSkill - resist) / 20;
|
||||
if (knockBackChance > 0 && Utility.RandomDouble() < knockBackChance)
|
||||
{
|
||||
m.Move(Caster.GetDirectionTo(m));
|
||||
}
|
||||
source.MovingEffect(m, 0x1363, 12, 1, false, true, 0, 0);
|
||||
source.PlaySound(0x64B);
|
||||
});
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
Caster.MovingEffect(m, 0x1363, 12, 1, false, true, 0, 0);
|
||||
Caster.PlaySound(0x64B);
|
||||
|
||||
SpellHelper.Damage(this, m, GetNewAosDamage(40, 1, 5, m), 100, 0, 0, 0, 0);
|
||||
|
||||
Timer.StartTimer(TimeSpan.FromSeconds(1.2), () =>
|
||||
{
|
||||
if (CheckResisted(m))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var damageSkill = GetDamageSkill(Caster);
|
||||
var resist = GetResistSkill(m);
|
||||
|
||||
int secs = Math.Max(0, (int)(damageSkill / 10 - resist / 10));
|
||||
|
||||
if (secs > 0)
|
||||
{
|
||||
m.Paralyze(TimeSpan.FromSeconds(secs));
|
||||
}
|
||||
|
||||
// Up to 12% chance by checking mysticism + imbuing/focus against resist
|
||||
var knockBackChance = (GetBaseSkill(Caster) + damageSkill - resist) / 20;
|
||||
if (knockBackChance > 0 && Utility.RandomDouble() < knockBackChance)
|
||||
{
|
||||
m.Move(Caster.GetDirectionTo(m));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,8 +129,6 @@ public class CleansingWindsSpell : MysticSpell, ISpellTargetingMobile
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
public static int RemoveCurses(Mobile m)
|
||||
|
|
@ -212,4 +210,4 @@ public class CleansingWindsSpell : MysticSpell, ISpellTargetingMobile
|
|||
|
||||
return curseLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,8 +51,6 @@ public class EagleStrikeSpell : MysticSpell, ISpellTargetingMobile
|
|||
|
||||
Timer.StartTimer(TimeSpan.FromSeconds(1.0), () => Damage(m));
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
|
|
@ -73,4 +71,4 @@ public class EagleStrikeSpell : MysticSpell, ISpellTargetingMobile
|
|||
|
||||
to.PlaySound(0x64D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,8 +69,6 @@ public class HailStormSpell : MysticSpell, ISpellTargetingPoint3D
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
|
|
@ -122,4 +120,4 @@ public class HailStormSpell : MysticSpell, ISpellTargetingPoint3D
|
|||
0x4
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,8 +85,6 @@ public class NetherCycloneSpell : MysticSpell, ISpellTargetingPoint3D
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
|
|
@ -136,4 +134,4 @@ public class NetherCycloneSpell : MysticSpell, ISpellTargetingPoint3D
|
|||
0x4
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,13 +35,13 @@ public class SpellPlagueSpell : MysticSpell, ISpellTargetingMobile
|
|||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful);
|
||||
}
|
||||
|
||||
public void Target(Mobile targeted)
|
||||
public void Target(Mobile m)
|
||||
{
|
||||
if (CheckHSequence(targeted))
|
||||
if (CheckHSequence(m))
|
||||
{
|
||||
SpellHelper.Turn(Caster, targeted);
|
||||
SpellHelper.Turn(Caster, m);
|
||||
|
||||
SpellHelper.CheckReflect(6, Caster, ref targeted);
|
||||
SpellHelper.CheckReflect(6, Caster, ref m);
|
||||
|
||||
/* The target is hit with an explosion of chaos damage and then inflicted
|
||||
* with the spell plague curse. Each time the target is damaged while under
|
||||
|
|
@ -53,26 +53,24 @@ public class SpellPlagueSpell : MysticSpell, ISpellTargetingMobile
|
|||
* plagues so that they are applied one after the other.
|
||||
*/
|
||||
|
||||
VisualEffect(targeted);
|
||||
VisualEffect(m);
|
||||
|
||||
// Before Time of Legends, SDI was not applied to initial damage.
|
||||
var damage = GetNewAosDamage(33, 1, 5, Core.TOL, targeted);
|
||||
SpellHelper.Damage(this, targeted, damage, 0, 0, 0, 0, 0);
|
||||
var damage = GetNewAosDamage(33, 1, 5, Core.TOL, m);
|
||||
SpellHelper.Damage(this, m, damage, 0, 0, 0, 0, 0);
|
||||
|
||||
var timer = new SpellPlagueTimer(this, targeted);
|
||||
var timer = new SpellPlagueTimer(this, m);
|
||||
|
||||
if (_table.TryGetValue(targeted, out var oldtimer))
|
||||
if (_table.TryGetValue(m, out var oldtimer))
|
||||
{
|
||||
oldtimer.SetNext(timer);
|
||||
}
|
||||
else
|
||||
{
|
||||
_table[targeted] = timer;
|
||||
_table[m] = timer;
|
||||
timer.StartPlague();
|
||||
}
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
public static bool UnderEffect(Mobile m) => _table.ContainsKey(m);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue