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
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -92,9 +92,7 @@ namespace Server.Spells.Sixth
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -224,8 +224,8 @@ namespace Server.Spells.Sixth
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -107,9 +107,7 @@ namespace Server.Spells.Sixth
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ namespace Server.Spells.Spellweaving
|
|||
{
|
||||
ItemData id = item.ItemData;
|
||||
|
||||
if (item == null || item.Z + id.CalcHeight != location.Z)
|
||||
if (item.Z + id.CalcHeight != location.Z)
|
||||
continue;
|
||||
if (IsValidTile(item.ItemID))
|
||||
{
|
||||
|
|
@ -120,14 +120,12 @@ namespace Server.Spells.Spellweaving
|
|||
|
||||
private List<Mobile> GetArcanists()
|
||||
{
|
||||
List<Mobile> weavers = new List<Mobile>();
|
||||
|
||||
weavers.Add(Caster);
|
||||
List<Mobile> weavers = new List<Mobile> { Caster };
|
||||
|
||||
//OSI Verified: Even enemies/combatants count
|
||||
foreach (Mobile m in Caster.GetMobilesInRange(1)) //Range verified as 1
|
||||
if (m != Caster && m is PlayerMobile && Caster.CanBeBeneficial(m, false) &&
|
||||
Math.Abs(Caster.Skills.Spellweaving.Value - m.Skills.Spellweaving.Value) <= 20 && !(m is Clone))
|
||||
Math.Abs(Caster.Skills.Spellweaving.Value - m.Skills.Spellweaving.Value) <= 20)
|
||||
weavers.Add(m);
|
||||
// Everyone gets the Arcane Focus, power capped elsewhere
|
||||
|
||||
|
|
@ -143,15 +141,15 @@ namespace Server.Spells.Spellweaving
|
|||
|
||||
if (focus == null)
|
||||
{
|
||||
ArcaneFocus f = new ArcaneFocus(duration, strengthBonus);
|
||||
if (to.PlaceInBackpack(f))
|
||||
focus = new ArcaneFocus(duration, strengthBonus);
|
||||
if (to.PlaceInBackpack(focus))
|
||||
{
|
||||
f.SendTimeRemainingMessage(to);
|
||||
focus.SendTimeRemainingMessage(to);
|
||||
to.SendLocalizedMessage(1072740); // An arcane focus appears in your backpack.
|
||||
}
|
||||
else
|
||||
{
|
||||
f.Delete();
|
||||
focus.Delete();
|
||||
}
|
||||
}
|
||||
else //OSI renewal rules: the new one will override the old one, always.
|
||||
|
|
|
|||
|
|
@ -69,13 +69,13 @@ namespace Server.Spells.Spellweaving
|
|||
return false;
|
||||
}
|
||||
|
||||
if (caster is PlayerMobile)
|
||||
if (caster is PlayerMobile mobile)
|
||||
{
|
||||
MLQuestContext context = MLQuestSystem.GetContext((PlayerMobile)caster);
|
||||
MLQuestContext context = MLQuestSystem.GetContext(mobile);
|
||||
|
||||
if (context == null || !context.Spellweaving)
|
||||
{
|
||||
caster.SendLocalizedMessage(
|
||||
mobile.SendLocalizedMessage(
|
||||
1073220); // You must have completed the epic arcanist quest to use this ability.
|
||||
return false;
|
||||
}
|
||||
|
|
@ -93,7 +93,7 @@ namespace Server.Spells.Spellweaving
|
|||
if (caster.Skills[CastSkill].Value < RequiredSkill)
|
||||
{
|
||||
caster.SendLocalizedMessage(1063013,
|
||||
$"{RequiredSkill.ToString("F1")}\t{"#1044114"}"); // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
|
||||
$"{RequiredSkill:F1}\t{"#1044114"}"); // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,8 +39,6 @@ namespace Server.Spells.Spellweaving
|
|||
|
||||
public void Target(Mobile m)
|
||||
{
|
||||
BaseCreature bc = m as BaseCreature;
|
||||
|
||||
if (!Caster.CanSee(m))
|
||||
{
|
||||
Caster.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
|
|
@ -49,7 +47,7 @@ namespace Server.Spells.Spellweaving
|
|||
{
|
||||
// As per Osi: Nothing happens.
|
||||
}
|
||||
else if (m != Caster && (bc == null || !bc.IsBonded || bc.ControlMaster != Caster))
|
||||
else if (m != Caster && !(m is BaseCreature bc && bc.IsBonded && bc.ControlMaster == Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1072077); // You may only cast this spell on yourself or a bonded pet.
|
||||
}
|
||||
|
|
@ -101,9 +99,8 @@ namespace Server.Spells.Spellweaving
|
|||
{
|
||||
double hitsScalar = timer.Spell.HitsScalar;
|
||||
|
||||
if (m is BaseCreature && m.IsDeadBondedPet)
|
||||
if (m is BaseCreature pet && pet.IsDeadBondedPet)
|
||||
{
|
||||
BaseCreature pet = (BaseCreature)m;
|
||||
Mobile master = pet.GetMaster();
|
||||
|
||||
if (master?.NetState != null && Utility.InUpdateRange(pet, master))
|
||||
|
|
@ -190,8 +187,8 @@ namespace Server.Spells.Spellweaving
|
|||
|
||||
protected override void OnTarget(Mobile m, object o)
|
||||
{
|
||||
if (o is Mobile)
|
||||
m_Owner.Target((Mobile)o);
|
||||
if (o is Mobile mobile)
|
||||
m_Owner.Target(mobile);
|
||||
else
|
||||
m.SendLocalizedMessage(1072077); // You may only cast this spell on yourself or a bonded pet.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,7 +166,8 @@ namespace Server.Spells.Spellweaving
|
|||
|
||||
protected override void OnTarget(Mobile m, 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 m)
|
||||
|
|
|
|||
|
|
@ -26,9 +26,7 @@ namespace Server.Spells.Spellweaving
|
|||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
BaseWeapon weapon = Caster.Weapon as BaseWeapon;
|
||||
|
||||
if (weapon == null || weapon is Fists || weapon is BaseRanged)
|
||||
if (!(Caster.Weapon is BaseWeapon weapon) || weapon is Fists || weapon is BaseRanged)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1060179); // You must be wielding a weapon to use this ability!
|
||||
return false;
|
||||
|
|
@ -39,9 +37,7 @@ namespace Server.Spells.Spellweaving
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
BaseWeapon weapon = Caster.Weapon as BaseWeapon;
|
||||
|
||||
if (weapon == null || weapon is Fists || weapon is BaseRanged)
|
||||
if (!(Caster.Weapon is BaseWeapon weapon) || weapon is Fists || weapon is BaseRanged)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1060179); // You must be wielding a weapon to use this ability!
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,8 +84,8 @@ namespace Server.Spells.Spellweaving
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -28,13 +28,13 @@ namespace Server.Spells.Spellweaving
|
|||
Mobile caster = Caster;
|
||||
|
||||
// This is done after casting completes
|
||||
if (caster is PlayerMobile)
|
||||
if (caster is PlayerMobile mobile)
|
||||
{
|
||||
MLQuestContext context = MLQuestSystem.GetContext((PlayerMobile)caster);
|
||||
MLQuestContext context = MLQuestSystem.GetContext(mobile);
|
||||
|
||||
if (context == null || !context.SummonFey)
|
||||
{
|
||||
caster.SendLocalizedMessage(
|
||||
mobile.SendLocalizedMessage(
|
||||
1074563); // You haven't forged a friendship with the fey and are unable to summon their aid.
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,13 +28,13 @@ namespace Server.Spells.Spellweaving
|
|||
Mobile caster = Caster;
|
||||
|
||||
// This is done after casting completes
|
||||
if (caster is PlayerMobile)
|
||||
if (caster is PlayerMobile mobile)
|
||||
{
|
||||
MLQuestContext context = MLQuestSystem.GetContext((PlayerMobile)caster);
|
||||
MLQuestContext context = MLQuestSystem.GetContext(mobile);
|
||||
|
||||
if (context == null || !context.SummonFiend)
|
||||
{
|
||||
caster.SendLocalizedMessage(1074564); // You haven't demonstrated mastery to summon a fiend.
|
||||
mobile.SendLocalizedMessage(1074564); // You haven't demonstrated mastery to summon a fiend.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,11 +58,7 @@ namespace Server.Spells.Spellweaving
|
|||
damage /= 100;
|
||||
}
|
||||
|
||||
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]); //Chaos damage. Random elemental damage
|
||||
SpellHelper.Damage(this, m, damage, 0, 0, 0, 0, 0, 100);
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
|
|
@ -79,7 +75,8 @@ namespace Server.Spells.Spellweaving
|
|||
|
||||
protected override void OnTarget(Mobile m, 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 m)
|
||||
|
|
|
|||
|
|
@ -77,7 +77,8 @@ namespace Server.Spells.Third
|
|||
|
||||
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue