cleanup: Fixes bugs and cleans up code (#660)
This commit is contained in:
parent
1de0b656a9
commit
679e8100f4
99 changed files with 160 additions and 346 deletions
|
|
@ -114,7 +114,7 @@ namespace Server.Spells
|
|||
|
||||
var t = m_Types[spellID];
|
||||
|
||||
if (t == null || !t.IsSubclassOf(typeof(SpecialMove)))
|
||||
if (t?.IsSubclassOf(typeof(SpecialMove)) != true)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,24 +43,7 @@ namespace Server.Spells.Fifth
|
|||
var rx = (dx - dy) * 44;
|
||||
var ry = (dx + dy) * 44;
|
||||
|
||||
bool eastToWest;
|
||||
|
||||
if (rx >= 0 && ry >= 0)
|
||||
{
|
||||
eastToWest = false;
|
||||
}
|
||||
else if (rx >= 0)
|
||||
{
|
||||
eastToWest = true;
|
||||
}
|
||||
else if (ry >= 0)
|
||||
{
|
||||
eastToWest = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
eastToWest = false;
|
||||
}
|
||||
bool eastToWest = rx == 0 && ry >= 0 || rx >= 0 && ry == 0;
|
||||
|
||||
Effects.PlaySound(new Point3D(p), Caster.Map, 0x20B);
|
||||
|
||||
|
|
@ -169,24 +152,13 @@ namespace Server.Spells.Fifth
|
|||
|
||||
if (Core.AOS)
|
||||
{
|
||||
var total = (m_Caster.Skills.Magery.Fixed + m_Caster.Skills.Poisoning.Fixed) / 2;
|
||||
|
||||
if (total >= 1000)
|
||||
p = ((m_Caster.Skills.Magery.Fixed + m_Caster.Skills.Poisoning.Fixed) / 2) switch
|
||||
{
|
||||
p = Poison.Deadly;
|
||||
}
|
||||
else if (total > 850)
|
||||
{
|
||||
p = Poison.Greater;
|
||||
}
|
||||
else if (total > 650)
|
||||
{
|
||||
p = Poison.Regular;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = Poison.Lesser;
|
||||
}
|
||||
>= 1000 => Poison.Deadly,
|
||||
> 850 => Poison.Greater,
|
||||
> 650 => Poison.Regular,
|
||||
_ => Poison.Lesser
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -220,7 +192,7 @@ namespace Server.Spells.Fifth
|
|||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private static readonly Queue<Mobile> m_Queue = new();
|
||||
private static Queue<Mobile> m_Queue;
|
||||
private readonly bool m_CanFit;
|
||||
private readonly bool m_InLOS;
|
||||
private readonly InternalItem m_Item;
|
||||
|
|
@ -292,13 +264,14 @@ namespace Server.Spells.Fifth
|
|||
if (m.Z + 16 > m_Item.Z && m_Item.Z + 12 > m.Z && (!Core.AOS || m != caster) &&
|
||||
SpellHelper.ValidIndirectTarget(caster, m) && caster.CanBeHarmful(m, false))
|
||||
{
|
||||
m_Queue ??= new Queue<Mobile>();
|
||||
m_Queue.Enqueue(m);
|
||||
}
|
||||
}
|
||||
|
||||
eable.Free();
|
||||
|
||||
while (m_Queue.Count > 0)
|
||||
while (m_Queue?.Count > 0)
|
||||
{
|
||||
var m = m_Queue.Dequeue();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
using Server.Misc;
|
||||
using Server.Mobiles;
|
||||
|
|
@ -43,24 +43,7 @@ namespace Server.Spells.Fourth
|
|||
var rx = (dx - dy) * 44;
|
||||
var ry = (dx + dy) * 44;
|
||||
|
||||
bool eastToWest;
|
||||
|
||||
if (rx >= 0 && ry >= 0)
|
||||
{
|
||||
eastToWest = false;
|
||||
}
|
||||
else if (rx >= 0)
|
||||
{
|
||||
eastToWest = true;
|
||||
}
|
||||
else if (ry >= 0)
|
||||
{
|
||||
eastToWest = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
eastToWest = false;
|
||||
}
|
||||
bool eastToWest = rx == 0 && ry >= 0 || rx >= 0 && ry == 0;
|
||||
|
||||
Effects.PlaySound(new Point3D(p), Caster.Map, 0x20C);
|
||||
|
||||
|
|
@ -216,15 +199,12 @@ namespace Server.Spells.Fourth
|
|||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private static readonly Queue m_Queue = new();
|
||||
private static Queue<Mobile> m_Queue;
|
||||
private readonly bool m_CanFit;
|
||||
private readonly bool m_InLOS;
|
||||
private readonly FireFieldItem m_Item;
|
||||
|
||||
public InternalTimer(FireFieldItem item, TimeSpan delay, bool inLOS, bool canFit) : base(
|
||||
delay,
|
||||
TimeSpan.FromSeconds(1.0)
|
||||
)
|
||||
public InternalTimer(FireFieldItem item, TimeSpan delay, bool inLOS, bool canFit) : base(delay, TimeSpan.FromSeconds(1.0))
|
||||
{
|
||||
m_Item = item;
|
||||
m_InLOS = inLOS;
|
||||
|
|
@ -281,13 +261,14 @@ namespace Server.Spells.Fourth
|
|||
if (m.Z + 16 > m_Item.Z && m_Item.Z + 12 > m.Z && (!Core.AOS || m != caster) &&
|
||||
SpellHelper.ValidIndirectTarget(caster, m) && caster.CanBeHarmful(m, false))
|
||||
{
|
||||
m_Queue ??= new Queue<Mobile>();
|
||||
m_Queue.Enqueue(m);
|
||||
}
|
||||
}
|
||||
|
||||
while (m_Queue.Count > 0)
|
||||
while (m_Queue?.Count > 0)
|
||||
{
|
||||
var m = m_Queue.Dequeue() as Mobile;
|
||||
var m = m_Queue.Dequeue();
|
||||
if (m == null)
|
||||
{
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ namespace Server.Spells.Necromancy
|
|||
{
|
||||
if (!m_Table.ContainsKey(target))
|
||||
{
|
||||
var tmpB = new MRBucket(scalar, new MRExpireTimer(caster, target, duration));
|
||||
var tmpB = new MRBucket(scalar, new MRExpireTimer(target, duration));
|
||||
m_Table.Add(target, tmpB);
|
||||
BuffInfo.AddBuff(target, new BuffInfo(BuffIcon.Mindrot, 1075665, duration, target));
|
||||
tmpB.m_MRExpireTimer.Start();
|
||||
|
|
@ -113,7 +113,7 @@ namespace Server.Spells.Necromancy
|
|||
private readonly DateTime m_End;
|
||||
private readonly Mobile m_Target;
|
||||
|
||||
public MRExpireTimer(Mobile caster, Mobile target, TimeSpan delay) : base(
|
||||
public MRExpireTimer(Mobile target, TimeSpan delay) : base(
|
||||
TimeSpan.FromSeconds(1.0),
|
||||
TimeSpan.FromSeconds(1.0)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -43,24 +43,8 @@ namespace Server.Spells.Seventh
|
|||
var rx = (dx - dy) * 44;
|
||||
var ry = (dx + dy) * 44;
|
||||
|
||||
bool eastToWest;
|
||||
bool eastToWest = rx == 0 && ry >= 0 || rx >= 0 && ry == 0;
|
||||
|
||||
if (rx >= 0 && ry >= 0)
|
||||
{
|
||||
eastToWest = false;
|
||||
}
|
||||
else if (rx >= 0)
|
||||
{
|
||||
eastToWest = true;
|
||||
}
|
||||
else if (ry >= 0)
|
||||
{
|
||||
eastToWest = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
eastToWest = false;
|
||||
}
|
||||
|
||||
Effects.PlaySound(new Point3D(p), Caster.Map, 0x20B);
|
||||
|
||||
|
|
|
|||
|
|
@ -42,24 +42,7 @@ namespace Server.Spells.Sixth
|
|||
var rx = (dx - dy) * 44;
|
||||
var ry = (dx + dy) * 44;
|
||||
|
||||
bool eastToWest;
|
||||
|
||||
if (rx >= 0 && ry >= 0)
|
||||
{
|
||||
eastToWest = false;
|
||||
}
|
||||
else if (rx >= 0)
|
||||
{
|
||||
eastToWest = true;
|
||||
}
|
||||
else if (ry >= 0)
|
||||
{
|
||||
eastToWest = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
eastToWest = false;
|
||||
}
|
||||
bool eastToWest = rx == 0 && ry >= 0 || rx >= 0 && ry == 0;
|
||||
|
||||
Effects.PlaySound(new Point3D(p), Caster.Map, 0x20B);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using System;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells
|
||||
|
|
|
|||
|
|
@ -40,24 +40,7 @@ namespace Server.Spells.Third
|
|||
var rx = (dx - dy) * 44;
|
||||
var ry = (dx + dy) * 44;
|
||||
|
||||
bool eastToWest;
|
||||
|
||||
if (rx >= 0 && ry >= 0)
|
||||
{
|
||||
eastToWest = false;
|
||||
}
|
||||
else if (rx >= 0)
|
||||
{
|
||||
eastToWest = true;
|
||||
}
|
||||
else if (ry >= 0)
|
||||
{
|
||||
eastToWest = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
eastToWest = false;
|
||||
}
|
||||
bool eastToWest = rx == 0 && ry >= 0 || rx >= 0 && ry == 0;
|
||||
|
||||
Effects.PlaySound(new Point3D(p), Caster.Map, 0x1F6);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue