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:
parent
9542c79ea4
commit
c155c82325
115 changed files with 644 additions and 1041 deletions
|
|
@ -36,29 +36,23 @@ namespace Server
|
|||
|
||||
public static int Damage(Mobile m, Mobile from, int damage, int phys, int fire, int cold, int pois, int nrgy)
|
||||
{
|
||||
return Damage(m, from, damage, false, phys, fire, cold, pois, nrgy, 0, 0, false, false, false);
|
||||
return Damage(m, from, damage, false, phys, fire, cold, pois, nrgy);
|
||||
}
|
||||
|
||||
public static int Damage(Mobile m, Mobile from, int damage, int phys, int fire, int cold, int pois, int nrgy,
|
||||
int chaos)
|
||||
{
|
||||
return Damage(m, from, damage, false, phys, fire, cold, pois, nrgy, chaos, 0, false, false, false);
|
||||
}
|
||||
|
||||
public static int Damage(Mobile m, Mobile from, int damage, bool ignoreArmor, int phys, int fire, int cold, int pois,
|
||||
int nrgy)
|
||||
{
|
||||
return Damage(m, from, damage, ignoreArmor, phys, fire, cold, pois, nrgy, 0, 0, false, false, false);
|
||||
return Damage(m, from, damage, false, phys, fire, cold, pois, nrgy, chaos);
|
||||
}
|
||||
|
||||
public static int Damage(Mobile m, Mobile from, int damage, int phys, int fire, int cold, int pois, int nrgy,
|
||||
bool keepAlive)
|
||||
{
|
||||
return Damage(m, from, damage, false, phys, fire, cold, pois, nrgy, 0, 0, keepAlive, false, false);
|
||||
return Damage(m, from, damage, false, phys, fire, cold, pois, nrgy, 0, 0, keepAlive);
|
||||
}
|
||||
|
||||
public static int Damage(Mobile m, Mobile from, int damage, bool ignoreArmor, int phys, int fire, int cold, int pois,
|
||||
int nrgy, int chaos, int direct, bool keepAlive, bool archer, bool deathStrike)
|
||||
int nrgy, int chaos = 0, int direct = 0, bool keepAlive = false, bool archer = false, bool deathStrike = false)
|
||||
{
|
||||
if (m == null || m.Deleted || !m.Alive || damage <= 0)
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ namespace Server.Mobiles
|
|||
AddLoot(LootPack.Gems, 4);
|
||||
}
|
||||
|
||||
public override double GetControlChance(Mobile m, bool useBaseSkill)
|
||||
public override double GetControlChance(Mobile m, bool useBaseSkill = false)
|
||||
{
|
||||
double tamingChance = base.GetControlChance(m, useBaseSkill);
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace Server.Mobiles
|
|||
return true;
|
||||
}
|
||||
|
||||
public override double GetControlChance(Mobile m, bool useBaseSkill)
|
||||
public override double GetControlChance(Mobile m, bool useBaseSkill = false)
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace Server.Mobiles
|
|||
return true;
|
||||
}
|
||||
|
||||
public override double GetControlChance(Mobile m, bool useBaseSkill)
|
||||
public override double GetControlChance(Mobile m, bool useBaseSkill = false)
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ namespace Server.Mobiles
|
|||
return true;
|
||||
}
|
||||
|
||||
public override double GetControlChance(Mobile m, bool useBaseSkill)
|
||||
public override double GetControlChance(Mobile m, bool useBaseSkill = false)
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ namespace Server.Mobiles
|
|||
return 0x2C8;
|
||||
}
|
||||
|
||||
public override double GetControlChance(Mobile m, bool useBaseSkill)
|
||||
public override double GetControlChance(Mobile m, bool useBaseSkill = false)
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ namespace Server.Mobiles
|
|||
return 0x21D;
|
||||
}
|
||||
|
||||
public override double GetControlChance(Mobile m, bool useBaseSkill)
|
||||
public override double GetControlChance(Mobile m, bool useBaseSkill = false)
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,9 +66,7 @@ namespace Server.Mobiles
|
|||
|
||||
public override Item CreateBulkOrder(Mobile from, bool fromContextMenu)
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if (pm != null && pm.NextSmithBulkOrder == TimeSpan.Zero && (fromContextMenu || 0.2 > Utility.RandomDouble()))
|
||||
if (from is PlayerMobile pm && pm.NextSmithBulkOrder == TimeSpan.Zero && (fromContextMenu || 0.2 > Utility.RandomDouble()))
|
||||
{
|
||||
double theirSkill = pm.Skills[SkillName.Blacksmith].Base;
|
||||
|
||||
|
|
@ -100,16 +98,16 @@ namespace Server.Mobiles
|
|||
|
||||
public override TimeSpan GetNextBulkOrder(Mobile from)
|
||||
{
|
||||
if (from is PlayerMobile)
|
||||
return ((PlayerMobile)from).NextSmithBulkOrder;
|
||||
if (from is PlayerMobile mobile)
|
||||
return mobile.NextSmithBulkOrder;
|
||||
|
||||
return TimeSpan.Zero;
|
||||
}
|
||||
|
||||
public override void OnSuccessfulBulkOrderReceive(Mobile from)
|
||||
{
|
||||
if (Core.SE && from is PlayerMobile)
|
||||
((PlayerMobile)from).NextSmithBulkOrder = TimeSpan.Zero;
|
||||
if (Core.SE && from is PlayerMobile mobile)
|
||||
mobile.NextSmithBulkOrder = TimeSpan.Zero;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -47,9 +47,7 @@ namespace Server.Mobiles
|
|||
|
||||
public override Item CreateBulkOrder(Mobile from, bool fromContextMenu)
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if (pm != null && pm.NextTailorBulkOrder == TimeSpan.Zero && (fromContextMenu || 0.2 > Utility.RandomDouble()))
|
||||
if (from is PlayerMobile pm && pm.NextTailorBulkOrder == TimeSpan.Zero && (fromContextMenu || 0.2 > Utility.RandomDouble()))
|
||||
{
|
||||
double theirSkill = pm.Skills[SkillName.Tailoring].Base;
|
||||
|
||||
|
|
@ -81,16 +79,16 @@ namespace Server.Mobiles
|
|||
|
||||
public override TimeSpan GetNextBulkOrder(Mobile from)
|
||||
{
|
||||
if (from is PlayerMobile)
|
||||
return ((PlayerMobile)from).NextTailorBulkOrder;
|
||||
if (from is PlayerMobile mobile)
|
||||
return mobile.NextTailorBulkOrder;
|
||||
|
||||
return TimeSpan.Zero;
|
||||
}
|
||||
|
||||
public override void OnSuccessfulBulkOrderReceive(Mobile from)
|
||||
{
|
||||
if (Core.SE && from is PlayerMobile)
|
||||
((PlayerMobile)from).NextTailorBulkOrder = TimeSpan.Zero;
|
||||
if (Core.SE && from is PlayerMobile mobile)
|
||||
mobile.NextTailorBulkOrder = TimeSpan.Zero;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -309,33 +309,31 @@ namespace Server.Mobiles
|
|||
|
||||
public override bool CheckGold(Mobile from, Item dropped)
|
||||
{
|
||||
if (dropped is Gold)
|
||||
if (!(dropped is Gold g))
|
||||
return false;
|
||||
|
||||
if (g.Amount > 50)
|
||||
{
|
||||
Gold g = (Gold)dropped;
|
||||
PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "I cannot accept so large a tip!",
|
||||
from.NetState);
|
||||
}
|
||||
else
|
||||
{
|
||||
string tip = TipMessage;
|
||||
|
||||
if (g.Amount > 50)
|
||||
if (tip == null || (tip = tip.Trim()).Length == 0)
|
||||
{
|
||||
PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "I cannot accept so large a tip!",
|
||||
PrivateOverheadMessage(MessageType.Regular, 0x3B2, false,
|
||||
"It would not be fair of me to take your money and not offer you information in return.",
|
||||
from.NetState);
|
||||
}
|
||||
else
|
||||
{
|
||||
string tip = TipMessage;
|
||||
Direction = GetDirectionTo(from);
|
||||
PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, tip, from.NetState);
|
||||
|
||||
if (tip == null || (tip = tip.Trim()).Length == 0)
|
||||
{
|
||||
PrivateOverheadMessage(MessageType.Regular, 0x3B2, false,
|
||||
"It would not be fair of me to take your money and not offer you information in return.",
|
||||
from.NetState);
|
||||
}
|
||||
else
|
||||
{
|
||||
Direction = GetDirectionTo(from);
|
||||
PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, tip, from.NetState);
|
||||
|
||||
g.Delete();
|
||||
return true;
|
||||
}
|
||||
g.Delete();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -107,9 +107,9 @@ namespace Server.Mobiles
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!BaseHouse.NewVendorSystem && Parent is PlayerVendor)
|
||||
if (!BaseHouse.NewVendorSystem && Parent is PlayerVendor vendor)
|
||||
{
|
||||
BaseHouse house = ((PlayerVendor)Parent).House;
|
||||
BaseHouse house = vendor.House;
|
||||
|
||||
if (house != null && house.IsAosRules && !house.CheckAosStorage(1 + item.TotalItems + plusItems))
|
||||
{
|
||||
|
|
@ -155,9 +155,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
base.GetChildContextMenuEntries(from, list, item);
|
||||
|
||||
PlayerVendor pv = RootParent as PlayerVendor;
|
||||
|
||||
if (pv == null || pv.IsOwner(from))
|
||||
if (!(RootParent is PlayerVendor pv) || pv.IsOwner(from))
|
||||
return;
|
||||
|
||||
VendorItem vi = pv.GetVendorItem(item);
|
||||
|
|
@ -199,10 +197,8 @@ namespace Server.Mobiles
|
|||
|
||||
public override void OnSingleClickContained(Mobile from, Item item)
|
||||
{
|
||||
if (RootParent is PlayerVendor)
|
||||
if (RootParent is PlayerVendor vendor)
|
||||
{
|
||||
PlayerVendor vendor = (PlayerVendor)RootParent;
|
||||
|
||||
VendorItem vi = vendor.GetVendorItem(item);
|
||||
|
||||
if (vi != null)
|
||||
|
|
@ -985,9 +981,7 @@ namespace Server.Mobiles
|
|||
|
||||
public static void TryToBuy(Item item, Mobile from)
|
||||
{
|
||||
PlayerVendor vendor = item.RootParent as PlayerVendor;
|
||||
|
||||
if (vendor == null || !vendor.CanInteractWith(from, false))
|
||||
if (!(item.RootParent is PlayerVendor vendor) || !vendor.CanInteractWith(from, false))
|
||||
return;
|
||||
|
||||
if (vendor.IsOwner(from))
|
||||
|
|
@ -1330,7 +1324,8 @@ namespace Server.Mobiles
|
|||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (targeted is Item) TryToBuy((Item)targeted, from);
|
||||
if (targeted is Item item)
|
||||
TryToBuy(item, from);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1358,10 +1353,9 @@ namespace Server.Mobiles
|
|||
else
|
||||
firstWord = text;
|
||||
|
||||
int price;
|
||||
string description;
|
||||
|
||||
if (int.TryParse(firstWord, out price))
|
||||
if (int.TryParse(firstWord, out int price))
|
||||
{
|
||||
if (sep >= 0)
|
||||
description = text.Substring(sep + 1).Trim();
|
||||
|
|
@ -1397,7 +1391,7 @@ namespace Server.Mobiles
|
|||
|
||||
if (item is Container)
|
||||
{
|
||||
if (item is LockableContainer && ((LockableContainer)item).Locked)
|
||||
if (item is LockableContainer container && container.Locked)
|
||||
m_Vendor.SayTo(from, 1043298); // Locked items may not be made not-for-sale.
|
||||
else if (item.Items.Count > 0)
|
||||
m_Vendor.SayTo(from, 1043299); // To be not for sale, all items in a container must be for sale.
|
||||
|
|
@ -1448,9 +1442,7 @@ namespace Server.Mobiles
|
|||
|
||||
text = text.Trim();
|
||||
|
||||
int amount;
|
||||
|
||||
if (!int.TryParse(text, out amount))
|
||||
if (!int.TryParse(text, out int amount))
|
||||
amount = 0;
|
||||
|
||||
GiveGold(from, amount);
|
||||
|
|
|
|||
|
|
@ -110,9 +110,7 @@ namespace Server.Multis
|
|||
if (m_Owner == null)
|
||||
return Core.AOS ? DecayType.Condemned : DecayType.ManualRefresh;
|
||||
|
||||
Account acct = m_Owner.Account as Account;
|
||||
|
||||
if (acct == null)
|
||||
if (!(m_Owner.Account is Account acct))
|
||||
return Core.AOS ? DecayType.Condemned : DecayType.ManualRefresh;
|
||||
|
||||
if (acct.AccessLevel >= AccessLevel.GameMaster)
|
||||
|
|
@ -751,17 +749,18 @@ namespace Server.Multis
|
|||
if (!addon.Deleted)
|
||||
{
|
||||
Item deed = null;
|
||||
bool retainDeedHue = false; //if the items aren't hued but the deed itself is
|
||||
bool retainDeedHue = false; // if the items aren't hued but the deed itself is
|
||||
int hue = 0;
|
||||
|
||||
if (addon is IAddon)
|
||||
{
|
||||
deed = ((IAddon)addon).Deed;
|
||||
BaseAddon ba = addon as BaseAddon;
|
||||
|
||||
if (addon is BaseAddon && ((BaseAddon)addon).RetainDeedHue
|
||||
) //There are things that are IAddon which aren't BaseAddon
|
||||
if (addon is IAddon baseAddon)
|
||||
{
|
||||
deed = baseAddon.Deed;
|
||||
|
||||
// There are things that are IAddon which aren't BaseAddon
|
||||
if (ba?.RetainDeedHue == true)
|
||||
{
|
||||
BaseAddon ba = (BaseAddon)addon;
|
||||
retainDeedHue = true;
|
||||
|
||||
for (int i = 0; hue == 0 && i < ba.Components.Count; ++i)
|
||||
|
|
@ -778,16 +777,14 @@ namespace Server.Multis
|
|||
{
|
||||
#region Mondain's Legacy
|
||||
|
||||
if (deed is BaseAddonContainerDeed && addon is BaseAddonContainer)
|
||||
if (deed is BaseAddonContainerDeed containerDeed && addon is BaseAddonContainer c)
|
||||
{
|
||||
BaseAddonContainer c = (BaseAddonContainer)addon;
|
||||
c.DropItemsToGround();
|
||||
|
||||
((BaseAddonContainerDeed)deed).Resource = c.Resource;
|
||||
containerDeed.Resource = c.Resource;
|
||||
}
|
||||
else if (deed is BaseAddonDeed && addon is BaseAddon)
|
||||
else if (deed is BaseAddonDeed addonDeed && ba != null)
|
||||
{
|
||||
((BaseAddonDeed)deed).Resource = ((BaseAddon)addon).Resource;
|
||||
addonDeed.Resource = ba.Resource;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -874,10 +871,10 @@ namespace Server.Multis
|
|||
|
||||
RelocatedEntities.Add(relocEntity);
|
||||
|
||||
if (entity is Item)
|
||||
((Item)entity).Internalize();
|
||||
else
|
||||
((Mobile)entity).Internalize();
|
||||
if (entity is Item item)
|
||||
item.Internalize();
|
||||
else if (entity is Mobile mobile)
|
||||
mobile.Internalize();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -889,15 +886,14 @@ namespace Server.Multis
|
|||
Point3D location = new Point3D(relLoc.X + X, relLoc.Y + Y, relLoc.Z + Z);
|
||||
|
||||
IEntity entity = relocEntity.Entity;
|
||||
if (entity is Item)
|
||||
if (entity is Item item)
|
||||
{
|
||||
Item item = (Item)entity;
|
||||
|
||||
if (!item.Deleted)
|
||||
{
|
||||
if (item is IAddon)
|
||||
IAddon addon = item as IAddon;
|
||||
if (addon != null)
|
||||
{
|
||||
if (((IAddon)item).CouldFit(location, Map))
|
||||
if (addon.CouldFit(location, Map))
|
||||
{
|
||||
item.MoveToWorld(location, Map);
|
||||
continue;
|
||||
|
|
@ -939,19 +935,18 @@ namespace Server.Multis
|
|||
|
||||
Item relocateItem = item;
|
||||
|
||||
if (item is StrongBox)
|
||||
relocateItem = ((StrongBox)item).ConvertToStandardContainer();
|
||||
if (item is StrongBox box)
|
||||
relocateItem = box.ConvertToStandardContainer();
|
||||
|
||||
if (item is IAddon)
|
||||
if (addon != null)
|
||||
{
|
||||
Item deed = ((IAddon)item).Deed;
|
||||
Item deed = addon.Deed;
|
||||
bool retainDeedHue = false; //if the items aren't hued but the deed itself is
|
||||
int hue = 0;
|
||||
|
||||
if (item is BaseAddon && ((BaseAddon)item).RetainDeedHue
|
||||
if (item is BaseAddon ba && ba.RetainDeedHue
|
||||
) //There are things that are IAddon which aren't BaseAddon
|
||||
{
|
||||
BaseAddon ba = (BaseAddon)item;
|
||||
retainDeedHue = true;
|
||||
|
||||
for (int i = 0; hue == 0 && i < ba.Components.Count; ++i)
|
||||
|
|
@ -967,17 +962,14 @@ namespace Server.Multis
|
|||
|
||||
if (deed != null)
|
||||
{
|
||||
if (deed is BaseAddonContainerDeed && item is BaseAddonContainer)
|
||||
if (deed is BaseAddonContainerDeed containerDeed && item is BaseAddonContainer c)
|
||||
{
|
||||
BaseAddonContainer c = (BaseAddonContainer)item;
|
||||
c.DropItemsToGround();
|
||||
|
||||
((BaseAddonContainerDeed)deed).Resource = c.Resource;
|
||||
}
|
||||
else if (deed is BaseAddonDeed && item is BaseAddon)
|
||||
{
|
||||
((BaseAddonDeed)deed).Resource = ((BaseAddon)item).Resource;
|
||||
containerDeed.Resource = c.Resource;
|
||||
}
|
||||
else if (deed is BaseAddonDeed addonDeed && item is BaseAddon baseAddon)
|
||||
addonDeed.Resource = baseAddon.Resource;
|
||||
|
||||
if (retainDeedHue)
|
||||
deed.Hue = hue;
|
||||
|
|
@ -1004,17 +996,12 @@ namespace Server.Multis
|
|||
if (((SecureInfo)Secures[i]).Item == item)
|
||||
Secures.RemoveAt(i);
|
||||
}
|
||||
else
|
||||
else if (entity is Mobile mobile && !mobile.Deleted)
|
||||
{
|
||||
Mobile mobile = (Mobile)entity;
|
||||
|
||||
if (!mobile.Deleted)
|
||||
{
|
||||
if (Map.CanFit(location, 16, false, false))
|
||||
mobile.MoveToWorld(location, Map);
|
||||
else
|
||||
InternalizedVendors.Add(mobile);
|
||||
}
|
||||
if (Map.CanFit(location, 16, false, false))
|
||||
mobile.MoveToWorld(location, Map);
|
||||
else
|
||||
InternalizedVendors.Add(mobile);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1212,9 +1199,7 @@ namespace Server.Multis
|
|||
|
||||
for (int i = 0; i < sector.Multis.Count; ++i)
|
||||
{
|
||||
BaseHouse house = sector.Multis[i] as BaseHouse;
|
||||
|
||||
if (house != null && house.IsInside(loc, height))
|
||||
if (sector.Multis[i] is BaseHouse house && house.IsInside(loc, height))
|
||||
return house;
|
||||
}
|
||||
|
||||
|
|
@ -1254,8 +1239,8 @@ namespace Server.Multis
|
|||
return true;
|
||||
if (item is Runebook)
|
||||
return true;
|
||||
if (item is ISecurable)
|
||||
return HasSecureAccess(from, ((ISecurable)item).Level);
|
||||
if (item is ISecurable securable)
|
||||
return HasSecureAccess(from, securable.Level);
|
||||
if (item is Container)
|
||||
return IsCoOwner(from);
|
||||
if (item.Stackable)
|
||||
|
|
@ -1264,8 +1249,6 @@ namespace Server.Multis
|
|||
return IsFriend(from);
|
||||
if (item is PotionKeg)
|
||||
return IsFriend(from);
|
||||
if (item is BaseBoard)
|
||||
return true;
|
||||
if (item is Dices)
|
||||
return true;
|
||||
if (item is RecallRune)
|
||||
|
|
@ -1276,7 +1259,7 @@ namespace Server.Multis
|
|||
return true;
|
||||
if (item is BaseInstrument)
|
||||
return true;
|
||||
if (item is Dyes || item is DyeTub)
|
||||
if (item is Dyes)
|
||||
return true;
|
||||
if (item is VendorRentalContract)
|
||||
return true;
|
||||
|
|
@ -1358,10 +1341,10 @@ namespace Server.Multis
|
|||
item.Map = Map;
|
||||
|
||||
foreach (IEntity entity in GetHouseEntities())
|
||||
if (entity is Item)
|
||||
((Item)entity).Map = Map;
|
||||
else
|
||||
((Mobile)entity).Map = Map;
|
||||
if (entity is Item item)
|
||||
item.Map = Map;
|
||||
else if (entity is Mobile mobile)
|
||||
mobile.Map = Map;
|
||||
}
|
||||
|
||||
public virtual void ChangeSignType(int itemID)
|
||||
|
|
@ -1408,10 +1391,10 @@ namespace Server.Multis
|
|||
{
|
||||
Point3D newLocation = new Point3D(entity.X + x, entity.Y + y, entity.Z + z);
|
||||
|
||||
if (entity is Item)
|
||||
((Item)entity).Location = newLocation;
|
||||
else
|
||||
((Mobile)entity).Location = newLocation;
|
||||
if (entity is Item item)
|
||||
item.Location = newLocation;
|
||||
else if (entity is Mobile mobile)
|
||||
mobile.Location = newLocation;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1499,7 +1482,7 @@ namespace Server.Multis
|
|||
AddDoor(westDoor, x, y, z);
|
||||
AddDoor(eastDoor, x + 1, y, z);
|
||||
|
||||
return new BaseDoor[2] { westDoor, eastDoor };
|
||||
return new BaseDoor[] { westDoor, eastDoor };
|
||||
}
|
||||
|
||||
public uint CreateKeys(Mobile m)
|
||||
|
|
@ -1544,7 +1527,7 @@ namespace Server.Multis
|
|||
AddDoor(westDoor, x, y, z);
|
||||
AddDoor(eastDoor, x + 1, y, z);
|
||||
|
||||
return new BaseDoor[2] { westDoor, eastDoor };
|
||||
return new BaseDoor[] { westDoor, eastDoor };
|
||||
}
|
||||
|
||||
public BaseDoor MakeDoor(bool wood, DoorFacing facing)
|
||||
|
|
@ -1583,9 +1566,7 @@ namespace Server.Multis
|
|||
|
||||
if (m_Trash == null || m_Trash.Deleted)
|
||||
{
|
||||
m_Trash = new TrashBarrel();
|
||||
|
||||
m_Trash.Movable = false;
|
||||
m_Trash = new TrashBarrel { Movable = false };
|
||||
m_Trash.MoveToWorld(from.Location, from.Map);
|
||||
|
||||
from.SendLocalizedMessage(502121); /* You have a new trash barrel.
|
||||
|
|
@ -1604,25 +1585,16 @@ namespace Server.Multis
|
|||
Sign.MoveToWorld(new Point3D(X + xoff, Y + yoff, Z + zoff), Map);
|
||||
}
|
||||
|
||||
private void SetLockdown(Item i, bool locked)
|
||||
{
|
||||
SetLockdown(i, locked, false);
|
||||
}
|
||||
|
||||
private void SetLockdown(Item i, bool locked, bool checkContains)
|
||||
private void SetLockdown(Item i, bool locked, bool checkContains = false)
|
||||
{
|
||||
if (LockDowns == null)
|
||||
return;
|
||||
|
||||
#region Mondain's Legacy
|
||||
|
||||
if (i is BaseAddonContainer)
|
||||
i.Movable = false;
|
||||
else
|
||||
|
||||
#endregion
|
||||
|
||||
i.Movable = !locked;
|
||||
|
||||
i.IsLockedDown = locked;
|
||||
|
||||
if (locked)
|
||||
|
|
@ -1976,12 +1948,9 @@ namespace Server.Multis
|
|||
{
|
||||
AggressorInfo info = m.Aggressed[i];
|
||||
|
||||
Guild attackerGuild = m.Guild as Guild;
|
||||
Guild defenderGuild = info.Defender.Guild as Guild;
|
||||
|
||||
if (info.Defender.Player && info.Defender.Alive &&
|
||||
DateTime.UtcNow - info.LastCombatTime < HouseRegion.CombatHeatDelay &&
|
||||
(attackerGuild == null || defenderGuild == null ||
|
||||
(!(m.Guild is Guild attackerGuild) || !(info.Defender.Guild is Guild defenderGuild) ||
|
||||
defenderGuild != attackerGuild && !defenderGuild.IsEnemy(attackerGuild)))
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2063,7 +2032,7 @@ namespace Server.Multis
|
|||
{
|
||||
Container c = info.Item;
|
||||
|
||||
if (!c.Deleted && c is StrongBox && ((StrongBox)c).Owner == from)
|
||||
if (!c.Deleted && c is StrongBox box && box.Owner == from)
|
||||
{
|
||||
from.SendLocalizedMessage(502112); //You already have a strong box
|
||||
return;
|
||||
|
|
@ -2086,10 +2055,7 @@ namespace Server.Multis
|
|||
}
|
||||
}
|
||||
|
||||
StrongBox sb = new StrongBox(from, this);
|
||||
sb.Movable = false;
|
||||
sb.IsLockedDown = false;
|
||||
sb.IsSecure = true;
|
||||
StrongBox sb = new StrongBox(from, this) { Movable = false, IsLockedDown = false, IsSecure = true };
|
||||
Secures.Add(new SecureInfo(sb, SecureLevel.CoOwners));
|
||||
sb.MoveToWorld(from.Location, from.Map);
|
||||
}
|
||||
|
|
@ -2115,7 +2081,7 @@ namespace Server.Multis
|
|||
{
|
||||
from.SendLocalizedMessage(501352); // You may not eject someone who is not in your house!
|
||||
}
|
||||
else if (targ is BaseCreature && ((BaseCreature)targ).NoHouseRestrictions)
|
||||
else if (targ is BaseCreature creature && creature.NoHouseRestrictions)
|
||||
{
|
||||
from.SendLocalizedMessage(501347); // You cannot eject that from the house!
|
||||
}
|
||||
|
|
@ -2196,7 +2162,7 @@ namespace Server.Multis
|
|||
from.SendLocalizedMessage(
|
||||
1062521); // You cannot ban someone from a private house. Revoke their access instead.
|
||||
}
|
||||
else if (targ is BaseCreature && ((BaseCreature)targ).NoHouseRestrictions)
|
||||
else if (targ is BaseCreature bc && bc.NoHouseRestrictions)
|
||||
{
|
||||
from.SendLocalizedMessage(1062040); // You cannot ban that.
|
||||
}
|
||||
|
|
@ -2296,12 +2262,12 @@ namespace Server.Multis
|
|||
{
|
||||
Container c = info.Item;
|
||||
|
||||
if (c is StrongBox && ((StrongBox)c).Owner == targ)
|
||||
if (c is StrongBox box && box.Owner == targ)
|
||||
{
|
||||
c.IsLockedDown = false;
|
||||
c.IsSecure = false;
|
||||
box.IsLockedDown = false;
|
||||
box.IsSecure = false;
|
||||
Secures.Remove(info);
|
||||
c.Destroy();
|
||||
box.Destroy();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -2452,9 +2418,8 @@ namespace Server.Multis
|
|||
{
|
||||
Item item = (Item)LockDowns[i];
|
||||
|
||||
if (item is Container && !(item is BaseBoard || item is Aquarium || item is FishBowl))
|
||||
if (item is Container cont && !(cont is BaseBoard || cont is Aquarium || cont is FishBowl))
|
||||
{
|
||||
Container cont = (Container)item;
|
||||
List<Item> children = cont.Items;
|
||||
|
||||
for (int j = 0; j < children.Count; ++j)
|
||||
|
|
@ -2640,9 +2605,7 @@ namespace Server.Multis
|
|||
|
||||
for (int i = 0; i < items.Count; ++i)
|
||||
{
|
||||
Container c = items[i] as Container;
|
||||
|
||||
if (c != null)
|
||||
if (items[i] is Container c)
|
||||
{
|
||||
c.IsSecure = true;
|
||||
Secures.Add(new SecureInfo(c, SecureLevel.CoOwners));
|
||||
|
|
@ -2888,16 +2851,15 @@ namespace Server.Multis
|
|||
|
||||
if (item != null)
|
||||
{
|
||||
if (!item.Deleted && item is IAddon)
|
||||
if (!item.Deleted && item is IAddon addon)
|
||||
{
|
||||
Item deed = ((IAddon)item).Deed;
|
||||
Item deed = addon.Deed;
|
||||
bool retainDeedHue = false; //if the items aren't hued but the deed itself is
|
||||
int hue = 0;
|
||||
|
||||
if (item is BaseAddon && ((BaseAddon)item).RetainDeedHue
|
||||
if (addon is BaseAddon ba && ba.RetainDeedHue
|
||||
) //There are things that are IAddon which aren't BaseAddon
|
||||
{
|
||||
BaseAddon ba = (BaseAddon)item;
|
||||
retainDeedHue = true;
|
||||
|
||||
for (int j = 0; hue == 0 && j < ba.Components.Count; ++j)
|
||||
|
|
@ -2959,9 +2921,7 @@ namespace Server.Multis
|
|||
|
||||
public static bool HasAccountHouse(Mobile m)
|
||||
{
|
||||
Account a = m.Account as Account;
|
||||
|
||||
if (a == null)
|
||||
if (!(m.Account is Account a))
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < a.Length; ++i)
|
||||
|
|
@ -3009,9 +2969,7 @@ namespace Server.Multis
|
|||
|
||||
for (int i = 0; keyValue == 0 && i < Doors.Count; ++i)
|
||||
{
|
||||
BaseDoor door = Doors[i] as BaseDoor;
|
||||
|
||||
if (door != null)
|
||||
if (Doors[i] is BaseDoor door)
|
||||
keyValue = door.KeyValue;
|
||||
}
|
||||
|
||||
|
|
@ -3026,9 +2984,7 @@ namespace Server.Multis
|
|||
if (Doors != null)
|
||||
for (int i = 0; i < Doors.Count; ++i)
|
||||
{
|
||||
BaseDoor door = Doors[i] as BaseDoor;
|
||||
|
||||
if (door != null)
|
||||
if (Doors[i] is BaseDoor door)
|
||||
door.KeyValue = keyValue;
|
||||
}
|
||||
}
|
||||
|
|
@ -3038,9 +2994,7 @@ namespace Server.Multis
|
|||
if (Doors != null)
|
||||
for (int i = 0; i < Doors.Count; ++i)
|
||||
{
|
||||
BaseDoor door = Doors[i] as BaseDoor;
|
||||
|
||||
if (door != null)
|
||||
if (Doors[i] is BaseDoor door)
|
||||
{
|
||||
door.KeyValue = 0;
|
||||
door.Locked = false;
|
||||
|
|
@ -3075,9 +3029,7 @@ namespace Server.Multis
|
|||
if (c == m)
|
||||
return true;
|
||||
|
||||
Account bannedAccount = c.Account as Account;
|
||||
|
||||
if (bannedAccount != null && bannedAccount == theirAccount)
|
||||
if (c.Account is Account bannedAccount && bannedAccount == theirAccount)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -3092,10 +3044,8 @@ namespace Server.Multis
|
|||
if (m.AccessLevel > AccessLevel.Player || IsFriend(m) || Access != null && Access.Contains(m))
|
||||
return true;
|
||||
|
||||
if (m is BaseCreature)
|
||||
if (m is BaseCreature bc)
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)m;
|
||||
|
||||
if (bc.NoHouseRestrictions)
|
||||
return true;
|
||||
|
||||
|
|
@ -3425,57 +3375,43 @@ namespace Server.Multis
|
|||
if (!from.Alive || m_House.Deleted || !m_House.IsCoOwner(from))
|
||||
return;
|
||||
|
||||
if (targeted is Item)
|
||||
if (targeted is Item item)
|
||||
{
|
||||
if (m_Release)
|
||||
{
|
||||
#region Mondain's legacy
|
||||
|
||||
if (targeted is AddonContainerComponent)
|
||||
if (item is AddonContainerComponent component)
|
||||
{
|
||||
AddonContainerComponent component = (AddonContainerComponent)targeted;
|
||||
|
||||
if (component.Addon != null)
|
||||
m_House.Release(from, component.Addon);
|
||||
}
|
||||
else
|
||||
|
||||
#endregion
|
||||
|
||||
{
|
||||
m_House.Release(from, (Item)targeted);
|
||||
m_House.Release(from, item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (targeted is VendorRentalContract)
|
||||
if (item is VendorRentalContract)
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2,
|
||||
1062392); // You must double click the contract in your pack to lock it down.
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501732); // I cannot lock this down!
|
||||
}
|
||||
else if ((Item)targeted is AddonComponent)
|
||||
else if (item is AddonComponent)
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3E9, 501727); // You cannot lock that down!
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3E9, 501732); // I cannot lock this down!
|
||||
}
|
||||
else
|
||||
{
|
||||
#region Mondain's legacy
|
||||
|
||||
if (targeted is AddonContainerComponent)
|
||||
if (item is AddonContainerComponent component)
|
||||
{
|
||||
AddonContainerComponent component = (AddonContainerComponent)targeted;
|
||||
|
||||
if (component.Addon != null)
|
||||
m_House.LockDown(from, component.Addon);
|
||||
}
|
||||
else
|
||||
|
||||
#endregion
|
||||
|
||||
{
|
||||
m_House.LockDown(from, (Item)targeted);
|
||||
m_House.LockDown(from, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3513,30 +3449,23 @@ namespace Server.Multis
|
|||
if (!from.Alive || m_House.Deleted || !m_House.IsCoOwner(from))
|
||||
return;
|
||||
|
||||
if (targeted is Item)
|
||||
if (targeted is Item item)
|
||||
{
|
||||
if (m_Release)
|
||||
{
|
||||
#region Mondain's legacy
|
||||
|
||||
if (targeted is AddonContainerComponent)
|
||||
if (item is AddonContainerComponent component)
|
||||
{
|
||||
AddonContainerComponent component = (AddonContainerComponent)targeted;
|
||||
|
||||
if (component.Addon != null)
|
||||
m_House.ReleaseSecure(from, component.Addon);
|
||||
}
|
||||
else
|
||||
|
||||
#endregion
|
||||
|
||||
{
|
||||
m_House.ReleaseSecure(from, (Item)targeted);
|
||||
m_House.ReleaseSecure(from, item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (targeted is VendorRentalContract)
|
||||
if (item is VendorRentalContract)
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2,
|
||||
1062392); // You must double click the contract in your pack to lock it down.
|
||||
|
|
@ -3544,21 +3473,14 @@ namespace Server.Multis
|
|||
}
|
||||
else
|
||||
{
|
||||
#region Mondain's legacy
|
||||
|
||||
if (targeted is AddonContainerComponent)
|
||||
if (item is AddonContainerComponent component)
|
||||
{
|
||||
AddonContainerComponent component = (AddonContainerComponent)targeted;
|
||||
|
||||
if (component.Addon != null)
|
||||
m_House.AddSecure(from, component.Addon);
|
||||
}
|
||||
else
|
||||
|
||||
#endregion
|
||||
|
||||
{
|
||||
m_House.AddSecure(from, (Item)targeted);
|
||||
m_House.AddSecure(from, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3586,8 +3508,8 @@ namespace Server.Multis
|
|||
if (!from.Alive || m_House.Deleted || !m_House.IsFriend(from))
|
||||
return;
|
||||
|
||||
if (targeted is Mobile)
|
||||
m_House.Kick(from, (Mobile)targeted);
|
||||
if (targeted is Mobile mobile)
|
||||
m_House.Kick(from, mobile);
|
||||
else
|
||||
from.SendLocalizedMessage(501347); //You cannot eject that from the house!
|
||||
}
|
||||
|
|
@ -3611,12 +3533,12 @@ namespace Server.Multis
|
|||
if (!from.Alive || m_House.Deleted || !m_House.IsFriend(from))
|
||||
return;
|
||||
|
||||
if (targeted is Mobile)
|
||||
if (targeted is Mobile mobile)
|
||||
{
|
||||
if (m_Banning)
|
||||
m_House.Ban(from, (Mobile)targeted);
|
||||
m_House.Ban(from, mobile);
|
||||
else
|
||||
m_House.RemoveBan(from, (Mobile)targeted);
|
||||
m_House.RemoveBan(from, mobile);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3641,8 +3563,8 @@ namespace Server.Multis
|
|||
if (!from.Alive || m_House.Deleted || !m_House.IsFriend(from))
|
||||
return;
|
||||
|
||||
if (targeted is Mobile)
|
||||
m_House.GrantAccess(from, (Mobile)targeted);
|
||||
if (targeted is Mobile mobile)
|
||||
m_House.GrantAccess(from, mobile);
|
||||
else
|
||||
from.SendLocalizedMessage(1060712); // That is not a player.
|
||||
}
|
||||
|
|
@ -3666,12 +3588,12 @@ namespace Server.Multis
|
|||
if (!from.Alive || m_House.Deleted || !m_House.IsOwner(from))
|
||||
return;
|
||||
|
||||
if (targeted is Mobile)
|
||||
if (targeted is Mobile mobile)
|
||||
{
|
||||
if (m_Add)
|
||||
m_House.AddCoOwner(from, (Mobile)targeted);
|
||||
m_House.AddCoOwner(from, mobile);
|
||||
else
|
||||
m_House.RemoveCoOwner(from, (Mobile)targeted);
|
||||
m_House.RemoveCoOwner(from, mobile);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3698,12 +3620,12 @@ namespace Server.Multis
|
|||
if (!from.Alive || m_House.Deleted || !m_House.IsCoOwner(from))
|
||||
return;
|
||||
|
||||
if (targeted is Mobile)
|
||||
if (targeted is Mobile mobile)
|
||||
{
|
||||
if (m_Add)
|
||||
m_House.AddFriend(from, (Mobile)targeted);
|
||||
m_House.AddFriend(from, mobile);
|
||||
else
|
||||
m_House.RemoveFriend(from, (Mobile)targeted);
|
||||
m_House.RemoveFriend(from, mobile);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3725,8 +3647,8 @@ namespace Server.Multis
|
|||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (targeted is Mobile)
|
||||
m_House.BeginConfirmTransfer(from, (Mobile)targeted);
|
||||
if (targeted is Mobile mobile)
|
||||
m_House.BeginConfirmTransfer(from, mobile);
|
||||
else
|
||||
from.SendLocalizedMessage(501384); // Only a player can own a house!
|
||||
}
|
||||
|
|
@ -3759,7 +3681,7 @@ namespace Server.Multis
|
|||
bool isOwned = house.Doors.Contains(item);
|
||||
|
||||
if (!isOwned)
|
||||
isOwned = house is HouseFoundation && ((HouseFoundation)house).IsFixture(item);
|
||||
isOwned = house is HouseFoundation foundation && foundation.IsFixture(item);
|
||||
|
||||
if (!isOwned)
|
||||
isOwned = house.HasLockedDownItem(item);
|
||||
|
|
|
|||
|
|
@ -231,9 +231,7 @@ namespace Server.Multis
|
|||
|
||||
for (int i = 0; i < sector.Multis.Count; i++)
|
||||
{
|
||||
BaseBoat boat = sector.Multis[i] as BaseBoat;
|
||||
|
||||
if (boat != null && boat.Contains(loc.X, loc.Y))
|
||||
if (sector.Multis[i] is BaseBoat boat && boat.Contains(loc.X, loc.Y))
|
||||
return boat;
|
||||
}
|
||||
|
||||
|
|
@ -1521,19 +1519,15 @@ namespace Server.Multis
|
|||
}
|
||||
|
||||
foreach (IEntity e in toMove)
|
||||
if (e is Item)
|
||||
if (e is Item item)
|
||||
{
|
||||
Item item = (Item)e;
|
||||
|
||||
item.NoMoveHS = true;
|
||||
|
||||
if (!(item is TillerMan || item is Hold || item is Plank))
|
||||
item.Location = new Point3D(item.X + xOffset, item.Y + yOffset, item.Z);
|
||||
}
|
||||
else if (e is Mobile)
|
||||
else if (e is Mobile m)
|
||||
{
|
||||
Mobile m = (Mobile)e;
|
||||
|
||||
m.NoMoveHS = true;
|
||||
m.Location = new Point3D(m.X + xOffset, m.Y + yOffset, m.Z);
|
||||
}
|
||||
|
|
@ -1542,10 +1536,10 @@ namespace Server.Multis
|
|||
Location = new Point3D(X + xOffset, Y + yOffset, Z);
|
||||
|
||||
foreach (IEntity e in toMove)
|
||||
if (e is Item)
|
||||
((Item)e).NoMoveHS = false;
|
||||
else if (e is Mobile)
|
||||
((Mobile)e).NoMoveHS = false;
|
||||
if (e is Item item)
|
||||
item.NoMoveHS = false;
|
||||
else if (e is Mobile mobile)
|
||||
mobile.NoMoveHS = false;
|
||||
|
||||
NoMoveHS = false;
|
||||
}
|
||||
|
|
@ -1567,16 +1561,12 @@ namespace Server.Multis
|
|||
{
|
||||
IEntity e = toMove[i];
|
||||
|
||||
if (e is Item)
|
||||
if (e is Item item)
|
||||
{
|
||||
Item item = (Item)e;
|
||||
|
||||
item.Location = new Point3D(item.X + xOffset, item.Y + yOffset, item.Z + zOffset);
|
||||
}
|
||||
else if (e is Mobile)
|
||||
else if (e is Mobile m)
|
||||
{
|
||||
Mobile m = (Mobile)e;
|
||||
|
||||
m.Location = new Point3D(m.X + xOffset, m.Y + yOffset, m.Z + zOffset);
|
||||
}
|
||||
}
|
||||
|
|
@ -1595,23 +1585,19 @@ namespace Server.Multis
|
|||
|
||||
MultiComponentList mcl = Components;
|
||||
|
||||
foreach (object o in map.GetObjectsInBounds(new Rectangle2D(X + mcl.Min.X, Y + mcl.Min.Y, mcl.Width, mcl.Height))
|
||||
foreach (IEntity o in map.GetObjectsInBounds(new Rectangle2D(X + mcl.Min.X, Y + mcl.Min.Y, mcl.Width, mcl.Height))
|
||||
)
|
||||
{
|
||||
if (o == this || o is TillerMan || o is Hold || o is Plank)
|
||||
continue;
|
||||
|
||||
if (o is Item)
|
||||
if (o is Item item)
|
||||
{
|
||||
Item item = (Item)o;
|
||||
|
||||
if (Contains(item) && item.Visible && item.Z >= Z)
|
||||
list.Add(item);
|
||||
}
|
||||
else if (o is Mobile)
|
||||
else if (o is Mobile m)
|
||||
{
|
||||
Mobile m = (Mobile)o;
|
||||
|
||||
if (Contains(m))
|
||||
list.Add(m);
|
||||
}
|
||||
|
|
@ -1679,16 +1665,12 @@ namespace Server.Multis
|
|||
{
|
||||
IEntity e = toMove[i];
|
||||
|
||||
if (e is Item)
|
||||
if (e is Item item)
|
||||
{
|
||||
Item item = (Item)e;
|
||||
|
||||
item.Location = Rotate(item.Location, count);
|
||||
}
|
||||
else if (e is Mobile)
|
||||
else if (e is Mobile m)
|
||||
{
|
||||
Mobile m = (Mobile)e;
|
||||
|
||||
m.Direction = (m.Direction - old + facing) & Direction.Mask;
|
||||
m.Location = Rotate(m.Location, count);
|
||||
}
|
||||
|
|
@ -1894,10 +1876,8 @@ namespace Server.Multis
|
|||
m_Stream.Write((byte)0xF3);
|
||||
m_Stream.Write((short)0x1);
|
||||
|
||||
if (ent is BaseMulti)
|
||||
if (ent is BaseMulti bm)
|
||||
{
|
||||
BaseMulti bm = (BaseMulti)ent;
|
||||
|
||||
m_Stream.Write((byte)0x02);
|
||||
m_Stream.Write(bm.Serial);
|
||||
// TODO: Mask no longer needed, merge with Item case?
|
||||
|
|
@ -1915,10 +1895,8 @@ namespace Server.Multis
|
|||
m_Stream.Write((short)bm.Hue);
|
||||
m_Stream.Write((byte)bm.GetPacketFlags());
|
||||
}
|
||||
else if (ent is Mobile)
|
||||
else if (ent is Mobile m)
|
||||
{
|
||||
Mobile m = (Mobile)ent;
|
||||
|
||||
m_Stream.Write((byte)0x01);
|
||||
m_Stream.Write(m.Serial);
|
||||
m_Stream.Write((short)m.Body);
|
||||
|
|
@ -1935,10 +1913,8 @@ namespace Server.Multis
|
|||
m_Stream.Write((short)m.Hue);
|
||||
m_Stream.Write((byte)m.GetPacketFlags());
|
||||
}
|
||||
else if (ent is Item)
|
||||
else if (ent is Item item)
|
||||
{
|
||||
Item item = (Item)ent;
|
||||
|
||||
m_Stream.Write((byte)0x00);
|
||||
m_Stream.Write(item.Serial);
|
||||
m_Stream.Write((ushort)(item.ItemID & 0xFFFF));
|
||||
|
|
|
|||
|
|
@ -153,12 +153,10 @@ namespace Server.Multis
|
|||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
IPoint3D ip = o as IPoint3D;
|
||||
|
||||
if (ip != null)
|
||||
if (o is IPoint3D ip)
|
||||
{
|
||||
if (ip is Item)
|
||||
ip = ((Item)ip).GetWorldTop();
|
||||
if (ip is Item item)
|
||||
ip = item.GetWorldTop();
|
||||
|
||||
Point3D p = new Point3D(ip);
|
||||
|
||||
|
|
|
|||
|
|
@ -172,12 +172,10 @@ namespace Server.Multis
|
|||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
IPoint3D ip = o as IPoint3D;
|
||||
|
||||
if (ip != null)
|
||||
if (o is IPoint3D ip)
|
||||
{
|
||||
if (ip is Item)
|
||||
ip = ((Item)ip).GetWorldTop();
|
||||
if (ip is Item item)
|
||||
ip = item.GetWorldTop();
|
||||
|
||||
Point3D p = new Point3D(ip);
|
||||
|
||||
|
|
|
|||
|
|
@ -97,17 +97,17 @@ namespace Server.Misc
|
|||
|
||||
object surface = map.GetTopSurface(from.Location);
|
||||
|
||||
if (surface is LandTile)
|
||||
if (surface is LandTile tile)
|
||||
{
|
||||
int id = ((LandTile)surface).ID;
|
||||
int id = tile.ID;
|
||||
|
||||
return id >= 168 && id <= 171
|
||||
|| id >= 310 && id <= 311;
|
||||
}
|
||||
|
||||
if (surface is StaticTile)
|
||||
if (surface is StaticTile staticTile)
|
||||
{
|
||||
int id = ((StaticTile)surface).ID;
|
||||
int id = staticTile.ID;
|
||||
|
||||
return id >= 0x1796 && id <= 0x17B2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,8 +79,8 @@ namespace Server.Items
|
|||
|
||||
public override bool OnDragDrop(Mobile from, Item dropped)
|
||||
{
|
||||
if (dropped is MapItem && m_Boat != null && m_Boat.CanCommand(from) && m_Boat.Contains(from))
|
||||
m_Boat.AssociateMap((MapItem)dropped);
|
||||
if (dropped is MapItem item && m_Boat != null && m_Boat.CanCommand(from) && m_Boat.Contains(from))
|
||||
m_Boat.AssociateMap(item);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,15 +80,14 @@ namespace Server.Multis
|
|||
|
||||
int zavg = Map.GetAverageZ(X + xOffset, Y + yOffset);
|
||||
Point3D loc = new Point3D(X + xOffset, Y + yOffset, zavg + zOffset);
|
||||
BaseCreature bc = m as BaseCreature;
|
||||
|
||||
if (bc != null)
|
||||
if (m is BaseCreature bc)
|
||||
{
|
||||
bc.RangeHome = wanderRange;
|
||||
bc.Home = loc;
|
||||
}
|
||||
|
||||
if (m is BaseVendor || m is Banker)
|
||||
if (m is BaseVendor)
|
||||
m.Direction = Direction.South;
|
||||
|
||||
m.MoveToWorld(loc, Map);
|
||||
|
|
|
|||
|
|
@ -235,8 +235,8 @@ namespace Server.Multis
|
|||
|
||||
public int GetInt32(object obj)
|
||||
{
|
||||
if (obj is int)
|
||||
return (int)obj;
|
||||
if (obj is int i)
|
||||
return i;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,12 +15,10 @@ namespace Server.Multis.Deeds
|
|||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
IPoint3D ip = o as IPoint3D;
|
||||
|
||||
if (ip != null)
|
||||
if (o is IPoint3D ip)
|
||||
{
|
||||
if (ip is Item)
|
||||
ip = ((Item)ip).GetWorldTop();
|
||||
if (ip is Item item)
|
||||
ip = item.GetWorldTop();
|
||||
|
||||
Point3D p = new Point3D(ip);
|
||||
|
||||
|
|
@ -139,9 +137,8 @@ namespace Server.Multis.Deeds
|
|||
}
|
||||
else
|
||||
{
|
||||
ArrayList toMove;
|
||||
Point3D center = new Point3D(p.X - Offset.X, p.Y - Offset.Y, p.Z - Offset.Z);
|
||||
HousePlacementResult res = HousePlacement.Check(from, MultiID, center, out toMove);
|
||||
HousePlacementResult res = HousePlacement.Check(from, MultiID, center, out ArrayList toMove);
|
||||
|
||||
switch (res)
|
||||
{
|
||||
|
|
@ -155,10 +152,10 @@ namespace Server.Multis.Deeds
|
|||
{
|
||||
object o = toMove[i];
|
||||
|
||||
if (o is Mobile)
|
||||
((Mobile)o).Location = house.BanLocation;
|
||||
else if (o is Item)
|
||||
((Item)o).Location = house.BanLocation;
|
||||
if (o is Mobile mobile)
|
||||
mobile.Location = house.BanLocation;
|
||||
else if (o is Item item)
|
||||
item.Location = house.BanLocation;
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -538,25 +538,19 @@ namespace Server.Multis
|
|||
{
|
||||
Item fixture = Fixtures[i];
|
||||
|
||||
if (fixture is HouseTeleporter)
|
||||
if (fixture is HouseTeleporter tp)
|
||||
{
|
||||
HouseTeleporter tp = (HouseTeleporter)fixture;
|
||||
|
||||
for (int j = 1; j <= Fixtures.Count; ++j)
|
||||
{
|
||||
HouseTeleporter check = Fixtures[(i + j) % Fixtures.Count] as HouseTeleporter;
|
||||
|
||||
if (check != null && check.ItemID == tp.ItemID)
|
||||
if (Fixtures[(i + j) % Fixtures.Count] is HouseTeleporter check && check.ItemID == tp.ItemID)
|
||||
{
|
||||
tp.Target = check;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (fixture is BaseHouseDoor)
|
||||
else if (fixture is BaseHouseDoor door)
|
||||
{
|
||||
BaseHouseDoor door = (BaseHouseDoor)fixture;
|
||||
|
||||
if (door.Link != null)
|
||||
continue;
|
||||
|
||||
|
|
@ -630,9 +624,7 @@ namespace Server.Multis
|
|||
|
||||
for (int j = i + 1; j < Fixtures.Count; ++j)
|
||||
{
|
||||
BaseHouseDoor check = Fixtures[j] as BaseHouseDoor;
|
||||
|
||||
if (check != null && check.Link == null && check.Facing == linkFacing &&
|
||||
if (Fixtures[j] is BaseHouseDoor check && check.Link == null && check.Facing == linkFacing &&
|
||||
check.X - door.X == xOffset && check.Y - door.Y == yOffset && check.Z == door.Z)
|
||||
{
|
||||
check.Link = door;
|
||||
|
|
@ -725,9 +717,7 @@ namespace Server.Multis
|
|||
|
||||
public static void ApplyFoundation(FoundationType type, MultiComponentList mcl)
|
||||
{
|
||||
int east, south, post, corner;
|
||||
|
||||
GetFoundationGraphics(type, out east, out south, out post, out corner);
|
||||
GetFoundationGraphics(type, out int east, out int south, out int post, out int corner);
|
||||
|
||||
int xCenter = mcl.Center.X;
|
||||
int yCenter = mcl.Center.Y;
|
||||
|
|
@ -834,7 +824,8 @@ namespace Server.Multis
|
|||
|
||||
public void BeginCustomize(Mobile m)
|
||||
{
|
||||
if (!m.CheckAlive()) return;
|
||||
if (!m.CheckAlive())
|
||||
return;
|
||||
|
||||
if (SpellHelper.CheckCombat(m))
|
||||
{
|
||||
|
|
@ -1579,6 +1570,7 @@ namespace Server.Multis
|
|||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1706,9 +1698,7 @@ namespace Server.Multis
|
|||
Mobile from = state.Mobile;
|
||||
DesignContext context = DesignContext.Find(from);
|
||||
|
||||
HouseFoundation foundation = World.FindItem(pvSrc.ReadInt32()) as HouseFoundation;
|
||||
|
||||
if (foundation != null && from.Map == foundation.Map && from.InRange(foundation.GetWorldLocation(), 24) &&
|
||||
if (World.FindItem(pvSrc.ReadInt32()) is HouseFoundation foundation && from.Map == foundation.Map && from.InRange(foundation.GetWorldLocation(), 24) &&
|
||||
from.CanSee(foundation))
|
||||
{
|
||||
DesignState stateToSend;
|
||||
|
|
@ -2139,8 +2129,8 @@ namespace Server.Multis
|
|||
|
||||
Table[from] = c;
|
||||
|
||||
if (from is PlayerMobile)
|
||||
((PlayerMobile)from).DesignContext = c;
|
||||
if (from is PlayerMobile pm)
|
||||
pm.DesignContext = c;
|
||||
|
||||
foundation.Customizer = from;
|
||||
|
||||
|
|
@ -2180,11 +2170,8 @@ namespace Server.Multis
|
|||
|
||||
Table.Remove(from);
|
||||
|
||||
if (from is PlayerMobile)
|
||||
((PlayerMobile)from).DesignContext = null;
|
||||
|
||||
if (context == null)
|
||||
return;
|
||||
if (from is PlayerMobile pm)
|
||||
pm.DesignContext = null;
|
||||
|
||||
context.Foundation.Customizer = null;
|
||||
|
||||
|
|
@ -2437,7 +2424,7 @@ namespace Server.Multis
|
|||
|
||||
++planeCount;
|
||||
|
||||
int size = 0;
|
||||
int size;
|
||||
|
||||
if (i == 0)
|
||||
size = width * height * 2;
|
||||
|
|
@ -2573,7 +2560,7 @@ namespace Server.Multis
|
|||
|
||||
while (count > 0)
|
||||
{
|
||||
SendQueueEntry sqe = null;
|
||||
SendQueueEntry sqe;
|
||||
|
||||
lock (m_SendQueueSyncRoot)
|
||||
{
|
||||
|
|
@ -2582,7 +2569,7 @@ namespace Server.Multis
|
|||
|
||||
try
|
||||
{
|
||||
Packet p = null;
|
||||
Packet p;
|
||||
|
||||
lock (sqe.m_Root)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -234,12 +234,10 @@ namespace Server.Items
|
|||
if (!from.CheckAlive() || from.Backpack?.FindItemByType<HousePlacementTool>() == null)
|
||||
return;
|
||||
|
||||
IPoint3D ip = o as IPoint3D;
|
||||
|
||||
if (ip != null)
|
||||
if (o is IPoint3D ip)
|
||||
{
|
||||
if (ip is Item)
|
||||
ip = ((Item)ip).GetWorldTop();
|
||||
if (ip is Item item)
|
||||
ip = item.GetWorldTop();
|
||||
|
||||
Point3D p = new Point3D(ip);
|
||||
|
||||
|
|
|
|||
|
|
@ -77,8 +77,7 @@ namespace Server.SkillHandlers
|
|||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
BaseBook book = targeted as BaseBook;
|
||||
if (book == null)
|
||||
if (!(targeted is BaseBook book))
|
||||
{
|
||||
from.SendLocalizedMessage(1046296); // That is not a book
|
||||
}
|
||||
|
|
@ -122,9 +121,7 @@ namespace Server.SkillHandlers
|
|||
if (m_BookSrc.Deleted)
|
||||
return;
|
||||
|
||||
BaseBook bookDst = targeted as BaseBook;
|
||||
|
||||
if (bookDst == null)
|
||||
if (!(targeted is BaseBook bookDst))
|
||||
{
|
||||
from.SendLocalizedMessage(1046296); // That is not a book
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,10 +42,8 @@ namespace Server.SkillHandlers
|
|||
{
|
||||
from.RevealingAction();
|
||||
|
||||
if (targeted is BaseCreature && from.CanBeHarmful((Mobile)targeted, true))
|
||||
if (targeted is BaseCreature creature && from.CanBeHarmful(creature, true))
|
||||
{
|
||||
BaseCreature creature = (BaseCreature)targeted;
|
||||
|
||||
if (!m_Instrument.IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
|
|
@ -91,10 +89,8 @@ namespace Server.SkillHandlers
|
|||
{
|
||||
from.RevealingAction();
|
||||
|
||||
if (targeted is BaseCreature)
|
||||
if (targeted is BaseCreature creature)
|
||||
{
|
||||
BaseCreature creature = (BaseCreature)targeted;
|
||||
|
||||
if (!m_Instrument.IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
|
|
|
|||
|
|
@ -45,10 +45,8 @@ namespace Server.SkillHandlers
|
|||
{
|
||||
from.SendLocalizedMessage(502816); // You feel that such an action would be inappropriate
|
||||
}
|
||||
else if (targeted is TrappableContainer)
|
||||
else if (targeted is TrappableContainer targ)
|
||||
{
|
||||
TrappableContainer targ = (TrappableContainer)targeted;
|
||||
|
||||
from.Direction = from.GetDirectionTo(targ);
|
||||
|
||||
if (targ.TrapType == TrapType.None)
|
||||
|
|
|
|||
|
|
@ -28,9 +28,7 @@ namespace Server.SkillHandlers
|
|||
if (reg == null || reg.IsDisabled())
|
||||
return true; // not in town? we can snoop any npc
|
||||
|
||||
BaseCreature cret = to as BaseCreature;
|
||||
|
||||
if (to.Body.IsHuman && (cret == null || !cret.AlwaysAttackable && !cret.AlwaysMurderer))
|
||||
if (to.Body.IsHuman && (!(to is BaseCreature cret) || !cret.AlwaysAttackable && !cret.AlwaysMurderer))
|
||||
return false; // in town we cannot snoop blue human npcs
|
||||
|
||||
return true;
|
||||
|
|
@ -81,7 +79,7 @@ namespace Server.SkillHandlers
|
|||
|
||||
if (from.AccessLevel > AccessLevel.Player || from.CheckTargetSkill(SkillName.Snooping, cont, 0.0, 100.0))
|
||||
{
|
||||
if (cont is TrappableContainer && ((TrappableContainer)cont).ExecuteTrap(from))
|
||||
if (cont is TrappableContainer container && container.ExecuteTrap(from))
|
||||
return;
|
||||
|
||||
cont.DisplayTo(from);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
|
|
@ -134,14 +135,9 @@ namespace Server.SkillHandlers
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Corpse toChannel = null;
|
||||
|
||||
foreach (Item item in Caster.GetItemsInRange(3))
|
||||
if (item is Corpse && !((Corpse)item).Channeled)
|
||||
{
|
||||
toChannel = (Corpse)item;
|
||||
break;
|
||||
}
|
||||
IPooledEnumerable<Corpse> eable = Caster.GetItemsInRange<Corpse>(3);
|
||||
Corpse toChannel = eable.ToList().Find(item => item is Corpse corpse && !corpse.Channeled);
|
||||
eable.Free();
|
||||
|
||||
int max, min, mana, number;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ namespace Server.SkillHandlers
|
|||
|
||||
public static bool IsInGuild(Mobile m)
|
||||
{
|
||||
return m is PlayerMobile && ((PlayerMobile)m).NpcGuild == NpcGuild.ThievesGuild;
|
||||
return m is PlayerMobile mobile && mobile.NpcGuild == NpcGuild.ThievesGuild;
|
||||
}
|
||||
|
||||
public static bool IsInnocentTo(Mobile from, Mobile to)
|
||||
|
|
@ -72,7 +72,6 @@ namespace Server.SkillHandlers
|
|||
public StealingTarget(Mobile thief) : base(1, false, TargetFlags.None)
|
||||
{
|
||||
m_Thief = thief;
|
||||
|
||||
AllowNonlocal = true;
|
||||
}
|
||||
|
||||
|
|
@ -81,6 +80,7 @@ namespace Server.SkillHandlers
|
|||
Item stolen = null;
|
||||
|
||||
object root = toSteal.RootParent;
|
||||
Mobile mobRoot = root as Mobile;
|
||||
|
||||
StealableArtifactsSpawner.StealableInstance si = null;
|
||||
if (toSteal.Parent == null || !toSteal.Movable)
|
||||
|
|
@ -94,16 +94,16 @@ namespace Server.SkillHandlers
|
|||
{
|
||||
m_Thief.SendMessage("You may not steal in this area.");
|
||||
}
|
||||
else if (root is Mobile && ((Mobile)root).Player && !IsInGuild(m_Thief))
|
||||
else if (mobRoot?.Player == true && !IsInGuild(m_Thief))
|
||||
{
|
||||
m_Thief.SendLocalizedMessage(1005596); // You must be in the thieves guild to steal from other players.
|
||||
}
|
||||
else if (SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild(m_Thief) &&
|
||||
else if (SuspendOnMurder && mobRoot?.Player == true && IsInGuild(m_Thief) &&
|
||||
m_Thief.Kills > 0)
|
||||
{
|
||||
m_Thief.SendLocalizedMessage(502706); // You are currently suspended from the thieves guild.
|
||||
}
|
||||
else if (root is BaseVendor && ((BaseVendor)root).IsInvulnerable)
|
||||
else if (root is BaseVendor vendor && vendor.IsInvulnerable)
|
||||
{
|
||||
m_Thief.SendLocalizedMessage(1005598); // You can't steal from shopkeepers.
|
||||
}
|
||||
|
|
@ -122,14 +122,12 @@ namespace Server.SkillHandlers
|
|||
|
||||
#region Sigils
|
||||
|
||||
else if (toSteal is Sigil)
|
||||
else if (toSteal is Sigil sig)
|
||||
{
|
||||
PlayerState pl = PlayerState.Find(m_Thief);
|
||||
Faction faction = pl?.Faction;
|
||||
|
||||
Sigil sig = (Sigil)toSteal;
|
||||
|
||||
if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1))
|
||||
if (!m_Thief.InRange(sig.GetWorldLocation(), 1))
|
||||
{
|
||||
m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it.
|
||||
}
|
||||
|
|
@ -242,11 +240,11 @@ namespace Server.SkillHandlers
|
|||
{
|
||||
m_Thief.SendLocalizedMessage(502704); // You catch yourself red-handed.
|
||||
}
|
||||
else if (root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player)
|
||||
else if (mobRoot?.AccessLevel > AccessLevel.Player)
|
||||
{
|
||||
m_Thief.SendLocalizedMessage(502710); // You can't steal that!
|
||||
}
|
||||
else if (root is Mobile && !m_Thief.CanBeHarmful((Mobile)root))
|
||||
else if (mobRoot != null && !m_Thief.CanBeHarmful((Mobile)root))
|
||||
{
|
||||
}
|
||||
else if (root is Corpse)
|
||||
|
|
@ -337,20 +335,20 @@ namespace Server.SkillHandlers
|
|||
object root = null;
|
||||
bool caught = false;
|
||||
|
||||
if (target is Item)
|
||||
if (target is Item item)
|
||||
{
|
||||
root = ((Item)target).RootParent;
|
||||
stolen = TryStealItem((Item)target, ref caught);
|
||||
root = item.RootParent;
|
||||
stolen = TryStealItem(item, ref caught);
|
||||
}
|
||||
else if (target is Mobile)
|
||||
else if (target is Mobile mobile)
|
||||
{
|
||||
Container pack = ((Mobile)target).Backpack;
|
||||
Container pack = mobile.Backpack;
|
||||
|
||||
if (pack != null && pack.Items.Count > 0)
|
||||
{
|
||||
int randomIndex = Utility.Random(pack.Items.Count);
|
||||
|
||||
root = target;
|
||||
root = mobile;
|
||||
stolen = TryStealItem(pack.Items[randomIndex], ref caught);
|
||||
}
|
||||
}
|
||||
|
|
@ -358,28 +356,27 @@ namespace Server.SkillHandlers
|
|||
{
|
||||
m_Thief.SendLocalizedMessage(502710); // You can't steal that!
|
||||
}
|
||||
|
||||
Mobile mobRoot = root as Mobile;
|
||||
|
||||
if (stolen != null)
|
||||
{
|
||||
from.AddToBackpack(stolen);
|
||||
|
||||
if (!(stolen is Container || stolen.Stackable)) StolenItem.Add(stolen, m_Thief, root as Mobile);
|
||||
if (!(stolen is Container || stolen.Stackable))
|
||||
StolenItem.Add(stolen, m_Thief, mobRoot);
|
||||
}
|
||||
|
||||
Corpse corpse = root as Corpse;
|
||||
|
||||
if (caught)
|
||||
{
|
||||
if (root == null)
|
||||
if (root == null || corpse?.IsCriminalAction(m_Thief) == true)
|
||||
{
|
||||
m_Thief.CriminalAction(false);
|
||||
}
|
||||
else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief))
|
||||
else if (mobRoot != null)
|
||||
{
|
||||
m_Thief.CriminalAction(false);
|
||||
}
|
||||
else if (root is Mobile)
|
||||
{
|
||||
Mobile mobRoot = (Mobile)root;
|
||||
|
||||
if (!IsInGuild(mobRoot) && IsInnocentTo(m_Thief, mobRoot))
|
||||
m_Thief.CriminalAction(false);
|
||||
|
||||
|
|
@ -390,16 +387,14 @@ namespace Server.SkillHandlers
|
|||
ns.Mobile.SendMessage(message);
|
||||
}
|
||||
}
|
||||
else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief))
|
||||
else if (corpse?.IsCriminalAction(m_Thief) == true)
|
||||
{
|
||||
m_Thief.CriminalAction(false);
|
||||
}
|
||||
|
||||
if (root is Mobile && ((Mobile)root).Player && m_Thief is PlayerMobile &&
|
||||
IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild((Mobile)root))
|
||||
if (mobRoot?.Player == true && m_Thief is PlayerMobile pm &&
|
||||
IsInnocentTo(pm, mobRoot) && !IsInGuild(mobRoot))
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)m_Thief;
|
||||
|
||||
pm.PermaFlags.Add((Mobile)root);
|
||||
pm.Delta(MobileDelta.Noto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,9 +38,7 @@ namespace Server.SkillHandlers
|
|||
|
||||
for (int i = 0; i < m.Items.Count; i++)
|
||||
{
|
||||
BaseArmor armor = m.Items[i] as BaseArmor;
|
||||
|
||||
if (armor == null)
|
||||
if (!(m.Items[i] is BaseArmor armor))
|
||||
continue;
|
||||
|
||||
int materialType = (int)armor.MaterialType;
|
||||
|
|
@ -91,9 +89,7 @@ namespace Server.SkillHandlers
|
|||
|
||||
m.AllowedStealthSteps = steps;
|
||||
|
||||
PlayerMobile pm = m as PlayerMobile; // IsStealthing should be moved to Server.Mobiles
|
||||
|
||||
if (pm != null)
|
||||
if (m is PlayerMobile pm)
|
||||
pm.IsStealthing = true;
|
||||
|
||||
m.SendLocalizedMessage(502730); // You begin to move quietly.
|
||||
|
|
|
|||
|
|
@ -35,10 +35,8 @@ namespace Server.SkillHandlers
|
|||
{
|
||||
from.SendLocalizedMessage(502816); // You feel that such an action would be inappropriate.
|
||||
}
|
||||
else if (targeted is Food)
|
||||
else if (targeted is Food food)
|
||||
{
|
||||
Food food = (Food)targeted;
|
||||
|
||||
if (from.CheckTargetSkill(SkillName.TasteID, food, 0, 100))
|
||||
{
|
||||
if (food.Poison != null)
|
||||
|
|
@ -52,17 +50,13 @@ namespace Server.SkillHandlers
|
|||
food.SendLocalizedMessageTo(from, 502823); // You cannot discern anything about this substance.
|
||||
}
|
||||
}
|
||||
else if (targeted is BasePotion)
|
||||
else if (targeted is BasePotion potion)
|
||||
{
|
||||
BasePotion potion = (BasePotion)targeted;
|
||||
|
||||
potion.SendLocalizedMessageTo(from, 502813); // You already know what kind of potion that is.
|
||||
potion.SendLocalizedMessageTo(from, potion.LabelNumber);
|
||||
}
|
||||
else if (targeted is PotionKeg)
|
||||
else if (targeted is PotionKeg keg)
|
||||
{
|
||||
PotionKeg keg = (PotionKeg)targeted;
|
||||
|
||||
if (keg.Held <= 0)
|
||||
{
|
||||
keg.SendLocalizedMessageTo(from, 502228); // There is nothing in the keg to taste!
|
||||
|
|
|
|||
|
|
@ -26,9 +26,7 @@ namespace Server.Misc
|
|||
|
||||
private static void EventSink_Login(LoginEventArgs e)
|
||||
{
|
||||
Account acct = e.Mobile.Account as Account;
|
||||
|
||||
if (acct == null)
|
||||
if (!(e.Mobile.Account is Account acct))
|
||||
return;
|
||||
|
||||
DateTime now = DateTime.UtcNow;
|
||||
|
|
|
|||
|
|
@ -90,13 +90,8 @@ namespace Server.Spells
|
|||
if (IsCasting)
|
||||
{
|
||||
object o = ProtectionSpell.Registry[Caster];
|
||||
bool disturb = true;
|
||||
|
||||
if (o is double)
|
||||
if ((double)o > Utility.RandomDouble() * 100.0)
|
||||
disturb = false;
|
||||
|
||||
if (disturb)
|
||||
if (!(o is double d) || d <= Utility.RandomDouble() * 100.0)
|
||||
Disturb(DisturbType.Hurt, false, true);
|
||||
}
|
||||
}
|
||||
|
|
@ -205,8 +200,8 @@ namespace Server.Spells
|
|||
|
||||
TransformContext context = TransformationSpellHelper.GetContext(Caster);
|
||||
|
||||
if (context?.Spell is ReaperFormSpell)
|
||||
damageBonus += ((ReaperFormSpell)context.Spell).SpellDamageBonus;
|
||||
if (context?.Spell is ReaperFormSpell spell)
|
||||
damageBonus += spell.SpellDamageBonus;
|
||||
|
||||
damage = AOS.Scale(damage, 100 + damageBonus);
|
||||
|
||||
|
|
@ -380,20 +375,12 @@ namespace Server.Spells
|
|||
}
|
||||
}
|
||||
|
||||
public void Disturb(DisturbType type)
|
||||
{
|
||||
Disturb(type, true, false);
|
||||
}
|
||||
|
||||
public virtual bool CheckDisturb(DisturbType type, bool firstCircle, bool resistable)
|
||||
{
|
||||
if (resistable && Scroll is BaseWand)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return !(resistable && Scroll is BaseWand);
|
||||
}
|
||||
|
||||
public void Disturb(DisturbType type, bool firstCircle, bool resistable)
|
||||
public void Disturb(DisturbType type, bool firstCircle = true, bool resistable = false)
|
||||
{
|
||||
if (!CheckDisturb(type, firstCircle, resistable))
|
||||
return;
|
||||
|
|
@ -456,7 +443,7 @@ namespace Server.Spells
|
|||
if (Scroll is BaseWand)
|
||||
return;
|
||||
|
||||
if (Info.Mantra != null && Info.Mantra.Length > 0 && Caster.Player)
|
||||
if (!string.IsNullOrEmpty(Info.Mantra) && Caster.Player)
|
||||
Caster.PublicOverheadMessage(MessageType.Spell, Caster.SpeechHue, true, Info.Mantra, false);
|
||||
}
|
||||
|
||||
|
|
@ -464,8 +451,8 @@ namespace Server.Spells
|
|||
{
|
||||
StartCastTime = Core.TickCount;
|
||||
|
||||
if (Core.AOS && Caster.Spell is Spell && ((Spell)Caster.Spell).State == SpellState.Sequencing)
|
||||
((Spell)Caster.Spell).Disturb(DisturbType.NewCast);
|
||||
if (Core.AOS && Caster.Spell is Spell spell && spell.State == SpellState.Sequencing)
|
||||
spell.Disturb(DisturbType.NewCast);
|
||||
|
||||
if (!Caster.CheckAlive()) return false;
|
||||
|
||||
|
|
@ -491,9 +478,9 @@ namespace Server.Spells
|
|||
{
|
||||
Caster.SendLocalizedMessage(502644); // You have not yet recovered from casting a spell.
|
||||
}
|
||||
else if (Caster is PlayerMobile && ((PlayerMobile)Caster).PeacedUntil > DateTime.UtcNow)
|
||||
else if (Caster is PlayerMobile mobile && mobile.PeacedUntil > DateTime.UtcNow)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1072060); // You cannot cast a spell while calmed.
|
||||
mobile.SendLocalizedMessage(1072060); // You cannot cast a spell while calmed.
|
||||
}
|
||||
|
||||
#region Dueling
|
||||
|
|
@ -582,9 +569,7 @@ namespace Server.Spells
|
|||
if (Scroll is BaseWand)
|
||||
return true;
|
||||
|
||||
double minSkill, maxSkill;
|
||||
|
||||
GetCastSkills(out minSkill, out maxSkill);
|
||||
GetCastSkills(out double minSkill, out double maxSkill);
|
||||
|
||||
if (DamageSkill != CastSkill)
|
||||
Caster.CheckSkill(DamageSkill, 0.0, Caster.Skills[DamageSkill].Cap);
|
||||
|
|
@ -710,8 +695,8 @@ namespace Server.Spells
|
|||
DoFizzle();
|
||||
}
|
||||
else if (Scroll != null && !(Scroll is Runebook) &&
|
||||
(Scroll.Amount <= 0 || Scroll.Deleted || Scroll.RootParent != Caster || Scroll is BaseWand &&
|
||||
(((BaseWand)Scroll).Charges <= 0 || Scroll.Parent != Caster)))
|
||||
(Scroll.Amount <= 0 || Scroll.Deleted || Scroll.RootParent != Caster || Scroll is BaseWand baseWand &&
|
||||
(baseWand.Charges <= 0 || baseWand.Parent != Caster)))
|
||||
{
|
||||
DoFizzle();
|
||||
}
|
||||
|
|
@ -728,9 +713,9 @@ namespace Server.Spells
|
|||
Caster.SendLocalizedMessage(502646); // You cannot cast a spell while frozen.
|
||||
DoFizzle();
|
||||
}
|
||||
else if (Caster is PlayerMobile && ((PlayerMobile)Caster).PeacedUntil > DateTime.UtcNow)
|
||||
else if (Caster is PlayerMobile mobile && mobile.PeacedUntil > DateTime.UtcNow)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1072060); // You cannot cast a spell while calmed.
|
||||
mobile.SendLocalizedMessage(1072060); // You cannot cast a spell while calmed.
|
||||
DoFizzle();
|
||||
}
|
||||
else if (CheckFizzle())
|
||||
|
|
@ -741,9 +726,9 @@ namespace Server.Spells
|
|||
{
|
||||
Scroll.Consume();
|
||||
}
|
||||
else if (Scroll is BaseWand)
|
||||
else if (Scroll is BaseWand wand)
|
||||
{
|
||||
((BaseWand)Scroll).ConsumeCharge(Caster);
|
||||
wand.ConsumeCharge(Caster);
|
||||
Caster.RevealingAction();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ namespace Server.Spells
|
|||
IsMLDungeon
|
||||
};
|
||||
|
||||
// TODO: Find a better way
|
||||
private static bool[,] m_Rules =
|
||||
{
|
||||
/*T2A(Fel), Khaldun, Ilshenar, Wind(Tram), Wind(Fel), Dungeons(Fel), Solen(Tram), Solen(Fel), CrystalCave(Malas), Gauntlet(Malas), Gauntlet(Ferry), SafeZone, Stronghold, ChampionSpawn, Dungeons(Tokuno[Malas]), LampRoom(Doom), GuardianRoom(Doom), Heartwood, MLDungeons */
|
||||
|
|
@ -155,17 +156,7 @@ namespace Server.Spells
|
|||
return Core.AOS ? AosDamageDelay : OldDamageDelay;
|
||||
}
|
||||
|
||||
public static bool CheckMulti(Point3D p, Map map)
|
||||
{
|
||||
return CheckMulti(p, map, true, 0);
|
||||
}
|
||||
|
||||
public static bool CheckMulti(Point3D p, Map map, bool houses)
|
||||
{
|
||||
return CheckMulti(p, map, houses, 0);
|
||||
}
|
||||
|
||||
public static bool CheckMulti(Point3D p, Map map, bool houses, int housingrange)
|
||||
public static bool CheckMulti(Point3D p, Map map, bool houses = true, int housingrange = 0)
|
||||
{
|
||||
if (map == null || map == Map.Internal)
|
||||
return false;
|
||||
|
|
@ -176,10 +167,8 @@ namespace Server.Spells
|
|||
{
|
||||
BaseMulti multi = sector.Multis[i];
|
||||
|
||||
if (multi is BaseHouse)
|
||||
if (multi is BaseHouse bh)
|
||||
{
|
||||
BaseHouse bh = (BaseHouse)multi;
|
||||
|
||||
if (houses && bh.IsInside(p, 16) || housingrange > 0 && bh.InRange(p, housingrange))
|
||||
return true;
|
||||
}
|
||||
|
|
@ -194,15 +183,11 @@ namespace Server.Spells
|
|||
|
||||
public static void Turn(Mobile from, object to)
|
||||
{
|
||||
IPoint3D target = to as IPoint3D;
|
||||
|
||||
if (target == null)
|
||||
if (!(to is IPoint3D target))
|
||||
return;
|
||||
|
||||
if (target is Item)
|
||||
if (target is Item item)
|
||||
{
|
||||
Item item = (Item)target;
|
||||
|
||||
if (item.RootParent != from)
|
||||
from.Direction = from.GetDirectionTo(item.GetWorldLocation());
|
||||
}
|
||||
|
|
@ -258,26 +243,18 @@ namespace Server.Spells
|
|||
|
||||
public static bool CanRevealCaster(Mobile m)
|
||||
{
|
||||
if (m is BaseCreature)
|
||||
{
|
||||
BaseCreature c = (BaseCreature)m;
|
||||
|
||||
if (!c.Controlled)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return m is BaseCreature c && !c.Controlled;
|
||||
}
|
||||
|
||||
public static void GetSurfaceTop(ref IPoint3D p)
|
||||
{
|
||||
if (p is Item)
|
||||
if (p is Item item)
|
||||
{
|
||||
p = ((Item)p).GetSurfaceTop();
|
||||
p = item.GetSurfaceTop();
|
||||
}
|
||||
else if (p is StaticTarget)
|
||||
else if (p is StaticTarget t)
|
||||
{
|
||||
StaticTarget t = (StaticTarget)p;
|
||||
int z = t.Z;
|
||||
|
||||
if ((t.Flags & TileFlag.Surface) == 0)
|
||||
|
|
@ -408,9 +385,8 @@ namespace Server.Spells
|
|||
{
|
||||
Guild g = m.Guild as Guild;
|
||||
|
||||
if (g == null && m is BaseCreature)
|
||||
if (g == null && m is BaseCreature c)
|
||||
{
|
||||
BaseCreature c = (BaseCreature)m;
|
||||
m = c.ControlMaster;
|
||||
|
||||
if (m != null)
|
||||
|
|
@ -436,26 +412,23 @@ namespace Server.Spells
|
|||
if (to.Hidden && to.AccessLevel > from.AccessLevel)
|
||||
return false;
|
||||
|
||||
BaseCreature bcFrom = from as BaseCreature;
|
||||
BaseCreature bcTarg = to as BaseCreature;
|
||||
|
||||
#region Dueling
|
||||
|
||||
PlayerMobile pmFrom = from as PlayerMobile;
|
||||
PlayerMobile pmTarg = to as PlayerMobile;
|
||||
PlayerMobile pmFrom;
|
||||
PlayerMobile pmTarg;
|
||||
|
||||
if (pmFrom == null && from is BaseCreature)
|
||||
{
|
||||
BaseCreature bcFrom = (BaseCreature)from;
|
||||
if (bcFrom != null && bcFrom.Summoned)
|
||||
pmFrom = bcFrom.SummonMaster as PlayerMobile;
|
||||
else
|
||||
pmFrom = from as PlayerMobile;
|
||||
|
||||
if (bcFrom.Summoned)
|
||||
pmFrom = bcFrom.SummonMaster as PlayerMobile;
|
||||
}
|
||||
|
||||
if (pmTarg == null && to is BaseCreature)
|
||||
{
|
||||
BaseCreature bcTarg = (BaseCreature)to;
|
||||
|
||||
if (bcTarg.Summoned)
|
||||
pmTarg = bcTarg.SummonMaster as PlayerMobile;
|
||||
}
|
||||
if (bcTarg != null && bcTarg.Summoned)
|
||||
pmTarg = bcTarg.SummonMaster as PlayerMobile;
|
||||
else
|
||||
pmTarg = to as PlayerMobile;
|
||||
|
||||
if (pmFrom != null && pmTarg != null)
|
||||
if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.Started &&
|
||||
|
|
@ -475,37 +448,27 @@ namespace Server.Spells
|
|||
if (p != null && p.Contains(to))
|
||||
return false;
|
||||
|
||||
if (to is BaseCreature)
|
||||
if (bcTarg != null && (bcTarg.Controlled || bcTarg.Summoned))
|
||||
{
|
||||
BaseCreature c = (BaseCreature)to;
|
||||
if (bcTarg.ControlMaster == from || bcTarg.SummonMaster == from)
|
||||
return false;
|
||||
|
||||
if (c.Controlled || c.Summoned)
|
||||
{
|
||||
if (c.ControlMaster == from || c.SummonMaster == from)
|
||||
return false;
|
||||
|
||||
if (p != null && (p.Contains(c.ControlMaster) || p.Contains(c.SummonMaster)))
|
||||
return false;
|
||||
}
|
||||
if (p != null && (p.Contains(bcTarg.ControlMaster) || p.Contains(bcTarg.SummonMaster)))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (from is BaseCreature)
|
||||
if (bcFrom != null && (bcFrom.Controlled || bcFrom.Summoned))
|
||||
{
|
||||
BaseCreature c = (BaseCreature)from;
|
||||
if (bcFrom.ControlMaster == to || bcFrom.SummonMaster == to)
|
||||
return false;
|
||||
|
||||
if (c.Controlled || c.Summoned)
|
||||
{
|
||||
if (c.ControlMaster == to || c.SummonMaster == to)
|
||||
return false;
|
||||
p = Party.Get(to);
|
||||
|
||||
p = Party.Get(to);
|
||||
|
||||
if (p != null && (p.Contains(c.ControlMaster) || p.Contains(c.SummonMaster)))
|
||||
return false;
|
||||
}
|
||||
if (p != null && (p.Contains(bcFrom.ControlMaster) || p.Contains(bcFrom.SummonMaster)))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (to is BaseCreature && !((BaseCreature)to).Controlled && ((BaseCreature)to).InitialInnocent)
|
||||
if (bcTarg != null && !bcTarg.Controlled && bcTarg.InitialInnocent)
|
||||
return true;
|
||||
|
||||
int noto = Notoriety.Compute(from, to);
|
||||
|
|
@ -661,13 +624,8 @@ namespace Server.Spells
|
|||
}
|
||||
|
||||
// Always allow monsters to teleport
|
||||
if (caster is BaseCreature && (type == TravelCheckType.TeleportTo || type == TravelCheckType.TeleportFrom))
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)caster;
|
||||
|
||||
if (!bc.Controlled && !bc.Summoned)
|
||||
if (caster is BaseCreature bc && !bc.Controlled && !bc.Summoned && (type == TravelCheckType.TeleportTo || type == TravelCheckType.TeleportFrom))
|
||||
return true;
|
||||
}
|
||||
|
||||
m_TravelCaster = caster;
|
||||
m_TravelType = type;
|
||||
|
|
@ -883,12 +841,12 @@ namespace Server.Spells
|
|||
}
|
||||
|
||||
//towns
|
||||
public static bool IsTown(IPoint3D loc, Mobile caster)
|
||||
public static bool IsTown(IPoint3D ip, Mobile caster)
|
||||
{
|
||||
if (loc is Item)
|
||||
loc = ((Item)loc).GetWorldLocation();
|
||||
if (ip is Item item)
|
||||
ip = item.GetWorldLocation();
|
||||
|
||||
return IsTown(new Point3D(loc), caster);
|
||||
return IsTown(new Point3D(ip), caster);
|
||||
}
|
||||
|
||||
public static bool IsTown(Point3D loc, Mobile caster)
|
||||
|
|
@ -917,12 +875,12 @@ namespace Server.Spells
|
|||
return reg != null && !reg.IsDisabled();
|
||||
}
|
||||
|
||||
public static bool CheckTown(IPoint3D loc, Mobile caster)
|
||||
public static bool CheckTown(IPoint3D ip, Mobile caster)
|
||||
{
|
||||
if (loc is Item)
|
||||
loc = ((Item)loc).GetWorldLocation();
|
||||
if (ip is Item item)
|
||||
ip = item.GetWorldLocation();
|
||||
|
||||
return CheckTown(new Point3D(loc), caster);
|
||||
return CheckTown(new Point3D(ip), caster);
|
||||
}
|
||||
|
||||
public static bool CheckTown(Point3D loc, Mobile caster)
|
||||
|
|
@ -971,18 +929,18 @@ namespace Server.Spells
|
|||
target = temp;
|
||||
}
|
||||
}
|
||||
else if (target is BaseCreature)
|
||||
else if (target is BaseCreature creature)
|
||||
{
|
||||
bool reflect = false;
|
||||
|
||||
((BaseCreature)target).CheckReflect(caster, ref reflect);
|
||||
creature.CheckReflect(caster, ref reflect);
|
||||
|
||||
if (reflect)
|
||||
{
|
||||
target.FixedEffect(0x37B9, 10, 5);
|
||||
creature.FixedEffect(0x37B9, 10, 5);
|
||||
|
||||
Mobile temp = caster;
|
||||
caster = target;
|
||||
caster = creature;
|
||||
target = temp;
|
||||
}
|
||||
}
|
||||
|
|
@ -1022,63 +980,45 @@ namespace Server.Spells
|
|||
new SpellDamageTimer(spell, target, from, iDamage, delay).Start();
|
||||
}
|
||||
|
||||
if (target is BaseCreature && from != null && delay == TimeSpan.Zero)
|
||||
if (target is BaseCreature c && from != null && delay == TimeSpan.Zero)
|
||||
{
|
||||
BaseCreature c = (BaseCreature)target;
|
||||
|
||||
c.OnHarmfulSpell(from);
|
||||
c.OnDamagedBySpell(from);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Damage(Spell spell, Mobile target, double damage, int phys, int fire, int cold, int pois,
|
||||
int nrgy)
|
||||
int nrgy, int chaos = 0, DFAlgorithm dfa = DFAlgorithm.Standard)
|
||||
{
|
||||
TimeSpan ts = GetDamageDelayForSpell(spell);
|
||||
|
||||
Damage(spell, ts, target, spell.Caster, damage, phys, fire, cold, pois, nrgy, DFAlgorithm.Standard);
|
||||
}
|
||||
|
||||
public static void Damage(Spell spell, Mobile target, double damage, int phys, int fire, int cold, int pois,
|
||||
int nrgy, DFAlgorithm dfa)
|
||||
{
|
||||
TimeSpan ts = GetDamageDelayForSpell(spell);
|
||||
|
||||
Damage(spell, ts, target, spell.Caster, damage, phys, fire, cold, pois, nrgy, dfa);
|
||||
Damage(spell, GetDamageDelayForSpell(spell), target, spell.Caster, damage, phys, fire, cold, pois, nrgy, chaos, dfa);
|
||||
}
|
||||
|
||||
public static void Damage(TimeSpan delay, Mobile target, double damage, int phys, int fire, int cold, int pois,
|
||||
int nrgy)
|
||||
int nrgy, int chaos = 0, DFAlgorithm dfa = DFAlgorithm.Standard)
|
||||
{
|
||||
Damage(delay, target, null, damage, phys, fire, cold, pois, nrgy);
|
||||
Damage(delay, target, null, damage, phys, fire, cold, pois, nrgy, chaos, dfa);
|
||||
}
|
||||
|
||||
public static void Damage(TimeSpan delay, Mobile target, Mobile from, double damage, int phys, int fire, int cold,
|
||||
int pois, int nrgy)
|
||||
int pois, int nrgy, int chaos = 0, DFAlgorithm dfa = DFAlgorithm.Standard)
|
||||
{
|
||||
Damage(delay, target, from, damage, phys, fire, cold, pois, nrgy, DFAlgorithm.Standard);
|
||||
}
|
||||
|
||||
public static void Damage(TimeSpan delay, Mobile target, Mobile from, double damage, int phys, int fire, int cold,
|
||||
int pois, int nrgy, DFAlgorithm dfa)
|
||||
{
|
||||
Damage(null, delay, target, from, damage, phys, fire, cold, pois, nrgy, dfa);
|
||||
Damage(null, delay, target, from, damage, phys, fire, cold, pois, nrgy, chaos, dfa);
|
||||
}
|
||||
|
||||
public static void Damage(Spell spell, TimeSpan delay, Mobile target, Mobile from, double damage, int phys, int fire,
|
||||
int cold, int pois, int nrgy, DFAlgorithm dfa)
|
||||
int cold, int pois, int nrgy, int chaos = 0, DFAlgorithm dfa = DFAlgorithm.Standard)
|
||||
{
|
||||
int iDamage = (int)damage;
|
||||
int dmg = (int)damage;
|
||||
|
||||
if (delay == TimeSpan.Zero)
|
||||
{
|
||||
(from as BaseCreature)?.AlterSpellDamageTo(target, ref iDamage);
|
||||
(from as BaseCreature)?.AlterSpellDamageTo(target, ref dmg);
|
||||
|
||||
(target as BaseCreature)?.AlterSpellDamageFrom(from, ref iDamage);
|
||||
(target as BaseCreature)?.AlterSpellDamageFrom(from, ref dmg);
|
||||
|
||||
WeightOverloading.DFA = dfa;
|
||||
|
||||
int damageGiven = AOS.Damage(target, from, iDamage, phys, fire, cold, pois, nrgy);
|
||||
int damageGiven = AOS.Damage(target, from, dmg, phys, fire, cold, pois, nrgy, chaos);
|
||||
|
||||
if (from != null) // sanity check
|
||||
DoLeech(damageGiven, from, target);
|
||||
|
|
@ -1087,13 +1027,11 @@ namespace Server.Spells
|
|||
}
|
||||
else
|
||||
{
|
||||
new SpellDamageTimerAOS(spell, target, from, iDamage, phys, fire, cold, pois, nrgy, delay, dfa).Start();
|
||||
new SpellDamageTimerAOS(spell, delay, target, from, dmg, phys, fire, cold, pois, nrgy, chaos, dfa).Start();
|
||||
}
|
||||
|
||||
if (target is BaseCreature && from != null && delay == TimeSpan.Zero)
|
||||
if (target is BaseCreature c && from != null && delay == TimeSpan.Zero)
|
||||
{
|
||||
BaseCreature c = (BaseCreature)target;
|
||||
|
||||
c.OnHarmfulSpell(from);
|
||||
c.OnDamagedBySpell(from);
|
||||
}
|
||||
|
|
@ -1103,25 +1041,25 @@ namespace Server.Spells
|
|||
{
|
||||
TransformContext context = TransformationSpellHelper.GetContext(from);
|
||||
|
||||
if (context != null) /* cleanup */
|
||||
if (context == null) /* cleanup */
|
||||
return;
|
||||
|
||||
if (context.Type == typeof(WraithFormSpell))
|
||||
{
|
||||
if (context.Type == typeof(WraithFormSpell))
|
||||
int wraithLeech =
|
||||
5 + (int)(15 * from.Skills.SpiritSpeak.Value / 100); // Wraith form gives 5-20% mana leech
|
||||
int manaLeech = AOS.Scale(damageGiven, wraithLeech);
|
||||
if (manaLeech != 0)
|
||||
{
|
||||
int wraithLeech =
|
||||
5 + (int)(15 * from.Skills.SpiritSpeak.Value / 100); // Wraith form gives 5-20% mana leech
|
||||
int manaLeech = AOS.Scale(damageGiven, wraithLeech);
|
||||
if (manaLeech != 0)
|
||||
{
|
||||
from.Mana += manaLeech;
|
||||
from.PlaySound(0x44D);
|
||||
}
|
||||
}
|
||||
else if (context.Type == typeof(VampiricEmbraceSpell))
|
||||
{
|
||||
from.Hits += AOS.Scale(damageGiven, 20);
|
||||
from.Mana += manaLeech;
|
||||
from.PlaySound(0x44D);
|
||||
}
|
||||
}
|
||||
else if (context.Type == typeof(VampiricEmbraceSpell))
|
||||
{
|
||||
from.Hits += AOS.Scale(damageGiven, 20);
|
||||
from.PlaySound(0x44D);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Heal(int amount, Mobile target, Mobile from)
|
||||
|
|
@ -1172,12 +1110,12 @@ namespace Server.Spells
|
|||
{
|
||||
private int m_Damage;
|
||||
private DFAlgorithm m_DFA;
|
||||
private int m_Phys, m_Fire, m_Cold, m_Pois, m_Nrgy;
|
||||
private int m_Phys, m_Fire, m_Cold, m_Pois, m_Nrgy, m_Chaos;
|
||||
private Spell m_Spell;
|
||||
private Mobile m_Target, m_From;
|
||||
|
||||
public SpellDamageTimerAOS(Spell s, Mobile target, Mobile from, int damage, int phys, int fire, int cold,
|
||||
int pois, int nrgy, TimeSpan delay, DFAlgorithm dfa)
|
||||
public SpellDamageTimerAOS(Spell s, TimeSpan delay, Mobile target, Mobile from, int damage, int phys, int fire, int cold,
|
||||
int pois, int nrgy, int chaos, DFAlgorithm dfa)
|
||||
: base(delay)
|
||||
{
|
||||
m_Target = target;
|
||||
|
|
@ -1188,6 +1126,7 @@ namespace Server.Spells
|
|||
m_Cold = cold;
|
||||
m_Pois = pois;
|
||||
m_Nrgy = nrgy;
|
||||
m_Chaos = chaos;
|
||||
m_DFA = dfa;
|
||||
m_Spell = s;
|
||||
if (m_Spell != null && m_Spell.DelayedDamage && !m_Spell.DelayedDamageStacking)
|
||||
|
|
@ -1198,27 +1137,28 @@ namespace Server.Spells
|
|||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if (m_From is BaseCreature && m_Target != null)
|
||||
((BaseCreature)m_From).AlterSpellDamageTo(m_Target, ref m_Damage);
|
||||
BaseCreature bcFrom = m_From as BaseCreature;
|
||||
BaseCreature bcTarg = m_Target as BaseCreature;
|
||||
|
||||
if (bcFrom != null && m_Target != null)
|
||||
bcFrom.AlterSpellDamageTo(m_Target, ref m_Damage);
|
||||
|
||||
if (m_Target is BaseCreature && m_From != null)
|
||||
((BaseCreature)m_Target).AlterSpellDamageFrom(m_From, ref m_Damage);
|
||||
if (bcTarg != null && m_From != null)
|
||||
bcTarg.AlterSpellDamageFrom(m_From, ref m_Damage);
|
||||
|
||||
WeightOverloading.DFA = m_DFA;
|
||||
|
||||
int damageGiven = AOS.Damage(m_Target, m_From, m_Damage, m_Phys, m_Fire, m_Cold, m_Pois, m_Nrgy);
|
||||
int damageGiven = AOS.Damage(m_Target, m_From, m_Damage, m_Phys, m_Fire, m_Cold, m_Pois, m_Nrgy, m_Chaos);
|
||||
|
||||
if (m_From != null) // sanity check
|
||||
DoLeech(damageGiven, m_From, m_Target);
|
||||
|
||||
WeightOverloading.DFA = DFAlgorithm.Standard;
|
||||
|
||||
if (m_Target is BaseCreature && m_From != null)
|
||||
if (bcTarg != null && m_From != null)
|
||||
{
|
||||
BaseCreature c = (BaseCreature)m_Target;
|
||||
|
||||
c.OnHarmfulSpell(m_From);
|
||||
c.OnDamagedBySpell(m_From);
|
||||
bcTarg.OnHarmfulSpell(m_From);
|
||||
bcTarg.OnDamagedBySpell(m_From);
|
||||
}
|
||||
|
||||
m_Spell?.RemoveDelayedDamageContext(m_Target);
|
||||
|
|
@ -1253,9 +1193,7 @@ namespace Server.Spells
|
|||
|
||||
public static bool OnCast(Mobile caster, Spell spell)
|
||||
{
|
||||
ITransformationSpell transformSpell = spell as ITransformationSpell;
|
||||
|
||||
if (transformSpell == null)
|
||||
if (!(spell is ITransformationSpell transformSpell))
|
||||
return false;
|
||||
|
||||
if (Sigil.ExistsOn(caster))
|
||||
|
|
|
|||
|
|
@ -37,9 +37,7 @@ namespace Server.Spells.Bushido
|
|||
if (Caster == null) // Sanity
|
||||
return false;
|
||||
|
||||
BaseWeapon weap = Caster.FindItemOnLayer(Layer.OneHanded) as BaseWeapon;
|
||||
|
||||
if (weap == null)
|
||||
if (!(Caster.FindItemOnLayer(Layer.OneHanded) is BaseWeapon weap))
|
||||
weap = Caster.FindItemOnLayer(Layer.TwoHanded) as BaseWeapon;
|
||||
|
||||
if (weap != null)
|
||||
|
|
@ -70,9 +68,7 @@ namespace Server.Spells.Bushido
|
|||
|
||||
public static bool CheckSpellEvasion(Mobile defender)
|
||||
{
|
||||
BaseWeapon weap = defender.FindItemOnLayer(Layer.OneHanded) as BaseWeapon;
|
||||
|
||||
if (weap == null)
|
||||
if (!(defender.FindItemOnLayer(Layer.OneHanded) is BaseWeapon weap))
|
||||
weap = defender.FindItemOnLayer(Layer.TwoHanded) as BaseWeapon;
|
||||
|
||||
if (Core.ML)
|
||||
|
|
|
|||
|
|
@ -28,9 +28,7 @@ namespace Server.Spells.Bushido
|
|||
|
||||
ClearCurrentMove(attacker);
|
||||
|
||||
HonorableExecutionInfo info = m_Table[attacker] as HonorableExecutionInfo;
|
||||
|
||||
if (info != null)
|
||||
if (m_Table[attacker] is HonorableExecutionInfo info)
|
||||
{
|
||||
info.Clear();
|
||||
|
||||
|
|
@ -54,14 +52,15 @@ namespace Server.Spells.Bushido
|
|||
}
|
||||
else
|
||||
{
|
||||
ArrayList mods = new ArrayList();
|
||||
|
||||
mods.Add(new ResistanceMod(ResistanceType.Physical, -40));
|
||||
mods.Add(new ResistanceMod(ResistanceType.Fire, -40));
|
||||
mods.Add(new ResistanceMod(ResistanceType.Cold, -40));
|
||||
mods.Add(new ResistanceMod(ResistanceType.Poison, -40));
|
||||
mods.Add(new ResistanceMod(ResistanceType.Energy, -40));
|
||||
|
||||
ArrayList mods = new ArrayList
|
||||
{
|
||||
new ResistanceMod(ResistanceType.Physical, -40),
|
||||
new ResistanceMod(ResistanceType.Fire, -40),
|
||||
new ResistanceMod(ResistanceType.Cold, -40),
|
||||
new ResistanceMod(ResistanceType.Poison, -40),
|
||||
new ResistanceMod(ResistanceType.Energy, -40)
|
||||
};
|
||||
|
||||
double resSpells = attacker.Skills[SkillName.MagicResist].Value;
|
||||
|
||||
if (resSpells > 0.0)
|
||||
|
|
@ -78,9 +77,7 @@ namespace Server.Spells.Bushido
|
|||
|
||||
public static int GetSwingBonus(Mobile target)
|
||||
{
|
||||
HonorableExecutionInfo info = m_Table[target] as HonorableExecutionInfo;
|
||||
|
||||
if (info == null)
|
||||
if (!(m_Table[target] is HonorableExecutionInfo info))
|
||||
return 0;
|
||||
|
||||
return info.m_SwingBonus;
|
||||
|
|
@ -88,9 +85,7 @@ namespace Server.Spells.Bushido
|
|||
|
||||
public static bool IsUnderPenalty(Mobile target)
|
||||
{
|
||||
HonorableExecutionInfo info = m_Table[target] as HonorableExecutionInfo;
|
||||
|
||||
if (info == null)
|
||||
if (!(m_Table[target] is HonorableExecutionInfo info))
|
||||
return false;
|
||||
|
||||
return info.m_Penalty;
|
||||
|
|
@ -98,9 +93,7 @@ namespace Server.Spells.Bushido
|
|||
|
||||
public static void RemovePenalty(Mobile target)
|
||||
{
|
||||
HonorableExecutionInfo info = m_Table[target] as HonorableExecutionInfo;
|
||||
|
||||
if (info == null || !info.m_Penalty)
|
||||
if (!(m_Table[target] is HonorableExecutionInfo info) || !info.m_Penalty)
|
||||
return;
|
||||
|
||||
info.Clear();
|
||||
|
|
@ -112,9 +105,7 @@ namespace Server.Spells.Bushido
|
|||
|
||||
public void EndEffect(object state)
|
||||
{
|
||||
HonorableExecutionInfo info = (HonorableExecutionInfo)state;
|
||||
|
||||
RemovePenalty(info.m_Mobile);
|
||||
RemovePenalty(((HonorableExecutionInfo)state).m_Mobile);
|
||||
}
|
||||
|
||||
private class HonorableExecutionInfo
|
||||
|
|
@ -125,15 +116,11 @@ namespace Server.Spells.Bushido
|
|||
public int m_SwingBonus;
|
||||
public Timer m_Timer;
|
||||
|
||||
public HonorableExecutionInfo(Mobile from, int swingBonus) : this(from, swingBonus, null, false)
|
||||
{
|
||||
}
|
||||
|
||||
public HonorableExecutionInfo(Mobile from, ArrayList mods) : this(from, 0, mods, true)
|
||||
{
|
||||
}
|
||||
|
||||
public HonorableExecutionInfo(Mobile from, int swingBonus, ArrayList mods, bool penalty)
|
||||
public HonorableExecutionInfo(Mobile from, int swingBonus, ArrayList mods = null, bool penalty = false)
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_SwingBonus = swingBonus;
|
||||
|
|
@ -152,10 +139,10 @@ namespace Server.Spells.Bushido
|
|||
{
|
||||
object mod = m_Mods[i];
|
||||
|
||||
if (mod is ResistanceMod)
|
||||
m_Mobile.AddResistanceMod((ResistanceMod)mod);
|
||||
else if (mod is SkillMod)
|
||||
m_Mobile.AddSkillMod((SkillMod)mod);
|
||||
if (mod is ResistanceMod resistanceMod)
|
||||
m_Mobile.AddResistanceMod(resistanceMod);
|
||||
else if (mod is SkillMod skillMod)
|
||||
m_Mobile.AddSkillMod(skillMod);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -168,10 +155,10 @@ namespace Server.Spells.Bushido
|
|||
{
|
||||
object mod = m_Mods[i];
|
||||
|
||||
if (mod is ResistanceMod)
|
||||
m_Mobile.RemoveResistanceMod((ResistanceMod)mod);
|
||||
else if (mod is SkillMod)
|
||||
m_Mobile.RemoveSkillMod((SkillMod)mod);
|
||||
if (mod is ResistanceMod resistanceMod)
|
||||
m_Mobile.RemoveResistanceMod(resistanceMod);
|
||||
else if (mod is SkillMod skillMod)
|
||||
m_Mobile.RemoveSkillMod(skillMod);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,8 +113,8 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ namespace Server.Spells.Chivalry
|
|||
{
|
||||
Caster.SendLocalizedMessage(1060178); // You are too far away to perform that action!
|
||||
}
|
||||
else if (m is BaseCreature && ((BaseCreature)m).IsAnimatedDead)
|
||||
else if (m is BaseCreature creature && creature.IsAnimatedDead)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1061654); // You cannot heal that which is not alive.
|
||||
}
|
||||
|
|
@ -72,19 +72,12 @@ namespace Server.Spells.Chivalry
|
|||
* The caster's Karma affects the amount of damage healed.
|
||||
*/
|
||||
|
||||
int toHeal = ComputePowerValue(6) + Utility.RandomMinMax(0, 2);
|
||||
|
||||
// TODO: Should caps be applied?
|
||||
if (toHeal < 7)
|
||||
toHeal = 7;
|
||||
else if (toHeal > 39)
|
||||
toHeal = 39;
|
||||
int toHeal = Math.Min(Math.Max(ComputePowerValue(6) + Utility.RandomMinMax(0, 2), 7), 39);
|
||||
|
||||
if (m.Hits + toHeal > m.HitsMax)
|
||||
toHeal = m.HitsMax - m.Hits;
|
||||
|
||||
//m.Hits += toHeal; //Was previously due to the message
|
||||
//m.Heal( toHeal, Caster, false );
|
||||
SpellHelper.Heal(toHeal, m, Caster, false);
|
||||
|
||||
m.SendLocalizedMessage(1060203,
|
||||
|
|
@ -109,8 +102,8 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -28,9 +28,7 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
BaseWeapon weapon = Caster.Weapon as BaseWeapon;
|
||||
|
||||
if (weapon == null || weapon is Fists)
|
||||
if (!(Caster.Weapon is BaseWeapon weapon) || weapon is Fists)
|
||||
{
|
||||
Caster.SendLocalizedMessage(501078); // You must be holding a weapon.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,13 +54,10 @@ namespace Server.Spells.Chivalry
|
|||
for (int i = 0; i < targets.Count; ++i)
|
||||
{
|
||||
Mobile m = targets[i];
|
||||
BaseCreature bc = m as BaseCreature;
|
||||
|
||||
if (bc != null)
|
||||
if (m is BaseCreature bc)
|
||||
{
|
||||
bool dispellable = bc.Summoned && !bc.IsAnimatedDead;
|
||||
|
||||
if (dispellable)
|
||||
if (bc.Summoned && !bc.IsAnimatedDead)
|
||||
{
|
||||
double dispelChance = (50.0 + 100 * (chiv - bc.DispelDifficulty) / (bc.DispelFocus * 2)) / 100;
|
||||
dispelChance *= dispelSkill / 100.0;
|
||||
|
|
|
|||
|
|
@ -50,13 +50,13 @@ namespace Server.Spells.Chivalry
|
|||
m_Table[Caster] = Timer.DelayCall(TimeSpan.FromMinutes(delay), new TimerStateCallback(Expire_Callback),
|
||||
Caster);
|
||||
|
||||
if (Caster is PlayerMobile)
|
||||
if (Caster is PlayerMobile mobile)
|
||||
{
|
||||
((PlayerMobile)Caster).EnemyOfOneType = null;
|
||||
((PlayerMobile)Caster).WaitingForEnemy = true;
|
||||
mobile.EnemyOfOneType = null;
|
||||
mobile.WaitingForEnemy = true;
|
||||
|
||||
BuffInfo.AddBuff(Caster,
|
||||
new BuffInfo(BuffIcon.EnemyOfOne, 1075653, 1044111, TimeSpan.FromMinutes(delay), Caster));
|
||||
BuffInfo.AddBuff(mobile,
|
||||
new BuffInfo(BuffIcon.EnemyOfOne, 1075653, 1044111, TimeSpan.FromMinutes(delay), mobile));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -71,10 +71,10 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
m.PlaySound(0x1F8);
|
||||
|
||||
if (m is PlayerMobile)
|
||||
if (m is PlayerMobile mobile)
|
||||
{
|
||||
((PlayerMobile)m).EnemyOfOneType = null;
|
||||
((PlayerMobile)m).WaitingForEnemy = false;
|
||||
mobile.EnemyOfOneType = null;
|
||||
mobile.WaitingForEnemy = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
foreach (Mobile m in Caster.GetMobilesInRange(3)) // TODO: Validate range
|
||||
{
|
||||
if (m is BaseCreature && ((BaseCreature)m).IsAnimatedDead)
|
||||
if (m is BaseCreature creature && creature.IsAnimatedDead)
|
||||
continue;
|
||||
|
||||
if (Caster != m && m.InLOS(Caster) && Caster.CanBeBeneficial(m, false, true) && !(m is Golem))
|
||||
|
|
@ -54,7 +54,7 @@ namespace Server.Spells.Chivalry
|
|||
bool sacrifice = false;
|
||||
|
||||
// TODO: Is there really a resurrection chance?
|
||||
double resChance = 0.1 + 0.9 * ((double)Caster.Karma / 10000);
|
||||
double resChance = 0.1 + 0.9 * Caster.Karma / 10000.0d;
|
||||
|
||||
for (int i = 0; i < targets.Count; ++i)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -76,9 +76,7 @@ namespace Server.Spells.Chivalry
|
|||
Effects.SendMovingParticles(from, to, 0x2255, 1, 0, false, false, 13, 3, 9501, 1, 0, EffectLayer.Head,
|
||||
0x100);
|
||||
|
||||
StatMod mod;
|
||||
|
||||
mod = m.GetStatMod("[Magic] Str Offset");
|
||||
StatMod mod = m.GetStatMod("[Magic] Str Offset");
|
||||
if (mod != null && mod.Offset < 0)
|
||||
m.RemoveStatMod("[Magic] Str Offset");
|
||||
|
||||
|
|
@ -130,8 +128,8 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -21,11 +21,7 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
private RunebookEntry m_Entry;
|
||||
|
||||
public SacredJourneySpell(Mobile caster, Item scroll) : this(caster, scroll, null, null)
|
||||
{
|
||||
}
|
||||
|
||||
public SacredJourneySpell(Mobile caster, Item scroll, RunebookEntry entry, Runebook book) : base(caster, scroll,
|
||||
public SacredJourneySpell(Mobile caster, Item scroll, RunebookEntry entry = null, Runebook book = null) : base(caster, scroll,
|
||||
m_Info)
|
||||
{
|
||||
m_Entry = entry;
|
||||
|
|
@ -96,9 +92,9 @@ namespace Server.Spells.Chivalry
|
|||
else if (!SpellHelper.CheckTravel(Caster, map, loc, TravelCheckType.RecallTo))
|
||||
{
|
||||
}
|
||||
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)
|
||||
{
|
||||
|
|
@ -157,38 +153,32 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
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(501805); // 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);
|
||||
else
|
||||
from.SendLocalizedMessage(502354); // Target is not marked.
|
||||
}
|
||||
else if (o is Key && ((Key)o).KeyValue != 0 && ((Key)o).Link is BaseBoat)
|
||||
else if (o is Key key && key.KeyValue != 0 && key.Link is BaseBoat boat)
|
||||
{
|
||||
BaseBoat boat = ((Key)o).Link as BaseBoat;
|
||||
|
||||
if (!boat.Deleted && boat.CheckKey(((Key)o).KeyValue))
|
||||
if (!boat.Deleted && boat.CheckKey(key.KeyValue))
|
||||
m_Owner.Effect(boat.GetMarkedLocation(), boat.Map, false);
|
||||
else
|
||||
from.Send(new MessageLocalized(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 502357,
|
||||
from.Name, "")); // I can not recall 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
|
||||
|
|
|
|||
|
|
@ -78,8 +78,8 @@ namespace Server.Spells.Eighth
|
|||
|
||||
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 OnTargetOutOfLOS(Mobile from, object o)
|
||||
|
|
|
|||
|
|
@ -98,7 +98,8 @@ namespace Server.Spells.Eighth
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -85,8 +85,8 @@ namespace Server.Spells.Fifth
|
|||
|
||||
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 OnTargetOutOfLOS(Mobile from, object o)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace Server.Spells.Fifth
|
|||
{
|
||||
Caster.SendLocalizedMessage(1005049); // That cannot be dispelled.
|
||||
}
|
||||
else if (item is Moongate && !((Moongate)item).Dispellable)
|
||||
else if (item is Moongate moongate && !moongate.Dispellable)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1005047); // That magic is too chaotic
|
||||
}
|
||||
|
|
@ -69,8 +69,8 @@ namespace Server.Spells.Fifth
|
|||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is Item)
|
||||
m_Owner.Target((Item)o);
|
||||
if (o is Item item)
|
||||
m_Owner.Target(item);
|
||||
else
|
||||
m_Owner.Caster.SendLocalizedMessage(1005049); // That cannot be dispelled.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,8 +141,8 @@ namespace Server.Spells.Fifth
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -71,9 +71,9 @@ namespace Server.Spells.Fifth
|
|||
duration *= 0.75;
|
||||
}
|
||||
|
||||
if (m is PlagueBeastLord)
|
||||
if (m is PlagueBeastLord lord)
|
||||
{
|
||||
((PlagueBeastLord)m).OnParalyzed(Caster);
|
||||
lord.OnParalyzed(Caster);
|
||||
duration = 120;
|
||||
}
|
||||
|
||||
|
|
@ -99,8 +99,8 @@ namespace Server.Spells.Fifth
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -281,8 +281,8 @@ namespace Server.Spells.Fifth
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@ namespace Server.Spells.First
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@ namespace Server.Spells.First
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ namespace Server.Spells.First
|
|||
{
|
||||
Caster.SendLocalizedMessage(1060177); // You cannot heal a creature that is already dead!
|
||||
}
|
||||
else if (m is BaseCreature && ((BaseCreature)m).IsAnimatedDead)
|
||||
else if (m is BaseCreature creature && creature.IsAnimatedDead)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1061654); // You cannot heal that which is not alive.
|
||||
}
|
||||
|
|
@ -102,7 +102,8 @@ namespace Server.Spells.First
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -80,7 +80,8 @@ namespace Server.Spells.First
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -34,10 +34,8 @@ namespace Server.Spells.First
|
|||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (targeted is Mobile && m_Spell.CheckBSequence((Mobile)targeted))
|
||||
if (targeted is Mobile targ && m_Spell.CheckBSequence(targ))
|
||||
{
|
||||
Mobile targ = (Mobile)targeted;
|
||||
|
||||
SpellHelper.Turn(m_Spell.Caster, targ);
|
||||
|
||||
if (targ.BeginAction(typeof(LightCycle)))
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@ namespace Server.Spells.First
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -170,9 +170,7 @@ namespace Server.Spells.Fourth
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -152,9 +152,7 @@ namespace Server.Spells.Fourth
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ namespace Server.Spells.Fourth
|
|||
) //On OSI you CAN curse yourself and get this effect.
|
||||
{
|
||||
TimeSpan duration = SpellHelper.GetDuration(Caster, m);
|
||||
m_UnderEffect[m] = t = Timer.DelayCall(duration, new TimerStateCallback(RemoveEffect), m);
|
||||
m_UnderEffect[m] = Timer.DelayCall(duration, new TimerStateCallback(RemoveEffect), m);
|
||||
m.UpdateResistances();
|
||||
}
|
||||
|
||||
|
|
@ -101,8 +101,8 @@ namespace Server.Spells.Fourth
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -246,36 +246,36 @@ namespace Server.Spells.Fourth
|
|||
Map map = m_Item.Map;
|
||||
Mobile caster = m_Item.m_Caster;
|
||||
|
||||
if (map != null && caster != null)
|
||||
if (map == null || caster == null)
|
||||
return;
|
||||
|
||||
foreach (Mobile m in m_Item.GetMobilesInRange(0))
|
||||
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.Enqueue(m);
|
||||
|
||||
while (m_Queue.Count > 0)
|
||||
{
|
||||
foreach (Mobile m in m_Item.GetMobilesInRange(0))
|
||||
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.Enqueue(m);
|
||||
Mobile m = (Mobile)m_Queue.Dequeue();
|
||||
|
||||
while (m_Queue.Count > 0)
|
||||
if (SpellHelper.CanRevealCaster(m))
|
||||
caster.RevealingAction();
|
||||
|
||||
caster.DoHarmful(m);
|
||||
|
||||
int damage = m_Item.m_Damage;
|
||||
|
||||
if (!Core.AOS && m.CheckSkill(SkillName.MagicResist, 0.0, 30.0))
|
||||
{
|
||||
Mobile m = (Mobile)m_Queue.Dequeue();
|
||||
damage = 1;
|
||||
|
||||
if (SpellHelper.CanRevealCaster(m))
|
||||
caster.RevealingAction();
|
||||
|
||||
caster.DoHarmful(m);
|
||||
|
||||
int damage = m_Item.m_Damage;
|
||||
|
||||
if (!Core.AOS && m.CheckSkill(SkillName.MagicResist, 0.0, 30.0))
|
||||
{
|
||||
damage = 1;
|
||||
|
||||
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
||||
}
|
||||
|
||||
AOS.Damage(m, caster, damage, 0, 100, 0, 0, 0);
|
||||
m.PlaySound(0x208);
|
||||
|
||||
(m as BaseCreature)?.OnHarmfulSpell(caster);
|
||||
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
||||
}
|
||||
|
||||
AOS.Damage(m, caster, damage, 0, 100, 0, 0, 0);
|
||||
m.PlaySound(0x208);
|
||||
|
||||
(m as BaseCreature)?.OnHarmfulSpell(caster);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -293,8 +293,8 @@ namespace Server.Spells.Fourth
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace Server.Spells.Fourth
|
|||
{
|
||||
Caster.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
}
|
||||
else if (m is BaseCreature && ((BaseCreature)m).IsAnimatedDead)
|
||||
else if (m is BaseCreature creature && creature.IsAnimatedDead)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1061654); // You cannot heal that which is not alive.
|
||||
}
|
||||
|
|
@ -92,7 +92,8 @@ namespace Server.Spells.Fourth
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -76,8 +76,8 @@ namespace Server.Spells.Fourth
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -120,8 +120,8 @@ namespace Server.Spells.Fourth
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -24,11 +24,7 @@ namespace Server.Spells.Fourth
|
|||
|
||||
private RunebookEntry m_Entry;
|
||||
|
||||
public RecallSpell(Mobile caster, Item scroll) : this(caster, scroll, null, null)
|
||||
{
|
||||
}
|
||||
|
||||
public RecallSpell(Mobile caster, Item scroll, RunebookEntry entry, Runebook book) : base(caster, scroll, m_Info)
|
||||
public RecallSpell(Mobile caster, Item scroll, RunebookEntry entry = null, Runebook book = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
m_Entry = entry;
|
||||
m_Book = book;
|
||||
|
|
@ -99,9 +95,9 @@ namespace Server.Spells.Fourth
|
|||
else if (!SpellHelper.CheckTravel(Caster, map, loc, TravelCheckType.RecallTo))
|
||||
{
|
||||
}
|
||||
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)
|
||||
{
|
||||
|
|
@ -159,38 +155,32 @@ namespace Server.Spells.Fourth
|
|||
|
||||
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(501805); // 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);
|
||||
else
|
||||
from.SendLocalizedMessage(502354); // Target is not marked.
|
||||
}
|
||||
else if (o is Key && ((Key)o).KeyValue != 0 && ((Key)o).Link is BaseBoat)
|
||||
else if (o is Key key && key.KeyValue != 0 && key.Link is BaseBoat boat)
|
||||
{
|
||||
BaseBoat boat = ((Key)o).Link as BaseBoat;
|
||||
|
||||
if (!boat.Deleted && boat.CheckKey(((Key)o).KeyValue))
|
||||
if (!boat.Deleted && boat.CheckKey(key.KeyValue))
|
||||
m_Owner.Effect(boat.GetMarkedLocation(), boat.Map, false);
|
||||
else
|
||||
from.Send(new MessageLocalized(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 502357,
|
||||
from.Name, "")); // I can not recall 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
|
||||
|
|
|
|||
|
|
@ -76,8 +76,8 @@ namespace Server.Spells.Mysticism
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -75,8 +75,8 @@ namespace Server.Spells.Mysticism
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@ namespace Server.Spells.Mysticism
|
|||
|
||||
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>();
|
||||
|
||||
|
|
@ -131,9 +131,7 @@ namespace Server.Spells.Mysticism
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ namespace Server.Spells.Mysticism
|
|||
|
||||
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>();
|
||||
|
||||
|
|
@ -83,11 +83,7 @@ namespace Server.Spells.Mysticism
|
|||
foreach (Mobile m in targets)
|
||||
{
|
||||
Caster.DoHarmful(m);
|
||||
|
||||
int[] types = new int[4];
|
||||
types[Utility.Random(types.Length)] = 100;
|
||||
|
||||
SpellHelper.Damage(this, m, damage, 0, types[0], types[1], types[2], types[3]);
|
||||
SpellHelper.Damage(this, m, damage, 0, 0, 0, 0, 0, 100);
|
||||
|
||||
double resistedReduction = reduction - m.Skills[SkillName.MagicResist].Value / 800.0;
|
||||
|
||||
|
|
|
|||
|
|
@ -63,11 +63,7 @@ namespace Server.Spells.Mysticism
|
|||
VisualEffect(targeted);
|
||||
|
||||
int damage = GetNewAosDamage(33, 1, 5, targeted);
|
||||
|
||||
int[] types = new int[4];
|
||||
types[Utility.Random(types.Length)] = 100;
|
||||
|
||||
SpellHelper.Damage(this, targeted, damage, 0, types[0], types[1], types[2], types[3]);
|
||||
SpellHelper.Damage(this, targeted, damage, 0, 0, 0, 0, 0);
|
||||
|
||||
SpellPlagueContext context = new SpellPlagueContext(this, targeted);
|
||||
|
||||
|
|
@ -176,10 +172,7 @@ namespace Server.Spells.Mysticism
|
|||
m_Explosions++;
|
||||
m_LastExploded = DateTime.Now;
|
||||
|
||||
int[] types = new int[4];
|
||||
types[Utility.Random(types.Length)] = 100;
|
||||
|
||||
SpellHelper.Damage(m_Owner, m_Target, damage, 0, types[0], types[1], types[2], types[3]);
|
||||
SpellHelper.Damage(m_Owner, m_Target, damage, 0, 0, 0, 0, 0, 100);
|
||||
|
||||
if (m_Explosions >= 3)
|
||||
EndPlague();
|
||||
|
|
@ -222,8 +215,8 @@ namespace Server.Spells.Mysticism
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -132,9 +132,7 @@ namespace Server.Spells.Necromancy
|
|||
{
|
||||
MaabusCoffinComponent comp = obj as MaabusCoffinComponent;
|
||||
|
||||
MaabusCoffin addon = comp?.Addon as MaabusCoffin;
|
||||
|
||||
if (addon != null)
|
||||
if (comp?.Addon is MaabusCoffin addon)
|
||||
{
|
||||
PlayerMobile pm = Caster as PlayerMobile;
|
||||
|
||||
|
|
@ -154,9 +152,7 @@ namespace Server.Spells.Necromancy
|
|||
return;
|
||||
}
|
||||
|
||||
Corpse c = obj as Corpse;
|
||||
|
||||
if (c == null)
|
||||
if (!(obj is Corpse c))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1061084); // You cannot animate that.
|
||||
}
|
||||
|
|
@ -167,8 +163,8 @@ namespace Server.Spells.Necromancy
|
|||
if (c.Owner != null) type = c.Owner.GetType();
|
||||
|
||||
if (c.ItemID != 0x2006 || c.Animated || type == typeof(PlayerMobile) || type == null ||
|
||||
c.Owner != null && c.Owner.Fame < 100 || c.Owner is BaseCreature &&
|
||||
(((BaseCreature)c.Owner).Summoned || ((BaseCreature)c.Owner).IsBonded))
|
||||
c.Owner != null && c.Owner.Fame < 100 || c.Owner is BaseCreature creature &&
|
||||
(creature.Summoned || creature.IsBonded))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1061085); // There's not enough life force there to animate.
|
||||
}
|
||||
|
|
@ -326,25 +322,20 @@ namespace Server.Spells.Necromancy
|
|||
if (summoned == null)
|
||||
return;
|
||||
|
||||
if (summoned is BaseCreature)
|
||||
if (summoned is BaseCreature bc)
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)summoned;
|
||||
|
||||
// to be sure
|
||||
bc.Tamable = false;
|
||||
|
||||
if (bc is BaseMount)
|
||||
bc.ControlSlots = 1;
|
||||
else
|
||||
bc.ControlSlots = 0;
|
||||
bc.ControlSlots = bc is BaseMount ? 1 : 0;
|
||||
|
||||
Effects.PlaySound(loc, map, bc.GetAngerSound());
|
||||
|
||||
BaseCreature.Summon((BaseCreature)summoned, false, caster, loc, 0x28, TimeSpan.FromDays(1.0));
|
||||
BaseCreature.Summon(bc, false, caster, loc, 0x28, TimeSpan.FromDays(1.0));
|
||||
}
|
||||
|
||||
if (summoned is SkeletalDragon)
|
||||
Scale((SkeletalDragon)summoned, 50); // lose 50% hp and strength
|
||||
if (summoned is SkeletalDragon dragon)
|
||||
Scale(dragon, 50); // lose 50% hp and strength
|
||||
|
||||
summoned.Fame = 0;
|
||||
summoned.Karma = -1500;
|
||||
|
|
@ -359,9 +350,7 @@ namespace Server.Spells.Necromancy
|
|||
|
||||
public static void Scale(BaseCreature bc, int scalar)
|
||||
{
|
||||
int toScale;
|
||||
|
||||
toScale = bc.RawStr;
|
||||
int toScale = bc.RawStr;
|
||||
bc.RawStr = AOS.Scale(toScale, scalar);
|
||||
|
||||
toScale = bc.HitsMaxSeed;
|
||||
|
|
|
|||
|
|
@ -173,8 +173,8 @@ namespace Server.Spells.Necromancy
|
|||
|
||||
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);
|
||||
else
|
||||
from.SendLocalizedMessage(1060508); // You can't curse that.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,8 +141,8 @@ namespace Server.Spells.Necromancy
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -26,9 +26,7 @@ namespace Server.Spells.Necromancy
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
BaseWeapon weapon = Caster.Weapon as BaseWeapon;
|
||||
|
||||
if (weapon == null || weapon is Fists)
|
||||
if (!(Caster.Weapon is BaseWeapon weapon) || weapon is Fists)
|
||||
{
|
||||
Caster.SendLocalizedMessage(501078); // You must be holding a weapon.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,8 +116,8 @@ namespace Server.Spells.Necromancy
|
|||
|
||||
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);
|
||||
else
|
||||
from.SendLocalizedMessage(1060508); // You can't curse that.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,9 +87,7 @@ namespace Server.Spells.Necromancy
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
ChampionSpawnRegion r = Caster.Region.GetRegion(typeof(ChampionSpawnRegion)) as ChampionSpawnRegion;
|
||||
|
||||
if (r == null || !Caster.InRange(r.ChampionSpawn, Range))
|
||||
if (!(Caster.Region.GetRegion(typeof(ChampionSpawnRegion)) is ChampionSpawnRegion r) || !Caster.InRange(r.ChampionSpawn, Range))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1072111); // You are not in a valid exorcism region.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,8 +120,8 @@ namespace Server.Spells.Necromancy
|
|||
|
||||
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);
|
||||
else
|
||||
from.SendLocalizedMessage(1060508); // You can't curse that.
|
||||
}
|
||||
|
|
@ -135,14 +135,12 @@ namespace Server.Spells.Necromancy
|
|||
|
||||
public class MRExpireTimer : Timer
|
||||
{
|
||||
private Mobile m_Caster;
|
||||
private DateTime m_End;
|
||||
private Mobile m_Target;
|
||||
|
||||
public MRExpireTimer(Mobile caster, Mobile target, TimeSpan delay) : base(TimeSpan.FromSeconds(1.0),
|
||||
TimeSpan.FromSeconds(1.0))
|
||||
{
|
||||
m_Caster = caster;
|
||||
m_Target = target;
|
||||
m_End = DateTime.UtcNow + delay;
|
||||
Priority = TimerPriority.TwoFiftyMS;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ namespace Server.Spells.Necromancy
|
|||
{
|
||||
SpellHelper.Turn(Caster, m);
|
||||
|
||||
//SpellHelper.CheckReflect( (int)this.Circle, Caster, ref m ); //Irrelevent asfter AoS
|
||||
//SpellHelper.CheckReflect( (int)this.Circle, Caster, ref m ); //Irrelevent after AoS
|
||||
|
||||
/* Temporarily causes intense physical pain to the target, dealing direct damage.
|
||||
* After 10 seconds the spell wears off, and if the target is still alive,
|
||||
|
|
@ -61,9 +61,8 @@ namespace Server.Spells.Necromancy
|
|||
if (m_Table.Contains(m))
|
||||
{
|
||||
damage = Utility.RandomMinMax(3, 7);
|
||||
Timer t = m_Table[m] as Timer;
|
||||
|
||||
if (t != null)
|
||||
if (m_Table[m] is Timer t)
|
||||
{
|
||||
t.Delay += TimeSpan.FromSeconds(2.0);
|
||||
|
||||
|
|
@ -77,6 +76,7 @@ namespace Server.Spells.Necromancy
|
|||
|
||||
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.PainSpike, 1075667, buffTime, m, Convert.ToString((int)damage)));
|
||||
|
||||
// TODO: Find a better way to do this
|
||||
WeightOverloading.DFA = DFAlgorithm.PainSpike;
|
||||
m.Damage((int)damage, Caster);
|
||||
SpellHelper.DoLeech((int)damage, Caster, m);
|
||||
|
|
@ -126,8 +126,8 @@ namespace Server.Spells.Necromancy
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -107,8 +107,8 @@ namespace Server.Spells.Necromancy
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -33,18 +33,12 @@ namespace Server.Spells.Ninjitsu
|
|||
return false;
|
||||
}
|
||||
|
||||
if (Core.ML)
|
||||
if (Core.ML && @from.Weapon is BaseRanged)
|
||||
{
|
||||
BaseRanged ranged = from.Weapon as BaseRanged;
|
||||
|
||||
if (ranged != null)
|
||||
{
|
||||
from.SendLocalizedMessage(1075858); // You can only use this with melee attacks.
|
||||
return false;
|
||||
}
|
||||
from.SendLocalizedMessage(1075858); // You can only use this with melee attacks.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return base.Validate(from);
|
||||
}
|
||||
|
||||
|
|
@ -86,9 +80,7 @@ namespace Server.Spells.Ninjitsu
|
|||
|
||||
public override void OnClearMove(Mobile from)
|
||||
{
|
||||
KiAttackInfo info = m_Table[from] as KiAttackInfo;
|
||||
|
||||
if (info != null)
|
||||
if (m_Table[@from] is KiAttackInfo info)
|
||||
{
|
||||
info.m_Timer?.Stop();
|
||||
|
||||
|
|
@ -98,9 +90,7 @@ namespace Server.Spells.Ninjitsu
|
|||
|
||||
public static double GetBonus(Mobile from)
|
||||
{
|
||||
KiAttackInfo info = m_Table[from] as KiAttackInfo;
|
||||
|
||||
if (info == null)
|
||||
if (!(m_Table[@from] is KiAttackInfo info))
|
||||
return 0.0;
|
||||
|
||||
int xDelta = info.m_Location.X - from.X;
|
||||
|
|
|
|||
|
|
@ -122,9 +122,7 @@ namespace Server.Spells.Ninjitsu
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,9 +86,7 @@ namespace Server.Spells.Ninjitsu
|
|||
|
||||
public static bool GetMalus(Mobile target, ref int malus)
|
||||
{
|
||||
SurpriseAttackInfo info = m_Table[target] as SurpriseAttackInfo;
|
||||
|
||||
if (info == null)
|
||||
if (!(m_Table[target] is SurpriseAttackInfo info))
|
||||
return false;
|
||||
|
||||
malus = info.m_Malus;
|
||||
|
|
|
|||
|
|
@ -71,7 +71,8 @@ namespace Server.Spells.Second
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -71,7 +71,8 @@ namespace Server.Spells.Second
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -87,7 +87,8 @@ namespace Server.Spells.Second
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -25,13 +25,11 @@ namespace Server.Spells.Second
|
|||
Caster.Target = new InternalTarget(this);
|
||||
}
|
||||
|
||||
|
||||
public override double GetSlayerDamageScalar(Mobile target)
|
||||
{
|
||||
return 1.0; //This spell isn't affected by slayer spellbooks
|
||||
}
|
||||
|
||||
|
||||
public void Target(Mobile m)
|
||||
{
|
||||
if (!Caster.CanSee(m))
|
||||
|
|
@ -97,7 +95,8 @@ namespace Server.Spells.Second
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -78,8 +78,8 @@ namespace Server.Spells.Second
|
|||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is TrappableContainer)
|
||||
m_Owner.Target((TrappableContainer)o);
|
||||
if (o is TrappableContainer container)
|
||||
m_Owner.Target(container);
|
||||
else
|
||||
from.SendMessage("You can't trap that");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@ namespace Server.Spells.Second
|
|||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is TrappableContainer)
|
||||
m_Owner.Target((TrappableContainer)o);
|
||||
if (o is TrappableContainer container)
|
||||
m_Owner.Target(container);
|
||||
else
|
||||
from.SendMessage("You can't disarm that");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,8 @@ namespace Server.Spells.Second
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,9 +37,8 @@ namespace Server.Spells.Sixth
|
|||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is Mobile)
|
||||
if (o is Mobile m)
|
||||
{
|
||||
Mobile m = (Mobile)o;
|
||||
BaseCreature bc = m as BaseCreature;
|
||||
|
||||
if (!from.CanSee(m))
|
||||
|
|
|
|||
|
|
@ -82,8 +82,8 @@ namespace Server.Spells.Sixth
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -115,8 +115,8 @@ namespace Server.Spells.Sixth
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ namespace Server.Spells.Sixth
|
|||
{
|
||||
Caster.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
}
|
||||
else if (m is BaseVendor || m is PlayerVendor || m is PlayerBarkeeper || m.AccessLevel > Caster.AccessLevel)
|
||||
else if (m is BaseVendor || m is PlayerVendor || m.AccessLevel > Caster.AccessLevel)
|
||||
{
|
||||
Caster.SendLocalizedMessage(501857); // This spell won't work on that!
|
||||
}
|
||||
|
|
@ -125,7 +125,8 @@ namespace Server.Spells.Sixth
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -74,8 +74,8 @@ namespace Server.Spells.Sixth
|
|||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is RecallRune)
|
||||
m_Owner.Target((RecallRune)o);
|
||||
if (o is RecallRune rune)
|
||||
m_Owner.Target(rune);
|
||||
else
|
||||
from.Send(new MessageLocalized(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 501797, from.Name,
|
||||
"")); // I cannot mark that object.
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue