Adds style cop (#109)

This commit is contained in:
Kamron Batman 2020-04-26 00:16:02 -07:00 • committed by GitHub
parent 3e715bcb60
commit 556a17aba8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1725 changed files with 33831 additions and 38046 deletions

View file

@ -46,7 +46,7 @@ namespace Server.Mobiles
PackItem(new PowerCrystal());
if (0.02 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.02)
PackItem(new BlackthornWelcomeBook());
m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(5, 30));
@ -71,11 +71,11 @@ namespace Server.Mobiles
{
base.OnDeath(c);
if (0.05 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.05)
{
if (!IsParagon)
{
if (0.75 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.75)
c.DropItem(DawnsMusicGear.RandomCommon);
else
c.DropItem(DawnsMusicGear.RandomUncommon);
@ -104,7 +104,7 @@ namespace Server.Mobiles
{
base.OnGaveMeleeAttack(defender);
if (!m_Stunning && 0.3 > Utility.RandomDouble())
if (!m_Stunning && Utility.RandomDouble() < 0.3)
{
m_Stunning = true;

View file

@ -36,7 +36,7 @@ namespace Server.Mobiles
VirtualArmor = 32;
if (0.025 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.025)
PackItem(new GargoylesPickaxe());
}

View file

@ -40,7 +40,7 @@ namespace Server.Mobiles
VirtualArmor = 50;
if (0.2 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.2)
PackItem(new GargoylesPickaxe());
}
@ -65,7 +65,7 @@ namespace Server.Mobiles
public override void OnDamagedBySpell(Mobile from)
{
if (from?.Alive == true && 0.4 > Utility.RandomDouble())
if (from?.Alive == true && Utility.RandomDouble() < 0.4)
ThrowHatchet(from);
}
@ -73,7 +73,7 @@ namespace Server.Mobiles
{
base.OnGotMeleeAttack(attacker);
if (attacker?.Alive == true && attacker.Weapon is BaseRanged && 0.4 > Utility.RandomDouble())
if (attacker?.Alive == true && attacker.Weapon is BaseRanged && Utility.RandomDouble() < 0.4)
ThrowHatchet(attacker);
}

View file

@ -38,7 +38,7 @@ namespace Server.Mobiles
VirtualArmor = 50;
if (0.2 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.2)
PackItem(new GargoylesPickaxe());
}

View file

@ -46,7 +46,7 @@ namespace Server.Mobiles
VirtualArmor = 16;
if (0.7 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.7)
PackItem(new ArcaneGem());
}

View file

@ -28,7 +28,6 @@ namespace Server.Mobiles
SetResistance(ResistanceType.Poison, 55, 65);
SetResistance(ResistanceType.Energy, 40, 50);
SetSkill(SkillName.Necromancy, 89, 99.1);
SetSkill(SkillName.SpiritSpeak, 90.0, 99.0);

View file

@ -38,10 +38,9 @@ namespace Server.Mobiles
VirtualArmor = 30;
PackReg(6);
if (0.05 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.05)
PackItem(new OrcishKinMask());
}

View file

@ -40,7 +40,7 @@ namespace Server.Mobiles
PackReg(6);
if (0.02 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.02)
PackStatue();
}

View file

@ -47,7 +47,7 @@ namespace Server.Mobiles
PackReg(10, 15);
PackItem(new Bandage(Utility.RandomMinMax(1, 15)));
if (0.1 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.1)
PackItem(new TribalBerry());
AddItem(new BoneArms());
@ -109,7 +109,7 @@ namespace Server.Mobiles
{
base.OnGotMeleeAttack(attacker);
if (0.1 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.1)
BeginSavageDance();
}
@ -151,116 +151,116 @@ namespace Server.Mobiles
return;
IPooledEnumerable<Mobile> eable = GetMobilesInRange(8);
switch (Utility.Random(3))
{
case 0: /* greater heal */
{
foreach (Mobile m in eable)
{
bool isFriendly = m is Savage || m is SavageRider || m is SavageShaman || m is SavageRidgeback;
foreach (Mobile m in eable)
{
bool isFriendly = m is Savage || m is SavageRider || m is SavageShaman || m is SavageRidgeback;
if (!isFriendly)
continue;
if (!isFriendly)
continue;
if (m.Poisoned || MortalStrike.IsWounded(m) || !CanBeBeneficial(m))
continue;
if (m.Poisoned || MortalStrike.IsWounded(m) || !CanBeBeneficial(m))
continue;
DoBeneficial(m);
DoBeneficial(m);
// Algorithm: (40% of magery) + (1-10)
// Algorithm: (40% of magery) + (1-10)
int toHeal = (int)(Skills.Magery.Value * 0.4);
toHeal += Utility.Random(1, 10);
int toHeal = (int)(Skills.Magery.Value * 0.4);
toHeal += Utility.Random(1, 10);
m.Heal(toHeal, this);
m.Heal(toHeal, this);
m.FixedParticles(0x376A, 9, 32, 5030, EffectLayer.Waist);
m.PlaySound(0x202);
m.FixedParticles(0x376A, 9, 32, 5030, EffectLayer.Waist);
m.PlaySound(0x202);
}
break;
}
break;
}
case 1: /* lightning */
{
foreach (Mobile m in eable)
{
bool isFriendly = m is Savage || m is SavageRider || m is SavageShaman || m is SavageRidgeback;
if (isFriendly)
continue;
if (!CanBeHarmful(m))
continue;
DoHarmful(m);
double damage;
if (Core.AOS)
foreach (Mobile m in eable)
{
int baseDamage = 6 + (int)(Skills.EvalInt.Value / 5.0);
bool isFriendly = m is Savage || m is SavageRider || m is SavageShaman || m is SavageRidgeback;
damage = Utility.RandomMinMax(baseDamage, baseDamage + 3);
}
else
{
damage = Utility.Random(12, 9);
if (isFriendly)
continue;
if (!CanBeHarmful(m))
continue;
DoHarmful(m);
double damage;
if (Core.AOS)
{
int baseDamage = 6 + (int)(Skills.EvalInt.Value / 5.0);
damage = Utility.RandomMinMax(baseDamage, baseDamage + 3);
}
else
{
damage = Utility.Random(12, 9);
}
m.BoltEffect(0);
SpellHelper.Damage(TimeSpan.FromSeconds(0.25), m, this, damage, 0, 0, 0, 0, 100);
}
m.BoltEffect(0);
SpellHelper.Damage(TimeSpan.FromSeconds(0.25), m, this, damage, 0, 0, 0, 0, 100);
break;
}
break;
}
case 2: /* poison */
{
foreach (Mobile m in eable)
{
bool isFriendly = m is Savage || m is SavageRider || m is SavageShaman || m is SavageRidgeback;
foreach (Mobile m in eable)
{
bool isFriendly = m is Savage || m is SavageRider || m is SavageShaman || m is SavageRidgeback;
if (isFriendly)
continue;
if (isFriendly)
continue;
if (!CanBeHarmful(m))
continue;
if (!CanBeHarmful(m))
continue;
DoHarmful(m);
DoHarmful(m);
m.Spell?.OnCasterHurt();
m.Spell?.OnCasterHurt();
m.Paralyzed = false;
m.Paralyzed = false;
double total = Skills.Magery.Value + Skills.Poisoning.Value;
double total = Skills.Magery.Value + Skills.Poisoning.Value;
double dist = GetDistanceToSqrt(m);
double dist = GetDistanceToSqrt(m);
if (dist >= 3.0)
total -= (dist - 3.0) * 10.0;
if (dist >= 3.0)
total -= (dist - 3.0) * 10.0;
int level;
int level;
if (total >= 200.0 && Utility.Random(1, 100) <= 10)
level = 3;
else if (total > 170.0)
level = 2;
else if (total > 130.0)
level = 1;
else
level = 0;
if (total >= 200.0 && Utility.Random(1, 100) <= 10)
level = 3;
else if (total > 170.0)
level = 2;
else if (total > 130.0)
level = 1;
else
level = 0;
m.ApplyPoison(this, Poison.GetPoison(level));
m.ApplyPoison(this, Poison.GetPoison(level));
m.FixedParticles(0x374A, 10, 15, 5021, EffectLayer.Waist);
m.PlaySound(0x474);
m.FixedParticles(0x374A, 10, 15, 5021, EffectLayer.Waist);
m.PlaySound(0x474);
}
break;
}
break;
}
}
eable.Free();
}

View file

@ -61,8 +61,8 @@ namespace Server.Mobiles
foreach (Mobile m in eable)
{
if (m == this || !CanBeHarmful(m) ||
!(m.Player || m is BaseCreature creature &&
(creature.Controlled || creature.Summoned || creature.Team != Team)))
!(m.Player || (m is BaseCreature creature &&
(creature.Controlled || creature.Summoned || creature.Team != Team))))
continue;
DoHarmful(m);
@ -70,7 +70,7 @@ namespace Server.Mobiles
m.FixedParticles(0x374A, 10, 15, 5013, 0x496, 0, EffectLayer.Waist);
m.PlaySound(0x231);
//m.SendMessage( "You feel the life drain out of you!" );
// m.SendMessage( "You feel the life drain out of you!" );
int toDrain = Utility.RandomMinMax(10, 40);
@ -85,7 +85,7 @@ namespace Server.Mobiles
{
base.OnGaveMeleeAttack(defender);
if (0.1 >= Utility.RandomDouble())
if (Utility.RandomDouble() <= 0.1)
DrainLife();
}
@ -93,7 +93,7 @@ namespace Server.Mobiles
{
base.OnGotMeleeAttack(attacker);
if (0.1 >= Utility.RandomDouble())
if (Utility.RandomDouble() <= 0.1)
DrainLife();
}

View file

@ -61,7 +61,7 @@ namespace Server.Mobiles
public override void GenerateLoot()
{
AddLoot(LootPack.Meager);
//AddLoot( LootPack.Miscellaneous );
// AddLoot( LootPack.Miscellaneous );
}
public override void Serialize(IGenericWriter writer)

View file

@ -33,7 +33,7 @@ namespace Server.Mobiles
VirtualArmor = 35;
if (0.2 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.2)
PackItem(new GargoylesPickaxe());
}

View file

@ -46,7 +46,6 @@ namespace Server.Mobiles
helm.Hue = 0x966;
AddItem(helm);
Bow bow = new Bow();
bow.Movable = false;
@ -73,7 +72,7 @@ namespace Server.Mobiles
{
base.Serialize(writer);
writer.Write(0); // version
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)

View file

@ -13,7 +13,6 @@ namespace Server.Mobiles
{
Body = 768;
SetStr(301, 400);
SetDex(51, 70);
SetInt(51, 100);
@ -42,10 +41,10 @@ namespace Server.Mobiles
VirtualArmor = 70;
if (0.1 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.1)
PackItem(new PowerCrystal());
if (0.4 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.4)
PackItem(new ClockworkAssembly());
}
@ -68,11 +67,11 @@ namespace Server.Mobiles
{
base.OnDeath(c);
if (0.05 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.05)
{
if (!IsParagon)
{
if (0.75 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.75)
c.DropItem(DawnsMusicGear.RandomCommon);
else
c.DropItem(DawnsMusicGear.RandomUncommon);
@ -100,7 +99,7 @@ namespace Server.Mobiles
{
base.OnGaveMeleeAttack(defender);
if (!m_Stunning && 0.3 > Utility.RandomDouble())
if (!m_Stunning && Utility.RandomDouble() < 0.3)
{
m_Stunning = true;

View file

@ -7,10 +7,10 @@ namespace Server.Mobiles
{
public class KhaldunRevenant : BaseCreature
{
private static HashSet<Mobile> m_Set = new HashSet<Mobile>();
private DateTime m_ExpireTime;
private static readonly HashSet<Mobile> m_Set = new HashSet<Mobile>();
private readonly DateTime m_ExpireTime;
private Mobile m_Target;
private readonly Mobile m_Target;
public KhaldunRevenant(Mobile target) : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.18, 0.36)
{
@ -116,8 +116,8 @@ namespace Server.Mobiles
return;
}
//Combatant = m_Target;
//FocusMob = m_Target;
// Combatant = m_Target;
// FocusMob = m_Target;
if (AIObject != null)
AIObject.Action = ActionType.Combat;

View file

@ -74,7 +74,7 @@ namespace Server.Mobiles
break;
}
if (0.2 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.2)
PackItem(new BolaBall());
}

View file

@ -48,7 +48,7 @@ namespace Server.Mobiles
PackItem(new MortarPestle());
PackItem(new LesserExplosionPotion());
if (0.2 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.2)
PackItem(new BolaBall());
}
@ -108,7 +108,7 @@ namespace Server.Mobiles
m_Thrown++;
if (0.75 >= Utility.RandomDouble() && m_Thrown % 2 == 1) // 75% chance to quickly throw another bomb
if (Utility.RandomDouble() <= 0.75 && m_Thrown % 2 == 1) // 75% chance to quickly throw another bomb
m_NextBomb = DateTime.UtcNow + TimeSpan.FromSeconds(3.0);
else
m_NextBomb = DateTime.UtcNow + TimeSpan.FromSeconds(5.0 + 10.0 * Utility.RandomDouble()); // 5-15 seconds
@ -138,7 +138,8 @@ namespace Server.Mobiles
private class InternalTimer : Timer
{
private Mobile m_Mobile, m_From;
private readonly Mobile m_Mobile;
private readonly Mobile m_From;
public InternalTimer(Mobile m, Mobile from) : base(TimeSpan.FromSeconds(1.0))
{

View file

@ -42,10 +42,10 @@ namespace Server.Mobiles
PackItem(ore);
PackItem(new IronIngot(10));
if (0.05 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.05)
PackItem(new OrcishKinMask());
if (0.2 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.2)
PackItem(new BolaBall());
}
@ -113,7 +113,7 @@ namespace Server.Mobiles
if (eable.Count() < 10)
{
BaseCreature orc = new SpawnedOrcishLord{ Team = Team };
BaseCreature orc = new SpawnedOrcishLord { Team = Team };
orc.MoveToWorld(map.GetRandomNearbyLocation(target.Location), map);
orc.Combatant = target;

View file

@ -56,10 +56,10 @@ namespace Server.Mobiles
PackItem(new RingmailChest());
if (0.3 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.3)
PackItem(Loot.RandomPossibleReagent());
if (0.2 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.2)
PackItem(new BolaBall());
}

View file

@ -76,8 +76,7 @@ namespace Server.Mobiles
public override bool IsEnemy(Mobile m)
{
if (m is PlayerMobile player && Map == Map.Trammel && X >= 5199 && X <= 5271 && Y >= 1812 && Y <= 1865
) // Schmendrick's cave
if (m is PlayerMobile player && Map == Map.Trammel && X >= 5199 && X <= 5271 && Y >= 1812 && Y <= 1865) // Schmendrick's cave
{
QuestSystem qs = player.Quest;

View file

@ -35,18 +35,18 @@ namespace Server.Mobiles
PackItem(new Bandage(Utility.RandomMinMax(1, 15)));
if (Female && 0.1 > Utility.RandomDouble())
if (Female && Utility.RandomDouble() < 0.1)
PackItem(new TribalBerry());
else if (!Female && 0.1 > Utility.RandomDouble())
else if (!Female && Utility.RandomDouble() < 0.1)
PackItem(new BolaBall());
AddItem(new Spear());
AddItem(new BoneArms());
AddItem(new BoneLegs());
if (0.5 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.5)
AddItem(new SavageMask());
else if (0.1 > Utility.RandomDouble())
else if (Utility.RandomDouble() < 0.1)
AddItem(new OrcishKinMask());
}

View file

@ -36,7 +36,7 @@ namespace Server.Mobiles
PackItem(new Bandage(Utility.RandomMinMax(1, 15)));
if (0.1 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.1)
PackItem(new BolaBall());
AddItem(new TribalSpear());

View file

@ -100,7 +100,7 @@ namespace Server.Mobiles
private class UnhideTimer : Timer
{
private ShadowFiend m_Owner;
private readonly ShadowFiend m_Owner;
public UnhideTimer(ShadowFiend owner) : base(TimeSpan.FromSeconds(30.0))
{

View file

@ -37,7 +37,7 @@ namespace Server.Mobiles
PackItem(new IronIngot(12));
if (0.05 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.05)
PackItem(new GargoylesPickaxe());
}