Skip to content
This repository has been archived by the owner on Jan 24, 2019. It is now read-only.

Commit

Permalink
Replaced .Next(d) == d calls to .NextBool(d) calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Jofairden committed Oct 18, 2017
1 parent 19ccbd7 commit c5ebfd1
Show file tree
Hide file tree
Showing 362 changed files with 666 additions and 666 deletions.
2 changes: 1 addition & 1 deletion Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public static float DistortFloat(float Float, float Percent)
DistortNumber *= 10;
Counter++;
}
return Float + ((Main.rand.Next(0, (int)DistortNumber + 1) / (float)(Math.Pow(10, Counter))) * ((Main.rand.Next(2) == 0) ? -1 : 1));
return Float + ((Main.rand.Next(0, (int)DistortNumber + 1) / (float)(Math.Pow(10, Counter))) * ((Main.rand.NextBool(2)) ? -1 : 1));
}

public static void Explode(int index, int sizeX, int sizeY, ExtraAction visualAction = null)
Expand Down
2 changes: 1 addition & 1 deletion Ice/Items/FrozenPaxe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public override void SetStaticDefaults()

public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.Next(3) == 0)
if (Main.rand.NextBool(3))
{
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 80);
}
Expand Down
2 changes: 1 addition & 1 deletion Invasion/CyberLaser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override void SetDefaults()
public override void OnHitNPC(NPC target1, int damage, float knockback, bool crit)
{
Player target = Main.player[Main.myPlayer];
if (Main.rand.Next(2) == 0)
if (Main.rand.NextBool(2))
target.AddBuff(mod.BuffType("Light"), 300);
}

Expand Down
8 changes: 4 additions & 4 deletions Invasion/InvisibleSoul.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public override float SpawnChance(NPCSpawnInfo spawnInfo)

public override void OnHitPlayer(Player player, int damage, bool crit)
{
if (Main.rand.Next(3) == 0)
if (Main.rand.NextBool(3))
{
player.AddBuff(164, 1000, true);
}
Expand All @@ -62,7 +62,7 @@ public override void HitEffect(int hitDirection, double damage)
}

CyberWrathInvasion modPlayer = Main.player[Main.myPlayer].GetModPlayer<CyberWrathInvasion>(mod);
if (InvasionWorld.CyberWrath && Main.rand.Next(3) == 1)
if (InvasionWorld.CyberWrath && Main.rand.NextBool(3))
{
InvasionWorld.CyberWrathPoints1 += 3;
//Main.NewText(("Wave 1: Complete " + TremorWorld.CyberWrathPoints + "%"), 39, 86, 134);
Expand All @@ -82,7 +82,7 @@ public override void NPCLoot()
int centerX = (int)(npc.position.X + npc.width / 2) / 16;
int centerY = (int)(npc.position.Y + npc.height / 2) / 16;
int halfLength = npc.width / 2 / 16 + 1;
if (Main.rand.Next(3) == 0)
if (Main.rand.NextBool(3))
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ParadoxElement"), Main.rand.Next(5, 7));
}
Expand Down Expand Up @@ -113,7 +113,7 @@ public override void AI()
SecondState = true;
}

if (Main.rand.Next(2) == 0)
if (Main.rand.NextBool(2))
{
int num706 = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType<CyberDust>(), 0f, 0f, 200, npc.color, 0.5f);
Main.dust[num706].velocity *= 0.6f;
Expand Down
4 changes: 2 additions & 2 deletions Invasion/MiniSoul.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public override void NPCLoot()

private void SettingNumber()
{
if (Main.rand.Next(2) == 1)
if (Main.rand.NextBool(2))
{
num++;
}
Expand All @@ -61,7 +61,7 @@ public override void HitEffect(int hitDirection, double damage)
}

CyberWrathInvasion modPlayer = Main.player[Main.myPlayer].GetModPlayer<CyberWrathInvasion>(mod);
if (InvasionWorld.CyberWrath && Main.rand.Next(4) == 1)
if (InvasionWorld.CyberWrath && Main.rand.NextBool(4))
{
InvasionWorld.CyberWrathPoints1 += 1;
//Main.NewText(("Wave 1: Complete " + TremorWorld.CyberWrathPoints + "%"), 39, 86, 134);
Expand Down
8 changes: 4 additions & 4 deletions Invasion/ParadoxBat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public override void HitEffect(int hitDirection, double damage)
}

CyberWrathInvasion modPlayer = Main.player[Main.myPlayer].GetModPlayer<CyberWrathInvasion>(mod);
if (InvasionWorld.CyberWrath && Main.rand.Next(2) == 1)
if (InvasionWorld.CyberWrath && Main.rand.NextBool(2))
{
InvasionWorld.CyberWrathPoints1 += 1;
//Main.NewText(("Wave 1: Complete " + TremorWorld.CyberWrathPoints + "%"), 39, 86, 134);
Expand Down Expand Up @@ -104,7 +104,7 @@ public override void NPCLoot()
int centerX = (int)(npc.position.X + npc.width / 2) / 16;
int centerY = (int)(npc.position.Y + npc.height / 2) / 16;
int halfLength = npc.width / 2 / 16 + 1;
if (Main.rand.Next(3) == 0)
if (Main.rand.NextBool(3))
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ParadoxElement"), Main.rand.Next(3, 5));
}
Expand Down Expand Up @@ -163,7 +163,7 @@ public override void AI()
npc.position.Y = Main.player[npc.target].position.Y + (float)((250 * Math.Sin(npc.ai[3])) * -1);
}
}
if (Main.rand.Next(2) == 0)
if (Main.rand.NextBool(2))
{
int num706 = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType<CyberDust>(), 0f, 0f, 200, npc.color, 0.5f);
Main.dust[num706].velocity *= 0.6f;
Expand Down Expand Up @@ -219,7 +219,7 @@ public override void AI()
}
npc.netUpdate = true;

if (Main.rand.Next(6) == 0)
if (Main.rand.NextBool(6))
{
int dust = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType<CyberDust>(), 0f, 0f, 200, npc.color, 0.4f);
Main.dust[dust].velocity *= 0.4f;
Expand Down
4 changes: 2 additions & 2 deletions Invasion/ParadoxSun.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public override void HitEffect(int hitDirection, double damage)
}

CyberWrathInvasion modPlayer = Main.player[Main.myPlayer].GetModPlayer<CyberWrathInvasion>(mod);
if (InvasionWorld.CyberWrath && Main.rand.Next(2) == 1)
if (InvasionWorld.CyberWrath && Main.rand.NextBool(2))
{
InvasionWorld.CyberWrathPoints1 += 2;
//Main.NewText(("Wave 1: Complete " + TremorWorld.CyberWrathPoints + "%"), 39, 86, 134);
Expand All @@ -75,7 +75,7 @@ public override void ScaleExpertStats(int numPlayers, float bossLifeScale)

public override void OnHitPlayer(Player player, int damage, bool crit)
{
if (Main.rand.Next(6) == 0)
if (Main.rand.NextBool(6))
{
player.AddBuff(31, 1000, true);
}
Expand Down
2 changes: 1 addition & 1 deletion Invasion/ParadoxTitanBag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public override void OpenBossBag(Player player)
{
player.TryGettingDevArmor();
}
if (Main.rand.Next(7) == 0)
if (Main.rand.NextBool(7))
{
player.QuickSpawnItem(mod.ItemType("ParadoxTitanMask"));
}
Expand Down
6 changes: 3 additions & 3 deletions Invasion/Relayx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ public override void SetStaticDefaults()

public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.Next(3) == 0)
if (Main.rand.NextBool(3))
{
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 59);
}
}

public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
if (Main.rand.Next(8) == 0)
if (Main.rand.NextBool(8))
{
if (Main.rand.Next(3) == 0)
if (Main.rand.NextBool(3))
{
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("RelayxDragonBig"), item.damage + 200, 10, Main.myPlayer);
}
Expand Down
2 changes: 1 addition & 1 deletion Invasion/RelayxDragon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public override void SetDefaults()
public override void AI()
{
projectile.spriteDirection = projectile.direction;
if (Main.rand.Next(3) == 1)
if (Main.rand.NextBool(3))
{
int dust2 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 59, 0f, 0f, 100, default(Color), 1f);
Main.dust[dust2].noGravity = true;
Expand Down
2 changes: 1 addition & 1 deletion Invasion/RelayxDragonBig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public override bool PreAI()
public override void AI()
{
projectile.spriteDirection = projectile.direction;
if (Main.rand.Next(3) == 1)
if (Main.rand.NextBool(3))
{
int dust2 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 59, 0f, 0f, 100, default(Color), 1f);
Main.dust[dust2].noGravity = true;
Expand Down
2 changes: 1 addition & 1 deletion Invasion/RelayxProj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public override void SetDefaults()

public override void AI()
{
if (Main.rand.Next(3) == 1)
if (Main.rand.NextBool(3))
{
int dust2 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 59, 0f, 0f, 100, default(Color), 1f);
Main.dust[dust2].noGravity = true;
Expand Down
6 changes: 3 additions & 3 deletions Invasion/Titan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public override void AI()
{
npc.TargetClosest(true);
}
if (!Main.player[npc.target].dead && Main.rand.Next(2) == 0)
if (!Main.player[npc.target].dead && Main.rand.NextBool(2))
{
npc.position.X = Main.player[npc.target].position.X + (float)((600 * Math.Cos(npc.ai[3])) * -1);
npc.position.Y = Main.player[npc.target].position.Y + (float)((600 * Math.Sin(npc.ai[3])) * -1);
Expand Down Expand Up @@ -203,7 +203,7 @@ public override void AI()
npc.TargetClosest(true);
}

if (!Main.player[npc.target].dead && Main.rand.Next(2) == 1)
if (!Main.player[npc.target].dead && Main.rand.NextBool(2))
{
npc.position.X = Main.player[npc.target].position.X + (float)((600 * Math.Cos(npc.ai[3])) * -1);
npc.position.Y = Main.player[npc.target].position.Y + (float)((600 * Math.Sin(npc.ai[3])) * -1);
Expand Down Expand Up @@ -303,7 +303,7 @@ public override void NPCLoot()
{
npc.DropBossBags();
}
if (!Main.expertMode && Main.rand.Next(7) == 0)
if (!Main.expertMode && Main.rand.NextBool(7))
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ParadoxTitanMask"));
}
Expand Down
2 changes: 1 addition & 1 deletion Invasion/TitanCrystal_.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public override void OnHitPlayer(Player target, int damage, bool crit)
{
for (int k = 0; k < Player.maxBuffs; k++)
{
if (target.buffType[k] > 0 && target.buffTime[k] > 0 && BuffLoader.CanBeCleared(target.buffType[k]) && Main.rand.Next(2) == 0)
if (target.buffType[k] > 0 && target.buffTime[k] > 0 && BuffLoader.CanBeCleared(target.buffType[k]) && Main.rand.NextBool(2))
{
target.DelBuff(k);
k--;
Expand Down
8 changes: 4 additions & 4 deletions Invasion/Violeum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ public override void NPCLoot()
{
npc.DropBossBags();
}
if (!Main.expertMode && Main.rand.Next(7) == 0)
if (!Main.expertMode && Main.rand.NextBool(7))
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VioleumMask"));
}
if (!Main.expertMode && Main.rand.Next(5) == 0)
if (!Main.expertMode && Main.rand.NextBool(5))
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Crystyle"));
}
Expand Down Expand Up @@ -170,7 +170,7 @@ public override void AI()
SecondState = true;
}

if (Main.rand.Next(2) == 0)
if (Main.rand.NextBool(2))
{
int num706 = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType<CyberDust>(), 0f, 0f, 200, npc.color, 0.5f);
Main.dust[num706].velocity *= 0.6f;
Expand Down Expand Up @@ -287,7 +287,7 @@ public override void AI()
}
}

if (Main.rand.Next(2) == 0)
if (Main.rand.NextBool(2))
{

float j = 0;
Expand Down
6 changes: 3 additions & 3 deletions Items/AlchemasterTreasureBag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public override bool CanRightClick()

public override void OpenBossBag(Player player)
{
if (Main.rand.Next(7) == 0)
if (Main.rand.NextBool(7))
{
player.QuickSpawnItem(mod.ItemType("AlchemasterMask"));
}
Expand All @@ -45,11 +45,11 @@ public override void OpenBossBag(Player player)
{
player.QuickSpawnItem(mod.ItemType("SparkingFlask"), Main.rand.Next(30, 78));
}
if (Main.rand.Next(3) == 0)
if (Main.rand.NextBool(3))
{
player.QuickSpawnItem(mod.ItemType("TheGlorch"));
}
if (Main.rand.Next(3) == 0)
if (Main.rand.NextBool(3))
{
player.QuickSpawnItem(mod.ItemType("BadApple"));
}
Expand Down
2 changes: 1 addition & 1 deletion Items/AncientClaymore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public override void SetStaticDefaults()

public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.Next(3) == 0)
if (Main.rand.NextBool(3))
{
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 64);
}
Expand Down
2 changes: 1 addition & 1 deletion Items/AncientDragonBag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public override void OpenBossBag(Player player)
break;
}

