Formatting #2 (#59)

This commit is contained in:
Kamron Batman 2019-10-05 00:37:03 -07:00 • committed by GitHub
parent 096d39609e
commit 8e9221bb5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
400 changed files with 3688 additions and 5969 deletions

View file

@ -340,7 +340,7 @@ namespace Server.Mobiles
Skill skill = ourSkills[i];
Skill theirSkill = theirSkills[i];
if (skill != null && skill?.Base >= 60.0 &&
if (skill != null && skill.Base >= 60.0 &&
m_Mobile.CheckTeach(skill.SkillName, e.Mobile))
{
double toTeach = skill.Base / 3.0;
@ -907,50 +907,23 @@ namespace Server.Mobiles
if (m_Mobile.Deleted)
return false;
switch (m_Mobile.ControlOrder)
return m_Mobile.ControlOrder switch
{
case OrderType.None:
return DoOrderNone();
case OrderType.Come:
return DoOrderCome();
case OrderType.Drop:
return DoOrderDrop();
case OrderType.Friend:
return DoOrderFriend();
case OrderType.Unfriend:
return DoOrderUnfriend();
case OrderType.Guard:
return DoOrderGuard();
case OrderType.Attack:
return DoOrderAttack();
case OrderType.Patrol:
return DoOrderPatrol();
case OrderType.Release:
return DoOrderRelease();
case OrderType.Stay:
return DoOrderStay();
case OrderType.Stop:
return DoOrderStop();
case OrderType.Follow:
return DoOrderFollow();
case OrderType.Transfer:
return DoOrderTransfer();
default:
return false;
}
OrderType.None => DoOrderNone(),
OrderType.Come => DoOrderCome(),
OrderType.Drop => DoOrderDrop(),
OrderType.Friend => DoOrderFriend(),
OrderType.Unfriend => DoOrderUnfriend(),
OrderType.Guard => DoOrderGuard(),
OrderType.Attack => DoOrderAttack(),
OrderType.Patrol => DoOrderPatrol(),
OrderType.Release => DoOrderRelease(),
OrderType.Stay => DoOrderStay(),
OrderType.Stop => DoOrderStop(),
OrderType.Follow => DoOrderFollow(),
OrderType.Transfer => DoOrderTransfer(),
_ => false
};
}
public virtual void OnCurrentOrderChanged()
@ -1131,7 +1104,7 @@ namespace Server.Mobiles
if (pack != null)
{
List<Item> list = pack?.Items;
List<Item> list = pack.Items;
for (int i = list.Count - 1; i >= 0; --i)
if (i < list.Count)
@ -1629,9 +1602,10 @@ namespace Server.Mobiles
public virtual bool DoBardProvoked()
{
if (DateTime.UtcNow >= m_Mobile.BardEndTime && (m_Mobile.BardMaster?.Deleted != false ||
m_Mobile.BardMaster.Map != m_Mobile.Map || m_Mobile.GetDistanceToSqrt(m_Mobile.BardMaster) >
m_Mobile.RangePerception))
if (DateTime.UtcNow >= m_Mobile.BardEndTime &&
(m_Mobile.BardMaster?.Deleted != false ||
m_Mobile.BardMaster.Map != m_Mobile.Map || m_Mobile.GetDistanceToSqrt(m_Mobile.BardMaster) >
m_Mobile.RangePerception))
{
m_Mobile.DebugSay("I have lost my provoker");
m_Mobile.BardProvoked = false;
@ -1767,7 +1741,7 @@ namespace Server.Mobiles
using (StreamWriter op = new StreamWriter("nan_transform.txt", true))
{
op.WriteLine(
$"NaN in TransformMoveDelay: {DateTime.UtcNow}, {GetType()}, {(m_Mobile == null ? "null" : m_Mobile.GetType().ToString())}, {m_Mobile.HitsMax}");
$"NaN in TransformMoveDelay: {DateTime.UtcNow}, {GetType()}, {m_Mobile?.GetType()}, {m_Mobile.HitsMax}");
}
return 1.0;
@ -1791,7 +1765,7 @@ namespace Server.Mobiles
public virtual MoveResult DoMoveImpl(Direction d)
{
if (m_Mobile.Deleted || m_Mobile.Frozen || m_Mobile.Paralyzed ||
m_Mobile.Spell != null && m_Mobile.Spell.IsCasting || m_Mobile.DisallowAllMoves)
m_Mobile.Spell?.IsCasting == true || m_Mobile.DisallowAllMoves)
return MoveResult.BadState;
if (!CheckMove())
return MoveResult.BadState;

View file

@ -13,7 +13,7 @@ namespace Server.Mobiles
if (AcquireFocusMob(m_Mobile.RangePerception, FightMode.Closest, false, true, true))
{
if (m_Mobile.Debug)
m_Mobile.DebugSay("I have detected " + m_Mobile.FocusMob.Name + " and I will attack");
m_Mobile.DebugSay($"I have detected {m_Mobile.FocusMob.Name} and I will attack");
m_Mobile.Combatant = m_Mobile.FocusMob;
Action = ActionType.Combat;
@ -45,12 +45,12 @@ namespace Server.Mobiles
if (m_Mobile.Combatant != null)
{
if (m_Mobile.Debug)
m_Mobile.DebugSay("I am still not in range of " + m_Mobile.Combatant.Name);
m_Mobile.DebugSay($"I am still not in range of {m_Mobile.Combatant.Name}");
if ((int)m_Mobile.GetDistanceToSqrt(m_Mobile.Combatant) > m_Mobile.RangePerception + 1)
{
if (m_Mobile.Debug)
m_Mobile.DebugSay("I have lost " + m_Mobile.Combatant.Name);
m_Mobile.DebugSay($"I have lost {m_Mobile.Combatant.Name}");
Action = ActionType.Guard;
return true;

View file

@ -143,9 +143,7 @@ namespace Server.Mobiles
if (m_Mobile.Hits < m_Mobile.HitsMax - 50)
{
if (UseNecromancy())
{
m_Mobile.UseSkill(SkillName.SpiritSpeak);
}
else
spell = new GreaterHealSpell(m_Mobile);
}
@ -199,7 +197,7 @@ namespace Server.Mobiles
public void RunFrom(Mobile m)
{
Run((m_Mobile.GetDirectionTo(m) - 4) & Direction.Mask);
Run(m_Mobile.GetDirectionTo(m) - 4 & Direction.Mask);
}
public void OnFailedMove()
@ -229,7 +227,7 @@ namespace Server.Mobiles
public void Run(Direction d)
{
if (m_Mobile.Spell != null && m_Mobile.Spell.IsCasting || m_Mobile.Paralyzed || m_Mobile.Frozen ||
if (m_Mobile.Spell?.IsCasting == true || m_Mobile.Paralyzed || m_Mobile.Frozen ||
m_Mobile.DisallowAllMoves)
return;
@ -284,22 +282,22 @@ namespace Server.Mobiles
else if (maxCircle > 8)
maxCircle = 8;
switch (Utility.Random(maxCircle * 2))
return Utility.Random(maxCircle * 2) switch
{
case 0:
case 1: return new MagicArrowSpell(m_Mobile);
case 2:
case 3: return new HarmSpell(m_Mobile);
case 4:
case 5: return new FireballSpell(m_Mobile);
case 6:
case 7: return new LightningSpell(m_Mobile);
case 8:
case 9: return new MindBlastSpell(m_Mobile);
case 10: return new EnergyBoltSpell(m_Mobile);
case 11: return new ExplosionSpell(m_Mobile);
default: return new FlameStrikeSpell(m_Mobile);
}
0 => (Spell)new MagicArrowSpell(m_Mobile),
1 => new MagicArrowSpell(m_Mobile),
2 => new HarmSpell(m_Mobile),
3 => new HarmSpell(m_Mobile),
4 => new FireballSpell(m_Mobile),
5 => new FireballSpell(m_Mobile),
6 => new LightningSpell(m_Mobile),
7 => new LightningSpell(m_Mobile),
8 => new MindBlastSpell(m_Mobile),
9 => new MindBlastSpell(m_Mobile),
10 => new EnergyBoltSpell(m_Mobile),
11 => new ExplosionSpell(m_Mobile),
_ => new FlameStrikeSpell(m_Mobile)
};
}
public virtual Spell GetRandomCurseSpell() => UseNecromancy() ? GetRandomCurseSpellNecro() : GetRandomCurseSpellMage();
@ -328,12 +326,12 @@ namespace Server.Mobiles
if (m_Mobile.Skills.Magery.Value >= 40.0 && Utility.Random(4) == 0)
return new CurseSpell(m_Mobile);
switch (Utility.Random(3))
return Utility.Random(3) switch
{
case 0: return new WeakenSpell(m_Mobile);
case 1: return new ClumsySpell(m_Mobile);
default: return new FeeblemindSpell(m_Mobile);
}
0 => (Spell)new WeakenSpell(m_Mobile),
1 => new ClumsySpell(m_Mobile),
_ => new FeeblemindSpell(m_Mobile)
};
}
public virtual Spell GetRandomManaDrainSpell()
@ -742,7 +740,7 @@ namespace Server.Mobiles
m_NextCastTime = Core.TickCount + (int)GetDelay(spell).TotalMilliseconds;
}
else if (m_Mobile.Spell == null || !m_Mobile.Spell.IsCasting)
else if (m_Mobile.Spell?.IsCasting != true)
{
RunTo(c);
}

View file

@ -169,8 +169,6 @@ namespace Server
if (m_Table == null)
LoadTable();
;
return m_Table.ContainsKey(obj.GetType());
}