Code Cleanup & Fixes Warnings (#74)

This commit is contained in:
Kamron Batman 2020-01-18 14:56:45 -08:00 committed by GitHub
parent e11d1f3ad9
commit 57b14ad690
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
143 changed files with 2960 additions and 3427 deletions

View file

@ -604,7 +604,7 @@ namespace Server.Spells
// Always allow monsters to teleport
if (caster is BaseCreature bc && !bc.Controlled && !bc.Summoned && (type == TravelCheckType.TeleportTo || type == TravelCheckType.TeleportFrom))
return true;
return true;
m_TravelCaster = caster;
m_TravelType = type;
@ -794,12 +794,9 @@ namespace Server.Spells
#region Dueling
if (Region.Find(loc, map).GetRegion<SafeZone>() != null)
{
PlayerMobile pm = caster as PlayerMobile;
if (pm.DuelContext?.Started != true || pm.DuelPlayer?.Eliminated != false)
if (caster is PlayerMobile pm && (pm.DuelContext?.Started != true || pm.DuelPlayer?.Eliminated != false))
return true;
}
#endregion
GuardedRegion reg = Region.Find(loc, map).GetRegion<GuardedRegion>();

View file

@ -74,7 +74,7 @@ namespace Server.Spells.Chivalry
if (evil)
{
// TODO: Is this right?
double fleeChance = (100 - Math.Sqrt(m.Fame / 2)) * chiv * dispelSkill;
double fleeChance = (100 - Math.Sqrt(m.Fame / 2.0)) * chiv * dispelSkill;
fleeChance /= 1000000;
if (fleeChance > Utility.RandomDouble()) bc.BeginFlee(TimeSpan.FromSeconds(30.0));

View file

@ -39,7 +39,7 @@ namespace Server.Spells.Eighth
{
if (CheckSequence())
{
TimeSpan duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5);
TimeSpan duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5.0);
if (Core.AOS)
SpellHelper.Summon(new SummonedAirElemental(), Caster, 0x217, duration, false, false);

View file

@ -39,7 +39,7 @@ namespace Server.Spells.Eighth
{
if (CheckSequence())
{
TimeSpan duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5);
TimeSpan duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5.0);
if (Core.AOS)
SpellHelper.Summon(new SummonedEarthElemental(), Caster, 0x217, duration, false, false);

View file

@ -70,7 +70,7 @@ namespace Server.Spells.Fifth
TimeSpan duration;
if (Core.AOS)
duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5);
duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5.0);
else
duration = TimeSpan.FromSeconds(4.0 * Caster.Skills.Magery.Value);

View file

@ -65,7 +65,7 @@ namespace Server.Spells.Fourth
TimeSpan duration;
if (Core.AOS)
duration = TimeSpan.FromSeconds((15 + Caster.Skills.Magery.Fixed / 5) / 4);
duration = TimeSpan.FromSeconds((15 + Caster.Skills.Magery.Fixed / 5.0) / 4.0);
else
duration = TimeSpan.FromSeconds(4.0 + Caster.Skills.Magery.Value * 0.5);

View file

@ -112,7 +112,7 @@ namespace Server.Spells.Spellweaving
// Everyone gets the Arcane Focus, power capped elsewhere
weavers.AddRange(Caster.GetMobilesInRange(1)
.Where(m => m != Caster && m is PlayerMobile && Caster.CanBeBeneficial(m, false) &&
Math.Abs(Caster.Skills.Spellweaving.Value - m.Skills.Spellweaving.Value) <= 20));
Math.Abs(Caster.Skills.Spellweaving.Value - m.Skills.Spellweaving.Value) <= 20));
return weavers;
}