Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)
This commit is contained in:
parent
e748af4430
commit
513e54f70e
1094 changed files with 15913 additions and 21892 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
using Server.Targeting;
|
||||
|
|
@ -38,14 +39,11 @@ namespace Server.Items
|
|||
return false;
|
||||
}
|
||||
|
||||
int sulfAsh = Core.AOS ? 4 : 15;
|
||||
if (from.Backpack == null || from.Backpack.GetAmount(typeof(SulfurousAsh)) < sulfAsh)
|
||||
{
|
||||
from.SendLocalizedMessage(1049617); // You do not have enough sulfurous ash.
|
||||
return false;
|
||||
}
|
||||
if (from.Backpack?.GetAmount(typeof(SulfurousAsh)) >= (Core.AOS ? 4 : 15))
|
||||
return true;
|
||||
|
||||
return true;
|
||||
from.SendLocalizedMessage(1049617); // You do not have enough sulfurous ash.
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
|
|
@ -85,22 +83,21 @@ namespace Server.Items
|
|||
new HuedEffect(EffectType.Moving, from.Serial, Serial.Zero, 0x36D4, from.Location, loc, 5, 0, false, true, 0,
|
||||
0));
|
||||
|
||||
List<Mobile> targets = new List<Mobile>();
|
||||
bool playerVsPlayer = false;
|
||||
|
||||
IPooledEnumerable<Mobile> eable = from.Map.GetMobilesInRange(new Point3D(loc), 2);
|
||||
|
||||
foreach (Mobile m in eable)
|
||||
if (from != m && SpellHelper.ValidIndirectTarget(from, m) && from.CanBeHarmful(m, false))
|
||||
{
|
||||
if (Core.AOS && !from.InLOS(m))
|
||||
continue;
|
||||
bool playerVsPlayer = false;
|
||||
List<Mobile> targets = eable.Where(m =>
|
||||
{
|
||||
if (from == m || !SpellHelper.ValidIndirectTarget(from, m) || !from.CanBeHarmful(m, false)
|
||||
|| Core.AOS && !from.InLOS(m))
|
||||
return false;
|
||||
|
||||
targets.Add(m);
|
||||
if (m.Player)
|
||||
playerVsPlayer = true;
|
||||
|
||||
if (m.Player)
|
||||
playerVsPlayer = true;
|
||||
}
|
||||
return true;
|
||||
|
||||
}).ToList();
|
||||
|
||||
eable.Free();
|
||||
|
||||
|
|
@ -219,4 +216,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue