Formatting FIxes (#58)

This commit is contained in:
Kamron Batman 2019-10-04 23:08:13 -07:00 committed by GitHub
parent 57fb9fb525
commit 096d39609e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1318 changed files with 11633 additions and 22129 deletions

View file

@ -18,10 +18,7 @@ namespace Server.Spells
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds((3 + (int)Circle) * CastDelaySecondsPerTick);
public override bool ConsumeReagents()
{
return base.ConsumeReagents() || ArcaneGem.ConsumeCharges(Caster, Core.SE ? 1 : 1 + (int)Circle);
}
public override bool ConsumeReagents() => base.ConsumeReagents() || ArcaneGem.ConsumeCharges(Caster, Core.SE ? 1 : 1 + (int)Circle);
public override void GetCastSkills(out double min, out double max)
{
@ -36,10 +33,7 @@ namespace Server.Spells
max = avg + ChanceOffset;
}
public override int GetMana()
{
return Scroll is BaseWand ? 0 : m_ManaTable[(int)Circle];
}
public override int GetMana() => Scroll is BaseWand ? 0 : m_ManaTable[(int)Circle];
public override double GetResistSkill(Mobile m)
{
@ -83,10 +77,7 @@ namespace Server.Spells
2.0; // Seems should be about half of what stratics says.
}
public virtual double GetResistPercent(Mobile target)
{
return GetResistPercentForCircle(target, Circle);
}
public virtual double GetResistPercent(Mobile target) => GetResistPercentForCircle(target, Circle);
public override TimeSpan GetCastDelay()
{

View file

@ -27,27 +27,15 @@ namespace Server.Spells
public virtual bool ValidatesDuringHit => true;
public virtual int GetAccuracyBonus(Mobile attacker)
{
return 0;
}
public virtual int GetAccuracyBonus(Mobile attacker) => 0;
public virtual double GetDamageScalar(Mobile attacker, Mobile defender)
{
return 1.0;
}
public virtual double GetDamageScalar(Mobile attacker, Mobile defender) => 1.0;
// Called before swinging, to make sure the accuracy scalar is to be computed.
public virtual bool OnBeforeSwing(Mobile attacker, Mobile defender)
{
return true;
}
public virtual bool OnBeforeSwing(Mobile attacker, Mobile defender) => true;
// Called when a hit connects, but before damage is calculated.
public virtual bool OnBeforeDamage(Mobile attacker, Mobile defender)
{
return true;
}
public virtual bool OnBeforeDamage(Mobile attacker, Mobile defender) => true;
// Called as soon as the ability is used.
public virtual void OnUse(Mobile from)
@ -69,15 +57,9 @@ namespace Server.Spells
{
}
public virtual bool IgnoreArmor(Mobile attacker)
{
return false;
}
public virtual bool IgnoreArmor(Mobile attacker) => false;
public virtual double GetPropertyBonus(Mobile attacker)
{
return 1.0;
}
public virtual double GetPropertyBonus(Mobile attacker) => 1.0;
public virtual bool CheckSkills(Mobile m)
{
@ -302,10 +284,7 @@ namespace Server.Spells
}
}
private static SpecialMoveContext GetContext(Mobile m)
{
return m_PlayersTable.TryGetValue(m, out SpecialMoveContext context) ? context : null;
}
private static SpecialMoveContext GetContext(Mobile m) => m_PlayersTable.TryGetValue(m, out SpecialMoveContext context) ? context : null;
private class SpecialMoveTimer : Timer
{

View file

@ -126,10 +126,7 @@ namespace Server.Spells
return true;
}
public virtual bool OnCastInTown(Region r)
{
return Info.AllowTown;
}
public virtual bool OnCastInTown(Region r) => Info.AllowTown;
public void StartDelayedDamageContext(Mobile m, Timer t)
{
@ -162,10 +159,7 @@ namespace Server.Spells
return GetNewAosDamage(bonus, dice, sides, false);
}
public virtual int GetNewAosDamage(int bonus, int dice, int sides, bool playerVsPlayer)
{
return GetNewAosDamage(bonus, dice, sides, playerVsPlayer, 1.0);
}
public virtual int GetNewAosDamage(int bonus, int dice, int sides, bool playerVsPlayer) => GetNewAosDamage(bonus, dice, sides, playerVsPlayer, 1.0);
public virtual int GetNewAosDamage(int bonus, int dice, int sides, bool playerVsPlayer, double scalar)
{
@ -225,40 +219,15 @@ namespace Server.Spells
return false;
}
public virtual double GetInscribeSkill(Mobile m)
{
// There is no chance to gain
// m.CheckSkill( SkillName.Inscribe, 0.0, 120.0 );
public virtual double GetInscribeSkill(Mobile m) => m.Skills.Inscribe.Value;
return m.Skills.Inscribe.Value;
}
public virtual int GetInscribeFixed(Mobile m) => m.Skills.Inscribe.Fixed;
public virtual int GetInscribeFixed(Mobile m)
{
// There is no chance to gain
// m.CheckSkill( SkillName.Inscribe, 0.0, 120.0 );
public virtual int GetDamageFixed(Mobile m) => m.Skills[DamageSkill].Fixed;
return m.Skills.Inscribe.Fixed;
}
public virtual double GetDamageSkill(Mobile m) => m.Skills[DamageSkill].Value;
public virtual int GetDamageFixed(Mobile m)
{
//m.CheckSkill( DamageSkill, 0.0, m.Skills[DamageSkill].Cap );
return m.Skills[DamageSkill].Fixed;
}
public virtual double GetDamageSkill(Mobile m)
{
//m.CheckSkill( DamageSkill, 0.0, m.Skills[DamageSkill].Cap );
return m.Skills[DamageSkill].Value;
}
public virtual double GetResistSkill(Mobile m)
{
return m.Skills.MagicResist.Value;
}
public virtual double GetResistSkill(Mobile m) => m.Skills.MagicResist.Value;
public virtual double GetDamageScalar(Mobile target)
{
@ -359,10 +328,7 @@ namespace Server.Spells
}
}
public virtual bool CheckDisturb(DisturbType type, bool firstCircle, bool resistable)
{
return !(resistable && Scroll is BaseWand);
}
public virtual bool CheckDisturb(DisturbType type, bool firstCircle, bool resistable) => !(resistable && Scroll is BaseWand);
public void Disturb(DisturbType type, bool firstCircle = true, bool resistable = false)
{
@ -417,10 +383,7 @@ namespace Server.Spells
Caster.SendLocalizedMessage(500641); // Your concentration is disturbed, thus ruining thy spell.
}
public virtual bool CheckCast()
{
return true;
}
public virtual bool CheckCast() => true;
public virtual void SayMantra()
{
@ -665,10 +628,7 @@ namespace Server.Spells
Caster.Spell = null;
}
public virtual int ComputeKarmaAward()
{
return 0;
}
public virtual int ComputeKarmaAward() => 0;
public virtual bool CheckSequence()
{
@ -762,10 +722,7 @@ namespace Server.Spells
return false;
}
public bool CheckBSequence(Mobile target)
{
return CheckBSequence(target, false);
}
public bool CheckBSequence(Mobile target) => CheckBSequence(target, false);
public bool CheckBSequence(Mobile target, bool allowDead)
{

View file

@ -241,11 +241,7 @@ namespace Server.Spells
return false;
}
public static bool CanRevealCaster(Mobile m)
{
return m is BaseCreature c && !c.Controlled;
}
public static bool CanRevealCaster(Mobile m) => m is BaseCreature c && !c.Controlled;
public static void GetSurfaceTop(ref IPoint3D p)
{
@ -274,10 +270,7 @@ namespace Server.Spells
return true;
}
public static bool AddStatBonus(Mobile caster, Mobile target, StatType type)
{
return AddStatBonus(caster, target, type, GetOffset(caster, target, type, false), GetDuration(caster, target));
}
public static bool AddStatBonus(Mobile caster, Mobile target, StatType type) => AddStatBonus(caster, target, type, GetOffset(caster, target, type, false), GetDuration(caster, target));
public static bool AddStatBonus(Mobile caster, Mobile target, StatType type, int bonus, TimeSpan duration)
{
@ -301,10 +294,7 @@ namespace Server.Spells
return false;
}
public static bool AddStatCurse(Mobile caster, Mobile target, StatType type)
{
return AddStatCurse(caster, target, type, GetOffset(caster, target, type, true), GetDuration(caster, target));
}
public static bool AddStatCurse(Mobile caster, Mobile target, StatType type) => AddStatCurse(caster, target, type, GetOffset(caster, target, type, true), GetDuration(caster, target));
public static bool AddStatCurse(Mobile caster, Mobile target, StatType type, int curse, TimeSpan duration)
{
@ -592,15 +582,9 @@ namespace Server.Spells
caster.SendLocalizedMessage(501802); // Thy spell doth not appear to work...
}
public static bool CheckTravel(Mobile caster, TravelCheckType type)
{
return CheckTravel(caster, caster.Map, caster.Location, type);
}
public static bool CheckTravel(Mobile caster, TravelCheckType type) => CheckTravel(caster, caster.Map, caster.Location, type);
public static bool CheckTravel(Map map, Point3D loc, TravelCheckType type)
{
return CheckTravel(null, map, loc, type);
}
public static bool CheckTravel(Map map, Point3D loc, TravelCheckType type) => CheckTravel(null, map, loc, type);
public static bool CheckTravel(Mobile caster, Map map, Point3D loc, TravelCheckType type)
{
@ -644,20 +628,11 @@ namespace Server.Spells
return x >= 5120 && y >= 0 && x < 5376 && y < 256;
}
public static bool IsFeluccaWind(Map map, Point3D loc)
{
return map == Map.Felucca && IsWindLoc(loc);
}
public static bool IsFeluccaWind(Map map, Point3D loc) => map == Map.Felucca && IsWindLoc(loc);
public static bool IsTrammelWind(Map map, Point3D loc)
{
return map == Map.Trammel && IsWindLoc(loc);
}
public static bool IsTrammelWind(Map map, Point3D loc) => map == Map.Trammel && IsWindLoc(loc);
public static bool IsIlshenar(Map map, Point3D loc)
{
return map == Map.Ilshenar;
}
public static bool IsIlshenar(Map map, Point3D loc) => map == Map.Ilshenar;
public static bool IsSolenHiveLoc(Point3D loc)
{
@ -666,15 +641,9 @@ namespace Server.Spells
return x >= 5640 && y >= 1776 && x < 5935 && y < 2039;
}
public static bool IsTrammelSolenHive(Map map, Point3D loc)
{
return map == Map.Trammel && IsSolenHiveLoc(loc);
}
public static bool IsTrammelSolenHive(Map map, Point3D loc) => map == Map.Trammel && IsSolenHiveLoc(loc);
public static bool IsFeluccaSolenHive(Map map, Point3D loc)
{
return map == Map.Felucca && IsSolenHiveLoc(loc);
}
public static bool IsFeluccaSolenHive(Map map, Point3D loc) => map == Map.Felucca && IsSolenHiveLoc(loc);
public static bool IsFeluccaT2A(Map map, Point3D loc)
{
@ -696,10 +665,7 @@ namespace Server.Spells
return region.IsPartOf<DungeonRegion>() && region.Map == Map.Felucca;
}
public static bool IsKhaldun(Map map, Point3D loc)
{
return Region.Find(loc, map).Name == "Khaldun";
}
public static bool IsKhaldun(Map map, Point3D loc) => Region.Find(loc, map).Name == "Khaldun";
public static bool IsCrystalCave(Map map, Point3D loc)
{
@ -728,22 +694,9 @@ namespace Server.Spells
return false;
}
public static bool IsFactionStronghold(Map map, Point3D loc)
{
/*// Teleporting is allowed, but only for faction members
if ( !Core.AOS && m_TravelCaster != null && (m_TravelType == TravelCheckType.TeleportTo || m_TravelType == TravelCheckType.TeleportFrom) )
{
if ( Factions.Faction.Find( m_TravelCaster, true, true ) != null )
return false;
}*/
public static bool IsFactionStronghold(Map map, Point3D loc) => Region.Find(loc, map).IsPartOf<StrongholdRegion>();
return Region.Find(loc, map).IsPartOf<StrongholdRegion>();
}
public static bool IsChampionSpawn(Map map, Point3D loc)
{
return Region.Find(loc, map).IsPartOf<ChampionSpawnRegion>();
}
public static bool IsChampionSpawn(Map map, Point3D loc) => Region.Find(loc, map).IsPartOf<ChampionSpawnRegion>();
public static bool IsDoomFerry(Map map, Point3D loc)
{
@ -812,10 +765,7 @@ namespace Server.Spells
return (map == Map.Trammel || map == Map.Felucca) && x >= 6911 && y >= 254 && x < 7167 && y < 511;
}
public static bool IsMLDungeon(Map map, Point3D loc)
{
return MondainsLegacy.IsMLRegion(Region.Find(loc, map));
}
public static bool IsMLDungeon(Map map, Point3D loc) => MondainsLegacy.IsMLRegion(Region.Find(loc, map));
public static bool IsInvalid(Map map, Point3D loc)
{
@ -1307,15 +1257,9 @@ namespace Server.Spells
return context;
}
public static bool UnderTransformation(Mobile m)
{
return GetContext(m) != null;
}
public static bool UnderTransformation(Mobile m) => GetContext(m) != null;
public static bool UnderTransformation(Mobile m, Type type)
{
return GetContext(m)?.Type == type;
}
public static bool UnderTransformation(Mobile m, Type type) => GetContext(m)?.Type == type;
#endregion
}

View file

@ -58,20 +58,11 @@ namespace Server.Spells
public static Dictionary<int, SpecialMove> SpecialMoves{ get; } = new Dictionary<int, SpecialMove>();
public static int GetRegistryNumber(ISpell s)
{
return GetRegistryNumber(s.GetType());
}
public static int GetRegistryNumber(ISpell s) => GetRegistryNumber(s.GetType());
public static int GetRegistryNumber(SpecialMove s)
{
return GetRegistryNumber(s.GetType());
}
public static int GetRegistryNumber(SpecialMove s) => GetRegistryNumber(s.GetType());
public static int GetRegistryNumber(Type type)
{
return m_IDsFromTypes.TryGetValue(type, out int value) ? value : -1;
}
public static int GetRegistryNumber(Type type) => m_IDsFromTypes.TryGetValue(type, out int value) ? value : -1;
public static void Register(int spellID, Type type)
{

View file

@ -48,10 +48,7 @@ namespace Server.Spells.Bushido
FinishSequence();
}
public static bool IsConfident(Mobile m)
{
return m_Table.ContainsKey(m);
}
public static bool IsConfident(Mobile m) => m_Table.ContainsKey(m);
public static void BeginConfidence(Mobile m)
{
@ -73,10 +70,7 @@ namespace Server.Spells.Bushido
OnEffectEnd(m, typeof(Confidence));
}
public static bool IsRegenerating(Mobile m)
{
return m_RegenTable.ContainsKey(m);
}
public static bool IsRegenerating(Mobile m) => m_RegenTable.ContainsKey(m);
public static void BeginRegenerating(Mobile m)
{

View file

@ -62,10 +62,7 @@ namespace Server.Spells.Bushido
FinishSequence();
}
public static bool IsCountering(Mobile m)
{
return m_Table.ContainsKey(m);
}
public static bool IsCountering(Mobile m) => m_Table.ContainsKey(m);
public static void StartCountering(Mobile m)
{

View file

@ -24,10 +24,7 @@ namespace Server.Spells.Bushido
public override double RequiredSkill => 60.0;
public override int RequiredMana => 10;
public override bool CheckCast()
{
return VerifyCast(Caster, true) && base.CheckCast();
}
public override bool CheckCast() => VerifyCast(Caster, true) && base.CheckCast();
public static bool VerifyCast(Mobile Caster, bool messages)
{
@ -118,10 +115,7 @@ namespace Server.Spells.Bushido
FinishSequence();
}
public static bool IsEvading(Mobile m)
{
return m_Table.ContainsKey(m);
}
public static bool IsEvading(Mobile m) => m_Table.ContainsKey(m);
public static TimeSpan GetEvadeDuration(Mobile m)
{

View file

@ -74,15 +74,9 @@ namespace Server.Spells.Bushido
CheckGain(attacker);
}
public static int GetSwingBonus(Mobile target)
{
return m_Table.TryGetValue(target, out HonorableExecutionInfo info) ? info.m_SwingBonus : 0;
}
public static int GetSwingBonus(Mobile target) => m_Table.TryGetValue(target, out HonorableExecutionInfo info) ? info.m_SwingBonus : 0;
public static bool IsUnderPenalty(Mobile target)
{
return m_Table.TryGetValue(target, out HonorableExecutionInfo info) && info.m_Penalty;
}
public static bool IsUnderPenalty(Mobile target) => m_Table.TryGetValue(target, out HonorableExecutionInfo info) && info.m_Penalty;
public static void RemovePenalty(Mobile target)
{

View file

@ -13,10 +13,7 @@ namespace Server.Spells.Bushido
public override bool ValidatesDuringHit => false;
public override int GetAccuracyBonus(Mobile attacker)
{
return 50;
}
public override int GetAccuracyBonus(Mobile attacker) => 50;
public override bool Validate(Mobile from)
{

View file

@ -25,10 +25,7 @@ namespace Server.Spells.Bushido
public override int CastRecoveryBase => 7;
public static bool CheckExpansion(Mobile from)
{
return (from as PlayerMobile)?.NetState?.SupportsExpansion(Expansion.SE) == true;
}
public static bool CheckExpansion(Mobile from) => (from as PlayerMobile)?.NetState?.SupportsExpansion(Expansion.SE) == true;
public override bool CheckCast()
{
@ -93,10 +90,7 @@ namespace Server.Spells.Bushido
max = RequiredSkill + 37.5;
}
public override int GetMana()
{
return 0;
}
public override int GetMana() => 0;
public virtual void OnCastSuccessful(Mobile caster)
{

View file

@ -57,10 +57,7 @@ namespace Server.Spells.Chivalry
FinishSequence();
}
public static bool UnderEffect(Mobile m)
{
return m_Table.ContainsKey(m);
}
public static bool UnderEffect(Mobile m) => m_Table.ContainsKey(m);
private static void Expire_Callback(Mobile m)
{

View file

@ -124,15 +124,9 @@ namespace Server.Spells.Chivalry
max = RequiredSkill + 50.0;
}
public override int GetMana()
{
return 0;
}
public override int GetMana() => 0;
public int ComputePowerValue(int div)
{
return ComputePowerValue(Caster, div);
}
public int ComputePowerValue(int div) => ComputePowerValue(Caster, div);
public static int ComputePowerValue(Mobile from, int div)
{

View file

@ -119,9 +119,6 @@ namespace Server.Spells.Fifth
FinishSequence();
}
public override double GetSlayerDamageScalar(Mobile target)
{
return 1.0; //This spell isn't affected by slayer spellbooks
}
public override double GetSlayerDamageScalar(Mobile target) => 1.0;
}
}

View file

@ -27,10 +27,7 @@ namespace Server.Spells.First
{
private Spell m_Spell;
public NightSightTarget(Spell spell) : base(12, false, TargetFlags.Beneficial)
{
m_Spell = spell;
}
public NightSightTarget(Spell spell) : base(12, false, TargetFlags.Beneficial) => m_Spell = spell;
protected override void OnTarget(Mobile from, object targeted)
{

View file

@ -142,14 +142,8 @@ namespace Server.Spells.Fourth
return false;
}
private static bool IsInnocentTo(Mobile from, Mobile to)
{
return Notoriety.Compute(from, to) == Notoriety.Innocent;
}
private static bool IsInnocentTo(Mobile from, Mobile to) => Notoriety.Compute(from, to) == Notoriety.Innocent;
private static bool IsAllyTo(Mobile from, Mobile to)
{
return Notoriety.Compute(from, to) == Notoriety.Ally;
}
private static bool IsAllyTo(Mobile from, Mobile to) => Notoriety.Compute(from, to) == Notoriety.Ally;
}
}

View file

@ -35,10 +35,7 @@ namespace Server.Spells.Fourth
m.UpdateResistances();
}
public static bool UnderEffect(Mobile m)
{
return m_UnderEffect.Contains(m);
}
public static bool UnderEffect(Mobile m) => m_UnderEffect.Contains(m);
public void Target(Mobile m)
{

View file

@ -100,9 +100,6 @@ namespace Server.Spells.Fourth
FinishSequence();
}
public override double GetResistPercent(Mobile target)
{
return 99.0;
}
public override double GetResistPercent(Mobile target) => 99.0;
}
}

View file

@ -1,82 +1,70 @@
using System;
namespace Server.Spells
{
public class FlySpell : Spell
{
private static readonly SpellInfo m_Info = new SpellInfo("Gargoyle Flight", null, -1, 9002);
private bool m_Stop;
public FlySpell(Mobile caster)
: base(caster, null, m_Info)
{
}
public override bool ClearHandsOnCast => false;
public override bool RevealOnCast => false;
public override double CastDelayFastScalar => 0;
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(.25);
public override TimeSpan GetCastRecovery()
{
return TimeSpan.Zero;
}
public override int GetMana()
{
return 0;
}
public override bool ConsumeReagents()
{
return true;
}
public override bool CheckFizzle()
{
return true;
}
public void Stop()
{
m_Stop = true;
Disturb(DisturbType.Hurt, false);
}
public override bool CheckDisturb(DisturbType type, bool checkFirst, bool resistable)
{
if (type == DisturbType.EquipRequest || type == DisturbType.UseRequest /* || type == DisturbType.Hurt*/)
return false;
return true;
}
public override void DoHurtFizzle()
{
}
public override void DoFizzle()
{
}
public override void OnDisturb(DisturbType type, bool message)
{
if (message && !m_Stop)
Caster.SendLocalizedMessage(1113192); // You have been disrupted while attempting to fly!
}
public override void OnCast()
{
Caster.Flying = false;
BuffInfo.RemoveBuff(Caster, BuffIcon.Fly);
Caster.Animate(60, 10, 1, true, false, 0);
Caster.SendLocalizedMessage(1112567); // You are flying.
Caster.Flying = true;
BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.Fly, 1112567));
FinishSequence();
}
}
using System;
namespace Server.Spells
{
public class FlySpell : Spell
{
private static readonly SpellInfo m_Info = new SpellInfo("Gargoyle Flight", null, -1, 9002);
private bool m_Stop;
public FlySpell(Mobile caster)
: base(caster, null, m_Info)
{
}
public override bool ClearHandsOnCast => false;
public override bool RevealOnCast => false;
public override double CastDelayFastScalar => 0;
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(.25);
public override TimeSpan GetCastRecovery() => TimeSpan.Zero;
public override int GetMana() => 0;
public override bool ConsumeReagents() => true;
public override bool CheckFizzle() => true;
public void Stop()
{
m_Stop = true;
Disturb(DisturbType.Hurt, false);
}
public override bool CheckDisturb(DisturbType type, bool checkFirst, bool resistable)
{
if (type == DisturbType.EquipRequest || type == DisturbType.UseRequest /* || type == DisturbType.Hurt*/)
return false;
return true;
}
public override void DoHurtFizzle()
{
}
public override void DoFizzle()
{
}
public override void OnDisturb(DisturbType type, bool message)
{
if (message && !m_Stop)
Caster.SendLocalizedMessage(1113192); // You have been disrupted while attempting to fly!
}
public override void OnCast()
{
Caster.Flying = false;
BuffInfo.RemoveBuff(Caster, BuffIcon.Fly);
Caster.Animate(60, 10, 1, true, false, 0);
Caster.SendLocalizedMessage(1112567); // You are flying.
Caster.Flying = true;
BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.Fly, 1112567));
FinishSequence();
}
}
}

View file

@ -1,93 +1,78 @@
using System;
namespace Server.Spells.Mysticism
{
public abstract class MysticSpell : Spell
{
public MysticSpell(Mobile caster, Item scroll, SpellInfo info)
: base(caster, scroll, info)
{
}
public abstract double RequiredSkill{ get; }
public abstract int RequiredMana{ get; }
public override SkillName CastSkill => SkillName.Mysticism;
/*
* As per OSI Publish 64:
* Imbuing is not the only skill associated with Mysticism now.
* Players can use EITHER their Focus skill or Imbuing skill.
* Evaluate Intelligence no longer has any effect on a Mystics spell power.
*/
public override double GetDamageSkill(Mobile m)
{
return Math.Max(m.Skills.Imbuing.Value, m.Skills.Focus.Value);
}
public override int GetDamageFixed(Mobile m)
{
return Math.Max(m.Skills.Imbuing.Fixed, m.Skills.Focus.Fixed);
}
public override void GetCastSkills(out double min, out double max)
{
// As per Mysticism page at the UO Herald Playguide
// This means that we have 25% success chance at min Required Skill
min = RequiredSkill - 12.5;
max = RequiredSkill + 37.5;
}
public override int GetMana()
{
return RequiredMana;
}
public override bool CheckCast()
{
if (!base.CheckCast())
return false;
int mana = ScaleMana(RequiredMana);
if (Caster.Mana < mana)
{
Caster.SendLocalizedMessage(1060174,
mana.ToString()); // You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability.
return false;
}
if (Caster.Skills[CastSkill].Value < RequiredSkill)
{
Caster.SendLocalizedMessage(1063013,
$"{RequiredSkill.ToString("F1")}\t{CastSkill.ToString()}\t "); // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
return false;
}
return true;
}
public override void OnBeginCast()
{
base.OnBeginCast();
SendCastEffect();
}
public virtual void SendCastEffect()
{
Caster.FixedEffect(0x37C4, 10, (int)(GetCastDelay().TotalSeconds * 28), 0x66C, 3);
}
public static double GetBaseSkill(Mobile m)
{
return m.Skills.Mysticism.Value;
}
public static double GetBoostSkill(Mobile m)
{
return Math.Max(m.Skills.Imbuing.Value, m.Skills.Focus.Value);
}
}
using System;
namespace Server.Spells.Mysticism
{
public abstract class MysticSpell : Spell
{
public MysticSpell(Mobile caster, Item scroll, SpellInfo info)
: base(caster, scroll, info)
{
}
public abstract double RequiredSkill{ get; }
public abstract int RequiredMana{ get; }
public override SkillName CastSkill => SkillName.Mysticism;
/*
* As per OSI Publish 64:
* Imbuing is not the only skill associated with Mysticism now.
* Players can use EITHER their Focus skill or Imbuing skill.
* Evaluate Intelligence no longer has any effect on a Mystics spell power.
*/
public override double GetDamageSkill(Mobile m) => Math.Max(m.Skills.Imbuing.Value, m.Skills.Focus.Value);
public override int GetDamageFixed(Mobile m) => Math.Max(m.Skills.Imbuing.Fixed, m.Skills.Focus.Fixed);
public override void GetCastSkills(out double min, out double max)
{
// As per Mysticism page at the UO Herald Playguide
// This means that we have 25% success chance at min Required Skill
min = RequiredSkill - 12.5;
max = RequiredSkill + 37.5;
}
public override int GetMana() => RequiredMana;
public override bool CheckCast()
{
if (!base.CheckCast())
return false;
int mana = ScaleMana(RequiredMana);
if (Caster.Mana < mana)
{
Caster.SendLocalizedMessage(1060174,
mana.ToString()); // You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability.
return false;
}
if (Caster.Skills[CastSkill].Value < RequiredSkill)
{
Caster.SendLocalizedMessage(1063013,
$"{RequiredSkill.ToString("F1")}\t{CastSkill.ToString()}\t "); // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
return false;
}
return true;
}
public override void OnBeginCast()
{
base.OnBeginCast();
SendCastEffect();
}
public virtual void SendCastEffect()
{
Caster.FixedEffect(0x37C4, 10, (int)(GetCastDelay().TotalSeconds * 28), 0x66C, 3);
}
public static double GetBaseSkill(Mobile m) => m.Skills.Mysticism.Value;
public static double GetBoostSkill(Mobile m) => Math.Max(m.Skills.Imbuing.Value, m.Skills.Focus.Value);
}
}

View file

@ -79,10 +79,7 @@ namespace Server.Spells.Mysticism
FinishSequence();
}
public static bool UnderEffect(Mobile m)
{
return m_Table.ContainsKey(m);
}
public static bool UnderEffect(Mobile m) => m_Table.ContainsKey(m);
public static void RemoveEffect(Mobile m)
{
@ -197,10 +194,8 @@ namespace Server.Spells.Mysticism
private SpellPlagueSpell m_Owner;
public InternalTarget(SpellPlagueSpell owner)
: base(12, false, TargetFlags.Harmful)
{
: base(12, false, TargetFlags.Harmful) =>
m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{

View file

@ -36,10 +36,7 @@ namespace Server.Spells.Mysticism
EventSink.PlayerDeath += OnPlayerDeath;
}
public static bool UnderEffect(Mobile m)
{
return m_Table.ContainsKey(m);
}
public static bool UnderEffect(Mobile m) => m_Table.ContainsKey(m);
public override bool CheckCast()
{
@ -129,15 +126,9 @@ namespace Server.Spells.Mysticism
FinishSequence();
}
public static int GetDIBonus(Mobile m)
{
return (int)((GetBaseSkill(m) + GetBoostSkill(m)) / 12.0);
}
public static int GetDIBonus(Mobile m) => (int)((GetBaseSkill(m) + GetBoostSkill(m)) / 12.0);
public static int GetResistCapBonus(Mobile m)
{
return (int)((GetBaseSkill(m) + GetBoostSkill(m)) / 48.0);
}
public static int GetResistCapBonus(Mobile m) => (int)((GetBaseSkill(m) + GetBoostSkill(m)) / 48.0);
public static void RemoveEffects(Mobile m)
{

View file

@ -97,10 +97,7 @@ namespace Server.Spells.Necromancy
t?.DoExpire();
}
public static Mobile GetBloodOath(Mobile m)
{
return m == null || m_OathTable.TryGetValue(m, out Mobile oath) && oath == m ? null : oath;
}
public static Mobile GetBloodOath(Mobile m) => m == null || m_OathTable.TryGetValue(m, out Mobile oath) && oath == m ? null : oath;
private class ExpireTimer : Timer
{

View file

@ -81,10 +81,7 @@ namespace Server.Spells.Necromancy
return base.CheckCast();
}
public override int ComputeKarmaAward()
{
return 0; //no karma lost from this spell!
}
public override int ComputeKarmaAward() => 0;
public override void OnCast()
{

View file

@ -76,10 +76,7 @@ namespace Server.Spells.Necromancy
m.SendLocalizedMessage(1060872); // Your mind feels normal again.
}
public static bool HasMindRotScalar(Mobile m)
{
return m_Table.ContainsKey(m);
}
public static bool HasMindRotScalar(Mobile m) => m_Table.ContainsKey(m);
public static bool GetMindRotScalar(Mobile m, ref double scalar)
{

View file

@ -53,9 +53,6 @@ namespace Server.Spells.Necromancy
return false;
}
public override int GetMana()
{
return RequiredMana;
}
public override int GetMana() => RequiredMana;
}
}