if (Main.rand.Next(7) == 0)
if (Main.rand.NextBool(7))
{
player.QuickSpawnItem(mod.ItemType("AncientDragonMask"));
}
Expand Down
2 changes: 1 addition & 1 deletion Items/AncientSmasher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public override void SetStaticDefaults()

public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.Next(3) == 0)
if (Main.rand.NextBool(3))
{
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 64);
}
Expand Down
2 changes: 1 addition & 1 deletion Items/AncientSolarWind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public override void SetStaticDefaults()

public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.Next(3) == 0)
if (Main.rand.NextBool(3))
{
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 64);
}
Expand Down
2 changes: 1 addition & 1 deletion Items/AncientSunStaff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public override void SetStaticDefaults()

public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.Next(3) == 0)
if (Main.rand.NextBool(3))
{
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 64);
}
Expand Down
2 changes: 1 addition & 1 deletion Items/AndasBag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public override void OpenBossBag(Player player)
break;
}

if (Main.rand.Next(7) == 0)
if (Main.rand.NextBool(7))
{
player.QuickSpawnItem(mod.ItemType("AndasMask"));
}
Expand Down
2 changes: 1 addition & 1 deletion Items/ArgiteBroadsword.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public override void AddRecipes()

public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.Next(3) == 0)
if (Main.rand.NextBool(3))
{
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 61);
}
Expand Down
2 changes: 1 addition & 1 deletion Items/ArgiteHamaxe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public override void AddRecipes()

public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.Next(3) == 0)
if (Main.rand.NextBool(3))
{
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 61);
}
Expand Down
2 changes: 1 addition & 1 deletion Items/ArgitePickaxe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public override void AddRecipes()

public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.Next(3) == 0)
if (Main.rand.NextBool(3))
{
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 61);
}
Expand Down
2 changes: 1 addition & 1 deletion Items/Awakening.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public override void SetStaticDefaults()

public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.Next(3) == 0)
if (Main.rand.NextBool(3))
{
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 13);
}
Expand Down
2 changes: 1 addition & 1 deletion Items/Banhammer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public override void ModifyTooltips(List<TooltipLine> tooltips)

public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.Next(2) == 0)
if (Main.rand.NextBool(2))
{
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 226);
}
Expand Down
2 changes: 1 addition & 1 deletion Items/Bolter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public override void SetStaticDefaults()

public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
if (Main.rand.Next(2) == 0)
if (Main.rand.NextBool(2))
{
type = 41;
}
Expand Down
2 changes: 1 addition & 1 deletion Items/BrassChainRepeater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public override void UpdateInventory(Player player)

public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
if (Main.rand.Next(4) == 0)
if (Main.rand.NextBool(4))
{
type = 260;
}
Expand Down
Loading

0 comments on commit c5ebfd1

Please sign in to comment.