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

@ -295,43 +295,34 @@ namespace Server.Items
public BasePotion FillBottle()
{
switch (m_Type)
return m_Type switch
{
default:
case PotionEffect.Nightsight: return new NightSightPotion();
case PotionEffect.CureLesser: return new LesserCurePotion();
case PotionEffect.Cure: return new CurePotion();
case PotionEffect.CureGreater: return new GreaterCurePotion();
case PotionEffect.Agility: return new AgilityPotion();
case PotionEffect.AgilityGreater: return new GreaterAgilityPotion();
case PotionEffect.Strength: return new StrengthPotion();
case PotionEffect.StrengthGreater: return new GreaterStrengthPotion();
case PotionEffect.PoisonLesser: return new LesserPoisonPotion();
case PotionEffect.Poison: return new PoisonPotion();
case PotionEffect.PoisonGreater: return new GreaterPoisonPotion();
case PotionEffect.PoisonDeadly: return new DeadlyPoisonPotion();
case PotionEffect.Refresh: return new RefreshPotion();
case PotionEffect.RefreshTotal: return new TotalRefreshPotion();
case PotionEffect.HealLesser: return new LesserHealPotion();
case PotionEffect.Heal: return new HealPotion();
case PotionEffect.HealGreater: return new GreaterHealPotion();
case PotionEffect.ExplosionLesser: return new LesserExplosionPotion();
case PotionEffect.Explosion: return new ExplosionPotion();
case PotionEffect.ExplosionGreater: return new GreaterExplosionPotion();
case PotionEffect.Conflagration: return new ConflagrationPotion();
case PotionEffect.ConflagrationGreater: return new GreaterConflagrationPotion();
case PotionEffect.ConfusionBlast: return new ConfusionBlastPotion();
case PotionEffect.ConfusionBlastGreater: return new GreaterConfusionBlastPotion();
}
PotionEffect.Nightsight => (BasePotion)new NightSightPotion(),
PotionEffect.CureLesser => new LesserCurePotion(),
PotionEffect.Cure => new CurePotion(),
PotionEffect.CureGreater => new GreaterCurePotion(),
PotionEffect.Agility => new AgilityPotion(),
PotionEffect.AgilityGreater => new GreaterAgilityPotion(),
PotionEffect.Strength => new StrengthPotion(),
PotionEffect.StrengthGreater => new GreaterStrengthPotion(),
PotionEffect.PoisonLesser => new LesserPoisonPotion(),
PotionEffect.Poison => new PoisonPotion(),
PotionEffect.PoisonGreater => new GreaterPoisonPotion(),
PotionEffect.PoisonDeadly => new DeadlyPoisonPotion(),
PotionEffect.Refresh => new RefreshPotion(),
PotionEffect.RefreshTotal => new TotalRefreshPotion(),
PotionEffect.HealLesser => new LesserHealPotion(),
PotionEffect.Heal => new HealPotion(),
PotionEffect.HealGreater => new GreaterHealPotion(),
PotionEffect.ExplosionLesser => new LesserExplosionPotion(),
PotionEffect.Explosion => new ExplosionPotion(),
PotionEffect.ExplosionGreater => new GreaterExplosionPotion(),
PotionEffect.Conflagration => new ConflagrationPotion(),
PotionEffect.ConflagrationGreater => new GreaterConflagrationPotion(),
PotionEffect.ConfusionBlast => new ConfusionBlastPotion(),
PotionEffect.ConfusionBlastGreater => new GreaterConfusionBlastPotion(),
_ => new NightSightPotion()
};
}
public static void Initialize()

View file

@ -22,7 +22,7 @@ namespace Server.Items
public override void Drink(Mobile from)
{
if (Core.AOS && (from.Paralyzed || from.Frozen || from.Spell != null && from.Spell.IsCasting))
if (Core.AOS && (from.Paralyzed || from.Frozen || from.Spell?.IsCasting == true))
{
from.SendLocalizedMessage(1062725); // You can not use that potion while paralyzed.
return;
@ -251,7 +251,6 @@ namespace Server.Items
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 != from) &&
SpellHelper.ValidIndirectTarget(from, m) && from.CanBeHarmful(m, false))
{
@ -260,7 +259,6 @@ namespace Server.Items
AOS.Damage(m, from, m_Item.GetDamage(), 0, 100, 0, 0, 0);
m.PlaySound(0x208);
}
}
}
}
}

