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();
}