From 157f2a4dc917231c992b5ab49e71289ffae2ce8e Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Thu, 7 Nov 2019 19:25:35 -0500 Subject: [PATCH] misc cleanups to rogue weapon code suggested by my laptop's visual studio --- Items/Weapons/Rogue/LunarKunai.cs | 3 --- Projectiles/CalamityGlobalProjectile.cs | 2 +- Projectiles/Rogue/DukesDecapitatorBubble.cs | 2 +- Projectiles/Rogue/EpidemicShredderProjectile.cs | 3 --- Projectiles/Rogue/LuminousShard.cs | 4 ++-- Projectiles/Rogue/LunarKunaiProj.cs | 6 +++--- Projectiles/Rogue/SandslasherProj.cs | 2 +- Utilities/CalamityUtils.cs | 7 +++---- 8 files changed, 11 insertions(+), 18 deletions(-) diff --git a/Items/Weapons/Rogue/LunarKunai.cs b/Items/Weapons/Rogue/LunarKunai.cs index 6cfe840687..f64b579dc0 100644 --- a/Items/Weapons/Rogue/LunarKunai.cs +++ b/Items/Weapons/Rogue/LunarKunai.cs @@ -47,8 +47,6 @@ namespace CalamityMod.Items.Weapons.Rogue { float num72 = item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default(Vector2)); - Vector2 vector3 = Main.MouseWorld - vector2; float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; if (player.gravDir == -1f) @@ -56,7 +54,6 @@ namespace CalamityMod.Items.Weapons.Rogue num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; } float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) { num78 = (float)player.direction; diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 13e9efc0a4..5ea4277c0a 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles projectile.light = 0.9f; if (Main.rand.Next(10) == 0) - Dust.NewDust(projectile.position, projectile.width, projectile.height, 58, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default(Color), 1.2f); + Dust.NewDust(projectile.position, projectile.width, projectile.height, 58, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); if (Main.rand.Next(20) == 0) Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); diff --git a/Projectiles/Rogue/DukesDecapitatorBubble.cs b/Projectiles/Rogue/DukesDecapitatorBubble.cs index 33e6dbc8a9..bf8493b6fc 100644 --- a/Projectiles/Rogue/DukesDecapitatorBubble.cs +++ b/Projectiles/Rogue/DukesDecapitatorBubble.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Rogue int num190 = Main.rand.Next(5, 9); for (int num191 = 0; num191 < num190; num191++) { - int num192 = Dust.NewDust(projectile.Center, 0, 0, 206, 0f, 0f, 100, default(Color), 1.4f); + int num192 = Dust.NewDust(projectile.Center, 0, 0, 206, 0f, 0f, 100, default, 1.4f); Main.dust[num192].velocity *= 0.8f; Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, projectile.Center, 0.5f); Main.dust[num192].noGravity = true; diff --git a/Projectiles/Rogue/EpidemicShredderProjectile.cs b/Projectiles/Rogue/EpidemicShredderProjectile.cs index 9ecddee150..4943895ea8 100644 --- a/Projectiles/Rogue/EpidemicShredderProjectile.cs +++ b/Projectiles/Rogue/EpidemicShredderProjectile.cs @@ -12,9 +12,6 @@ namespace CalamityMod.Projectiles.Rogue { public class EpidemicShredderProjectile : ModProjectile { - // This is never used - bool justhit = false; - public override void SetStaticDefaults() { DisplayName.SetDefault("Epidemic Shredder"); diff --git a/Projectiles/Rogue/LuminousShard.cs b/Projectiles/Rogue/LuminousShard.cs index b266b66058..01c34feeaf 100644 --- a/Projectiles/Rogue/LuminousShard.cs +++ b/Projectiles/Rogue/LuminousShard.cs @@ -43,10 +43,10 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i <= 2; i++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 176, projectile.oldVelocity.X / 4, projectile.oldVelocity.Y / 4, 0, default(Color), 0.75f); + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 176, projectile.oldVelocity.X / 4, projectile.oldVelocity.Y / 4, 0, default, 0.75f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 177, projectile.oldVelocity.X / 4, projectile.oldVelocity.Y / 4, 0, default(Color), 0.75f); + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 177, projectile.oldVelocity.X / 4, projectile.oldVelocity.Y / 4, 0, default, 0.75f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; } diff --git a/Projectiles/Rogue/LunarKunaiProj.cs b/Projectiles/Rogue/LunarKunaiProj.cs index 7e215e1e9d..6beda5f76c 100644 --- a/Projectiles/Rogue/LunarKunaiProj.cs +++ b/Projectiles/Rogue/LunarKunaiProj.cs @@ -92,10 +92,10 @@ namespace CalamityMod.Projectiles.Rogue projectile.damage /= 4; for (int num194 = 0; num194 < 10; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 0, default(Color), 1.5f); + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 0, default, 1.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default(Color), 1f); + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default, 1f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 5; i++) { - int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 265, 0f, 0f, 100, default(Color), 1f); + int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 265, 0f, 0f, 100, default, 1f); Main.dust[num304].noGravity = true; Main.dust[num304].velocity *= 1.2f; Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f; diff --git a/Projectiles/Rogue/SandslasherProj.cs b/Projectiles/Rogue/SandslasherProj.cs index 1516f177f0..c8025823e1 100644 --- a/Projectiles/Rogue/SandslasherProj.cs +++ b/Projectiles/Rogue/SandslasherProj.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 15; i++) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 85, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, default(Color), 1f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 85, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, default, 1f); } } } diff --git a/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index a5a266e995..f23f0add03 100644 --- a/Utilities/CalamityUtils.cs +++ b/Utilities/CalamityUtils.cs @@ -145,7 +145,7 @@ namespace CalamityMod { Player player = Main.player[Main.myPlayer]; Item item = player.inventory[player.selectedItem]; - float hitbox_X = 0, hitbox_Y = 0; + float hitbox_X, hitbox_Y; float mountOffsetY = player.mount.PlayerOffsetHitbox; // Third hitbox shifting values @@ -492,10 +492,10 @@ namespace CalamityMod time += 54000D; // Divide by seconds in an hour - time = time / 3600D; + time /= 3600D; // Terraria night starts at 7:30 PM, so offset accordingly - time = time - 19.5; + time -= 19.5; // Offset time to ensure it is not negative, then change to PM if necessary if (time < 0D) @@ -709,7 +709,6 @@ namespace CalamityMod public static bool LockedChestRightClick(bool isLocked, int left, int top, int i, int j) { Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; // If the player right clicked the chest while editing a sign, finish that up if (player.sign >= 0)