View file

@ -96,15 +96,9 @@ namespace Server.Spells.Ninjitsu
return base.CheckCast();
}
public override bool CheckDisturb(DisturbType type, bool firstCircle, bool resistable)
{
return false;
}
public override bool CheckDisturb(DisturbType type, bool firstCircle, bool resistable) => false;
private bool CasterIsMoving()
{
return Core.TickCount - Caster.LastMoveTime <= Caster.ComputeMovementSpeed(Caster.Direction);
}
private bool CasterIsMoving() => Core.TickCount - Caster.LastMoveTime <= Caster.ComputeMovementSpeed(Caster.Direction);
public override void OnBeginCast()
{
@ -114,11 +108,7 @@ namespace Server.Spells.Ninjitsu
m_WasMoving = CasterIsMoving();
}
public override bool CheckFizzle()
{
// Spell is initially always successful, and with no skill gain.
return true;
}
public override bool CheckFizzle() => true;
public override void OnCast()
{
@ -188,10 +178,7 @@ namespace Server.Spells.Ninjitsu
FinishSequence();
}
public int GetLastAnimalForm(Mobile m)
{
return m_LastAnimalForms.TryGetValue(m, out int value) ? value : -1;
}
public int GetLastAnimalForm(Mobile m) => m_LastAnimalForms.TryGetValue(m, out int value) ? value : -1;
public static MorphResult Morph(Mobile m, int entryID)
{
@ -311,20 +298,11 @@ namespace Server.Spells.Ninjitsu
context.Timer.Stop();
}
public static AnimalFormContext GetContext(Mobile m)
{
return m_Table.TryGetValue(m, out AnimalFormContext context) ? context : null;
}
public static AnimalFormContext GetContext(Mobile m) => m_Table.TryGetValue(m, out AnimalFormContext context) ? context : null;
public static bool UnderTransformation(Mobile m)
{
return m_Table.ContainsKey(m);
}
public static bool UnderTransformation(Mobile m) => m_Table.ContainsKey(m);
public static bool UnderTransformation(Mobile m, Type type)
{
return GetContext(m)?.Type == type;
}
public static bool UnderTransformation(Mobile m, Type type) => GetContext(m)?.Type == type;
/*
private delegate void AnimalFormCallback( Mobile from );

View file

@ -15,10 +15,7 @@ namespace Server.Spells.Ninjitsu
public override TextDefinition AbilityMessage =>
new TextDefinition(1063091); // You prepare to hit your opponent with a Death Strike.
public override double GetDamageScalar(Mobile attacker, Mobile defender)
{
return 0.5;
}
public override double GetDamageScalar(Mobile attacker, Mobile defender) => 0.5;
public override void OnHit(Mobile attacker, Mobile defender, int damage)
{

View file

@ -48,10 +48,7 @@ namespace Server.Spells.Ninjitsu
return 1.0 + (bonus * 3 + 0.01);
}
public override bool OnBeforeDamage(Mobile attacker, Mobile defender)
{
return Validate(attacker) && CheckMana(attacker, true);
}
public override bool OnBeforeDamage(Mobile attacker, Mobile defender) => Validate(attacker) && CheckMana(attacker, true);
public override void OnHit(Mobile attacker, Mobile defender, int damage)
{

View file

@ -29,10 +29,7 @@ namespace Server.Spells.Ninjitsu
public override bool BlockedByAnimalForm => false;
public static bool HasClone(Mobile m)
{
return m_CloneCount.ContainsKey(m);
}
public static bool HasClone(Mobile m) => m_CloneCount.ContainsKey(m);
public static void AddClone(Mobile m)
{
@ -77,10 +74,7 @@ namespace Server.Spells.Ninjitsu
return base.CheckCast();
}
public override bool CheckDisturb(DisturbType type, bool firstCircle, bool resistable)
{
return false;
}
public override bool CheckDisturb(DisturbType type, bool firstCircle, bool resistable) => false;
public override void OnBeginCast()
{
@ -179,10 +173,7 @@ namespace Server.Mobiles
public override bool IsDispellable => false;
public override bool Commandable => false;
public override bool IsHumanInTown()
{
return false;
}
public override bool IsHumanInTown() => false;
private Item CloneItem(Item item)
{
@ -239,10 +230,7 @@ namespace Server.Mobiles
{
public class CloneAI : BaseAI
{
public CloneAI(Clone m) : base(m)
{
m.CurrentSpeed = m.ActiveSpeed;
}
public CloneAI(Clone m) : base(m) => m.CurrentSpeed = m.ActiveSpeed;
public override bool CanDetectHidden => false;

View file

@ -24,10 +24,7 @@ namespace Server.Spells.Ninjitsu
public override int CastRecoveryBase => 7;
public static bool CheckExpansion(Mobile from)
{
return (from as PlayerMobile)?.NetState?.SupportsExpansion(Expansion.SE) == true;
}
public static bool CheckExpansion(Mobile from) => (from as PlayerMobile)?.NetState?.SupportsExpansion(Expansion.SE) == true;
public override bool CheckCast()
{
@ -92,9 +89,6 @@ namespace Server.Spells.Ninjitsu
max = RequiredSkill + 37.5;
}
public override int GetMana()
{
return 0;
}
public override int GetMana() => 0;
}
}

View file

@ -40,10 +40,7 @@ namespace Server.Spells.Ninjitsu
return base.CheckCast();
}
public override bool CheckDisturb(DisturbType type, bool firstCircle, bool resistable)
{
return false;
}
public override bool CheckDisturb(DisturbType type, bool firstCircle, bool resistable) => false;
public override void OnCast()
{

View file

@ -25,10 +25,7 @@ namespace Server.Spells.Second
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, Core.ML ? 10 : 12);
}
public override double GetSlayerDamageScalar(Mobile target)
{
return 1.0; //This spell isn't affected by slayer spellbooks
}
public override double GetSlayerDamageScalar(Mobile target) => 1.0;
public void Target(Mobile m)
{

View file

@ -20,10 +20,7 @@ namespace Server.Spells.Seventh
private RunebookEntry m_Entry;
public GateTravelSpell(Mobile caster, RunebookEntry entry = null, Item scroll = null) : base(caster, scroll, m_Info)
{
m_Entry = entry;
}
public GateTravelSpell(Mobile caster, RunebookEntry entry = null, Item scroll = null) : base(caster, scroll, m_Info) => m_Entry = entry;
public override SpellCircle Circle => SpellCircle.Seventh;

View file

@ -89,9 +89,6 @@ namespace Server.Spells.Seventh
FinishSequence();
}
public override double GetResistPercent(Mobile target)
{
return 98.0;
}
public override double GetResistPercent(Mobile target) => 98.0;
}
}

View file

@ -23,10 +23,7 @@ namespace Server.Spells.Seventh
private int m_NewBody;
public PolymorphSpell(Mobile caster, Item scroll, int body = 0) : base(caster, scroll, m_Info)
{
m_NewBody = body;
}
public PolymorphSpell(Mobile caster, Item scroll, int body = 0) : base(caster, scroll, m_Info) => m_NewBody = body;
public override SpellCircle Circle => SpellCircle.Seventh;

View file

@ -84,10 +84,7 @@ namespace Server.Spells.Sixth
FinishSequence();
}
public static bool HasTimer(Mobile m)
{
return m_Table.ContainsKey(m);
}
public static bool HasTimer(Mobile m) => m_Table.ContainsKey(m);
public static void RemoveTimer(Mobile m)
{

View file

@ -26,10 +26,7 @@ namespace Server.Spells.Sixth
Caster.Target = new SpellTargetItem(this, TargetFlags.None, Core.ML ? 10 : 12);
}
public override bool CheckCast()
{
return base.CheckCast() && SpellHelper.CheckTravel(Caster, TravelCheckType.Mark);
}
public override bool CheckCast() => base.CheckCast() && SpellHelper.CheckTravel(Caster, TravelCheckType.Mark);
public void Target(Item item)
{

View file

@ -65,10 +65,7 @@ namespace Server.Spells.Spellweaving
FinishSequence();
}
private static bool IsSanctuary(Point3D p, Map m)
{
return (m == Map.Trammel || m == Map.Felucca) && p.X == 6267 && p.Y == 131;
}
private static bool IsSanctuary(Point3D p, Map m) => (m == Map.Trammel || m == Map.Felucca) && p.X == 6267 && p.Y == 131;
private static bool IsValidLocation(Point3D location, Map map)
{
@ -102,13 +99,10 @@ namespace Server.Spells.Spellweaving
return found;
}
public static bool IsValidTile(int itemID)
{
//Per OSI, Center tile only
return itemID == 0xFEA || itemID == 0x1216 || itemID == 0x307F || itemID == 0x1D10 || itemID == 0x1D0F ||
itemID == 0x1D1F ||
itemID == 0x1D12; // Pentagram center, Abbatoir center, Arcane Circle Center, Bloody Pentagram has 4 tiles at center
}
public static bool IsValidTile(int itemID) =>
itemID == 0xFEA || itemID == 0x1216 || itemID == 0x307F || itemID == 0x1D10 || itemID == 0x1D0F ||
itemID == 0x1D1F ||
itemID == 0x1D12;
private List<Mobile> GetArcanists()
{

View file

@ -30,15 +30,9 @@ namespace Server.Spells.Spellweaving
return focus?.Deleted != false ? 0 : focus.StrengthBonus;
}
public static ArcaneFocus FindArcaneFocus(Mobile from)
{
return from.Holding as ArcaneFocus ?? from.Backpack?.FindItemByType<ArcaneFocus>();
}
public static ArcaneFocus FindArcaneFocus(Mobile from) => from.Holding as ArcaneFocus ?? from.Backpack?.FindItemByType<ArcaneFocus>();
public static bool CheckExpansion(Mobile from)
{
return !(from is PlayerMobile) || from.NetState?.SupportsExpansion(Expansion.ML) == true;
}
public static bool CheckExpansion(Mobile from) => !(from is PlayerMobile) || from.NetState?.SupportsExpansion(Expansion.ML) == true;
public override bool CheckCast()
{
@ -91,10 +85,7 @@ namespace Server.Spells.Spellweaving
max = RequiredSkill + 37.5;
}
public override int GetMana()
{
return RequiredMana;
}
public override int GetMana() => RequiredMana;
public override void DoFizzle()
{

View file

@ -84,10 +84,7 @@ namespace Server.Spells.Spellweaving
StopAbsorbing(defender, true);
}
public static bool IsAbsorbing(Mobile m)
{
return m_Table.ContainsKey(m);
}
public static bool IsAbsorbing(Mobile m) => m_Table.ContainsKey(m);
public static void StopAbsorbing(Mobile m, bool message)
{
@ -100,10 +97,8 @@ namespace Server.Spells.Spellweaving
private Mobile m_Mobile;
public ExpireTimer(Mobile m, TimeSpan delay)
: base(delay)
{
: base(delay) =>
m_Mobile = m;
}
protected override void OnTick()
{

View file

@ -61,20 +61,11 @@ namespace Server.Spells.Spellweaving
FinishSequence();
}
public static int GetFCMalus(Mobile m)
{
return m_Table.TryGetValue(m, out EssenceOfWindInfo info) ? info.FCMalus : 0;
}
public static int GetFCMalus(Mobile m) => m_Table.TryGetValue(m, out EssenceOfWindInfo info) ? info.FCMalus : 0;
public static int GetSSIMalus(Mobile m)
{
return m_Table.TryGetValue(m, out EssenceOfWindInfo info) ? info.SSIMalus : 0;
}
public static int GetSSIMalus(Mobile m) => m_Table.TryGetValue(m, out EssenceOfWindInfo info) ? info.SSIMalus : 0;
public static bool IsDebuffed(Mobile m)
{
return m_Table.ContainsKey(m);
}
public static bool IsDebuffed(Mobile m) => m_Table.ContainsKey(m);
public static void StopDebuffing(Mobile m, bool message)
{
@ -107,10 +98,7 @@ namespace Server.Spells.Spellweaving
{
private Mobile m_Mobile;
public ExpireTimer(Mobile m, TimeSpan delay) : base(delay)
{
m_Mobile = m;
}
public ExpireTimer(Mobile m, TimeSpan delay) : base(delay) => m_Mobile = m;
protected override void OnTick()
{

View file

@ -120,10 +120,8 @@ namespace Server.Spells.Spellweaving
private GiftOfRenewalInfo m_GiftInfo;
public InternalTimer(GiftOfRenewalInfo info)
: base(TimeSpan.FromSeconds(2.0), TimeSpan.FromSeconds(2.0))
{
: base(TimeSpan.FromSeconds(2.0), TimeSpan.FromSeconds(2.0)) =>
m_GiftInfo = info;
}
protected override void OnTick()
{

View file

@ -63,15 +63,9 @@ namespace Server.Spells.Spellweaving
FinishSequence();
}
public static bool IsImmolating(BaseWeapon weapon)
{
return m_WeaponDamageTable.ContainsKey(weapon);
}
public static bool IsImmolating(BaseWeapon weapon) => m_WeaponDamageTable.ContainsKey(weapon);
public static int GetImmolatingDamage(BaseWeapon weapon)
{
return m_WeaponDamageTable.TryGetValue(weapon, out ImmolatingWeaponEntry entry) ? entry.m_Damage : 0;
}
public static int GetImmolatingDamage(BaseWeapon weapon) => m_WeaponDamageTable.TryGetValue(weapon, out ImmolatingWeaponEntry entry) ? entry.m_Damage : 0;
public static void DoEffect(BaseWeapon weapon, Mobile target)
{

View file

@ -75,10 +75,8 @@ namespace Server.Spells.Spellweaving
private NatureFury m_NatureFury;
public InternalTimer(NatureFury nf)
: base(TimeSpan.FromSeconds(5.0), TimeSpan.FromSeconds(5.0))
{
: base(TimeSpan.FromSeconds(5.0), TimeSpan.FromSeconds(5.0)) =>
m_NatureFury = nf;
}
protected override void OnTick()
{

View file

@ -75,10 +75,7 @@ namespace Server.Spells.Spellweaving
FinishSequence();
}
public static int GetCastRecoveryMalus(Mobile m)
{
return m_Table.ContainsKey(m) ? 6 : 0;
}
public static int GetCastRecoveryMalus(Mobile m) => m_Table.ContainsKey(m) ? 6 : 0;
public static void DoExpire(Mobile m)
{

View file

@ -12,10 +12,7 @@ namespace Server.Spells
private ISpellTargetingItem m_Spell;
public ISpell Spell => m_Spell;
public SpellTargetItem(ISpellTargetingItem spell, TargetFlags flags, int range = 12) : base(range, false, flags)
{
m_Spell = spell;
}
public SpellTargetItem(ISpellTargetingItem spell, TargetFlags flags, int range = 12) : base(range, false, flags) => m_Spell = spell;
protected override void OnTarget(Mobile from, object o)
{

View file

@ -12,10 +12,7 @@ namespace Server.Spells
private ISpellTargetingMobile m_Spell;
public ISpell Spell => m_Spell;
public SpellTargetMobile(ISpellTargetingMobile spell, TargetFlags flags, int range = 12) : base(range, false, flags)
{
m_Spell = spell;
}
public SpellTargetMobile(ISpellTargetingMobile spell, TargetFlags flags, int range = 12) : base(range, false, flags) => m_Spell = spell;
protected override void OnTarget(Mobile from, object o)
{