chore(content): Cleans up abilities and some spell timers (#427)

- [X] Exposes Index/Count on the timer.
- [X] Cleans up abilities
- [X] Combines some spell context/info objects with their timers to reduce allocations
- [X] Fixes a bug where immolating weapon both finishes effect or stops in the wrong order due to a race condition.
This commit is contained in:
Kamron Batman 2021-01-23 16:40:53 -08:00 • committed by GitHub
parent 9ef7752beb
commit 178f71c6dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 469 additions and 677 deletions

View file

@ -62,19 +62,21 @@ namespace Server.Spells.Sixth
var duration = TimeSpan.FromSeconds(1.2 * Caster.Skills.Magery.Fixed / 10);
Timer t = new InternalTimer(m, duration);
BuffInfo.RemoveBuff(m, BuffIcon.HidingAndOrStealth);
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Invisibility, 1075825, duration, m)); // Invisibility/Invisible
m_Table[m] = t;
t.Start();
m_Table[m] = Timer.DelayCall(duration, EndInvisiblity, m);
}
FinishSequence();
}
private static void EndInvisiblity(Mobile m)
{
m.RevealingAction();
RemoveTimer(m);
}
public override bool CheckCast()
{
if (DuelContext.CheckSuddenDeath(Caster))
@ -100,22 +102,5 @@ namespace Server.Spells.Sixth
t.Stop();
}
}
private class InternalTimer : Timer
{
private readonly Mobile m_Mobile;
public InternalTimer(Mobile m, TimeSpan duration) : base(duration)
{
Priority = TimerPriority.OneSecond;
m_Mobile = m;
}
protected override void OnTick()
{
m_Mobile.RevealingAction();
RemoveTimer(m_Mobile);
}
}
}
}