Fixes chaos damage bug with the spell system. Fixes various small other bugs. Fixes more merge cast type checks and uses default values.

This commit is contained in:
Kamron Batman 2018-09-16 21:04:36 -07:00
parent 9542c79ea4
commit c155c82325
115 changed files with 644 additions and 1041 deletions

View file

@ -39,8 +39,8 @@ namespace Server.Spells.Seventh
{
SpellHelper.Turn(Caster, p);
if (p is Item)
p = ((Item)p).GetWorldLocation();
if (p is Item item)
p = item.GetWorldLocation();
List<Mobile> targets = new List<Mobile>();
@ -86,10 +86,9 @@ namespace Server.Spells.Seventh
else if (!Core.AOS)
damage /= targets.Count;
double toDeal;
for (int i = 0; i < targets.Count; ++i)
{
toDeal = damage;
double toDeal = damage;
Mobile m = targets[i];
if (!Core.AOS && CheckResisted(m))
@ -126,9 +125,7 @@ namespace Server.Spells.Seventh
protected override void OnTarget(Mobile from, object o)
{
IPoint3D p = o as IPoint3D;
if (p != null)
if (o is IPoint3D p)
m_Owner.Target(p);
}

View file

@ -188,8 +188,8 @@ namespace Server.Spells.Seventh
protected override void OnTarget(Mobile from, object o)
{
if (o is IPoint3D)
m_Owner.Target((IPoint3D)o);
if (o is IPoint3D d)
m_Owner.Target(d);
}
protected override void OnTargetFinish(Mobile from)

View file

@ -77,7 +77,8 @@ namespace Server.Spells.Seventh
protected override void OnTarget(Mobile from, object o)
{
if (o is Mobile) m_Owner.Target((Mobile)o);
if (o is Mobile mobile)
m_Owner.Target(mobile);
}
protected override void OnTargetFinish(Mobile from)

View file

@ -1,4 +1,5 @@
using System;
using System.Linq;
using Server.Factions;
using Server.Items;
using Server.Misc;
@ -65,19 +66,11 @@ namespace Server.Spells.Seventh
private bool GateExistsAt(Map map, Point3D loc)
{
bool _gateFound = false;
IPooledEnumerable<Item> eable = map.GetItemsInRange(loc, 0);
foreach (Item item in eable)
if (item is Moongate || item is PublicMoongate)
{
_gateFound = true;
break;
}
bool gateFound = eable.Any(item => item is Moongate || item is PublicMoongate);
eable.Free();
return _gateFound;
return gateFound;
}
public void Effect(Point3D loc, Map map, bool checkMulti)
@ -96,9 +89,9 @@ namespace Server.Spells.Seventh
else if (!SpellHelper.CheckTravel(Caster, map, loc, TravelCheckType.GateTo))
{
}
else if (map == Map.Felucca && Caster is PlayerMobile && ((PlayerMobile)Caster).Young)
else if (map == Map.Felucca && Caster is PlayerMobile mobile && mobile.Young)
{
Caster.SendLocalizedMessage(1049543); // You decide against traveling to Felucca while you are still young.
mobile.SendLocalizedMessage(1049543); // You decide against traveling to Felucca while you are still young.
}
else if (Caster.Kills >= 5 && map != Map.Felucca)
{
@ -207,18 +200,16 @@ namespace Server.Spells.Seventh
protected override void OnTarget(Mobile from, object o)
{
if (o is RecallRune)
if (o is RecallRune rune)
{
RecallRune rune = (RecallRune)o;
if (rune.Marked)
m_Owner.Effect(rune.Target, rune.TargetMap, true);
else
from.SendLocalizedMessage(501803); // That rune is not yet marked.
}
else if (o is Runebook)
else if (o is Runebook runebook)
{
RunebookEntry e = ((Runebook)o).Default;
RunebookEntry e = runebook.Default;
if (e != null)
m_Owner.Effect(e.Location, e.Map, true);
@ -234,10 +225,8 @@ namespace Server.Spells.Seventh
else
from.Send( new MessageLocalized( from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 501030, from.Name, "" ) ); // I can not gate travel from that object.
}*/
else if (o is HouseRaffleDeed && ((HouseRaffleDeed)o).ValidLocation())
else if (o is HouseRaffleDeed deed && deed.ValidLocation())
{
HouseRaffleDeed deed = (HouseRaffleDeed)o;
m_Owner.Effect(deed.PlotLocation, deed.PlotFacet, true);
}
else

View file

@ -104,7 +104,7 @@ namespace Server.Spells.Seventh
protected override void OnTarget(Mobile from, object o)
{
if (o is Mobile) m_Owner.Target((Mobile)o);
if (o is Mobile mobile)m_Owner.Target(mobile);
}
protected override void OnTargetFinish(Mobile from)

View file

@ -59,9 +59,7 @@ namespace Server.Spells.Seventh
{
Mobile m = targets[i];
BaseCreature bc = m as BaseCreature;
if (bc == null)
if (!(m is BaseCreature bc))
continue;
double dispelChance =
@ -98,9 +96,7 @@ namespace Server.Spells.Seventh
protected override void OnTarget(Mobile from, object o)
{
IPoint3D p = o as IPoint3D;
if (p != null)
if (o is IPoint3D p)
m_Owner.Target(p);
}

View file

@ -39,8 +39,8 @@ namespace Server.Spells.Seventh
{
SpellHelper.Turn(Caster, p);
if (p is Item)
p = ((Item)p).GetWorldLocation();
if (p is Item item)
p = item.GetWorldLocation();
List<Mobile> targets = new List<Mobile>();
@ -120,9 +120,7 @@ namespace Server.Spells.Seventh
protected override void OnTarget(Mobile from, object o)
{
IPoint3D p = o as IPoint3D;
if (p != null)
if (o is IPoint3D p)
m_Owner.Target(p);
}