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:
parent
9ef7752beb
commit
178f71c6dc
33 changed files with 469 additions and 677 deletions
|
|
@ -78,9 +78,7 @@ namespace Server.Spells.Bushido
|
|||
m_Table.TryGetValue(m, out var timer);
|
||||
timer?.Stop();
|
||||
|
||||
m_Table[m] = timer = new InternalTimer(m);
|
||||
|
||||
timer.Start();
|
||||
m_Table[m] = Timer.DelayCall(TimeSpan.FromSeconds(30.0), EndCountering, m);
|
||||
}
|
||||
|
||||
public static void StopCountering(Mobile m)
|
||||
|
|
@ -93,21 +91,10 @@ namespace Server.Spells.Bushido
|
|||
OnEffectEnd(m, typeof(CounterAttack));
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
private static void EndCountering(Mobile m)
|
||||
{
|
||||
private readonly Mobile m_Mobile;
|
||||
|
||||
public InternalTimer(Mobile m) : base(TimeSpan.FromSeconds(30.0))
|
||||
{
|
||||
m_Mobile = m;
|
||||
Priority = TimerPriority.TwoFiftyMS;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
StopCountering(m_Mobile);
|
||||
m_Mobile.SendLocalizedMessage(1063119); // You return to your normal stance.
|
||||
}
|
||||
StopCountering(m);
|
||||
m.SendLocalizedMessage(1063119); // You return to your normal stance.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue