fix: Fixes skill requirements and cleans up magery spells (#870)

* Preps damage stacking for mysticism, necromancy fixes, and spellweaving
* Removes extra LINQ allocations
* Fixes skill requirements for magery spells.
This commit is contained in:
Kamron Batman 2021-12-05 09:40:57 -08:00 • committed by GitHub
parent 1cf7b6c056
commit 4f9714818d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 311 additions and 382 deletions

View file

@ -10,8 +10,7 @@ namespace Server.Spells
{
public abstract class SpecialMove
{
private static readonly Dictionary<Mobile, SpecialMoveContext> m_PlayersTable =
new();
private static readonly Dictionary<Mobile, SpecialMoveContext> _playersTable = new();
public virtual int BaseMana => 0;
@ -159,40 +158,18 @@ namespace Server.Spells
return false;
}
string option = null;
if (this is Backstab)
string option = this switch
{
option = "Backstab";
}
else if (this is DeathStrike)
{
option = "Death Strike";
}
else if (this is FocusAttack)
{
option = "Focus Attack";
}
else if (this is KiAttack)
{
option = "Ki Attack";
}
else if (this is SurpriseAttack)
{
option = "Surprise Attack";
}
else if (this is HonorableExecution)
{
option = "Honorable Execution";
}
else if (this is LightningStrike)
{
option = "Lightning Strike";
}
else if (this is MomentumStrike)
{
option = "Momentum Strike";
}
Backstab => "Backstab",
DeathStrike => "Death Strike",
FocusAttack => "Focus Attack",
KiAttack => "Ki Attack",
SurpriseAttack => "Surprise Attack",
HonorableExecution => "Honorable Execution",
LightningStrike => "Lightning Strike",
MomentumStrike => "Momentum Strike",
_ => null
};
if (option != null && !DuelContext.AllowSpecialMove(from, option, this))
{
@ -303,7 +280,7 @@ namespace Server.Spells
private static void AddContext(Mobile m, SpecialMoveContext context)
{
m_PlayersTable[m] = context;
_playersTable[m] = context;
}
private static void RemoveContext(Mobile m)
@ -312,23 +289,20 @@ namespace Server.Spells
if (context != null)
{
m_PlayersTable.Remove(m);
_playersTable.Remove(m);
context.Timer.Stop();
}
}
private static SpecialMoveContext GetContext(Mobile m) =>
m_PlayersTable.TryGetValue(m, out var context) ? context : null;
_playersTable.TryGetValue(m, out var context) ? context : null;
private class SpecialMoveTimer : Timer
{
private readonly Mobile m_Mobile;
public SpecialMoveTimer(Mobile from) : base(TimeSpan.FromSeconds(3.0))
{
m_Mobile = from;
}
public SpecialMoveTimer(Mobile from) : base(TimeSpan.FromSeconds(3.0)) => m_Mobile = from;
protected override void OnTick()
{