View file

@ -23,7 +23,7 @@ namespace Server.Items
public override void Drink(Mobile from)
{
if (Core.AOS && (from.Paralyzed || from.Frozen || from.Spell != null && from.Spell.IsCasting))
if (Core.AOS && (from.Paralyzed || from.Frozen || from.Spell?.IsCasting == true))
{
from.SendLocalizedMessage(1062725); // You can not use that potion while paralyzed.
return;

View file

@ -62,7 +62,7 @@ namespace Server.Items
public override void Drink(Mobile from)
{
if (Core.AOS && (from.Paralyzed || from.Frozen || from.Spell != null && from.Spell.IsCasting))
if (Core.AOS && (from.Paralyzed || from.Frozen || from.Spell?.IsCasting == true))
{
from.SendLocalizedMessage(1062725); // You can not use a purple potion while paralyzed.
return;

View file

@ -284,33 +284,17 @@ namespace Server.Items
if (!DesignContext.Check(from))
return; // They are customizing
SpellbookType type;
switch (e.Type)
var type = e.Type switch
{
default:
case 1:
type = SpellbookType.Regular;
break;
case 2:
type = SpellbookType.Necromancer;
break;
case 3:
type = SpellbookType.Paladin;
break;
case 4:
type = SpellbookType.Ninja;
break;
case 5:
type = SpellbookType.Samurai;
break;
case 6:
type = SpellbookType.Arcanist;
break;
case 7:
type = SpellbookType.Mystic;
break;
}
1 => SpellbookType.Regular,
2 => SpellbookType.Necromancer,
3 => SpellbookType.Paladin,
4 => SpellbookType.Ninja,
5 => SpellbookType.Samurai,
6 => SpellbookType.Arcanist,
7 => SpellbookType.Mystic,
_ => SpellbookType.Regular
};
Spellbook book = Find(from, -1, type);
@ -453,10 +437,8 @@ namespace Server.Items
Container pack = from.Backpack;
for (int i = 0; i < pack?.Items.Count; ++i)
{
if (pack.Items[i] is Spellbook sp)
list.Add(sp);
}
return list;
}
@ -541,13 +523,13 @@ namespace Server.Items
string modName = Serial.ToString();
if (strBonus != 0)
from.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero));
from.AddStatMod(new StatMod(StatType.Str, $"{modName}Str", strBonus, TimeSpan.Zero));
if (dexBonus != 0)
from.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero));
from.AddStatMod(new StatMod(StatType.Dex, $"{modName}Dex", dexBonus, TimeSpan.Zero));
if (intBonus != 0)
from.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero));
from.AddStatMod(new StatMod(StatType.Int, $"{modName}Int", intBonus, TimeSpan.Zero));
}
from.CheckStatTimers();
@ -562,9 +544,9 @@ namespace Server.Items
string modName = Serial.ToString();
from.RemoveStatMod(modName + "Str");
from.RemoveStatMod(modName + "Dex");
from.RemoveStatMod(modName + "Int");
from.RemoveStatMod($"{modName}Str");
from.RemoveStatMod($"{modName}Dex");
from.RemoveStatMod($"{modName}Int");
from.CheckStatTimers();
}
@ -574,7 +556,7 @@ namespace Server.Items
{
spellID -= BookOffset;
return spellID >= 0 && spellID < BookCount && (m_Content & ((ulong)1 << spellID)) != 0;
return spellID >= 0 && spellID < BookCount && (m_Content & (ulong)1 << spellID) != 0;
}
public void DisplayTo(Mobile to)
@ -848,13 +830,13 @@ namespace Server.Items
string modName = Serial.ToString();
if (strBonus != 0)
m.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero));
m.AddStatMod(new StatMod(StatType.Str, $"{modName}Str", strBonus, TimeSpan.Zero));
if (dexBonus != 0)
m.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero));
m.AddStatMod(new StatMod(StatType.Dex, $"{modName}Dex", dexBonus, TimeSpan.Zero));
if (intBonus != 0)
m.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero));
m.AddStatMod(new StatMod(StatType.Int, $"{modName}Int", intBonus, TimeSpan.Zero));
}
m.CheckStatTimers();