diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index f45bf27981..3d11e73798 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -308,6 +308,9 @@ namespace CalamityMod.CalPlayer public bool eclipseMirrorCooldown = false; public bool featherCrown = false; public bool moonCrown = false; + public bool dragonScales = false; + public bool gloveOfPrecision = false; + public bool momentumCapacitor = false; // Armor Set public bool victideSet = false; @@ -1018,6 +1021,9 @@ namespace CalamityMod.CalPlayer eclipseMirrorCooldown = false; featherCrown = false; moonCrown = false; + dragonScales = false; + gloveOfPrecision = false; + momentumCapacitor = false; shadowflame = false; wDeath = false; @@ -1647,6 +1653,13 @@ namespace CalamityMod.CalPlayer #region HotKeys public override void ProcessTriggers(TriggersSet triggersSet) { + if (CalamityMod.MomentumCapacitatorHotkey.JustPressed && momentumCapacitor && Main.myPlayer == player.whoAmI && player.Calamity().rogueStealth >= player.Calamity().rogueStealthMax * 0.25f && + CalamityUtils.CountProjectiles(mod.ProjectileType("MomentumCapacitorOrb")) == 0) + { + player.Calamity().rogueStealth -= player.Calamity().rogueStealthMax * 0.25f; + Vector2 fieldSpawnCenter = new Vector2(Main.mouseX, Main.mouseY) + Main.screenPosition; + Projectile.NewProjectile(fieldSpawnCenter, Vector2.Zero, mod.ProjectileType("MomentumCapacitorOrb"), 0, 0f, player.whoAmI, 0f, 0f); + } if (CalamityMod.NormalityRelocatorHotKey.JustPressed && normalityRelocator && Main.myPlayer == player.whoAmI) { Vector2 teleportLocation; @@ -2003,7 +2016,6 @@ namespace CalamityMod.CalPlayer if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) { flag = true; - num3 += i; break; } } @@ -2097,7 +2109,6 @@ namespace CalamityMod.CalPlayer if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3)) { flag = true; - num3 += i; break; } } @@ -4450,6 +4461,11 @@ namespace CalamityMod.CalPlayer player.Calamity().throwingVelocity += 0.1f; } } + if (gloveOfPrecision) + { + player.Calamity().throwingCrit += 12; + player.Calamity().throwingVelocity *= 1.2f; + } if (tarraSummon) { int lifeCounter = 0; @@ -4477,7 +4493,6 @@ namespace CalamityMod.CalPlayer lifeCounter++; if (lifeCounter >= 180) { - lifeCounter = 0; } } if (brimstoneElementalLore && player.inferno) @@ -4723,34 +4738,52 @@ namespace CalamityMod.CalPlayer } #endregion } - + #region Dragon Scale Logic + public override void PostBuyItem(NPC vendor, Item[] shopInventory, Item item) + { + if (item.type == mod.ItemType("DragonScales") && !CalamityWorld.dragonScalesBought) + { + CalamityWorld.dragonScalesBought = true; + } + } + public override bool CanBuyItem(NPC vendor, Item[] shopInventory, Item item) + { + if (item.type == mod.ItemType("DragonScales")) + { + return !CalamityWorld.dragonScalesBought; + } + return base.CanBuyItem(vendor, shopInventory, item); + } + #endregion public override void PostUpdateRunSpeeds() { #region SpeedBoosts float runAccMult = 1f + + (shadowSpeed ? 0.5f : 0f) + ((stressPills || laudanum || draedonsHeart) ? 0.05f : 0f) + ((abyssalDivingSuit && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) ? 0.05f : 0f) + (sirenWaterBuff ? 0.15f : 0f) + ((frostFlare && player.statLife < (int)((double)player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + - (shadowSpeed ? 0.5f : 0f) + (auricSet ? 0.1f : 0f) + - (silvaSet ? 0.05f : 0f) + + (dragonScales ? 0.1f : 0f) + (cTracers ? 0.1f : 0f) + + (silvaSet ? 0.05f : 0f) + (eTracers ? 0.05f : 0f) + (blueCandle ? 0.05f : 0f) + ((deepDiver && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) ? 0.15f : 0f) + (rogueStealthMax > 0f ? (rogueStealth >= rogueStealthMax ? rogueStealth * 0.05f : rogueStealth * 0.025f) : 0f); float runSpeedMult = 1f + - ((stressPills || laudanum || draedonsHeart) ? 0.05f : 0f) + - ((abyssalDivingSuit && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) ? 0.05f : 0f) + - (sirenWaterBuff ? 0.15f : 0f) + - ((frostFlare && player.statLife < (int)((double)player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + (shadowSpeed ? 0.5f : 0f) + + ((abyssalDivingSuit && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) ? 0.05f : 0f) + + ((frostFlare && player.statLife < (int)((double)player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + + (sirenWaterBuff ? 0.15f : 0f) + (auricSet ? 0.1f : 0f) + - (silvaSet ? 0.05f : 0f) + + (dragonScales ? 0.1f : 0f) + (cTracers ? 0.1f : 0f) + + (silvaSet ? 0.05f : 0f) + (eTracers ? 0.05f : 0f) + + ((stressPills || laudanum || draedonsHeart) ? 0.05f : 0f) + ((deepDiver && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) ? 0.15f : 0f) + (rogueStealthMax > 0f ? (rogueStealth >= rogueStealthMax ? rogueStealth * 0.05f : rogueStealth * 0.025f) : 0f); diff --git a/CalamityMod.cs b/CalamityMod.cs index 268345a08c..52c1cf5d46 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -39,6 +39,7 @@ namespace CalamityMod public static ModHotKey AstralArcanumUIHotkey; public static ModHotKey BossBarToggleHotKey; public static ModHotKey BossBarToggleSmallTextHotKey; + public static ModHotKey MomentumCapacitatorHotkey; // Boss Spawners public static int ghostKillCount = 0; @@ -122,6 +123,7 @@ namespace CalamityMod TarraHotKey = RegisterHotKey("Armor Set Bonus", "Y"); AstralTeleportHotKey = RegisterHotKey("Astral Teleport", "P"); AstralArcanumUIHotkey = RegisterHotKey("Astral Arcanum UI Toggle", "O"); + MomentumCapacitatorHotkey = RegisterHotKey("Momentom Capacitater Effect", "U"); BossBarToggleHotKey = RegisterHotKey("Boss Health Bar Toggle", "NumPad0"); BossBarToggleSmallTextHotKey = RegisterHotKey("Boss Health Bar Small Text Toggle", "NumPad1"); @@ -207,6 +209,7 @@ namespace CalamityMod TarraHotKey = null; AstralTeleportHotKey = null; AstralArcanumUIHotkey = null; + MomentumCapacitatorHotkey = null; BossBarToggleHotKey = null; BossBarToggleSmallTextHotKey = null; @@ -2756,7 +2759,7 @@ namespace CalamityMod #endregion #region Seasons - public static Season season + public static Season CurrentSeason { get { diff --git a/Items/Accessories/DragonScales.cs b/Items/Accessories/DragonScales.cs new file mode 100644 index 0000000000..6fc1e2c19d --- /dev/null +++ b/Items/Accessories/DragonScales.cs @@ -0,0 +1,34 @@ +using CalamityMod.CalPlayer; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class DragonScales : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dragon Scales"); + Tooltip.SetDefault("Causes all rogue projectiles to emit a slow fireball as it travels\n" + + "Stealth strikes create infernados on death\n" + + "After Yharon is dead, you are granted 10% movement speed and acceleration\n" + + "'Only a living dragon holds true treasure'"); + } + + public override void SetDefaults() + { + item.width = 32; + item.height = 34; + item.value = Item.buyPrice(0, 90, 0, 0); + item.rare = 10; + item.Calamity().postMoonLordRarity = 15; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.dragonScales = true; + } + } +} diff --git a/Items/Accessories/DragonScales.png b/Items/Accessories/DragonScales.png new file mode 100644 index 0000000000..b39158f698 Binary files /dev/null and b/Items/Accessories/DragonScales.png differ diff --git a/Items/Accessories/GloveOfPrecicion.cs b/Items/Accessories/GloveOfPrecicion.cs new file mode 100644 index 0000000000..b974bade08 --- /dev/null +++ b/Items/Accessories/GloveOfPrecicion.cs @@ -0,0 +1,31 @@ +using CalamityMod.CalPlayer; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class GloveOfPrecicion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Glove Of Precision"); + Tooltip.SetDefault("Decreases rogue speed by 20% but increase damage and crit by 12% and velocity by 25%"); + } + + public override void SetDefaults() + { + item.width = 24; + item.height = 40; + item.value = Item.buyPrice(0, 50, 0, 0); + item.accessory = true; + item.rare = 8; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.gloveOfPrecision = true; + } + } +} diff --git a/Items/Accessories/GloveOfPrecicion.png b/Items/Accessories/GloveOfPrecicion.png new file mode 100644 index 0000000000..7eb7b3078e Binary files /dev/null and b/Items/Accessories/GloveOfPrecicion.png differ diff --git a/Items/Accessories/MomentumCapacitor.cs b/Items/Accessories/MomentumCapacitor.cs new file mode 100644 index 0000000000..661ed23eee --- /dev/null +++ b/Items/Accessories/MomentumCapacitor.cs @@ -0,0 +1,34 @@ +using CalamityMod.CalPlayer; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class MomentumCapacitor : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Momentum Capacitor"); + Tooltip.SetDefault("Pressing U, for the cost of 25% of max stealth, causes an energy field to appear at the cursor position\n" + + "Rogue projectiles that enter the field get a constant acceleration and 15% damage boost\n" + + "These boosts can only happen to a projectile once\n" + + "There can only be one field"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 32; + item.value = Item.buyPrice(0, 60, 0, 0); + item.accessory = true; + item.rare = 6; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.momentumCapacitor = true; + } + } +} diff --git a/Items/Accessories/MomentumCapacitor.png b/Items/Accessories/MomentumCapacitor.png new file mode 100644 index 0000000000..b24de1305d Binary files /dev/null and b/Items/Accessories/MomentumCapacitor.png differ diff --git a/Items/Accessories/OldDie.cs b/Items/Accessories/OldDie.cs index f34ee3c642..05b3a9126f 100644 --- a/Items/Accessories/OldDie.cs +++ b/Items/Accessories/OldDie.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories item.width = 24; item.height = 26; item.rare = 3; - item.value = Item.buyPrice(0, 40, 0, 0); + item.value = Item.buyPrice(0, 10, 0, 0); item.accessory = true; } diff --git a/Items/Accessories/PlagueHive.cs b/Items/Accessories/PlagueHive.cs index 0f7e976c15..756f98a3d7 100644 --- a/Items/Accessories/PlagueHive.cs +++ b/Items/Accessories/PlagueHive.cs @@ -85,7 +85,6 @@ namespace CalamityMod.Items.Accessories plagueCounter++; if (plagueCounter >= 180) { - plagueCounter = 0; } } } diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index 4f368586f1..f41ca39e91 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -148,7 +148,6 @@ namespace CalamityMod.Items.Accessories seaCounter++; if (seaCounter >= 180) { - seaCounter = 0; } if (FireCountdown == 0) { @@ -172,8 +171,7 @@ namespace CalamityMod.Items.Accessories { Vector2 spawn = baseSpawn; spawn.X = spawn.X + i * 30 - (FireProjectiles * 15); - Vector2 velocity = baseVelocity; - velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-FireAngleSpread / 2 + (FireAngleSpread * i / (float)FireProjectiles))); + Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-FireAngleSpread / 2 + (FireAngleSpread * i / (float)FireProjectiles))); velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; int projectile = Projectile.NewProjectile(spawn.X, spawn.Y, velocity.X, velocity.Y, mod.ProjectileType("BrimstoneHellfireballFriendly2"), 2000, 5f, Main.myPlayer, 0f, 0f); Main.projectile[projectile].tileCollide = false; diff --git a/Items/Accessories/VoidofExtinction.cs b/Items/Accessories/VoidofExtinction.cs index fc61121457..055dfe5ba9 100644 --- a/Items/Accessories/VoidofExtinction.cs +++ b/Items/Accessories/VoidofExtinction.cs @@ -112,8 +112,7 @@ namespace CalamityMod.Items.Accessories { Vector2 spawn = baseSpawn; spawn.X = spawn.X + i * 30 - (FireProjectiles * 15); - Vector2 velocity = baseVelocity; - velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-FireAngleSpread / 2 + (FireAngleSpread * i / (float)FireProjectiles))); + Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-FireAngleSpread / 2 + (FireAngleSpread * i / (float)FireProjectiles))); velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; int projectile = Projectile.NewProjectile(spawn.X, spawn.Y, velocity.X, velocity.Y, mod.ProjectileType("BrimstoneHellfireballFriendly2"), 70, 5f, Main.myPlayer, 0f, 0f); Main.projectile[projectile].tileCollide = false; diff --git a/Items/Amidias/MagicalConch.cs b/Items/Amidias/MagicalConch.cs index 9c6af39166..61c59f6b6f 100644 --- a/Items/Amidias/MagicalConch.cs +++ b/Items/Amidias/MagicalConch.cs @@ -50,12 +50,9 @@ namespace CalamityMod.Items.Amidias 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; - num79 = 0f; - num80 = num72; } else { diff --git a/Items/Armor/ReaverHelm_Head.png b/Items/Armor/ReaverHelm_Head.png index d38084d264..b770e4f4e1 100644 Binary files a/Items/Armor/ReaverHelm_Head.png and b/Items/Armor/ReaverHelm_Head.png differ diff --git a/Items/BrimstoneWaifu/Gehenna.cs b/Items/BrimstoneWaifu/Gehenna.cs index 25a006090a..8f91be432b 100644 --- a/Items/BrimstoneWaifu/Gehenna.cs +++ b/Items/BrimstoneWaifu/Gehenna.cs @@ -50,8 +50,7 @@ namespace CalamityMod.Items.BrimstoneWaifu { Vector2 spawn = baseSpawn; spawn.X = spawn.X + i * 30 - (FireProjectiles * 15); - Vector2 velocity = baseVelocity; - velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-FireAngleSpread / 2 + (FireAngleSpread * i / (float)FireProjectiles))); + Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-FireAngleSpread / 2 + (FireAngleSpread * i / (float)FireProjectiles))); velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; int projectile = Projectile.NewProjectile(spawn.X, spawn.Y, velocity.X, velocity.Y, mod.ProjectileType("BrimstoneHellfireballFriendly2"), 54, 5f, Main.myPlayer, 0f, 0f); Main.projectile[projectile].tileCollide = false; diff --git a/Items/CalamityCustomThrowingDamage/BlazingStar.cs b/Items/CalamityCustomThrowingDamage/BlazingStar.cs new file mode 100644 index 0000000000..ac0c45f68e --- /dev/null +++ b/Items/CalamityCustomThrowingDamage/BlazingStar.cs @@ -0,0 +1,76 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.CalamityCustomThrowingDamage +{ + public class BlazingStar : CalamityDamageItem + { + public static int BaseDamage = 34; + public static float Speed = 9f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blazing Star"); + Tooltip.SetDefault("Stacks up to 3\n" + + "Stealth Strike Effect: Releases all stars at once with infinite peircing"); + } + + public override void SafeSetDefaults() + { + item.damage = BaseDamage; + item.crit = 4; + item.Calamity().rogue = true; + item.noMelee = true; + item.noUseGraphic = true; + item.width = 1; + item.height = 1; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 1; + item.knockBack = 4f; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 4; + item.UseSound = SoundID.Item1; + item.maxStack = 3; + + item.shootSpeed = Speed; + item.shoot = mod.ProjectileType("BlazingStarProj"); + } + + 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 (player.Calamity().StealthStrikeAvailable()) + { + if (item.stack != 1) + { + for (int i = 0; i < item.stack; i++) + { + Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-MathHelper.ToRadians(8f), MathHelper.ToRadians(8f), i / (float)(item.stack - 1))); + Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, i == 1 ? type : mod.ProjectileType("BlazingStarProj"), damage, knockBack, player.whoAmI, 0f, 0f); + int projectileIndex = Projectile.NewProjectile(position, perturbedSpeed, type, damage, knockBack, player.whoAmI, 0f); + Main.projectile[projectileIndex].penetrate = -1; + } + return false; + } + return true; + } + return true; + } + + public override bool CanUseItem(Player player) + { + return player.ownedProjectileCounts[item.shoot] < item.stack; + } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "Glaive", 1); + recipe.AddIngredient(ItemID.HellstoneBar, 3); + recipe.AddIngredient(null, "EssenceofChaos", 4); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/BlazingStar.png b/Items/CalamityCustomThrowingDamage/BlazingStar.png new file mode 100644 index 0000000000..75c05587da Binary files /dev/null and b/Items/CalamityCustomThrowingDamage/BlazingStar.png differ diff --git a/Items/CalamityCustomThrowingDamage/CalamityDamageItem.cs b/Items/CalamityCustomThrowingDamage/CalamityDamageItem.cs index e9b7d91af2..b5ffd8f679 100644 --- a/Items/CalamityCustomThrowingDamage/CalamityDamageItem.cs +++ b/Items/CalamityCustomThrowingDamage/CalamityDamageItem.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -32,7 +33,14 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { crit = item.crit + player.Calamity().throwingCrit; } - + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (player.Calamity().gloveOfPrecision) + { + item.useTime = (int)(item.useTime * 0.8f); + item.useAnimation = (int)(item.useAnimation * 0.8f); + } + } // Not needed because the weapon is now internally thrown instead of ranged /* public override void GetWeaponKnockback(Player player, ref float knockback) diff --git a/Items/CalamityCustomThrowingDamage/CelestialReaper.cs b/Items/CalamityCustomThrowingDamage/CelestialReaper.cs index 01e28501df..7175765ad5 100644 --- a/Items/CalamityCustomThrowingDamage/CelestialReaper.cs +++ b/Items/CalamityCustomThrowingDamage/CelestialReaper.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 10; item.UseSound = SoundID.Item71; item.autoReuse = true; - item.value = Item.buyPrice(platinum: 2); //sell price of 40 gold + item.value = Item.buyPrice(platinum: 1); //sell price of 20 gold item.shoot = mod.ProjectileType("CelestialReaperProjectile"); item.shootSpeed = 20f; item.Calamity().rogue = true; diff --git a/Items/CalamityCustomThrowingDamage/Cinquedea.cs b/Items/CalamityCustomThrowingDamage/Cinquedea.cs index 4feaa4f23d..93f2263817 100644 --- a/Items/CalamityCustomThrowingDamage/Cinquedea.cs +++ b/Items/CalamityCustomThrowingDamage/Cinquedea.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class Cinquedea : CalamityDamageItem { - public static int BaseDamage = 16; + public static int BaseDamage = 36; public static float Knockback = 5f; public static float Speed = 8f; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.noUseGraphic = true; item.shoot = mod.ProjectileType("CinquedeaProj"); item.shootSpeed = Speed; - item.value = Item.buyPrice(0, 9, 0, 0); + item.value = Item.buyPrice(0, 4, 0, 0); item.Calamity().rogue = true; } diff --git a/Items/CalamityCustomThrowingDamage/EmpyreanKnivesThrown.cs b/Items/CalamityCustomThrowingDamage/EmpyreanKnivesThrown.cs index ed8c7ee3f3..3970605fe3 100644 --- a/Items/CalamityCustomThrowingDamage/EmpyreanKnivesThrown.cs +++ b/Items/CalamityCustomThrowingDamage/EmpyreanKnivesThrown.cs @@ -48,7 +48,6 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage 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/Items/CalamityCustomThrowingDamage/EnchantedAxe.cs b/Items/CalamityCustomThrowingDamage/EnchantedAxe.cs new file mode 100644 index 0000000000..f7caa133f3 --- /dev/null +++ b/Items/CalamityCustomThrowingDamage/EnchantedAxe.cs @@ -0,0 +1,70 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.CalamityCustomThrowingDamage +{ + public class EnchantedAxe : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Enchanted Axe"); + Tooltip.SetDefault("Throws a high velocity axe that returns to you after travelling a short distance or hitting a wall\n" + + "At the furthest point from the player, a magical axe that travels through walls will be cast towards the nearest enemy\n" + + "Stealth Strike Effect: The axe flies further, throwing out many other magical axes in all directions"); + } + + public override void SafeSetDefaults() + { + item.width = 40; + item.damage = 25; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.knockBack = 1f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 36; + item.maxStack = 1; + item.value = 1000; + item.rare = 3; + item.shoot = mod.ProjectileType("EnchantedAxe"); + item.shootSpeed = 30f; + item.Calamity().rogue = true; + } + + 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 (player.Calamity().StealthStrikeAvailable()) + { + int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + Main.projectile[p].Calamity().stealthStrike = true; + return false; + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.ItemType("IronFrancisca"), 100); + recipe.AddIngredient(ItemID.FallenStar, 5); + recipe.AddIngredient(mod.ItemType("VictoryShard"), 10); + recipe.AddIngredient(ItemID.Bone, 30); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.ItemType("LeadTomahawk"), 100); + recipe.AddIngredient(ItemID.FallenStar, 5); + recipe.AddIngredient(mod.ItemType("VictoryShard"), 10); + recipe.AddIngredient(ItemID.Bone, 30); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/EnchantedAxe.png b/Items/CalamityCustomThrowingDamage/EnchantedAxe.png new file mode 100644 index 0000000000..cdae20aa68 Binary files /dev/null and b/Items/CalamityCustomThrowingDamage/EnchantedAxe.png differ diff --git a/Items/CalamityCustomThrowingDamage/Glaive.cs b/Items/CalamityCustomThrowingDamage/Glaive.cs index 2d26b2ff04..fb64ed8e80 100644 --- a/Items/CalamityCustomThrowingDamage/Glaive.cs +++ b/Items/CalamityCustomThrowingDamage/Glaive.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { public class Glaive : CalamityDamageItem { - public static int BaseDamage = 23; + public static int BaseDamage = 50; public static float Knockback = 3f; public static float Speed = 10f; public static float StealthSpeedMult = 1.8f; @@ -31,7 +31,7 @@ Stealth strikes are super fast and pierce infinitely"); item.useAnimation = 15; item.useStyle = 1; item.knockBack = Knockback; - item.value = Item.buyPrice(0, 3, 0, 0); + item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; item.UseSound = SoundID.Item1; item.maxStack = 3; diff --git a/Items/CalamityCustomThrowingDamage/Kylie.cs b/Items/CalamityCustomThrowingDamage/Kylie.cs index 8cf6caeedc..56446ef36a 100644 --- a/Items/CalamityCustomThrowingDamage/Kylie.cs +++ b/Items/CalamityCustomThrowingDamage/Kylie.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.knockBack = 12; item.thrown = true; item.crit = 16; - item.value = Item.buyPrice(0, 10, 0, 0); + item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; item.useTime = 25; item.useAnimation = 25; diff --git a/Items/CalamityCustomThrowingDamage/MonkeyDarts.cs b/Items/CalamityCustomThrowingDamage/MonkeyDarts.cs index c0c4b8b863..a174ae5e1c 100644 --- a/Items/CalamityCustomThrowingDamage/MonkeyDarts.cs +++ b/Items/CalamityCustomThrowingDamage/MonkeyDarts.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override void SafeSetDefaults() { - item.damage = 270; + item.damage = 50; item.knockBack = 4; item.crit = 18; item.noMelee = true; @@ -29,8 +29,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.UseSound = SoundID.Item1; item.useTime = 30; item.useAnimation = 30; - item.rare = 7; - item.value = Item.buyPrice(0, 0, 4, 0); + item.value = Item.buyPrice(0, 0, 1, 0); + item.rare = 3; item.shootSpeed = 10.5f; item.shoot = mod.ProjectileType("MonkeyDart"); item.autoReuse = true; diff --git a/Items/CalamityCustomThrowingDamage/RoyalKnives.cs b/Items/CalamityCustomThrowingDamage/RoyalKnives.cs index 00388a052e..8c8eb360bb 100644 --- a/Items/CalamityCustomThrowingDamage/RoyalKnives.cs +++ b/Items/CalamityCustomThrowingDamage/RoyalKnives.cs @@ -48,7 +48,6 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage 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/Items/Leviathan/LeviathanAmbergris.cs b/Items/Leviathan/LeviathanAmbergris.cs index 9369bba48d..4ee315a2a4 100644 --- a/Items/Leviathan/LeviathanAmbergris.cs +++ b/Items/Leviathan/LeviathanAmbergris.cs @@ -85,7 +85,6 @@ namespace CalamityMod.Items.Leviathan seaCounter++; if (seaCounter >= 180) { - seaCounter = 0; } } } diff --git a/Items/Patreon/AngelicShotgun.cs b/Items/Patreon/AngelicShotgun.cs index 8a304fc45e..0d33935f0e 100644 --- a/Items/Patreon/AngelicShotgun.cs +++ b/Items/Patreon/AngelicShotgun.cs @@ -80,8 +80,6 @@ Fighting 'til the war's won"); if ((float.IsNaN(mouseDX) && float.IsNaN(mouseDY)) || (mouseDX == 0f && mouseDY == 0f)) { mouseDX = (float)player.direction; - mouseDY = 0f; - mouseDist = laserSpeed; } else { diff --git a/Items/Patreon/Ataraxia.cs b/Items/Patreon/Ataraxia.cs index 42efa8238d..8ae9f6af20 100644 --- a/Items/Patreon/Ataraxia.cs +++ b/Items/Patreon/Ataraxia.cs @@ -102,7 +102,7 @@ namespace CalamityMod.Items.Patreon for (int i = 0; i < dustCount; ++i) { // Pick a random dust to spawn - int dustID = -1; + int dustID; switch (Main.rand.Next(5)) { case 0: diff --git a/Items/Patreon/DivineRetribution.cs b/Items/Patreon/DivineRetribution.cs index d8d905bdc1..f49a55cb3f 100644 --- a/Items/Patreon/DivineRetribution.cs +++ b/Items/Patreon/DivineRetribution.cs @@ -50,8 +50,6 @@ namespace CalamityMod.Items.Patreon if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) { num78 = (float)player.direction; - num79 = 0f; - num80 = num72; } else { diff --git a/Items/Patreon/LightGodsBrilliance.cs b/Items/Patreon/LightGodsBrilliance.cs index 59190a2df2..86a25b9e16 100644 --- a/Items/Patreon/LightGodsBrilliance.cs +++ b/Items/Patreon/LightGodsBrilliance.cs @@ -38,8 +38,6 @@ namespace CalamityMod.Items.Patreon int num6 = Main.rand.Next(2, 5); for (int index = 0; index < num6; ++index) { - float num7 = speedX; - float num8 = speedY; float SpeedX = speedX + (float)Main.rand.Next(-50, 51) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-50, 51) * 0.05f; Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)(double)damage, knockBack, player.whoAmI, 0.0f, 0.0f); diff --git a/Items/Patreon/ResurrectionButterfly.cs b/Items/Patreon/ResurrectionButterfly.cs index 3566e90cc4..80688d35a6 100644 --- a/Items/Patreon/ResurrectionButterfly.cs +++ b/Items/Patreon/ResurrectionButterfly.cs @@ -51,7 +51,6 @@ namespace CalamityMod.Items.Patreon 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/Items/PlaguebringerGoliath/BloomStone.cs b/Items/PlaguebringerGoliath/BloomStone.cs index 3c7312b16d..9fd4b8985a 100644 --- a/Items/PlaguebringerGoliath/BloomStone.cs +++ b/Items/PlaguebringerGoliath/BloomStone.cs @@ -66,7 +66,6 @@ namespace CalamityMod.Items.PlaguebringerGoliath bloomCounter++; if (bloomCounter >= 180) { - bloomCounter = 0; } if (player.whoAmI == Main.myPlayer && player.velocity.Y == 0f && player.grappling[0] == -1) { diff --git a/Items/PlaguebringerGoliath/ToxicHeart.cs b/Items/PlaguebringerGoliath/ToxicHeart.cs index 5b11720fe9..f3d64c93f1 100644 --- a/Items/PlaguebringerGoliath/ToxicHeart.cs +++ b/Items/PlaguebringerGoliath/ToxicHeart.cs @@ -60,7 +60,6 @@ namespace CalamityMod.Items.PlaguebringerGoliath plagueCounter++; if (plagueCounter >= 180) { - plagueCounter = 0; } } } diff --git a/Items/SunkenSea/AmidiasPendant.cs b/Items/SunkenSea/AmidiasPendant.cs index c24a3ec721..ae910c4e21 100644 --- a/Items/SunkenSea/AmidiasPendant.cs +++ b/Items/SunkenSea/AmidiasPendant.cs @@ -49,8 +49,7 @@ namespace CalamityMod.Items.SunkenSea { Vector2 spawn = baseSpawn; spawn.X = spawn.X + i * 30 - (ShardProjectiles * 15); - Vector2 velocity = baseVelocity; - velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-ShardAngleSpread / 2 + (ShardAngleSpread * i / (float)ShardProjectiles))); + Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-ShardAngleSpread / 2 + (ShardAngleSpread * i / (float)ShardProjectiles))); velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; int type = 0; int damage = 0; diff --git a/Items/Weapons/AbyssWeapons/HalibutCannon.cs b/Items/Weapons/AbyssWeapons/HalibutCannon.cs index a783b5dcc7..b0e7b3a6a6 100644 --- a/Items/Weapons/AbyssWeapons/HalibutCannon.cs +++ b/Items/Weapons/AbyssWeapons/HalibutCannon.cs @@ -48,8 +48,6 @@ namespace CalamityMod.Items.Weapons.AbyssWeapons int num6 = Main.rand.Next(25, 36); for (int index = 0; index < num6; ++index) { - float num7 = speedX; - float num8 = speedY; float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); diff --git a/Items/Weapons/AbyssWeapons/SoulEdge.cs b/Items/Weapons/AbyssWeapons/SoulEdge.cs index 872b481494..cbb007fea3 100644 --- a/Items/Weapons/AbyssWeapons/SoulEdge.cs +++ b/Items/Weapons/AbyssWeapons/SoulEdge.cs @@ -34,13 +34,9 @@ namespace CalamityMod.Items.Weapons.AbyssWeapons public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float SpeedA = speedX; - float SpeedB = speedY; int num6 = Main.rand.Next(2, 4); for (int index = 0; index < num6; ++index) { - float num7 = speedX; - float num8 = speedY; float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; float ai1 = Main.rand.NextFloat() + 0.5f; diff --git a/Items/Weapons/AbyssWeapons/UndinesRetribution.cs b/Items/Weapons/AbyssWeapons/UndinesRetribution.cs index a372b51914..d1dc7063c6 100644 --- a/Items/Weapons/AbyssWeapons/UndinesRetribution.cs +++ b/Items/Weapons/AbyssWeapons/UndinesRetribution.cs @@ -49,8 +49,6 @@ namespace CalamityMod.Items.Weapons.AbyssWeapons if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) { num78 = (float)player.direction; - num79 = 0f; - num80 = num72; } else { diff --git a/Items/Weapons/Aftershock.cs b/Items/Weapons/Aftershock.cs index 8687fe683c..6e4bae4f6f 100644 --- a/Items/Weapons/Aftershock.cs +++ b/Items/Weapons/Aftershock.cs @@ -44,7 +44,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -55,8 +54,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); vector2.Y -= (float)100; diff --git a/Items/Weapons/AncientIceChunk.cs b/Items/Weapons/AncientIceChunk.cs index 7cea7a9a88..3190d7e869 100644 --- a/Items/Weapons/AncientIceChunk.cs +++ b/Items/Weapons/AncientIceChunk.cs @@ -46,12 +46,9 @@ namespace CalamityMod.Items.Weapons 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; - num79 = 0f; - num80 = num72; } else { diff --git a/Items/Weapons/ArkoftheAncients.cs b/Items/Weapons/ArkoftheAncients.cs index 6fbb6fe8db..4d59594962 100644 --- a/Items/Weapons/ArkoftheAncients.cs +++ b/Items/Weapons/ArkoftheAncients.cs @@ -55,7 +55,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -66,8 +65,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num107 = 2; for (int num108 = 0; num108 < num107; num108++) { diff --git a/Items/Weapons/ArkoftheCosmos.cs b/Items/Weapons/ArkoftheCosmos.cs index beac07fc80..7647474faa 100644 --- a/Items/Weapons/ArkoftheCosmos.cs +++ b/Items/Weapons/ArkoftheCosmos.cs @@ -66,7 +66,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -77,8 +76,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num107 = 4; for (int num108 = 0; num108 < num107; num108++) { diff --git a/Items/Weapons/ArkoftheElements.cs b/Items/Weapons/ArkoftheElements.cs index 456e564683..7732300d02 100644 --- a/Items/Weapons/ArkoftheElements.cs +++ b/Items/Weapons/ArkoftheElements.cs @@ -64,7 +64,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -75,8 +74,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num107 = 4; for (int num108 = 0; num108 < num107; num108++) { diff --git a/Items/Weapons/ArterialAssault.cs b/Items/Weapons/ArterialAssault.cs index 8ddc9cb225..be2d1e4ccf 100644 --- a/Items/Weapons/ArterialAssault.cs +++ b/Items/Weapons/ArterialAssault.cs @@ -57,7 +57,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -68,8 +67,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (-(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); vector2.X = (vector2.X + player.Center.X) / 2f; vector2.Y -= 100f; diff --git a/Items/Weapons/AsteroidStaff.cs b/Items/Weapons/AsteroidStaff.cs index e2c87cf76c..a5c8df8217 100644 --- a/Items/Weapons/AsteroidStaff.cs +++ b/Items/Weapons/AsteroidStaff.cs @@ -57,7 +57,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -68,8 +67,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num112 = 3; for (int num113 = 0; num113 < num112; num113++) { diff --git a/Items/Weapons/BarracudaGun.cs b/Items/Weapons/BarracudaGun.cs index 16c06ab8fe..b8fd4061c9 100644 --- a/Items/Weapons/BarracudaGun.cs +++ b/Items/Weapons/BarracudaGun.cs @@ -40,13 +40,9 @@ namespace CalamityMod.Items.Weapons public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float SpeedA = speedX; - float SpeedB = speedY; int num6 = Main.rand.Next(2, 3); for (int index = 0; index < num6; ++index) { - float num7 = speedX; - float num8 = speedY; float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)(double)damage, knockBack, player.whoAmI, 0.0f, 0.0f); diff --git a/Items/Weapons/Calamitas/BlightedEyeStaff.cs b/Items/Weapons/Calamitas/BlightedEyeStaff.cs index 859dd2d683..0fb564860b 100644 --- a/Items/Weapons/Calamitas/BlightedEyeStaff.cs +++ b/Items/Weapons/Calamitas/BlightedEyeStaff.cs @@ -49,7 +49,6 @@ namespace CalamityMod.Items.Weapons.Calamitas 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/Items/Weapons/CelestialClaymore.cs b/Items/Weapons/CelestialClaymore.cs index 97847e6cb2..a14f4ab611 100644 --- a/Items/Weapons/CelestialClaymore.cs +++ b/Items/Weapons/CelestialClaymore.cs @@ -44,7 +44,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -55,8 +54,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num107 = 3; for (int num108 = 0; num108 < num107; num108++) { @@ -75,8 +73,6 @@ namespace CalamityMod.Items.Weapons } num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); num80 = num72 / num80; - num78 *= num80; - num79 *= num80; switch (Main.rand.Next(3)) { case 0: diff --git a/Items/Weapons/Climax.cs b/Items/Weapons/Climax.cs index ef48a82720..c7f2d43111 100644 --- a/Items/Weapons/Climax.cs +++ b/Items/Weapons/Climax.cs @@ -47,12 +47,10 @@ namespace CalamityMod.Items.Weapons 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; num79 = 0f; - num80 = num72; } else { diff --git a/Items/Weapons/ClockworkBow.cs b/Items/Weapons/ClockworkBow.cs index c00fa895ae..9ec7940f60 100644 --- a/Items/Weapons/ClockworkBow.cs +++ b/Items/Weapons/ClockworkBow.cs @@ -63,7 +63,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -74,8 +73,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num130 = 15; if (Main.rand.NextBool(3)) { diff --git a/Items/Weapons/CometQuasher.cs b/Items/Weapons/CometQuasher.cs index 093c8b677f..f3d8890315 100644 --- a/Items/Weapons/CometQuasher.cs +++ b/Items/Weapons/CometQuasher.cs @@ -47,7 +47,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -58,8 +57,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num112 = 3; for (int num113 = 0; num113 < num112; num113++) { diff --git a/Items/Weapons/ConferenceCall.cs b/Items/Weapons/ConferenceCall.cs index 98555184fe..c98ece71a0 100644 --- a/Items/Weapons/ConferenceCall.cs +++ b/Items/Weapons/ConferenceCall.cs @@ -65,7 +65,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -76,8 +75,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + for (int num108 = 0; num108 < num6; num108++) { vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); diff --git a/Items/Weapons/CosmicImmaterializer.cs b/Items/Weapons/CosmicImmaterializer.cs index 815d748e04..70be013eb4 100644 --- a/Items/Weapons/CosmicImmaterializer.cs +++ b/Items/Weapons/CosmicImmaterializer.cs @@ -66,11 +66,9 @@ namespace CalamityMod.Items.Weapons 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; - num79 = 0f; num80 = item.shootSpeed; } else diff --git a/Items/Weapons/CosmicRainbow.cs b/Items/Weapons/CosmicRainbow.cs index fc6ca53a79..5e7491ccc2 100644 --- a/Items/Weapons/CosmicRainbow.cs +++ b/Items/Weapons/CosmicRainbow.cs @@ -74,7 +74,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -85,8 +84,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + for (int num108 = 0; num108 < 2; num108++) { vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); diff --git a/Items/Weapons/Cosmilamp.cs b/Items/Weapons/Cosmilamp.cs index 613447eaa2..897d4b7940 100644 --- a/Items/Weapons/Cosmilamp.cs +++ b/Items/Weapons/Cosmilamp.cs @@ -47,12 +47,9 @@ namespace CalamityMod.Items.Weapons 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; - num79 = 0f; - num80 = num72; } else { diff --git a/Items/Weapons/Crabulon/HyphaeRod.cs b/Items/Weapons/Crabulon/HyphaeRod.cs index f28af66a8c..8a8c1c8cd4 100644 --- a/Items/Weapons/Crabulon/HyphaeRod.cs +++ b/Items/Weapons/Crabulon/HyphaeRod.cs @@ -49,7 +49,6 @@ namespace CalamityMod.Items.Weapons.Crabulon 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; @@ -60,8 +59,7 @@ namespace CalamityMod.Items.Weapons.Crabulon { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num107 = 3; for (int num108 = 0; num108 < num107; num108++) { diff --git a/Items/Weapons/Cryogen/Avalanche.cs b/Items/Weapons/Cryogen/Avalanche.cs index dcaada6102..948ef0f505 100644 --- a/Items/Weapons/Cryogen/Avalanche.cs +++ b/Items/Weapons/Cryogen/Avalanche.cs @@ -45,7 +45,6 @@ namespace CalamityMod.Items.Weapons.Cryogen 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; @@ -56,8 +55,7 @@ namespace CalamityMod.Items.Weapons.Cryogen { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num107 = 2; for (int num108 = 0; num108 < num107; num108++) { @@ -76,8 +74,6 @@ namespace CalamityMod.Items.Weapons.Cryogen } num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); num80 = num72 / num80; - num78 *= num80; - num79 *= num80; Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, mod.ProjectileType("IceBombFriendly"), (int)((float)item.damage * player.meleeDamage), num74, i, 0f, (float)Main.rand.Next(3)); } } diff --git a/Items/Weapons/Cryogen/EffluviumBow.cs b/Items/Weapons/Cryogen/EffluviumBow.cs index 597ff34b44..90e6f16e39 100644 --- a/Items/Weapons/Cryogen/EffluviumBow.cs +++ b/Items/Weapons/Cryogen/EffluviumBow.cs @@ -44,12 +44,8 @@ namespace CalamityMod.Items.Weapons.Cryogen public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float SpeedA = speedX; - float SpeedB = speedY; for (int index = 0; index < 2; ++index) { - float num7 = speedX; - float num8 = speedY; float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("MistArrow"), damage, knockBack, player.whoAmI, 0f, 0f); diff --git a/Items/Weapons/Devastation.cs b/Items/Weapons/Devastation.cs index 33b322d8ec..0894645104 100644 --- a/Items/Weapons/Devastation.cs +++ b/Items/Weapons/Devastation.cs @@ -60,7 +60,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -71,8 +70,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num107 = 4; for (int num108 = 0; num108 < num107; num108++) { diff --git a/Items/Weapons/DevilsDevastation.cs b/Items/Weapons/DevilsDevastation.cs index f7517c2f57..880a42bf33 100644 --- a/Items/Weapons/DevilsDevastation.cs +++ b/Items/Weapons/DevilsDevastation.cs @@ -54,7 +54,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -65,8 +64,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num107 = 3; for (int num108 = 0; num108 < num107; num108++) { diff --git a/Items/Weapons/DevourerofGods/DeathhailStaff.cs b/Items/Weapons/DevourerofGods/DeathhailStaff.cs index 378e363584..e0b1bf6845 100644 --- a/Items/Weapons/DevourerofGods/DeathhailStaff.cs +++ b/Items/Weapons/DevourerofGods/DeathhailStaff.cs @@ -62,7 +62,6 @@ namespace CalamityMod.Items.Weapons.DevourerofGods 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; @@ -73,8 +72,7 @@ namespace CalamityMod.Items.Weapons.DevourerofGods { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num107 = 2; for (int num108 = 0; num108 < num107; num108++) { diff --git a/Items/Weapons/DevourerofGods/Deathwind.cs b/Items/Weapons/DevourerofGods/Deathwind.cs index c0aae8de64..185afcaaf2 100644 --- a/Items/Weapons/DevourerofGods/Deathwind.cs +++ b/Items/Weapons/DevourerofGods/Deathwind.cs @@ -44,13 +44,9 @@ namespace CalamityMod.Items.Weapons.DevourerofGods public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float SpeedA = speedX; - float SpeedB = speedY; int num6 = Main.rand.Next(4, 6); for (int index = 0; index < num6; ++index) { - float num7 = speedX; - float num8 = speedY; float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; if (type == ProjectileID.WoodenArrowFriendly) diff --git a/Items/Weapons/Earth.cs b/Items/Weapons/Earth.cs index 6f4e333cb5..b6bb73d524 100644 --- a/Items/Weapons/Earth.cs +++ b/Items/Weapons/Earth.cs @@ -48,7 +48,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -59,8 +58,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num107 = 3; for (int num108 = 0; num108 < num107; num108++) { diff --git a/Items/Weapons/EmpyreanKnives.cs b/Items/Weapons/EmpyreanKnives.cs index f31cf5d683..bf3b503b33 100644 --- a/Items/Weapons/EmpyreanKnives.cs +++ b/Items/Weapons/EmpyreanKnives.cs @@ -48,7 +48,6 @@ namespace CalamityMod.Items.Weapons 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/Items/Weapons/FirestormCannon.cs b/Items/Weapons/FirestormCannon.cs index 8f35b37372..1dfcb0fd4e 100644 --- a/Items/Weapons/FirestormCannon.cs +++ b/Items/Weapons/FirestormCannon.cs @@ -81,8 +81,6 @@ namespace CalamityMod.Items.Weapons int num6 = Main.rand.Next(1, 3); for (int index = 0; index < num6; ++index) { - float num7 = speedX; - float num8 = speedY; float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); diff --git a/Items/Weapons/GalacticaBlade.cs b/Items/Weapons/GalacticaBlade.cs index 7c52370570..e06be7c878 100644 --- a/Items/Weapons/GalacticaBlade.cs +++ b/Items/Weapons/GalacticaBlade.cs @@ -61,7 +61,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -72,8 +71,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num107 = 5; for (int num108 = 0; num108 < num107; num108++) { diff --git a/Items/Weapons/HellfireFlamberge.cs b/Items/Weapons/HellfireFlamberge.cs index 695ddca6e6..949ac1078b 100644 --- a/Items/Weapons/HellfireFlamberge.cs +++ b/Items/Weapons/HellfireFlamberge.cs @@ -35,12 +35,8 @@ namespace CalamityMod.Items.Weapons public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 20); - float SpeedA = speedX; - float SpeedB = speedY; for (int index = 0; index < 3; ++index) { - float num7 = speedX; - float num8 = speedY; float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; switch (index) diff --git a/Items/Weapons/HellwingStaff.cs b/Items/Weapons/HellwingStaff.cs index bcd296eff4..6e1c9e48ed 100644 --- a/Items/Weapons/HellwingStaff.cs +++ b/Items/Weapons/HellwingStaff.cs @@ -56,7 +56,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -67,8 +66,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num130 = 7; if (Main.rand.NextBool(6)) { diff --git a/Items/Weapons/Helstorm.cs b/Items/Weapons/Helstorm.cs index a50907da09..0312f62d71 100644 --- a/Items/Weapons/Helstorm.cs +++ b/Items/Weapons/Helstorm.cs @@ -36,8 +36,6 @@ namespace CalamityMod.Items.Weapons { for (int index = 0; index < 2; ++index) { - float num7 = speedX; - float num8 = speedY; float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); diff --git a/Items/Weapons/HiveMind/ShaderainStaff.cs b/Items/Weapons/HiveMind/ShaderainStaff.cs index 2432e6b39d..ed4cc34311 100644 --- a/Items/Weapons/HiveMind/ShaderainStaff.cs +++ b/Items/Weapons/HiveMind/ShaderainStaff.cs @@ -44,7 +44,6 @@ namespace CalamityMod.Items.Weapons.HiveMind 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/Items/Weapons/HiveMind/ShadowdropStaff.cs b/Items/Weapons/HiveMind/ShadowdropStaff.cs index bcbb2fa934..b840e1a020 100644 --- a/Items/Weapons/HiveMind/ShadowdropStaff.cs +++ b/Items/Weapons/HiveMind/ShadowdropStaff.cs @@ -57,7 +57,6 @@ namespace CalamityMod.Items.Weapons.HiveMind 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; @@ -68,8 +67,7 @@ namespace CalamityMod.Items.Weapons.HiveMind { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num107 = 10; for (int num108 = 0; num108 < num107; num108++) { diff --git a/Items/Weapons/IcicleStaff.cs b/Items/Weapons/IcicleStaff.cs index e2ec0178e3..99b924b484 100644 --- a/Items/Weapons/IcicleStaff.cs +++ b/Items/Weapons/IcicleStaff.cs @@ -61,7 +61,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -72,8 +71,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num107 = 1; for (int num108 = 0; num108 < num107; num108++) { diff --git a/Items/Weapons/Interfacer.cs b/Items/Weapons/Interfacer.cs index 42ee4c94ca..d99b4300d2 100644 --- a/Items/Weapons/Interfacer.cs +++ b/Items/Weapons/Interfacer.cs @@ -70,8 +70,6 @@ namespace CalamityMod.Items.Weapons if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) { num78 = (float)player.direction; - num79 = 0f; - num80 = num72; } else { diff --git a/Items/Weapons/Judgement.cs b/Items/Weapons/Judgement.cs index 2d9d31d43a..c20a1ba862 100644 --- a/Items/Weapons/Judgement.cs +++ b/Items/Weapons/Judgement.cs @@ -57,7 +57,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -68,8 +67,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num107 = 3; for (int num108 = 0; num108 < num107; num108++) { diff --git a/Items/Weapons/Leviathan/Greentide.cs b/Items/Weapons/Leviathan/Greentide.cs index 04ddbcdde7..59b6cad216 100644 --- a/Items/Weapons/Leviathan/Greentide.cs +++ b/Items/Weapons/Leviathan/Greentide.cs @@ -57,7 +57,6 @@ namespace CalamityMod.Items.Weapons.Leviathan 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; @@ -68,8 +67,7 @@ namespace CalamityMod.Items.Weapons.Leviathan { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num107 = 4; for (int num108 = 0; num108 < num107; num108++) { diff --git a/Items/Weapons/Meowthrower.cs b/Items/Weapons/Meowthrower.cs index 77978bceaf..c39f7c0be1 100644 --- a/Items/Weapons/Meowthrower.cs +++ b/Items/Weapons/Meowthrower.cs @@ -43,13 +43,9 @@ namespace CalamityMod.Items.Weapons public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float SpeedA = speedX; - float SpeedB = speedY; int num6 = Main.rand.Next(1, 3); for (int index = 0; index < num6; ++index) { - float num7 = speedX; - float num8 = speedY; float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; switch (Main.rand.Next(3)) diff --git a/Items/Weapons/PaintballBlaster.cs b/Items/Weapons/PaintballBlaster.cs index 2b28299f23..c2c69170df 100644 --- a/Items/Weapons/PaintballBlaster.cs +++ b/Items/Weapons/PaintballBlaster.cs @@ -45,12 +45,10 @@ namespace CalamityMod.Items.Weapons 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; num79 = 0f; - num80 = num72; } else { diff --git a/Items/Weapons/Perforators/BloodBath.cs b/Items/Weapons/Perforators/BloodBath.cs index 40e8092378..1517c1ef7b 100644 --- a/Items/Weapons/Perforators/BloodBath.cs +++ b/Items/Weapons/Perforators/BloodBath.cs @@ -57,7 +57,6 @@ namespace CalamityMod.Items.Weapons.Perforators 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; @@ -68,8 +67,7 @@ namespace CalamityMod.Items.Weapons.Perforators { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num107 = 2; if (Main.rand.NextBool(3)) { diff --git a/Items/Weapons/PlanetaryAnnihilation.cs b/Items/Weapons/PlanetaryAnnihilation.cs index 3e7ac8d35e..69e0a83ea6 100644 --- a/Items/Weapons/PlanetaryAnnihilation.cs +++ b/Items/Weapons/PlanetaryAnnihilation.cs @@ -52,7 +52,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -63,8 +62,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); vector2.Y -= 100f; diff --git a/Items/Weapons/Polterghast/BansheeHook.cs b/Items/Weapons/Polterghast/BansheeHook.cs index 25dcb079d9..d4daf4891a 100644 --- a/Items/Weapons/Polterghast/BansheeHook.cs +++ b/Items/Weapons/Polterghast/BansheeHook.cs @@ -57,7 +57,6 @@ namespace CalamityMod.Items.Weapons.Polterghast num83 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - position.Y; } float num84 = (float)Math.Sqrt((double)(num82 * num82 + num83 * num83)); - float num85 = num84; if ((float.IsNaN(num82) && float.IsNaN(num83)) || (num82 == 0f && num83 == 0f)) { num82 = (float)player.direction; diff --git a/Items/Weapons/Polterghast/EtherealSubjugator.cs b/Items/Weapons/Polterghast/EtherealSubjugator.cs index 9bff4ed9e2..92fb458686 100644 --- a/Items/Weapons/Polterghast/EtherealSubjugator.cs +++ b/Items/Weapons/Polterghast/EtherealSubjugator.cs @@ -50,7 +50,6 @@ namespace CalamityMod.Items.Weapons.Polterghast 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/Items/Weapons/Polterghast/FatesReveal.cs b/Items/Weapons/Polterghast/FatesReveal.cs index ebfb0d27ee..124f649063 100644 --- a/Items/Weapons/Polterghast/FatesReveal.cs +++ b/Items/Weapons/Polterghast/FatesReveal.cs @@ -46,7 +46,6 @@ namespace CalamityMod.Items.Weapons.Polterghast num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector.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/Items/Weapons/RareVariants/Arbalest.cs b/Items/Weapons/RareVariants/Arbalest.cs index 5a25bb791a..1a17cb5f10 100644 --- a/Items/Weapons/RareVariants/Arbalest.cs +++ b/Items/Weapons/RareVariants/Arbalest.cs @@ -38,8 +38,6 @@ namespace CalamityMod.Items.Weapons.RareVariants { for (int i = 0; i < 3; i++) { - float num7 = speedX; - float num8 = speedY; float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); diff --git a/Items/Weapons/RareVariants/Hellborn.cs b/Items/Weapons/RareVariants/Hellborn.cs index 73f2986d88..ba12ad4b0a 100644 --- a/Items/Weapons/RareVariants/Hellborn.cs +++ b/Items/Weapons/RareVariants/Hellborn.cs @@ -37,8 +37,6 @@ namespace CalamityMod.Items.Weapons.RareVariants { for (int index = 0; index < 3; ++index) { - float num7 = speedX; - float num8 = speedY; float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ProjectileID.ExplosiveBullet, damage, knockBack, player.whoAmI, 0f, 0f); diff --git a/Items/Weapons/RareVariants/Swordsplosion.cs b/Items/Weapons/RareVariants/Swordsplosion.cs index 8139543912..b4f0663a04 100644 --- a/Items/Weapons/RareVariants/Swordsplosion.cs +++ b/Items/Weapons/RareVariants/Swordsplosion.cs @@ -60,7 +60,6 @@ namespace CalamityMod.Items.Weapons.RareVariants 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; @@ -71,8 +70,7 @@ namespace CalamityMod.Items.Weapons.RareVariants { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num107 = 16; for (int num108 = 0; num108 < num107; num108++) { diff --git a/Items/Weapons/RareVariants/TrueConferenceCall.cs b/Items/Weapons/RareVariants/TrueConferenceCall.cs index 4144e8a32b..9293c3f64c 100644 --- a/Items/Weapons/RareVariants/TrueConferenceCall.cs +++ b/Items/Weapons/RareVariants/TrueConferenceCall.cs @@ -59,7 +59,6 @@ namespace CalamityMod.Items.Weapons.RareVariants 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; @@ -70,8 +69,7 @@ namespace CalamityMod.Items.Weapons.RareVariants { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + for (int num108 = 0; num108 < bulletAmt; num108++) { vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); diff --git a/Items/Weapons/RareVariants/VoidVortex.cs b/Items/Weapons/RareVariants/VoidVortex.cs index fd335e6e34..db724e1e9d 100644 --- a/Items/Weapons/RareVariants/VoidVortex.cs +++ b/Items/Weapons/RareVariants/VoidVortex.cs @@ -47,12 +47,10 @@ namespace CalamityMod.Items.Weapons.RareVariants 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; num79 = 0f; - num80 = num72; } else { diff --git a/Items/Weapons/RedSun.cs b/Items/Weapons/RedSun.cs index abde3aa5fb..97fb6082a3 100644 --- a/Items/Weapons/RedSun.cs +++ b/Items/Weapons/RedSun.cs @@ -61,7 +61,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -72,8 +71,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num107 = 3; for (int num108 = 0; num108 < num107; num108++) { diff --git a/Items/Weapons/RoyalKnivesMelee.cs b/Items/Weapons/RoyalKnivesMelee.cs index 24dca94768..3b4a9cc706 100644 --- a/Items/Weapons/RoyalKnivesMelee.cs +++ b/Items/Weapons/RoyalKnivesMelee.cs @@ -48,7 +48,6 @@ namespace CalamityMod.Items.Weapons 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/Items/Weapons/ShadecrystalTome.cs b/Items/Weapons/ShadecrystalTome.cs index 5d1cc07eb0..83af1e2903 100644 --- a/Items/Weapons/ShadecrystalTome.cs +++ b/Items/Weapons/ShadecrystalTome.cs @@ -34,13 +34,9 @@ namespace CalamityMod.Items.Weapons public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float SpeedA = speedX; - float SpeedB = speedY; int num6 = Main.rand.Next(1, 3); for (int index = 0; index < num6; ++index) { - float num7 = speedX; - float num8 = speedY; float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)(double)damage, knockBack, player.whoAmI, 0.0f, 0.0f); diff --git a/Items/Weapons/Shredder.cs b/Items/Weapons/Shredder.cs index ad3b73c703..ab9d1607cb 100644 --- a/Items/Weapons/Shredder.cs +++ b/Items/Weapons/Shredder.cs @@ -54,8 +54,6 @@ namespace CalamityMod.Items.Weapons { for (int index = 0; index < bulletAmt; ++index) { - float num7 = speedX; - float num8 = speedY; float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); @@ -67,8 +65,6 @@ namespace CalamityMod.Items.Weapons { for (int index = 0; index < bulletAmt; ++index) { - float num7 = speedX; - float num8 = speedY; float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("ChargedBlast"), damage, knockBack, player.whoAmI, 0f, 0f); diff --git a/Items/Weapons/SkyGlaze.cs b/Items/Weapons/SkyGlaze.cs index cb77274815..cb4aca1d45 100644 --- a/Items/Weapons/SkyGlaze.cs +++ b/Items/Weapons/SkyGlaze.cs @@ -46,7 +46,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -57,8 +56,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num107 = 3; for (int num108 = 0; num108 < num107; num108++) { diff --git a/Items/Weapons/SlimeGod/OverloadedBlaster.cs b/Items/Weapons/SlimeGod/OverloadedBlaster.cs index 6a35822f08..e6c5d1ca89 100644 --- a/Items/Weapons/SlimeGod/OverloadedBlaster.cs +++ b/Items/Weapons/SlimeGod/OverloadedBlaster.cs @@ -49,8 +49,6 @@ namespace CalamityMod.Items.Weapons.SlimeGod { for (int index = 0; index < 5; ++index) { - float num7 = speedX; - float num8 = speedY; float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); diff --git a/Items/Weapons/SpectralstormCannon.cs b/Items/Weapons/SpectralstormCannon.cs index 24c39de587..26c47c1d63 100644 --- a/Items/Weapons/SpectralstormCannon.cs +++ b/Items/Weapons/SpectralstormCannon.cs @@ -45,8 +45,6 @@ namespace CalamityMod.Items.Weapons int num6 = Main.rand.Next(1, 2); for (int index = 0; index < num6; ++index) { - float num7 = speedX; - float num8 = speedY; float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); diff --git a/Items/Weapons/StarCannonEX.cs b/Items/Weapons/StarCannonEX.cs index 473678e948..47011ef4fe 100644 --- a/Items/Weapons/StarCannonEX.cs +++ b/Items/Weapons/StarCannonEX.cs @@ -43,8 +43,6 @@ namespace CalamityMod.Items.Weapons int num6 = Main.rand.Next(1, 3); for (int index = 0; index < num6; ++index) { - float num7 = speedX; - float num8 = speedY; float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; switch (Main.rand.Next(3)) diff --git a/Items/Weapons/Starfleet.cs b/Items/Weapons/Starfleet.cs index f22fc722a6..b3b84f4aa7 100644 --- a/Items/Weapons/Starfleet.cs +++ b/Items/Weapons/Starfleet.cs @@ -43,8 +43,6 @@ namespace CalamityMod.Items.Weapons { for (int index = 0; index < 5; ++index) { - float num7 = speedX; - float num8 = speedY; float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); diff --git a/Items/Weapons/StellarStriker.cs b/Items/Weapons/StellarStriker.cs index 47a85f5c34..00a6ddcdf1 100644 --- a/Items/Weapons/StellarStriker.cs +++ b/Items/Weapons/StellarStriker.cs @@ -50,7 +50,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -61,8 +60,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num112 = 2; for (int num113 = 0; num113 < num112; num113++) { diff --git a/Items/Weapons/SunkenSea/Serpentine.cs b/Items/Weapons/SunkenSea/Serpentine.cs index c0a531f207..f18ea94b2a 100644 --- a/Items/Weapons/SunkenSea/Serpentine.cs +++ b/Items/Weapons/SunkenSea/Serpentine.cs @@ -59,8 +59,7 @@ namespace CalamityMod.Items.Weapons.SunkenSea { dist = num72 / dist; } - velX *= dist; - velY *= dist; + float num77 = Vector2.Dot(value, vector3); if (num77 > 0f) { diff --git a/Items/Weapons/Svantechnical.cs b/Items/Weapons/Svantechnical.cs index 9ab7f61c85..b8421929d0 100644 --- a/Items/Weapons/Svantechnical.cs +++ b/Items/Weapons/Svantechnical.cs @@ -64,12 +64,10 @@ namespace CalamityMod.Items.Weapons 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; num79 = 0f; - num80 = num72; } else { diff --git a/Items/Weapons/TearsofHeaven.cs b/Items/Weapons/TearsofHeaven.cs index ce1b0760b6..bb7da86cb8 100644 --- a/Items/Weapons/TearsofHeaven.cs +++ b/Items/Weapons/TearsofHeaven.cs @@ -34,13 +34,9 @@ namespace CalamityMod.Items.Weapons public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float SpeedA = speedX; - float SpeedB = speedY; int num6 = Main.rand.Next(2, 3); for (int index = 0; index < num6; ++index) { - float num7 = speedX; - float num8 = speedY; float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)(double)damage, knockBack, player.whoAmI, 0.0f, 0.0f); diff --git a/Items/Weapons/Terratomere.cs b/Items/Weapons/Terratomere.cs index 3e383316a1..70f0c68cb7 100644 --- a/Items/Weapons/Terratomere.cs +++ b/Items/Weapons/Terratomere.cs @@ -39,8 +39,6 @@ namespace CalamityMod.Items.Weapons int num6 = Main.rand.Next(4, 6); for (int index = 0; index < num6; ++index) { - float num7 = speedX; - float num8 = speedY; float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.5), knockBack, player.whoAmI, 0f, 0f); diff --git a/Items/Weapons/TheEnforcer.cs b/Items/Weapons/TheEnforcer.cs index d93c933708..2c7e8524fb 100644 --- a/Items/Weapons/TheEnforcer.cs +++ b/Items/Weapons/TheEnforcer.cs @@ -56,7 +56,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -67,8 +66,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num107 = 2; for (int num108 = 0; num108 < num107; num108++) { @@ -87,8 +85,6 @@ namespace CalamityMod.Items.Weapons } num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); num80 = num72 / num80; - num78 *= num80; - num79 *= num80; Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, mod.ProjectileType("EssenceFlame2"), (int)((float)item.damage * player.meleeDamage * 0.25f), num74, i, 0f, (float)Main.rand.Next(3)); } } diff --git a/Items/Weapons/TheStorm.cs b/Items/Weapons/TheStorm.cs index 751530f2ea..97def7d32d 100644 --- a/Items/Weapons/TheStorm.cs +++ b/Items/Weapons/TheStorm.cs @@ -52,7 +52,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -63,8 +62,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num107 = 3; for (int num108 = 0; num108 < num107; num108++) { diff --git a/Items/Weapons/TrueArkoftheAncients.cs b/Items/Weapons/TrueArkoftheAncients.cs index 995cea0da6..707b3980b4 100644 --- a/Items/Weapons/TrueArkoftheAncients.cs +++ b/Items/Weapons/TrueArkoftheAncients.cs @@ -60,7 +60,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -71,8 +70,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num107 = 2; for (int num108 = 0; num108 < num107; num108++) { diff --git a/Items/Weapons/Vesuvius.cs b/Items/Weapons/Vesuvius.cs index e994faf6b0..b5cab40ced 100644 --- a/Items/Weapons/Vesuvius.cs +++ b/Items/Weapons/Vesuvius.cs @@ -87,7 +87,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -98,8 +97,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + for (int num113 = 0; num113 < 4; num113++) { vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); diff --git a/Items/Weapons/VividClarity.cs b/Items/Weapons/VividClarity.cs index ae7f00f00c..518f5e39f9 100644 --- a/Items/Weapons/VividClarity.cs +++ b/Items/Weapons/VividClarity.cs @@ -50,7 +50,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -61,8 +60,7 @@ namespace CalamityMod.Items.Weapons { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num130 = 3; for (int num131 = 0; num131 < num130; num131++) { diff --git a/Items/Weapons/Vortexpopper.cs b/Items/Weapons/Vortexpopper.cs index 83ca408d0b..9e9312cb2c 100644 --- a/Items/Weapons/Vortexpopper.cs +++ b/Items/Weapons/Vortexpopper.cs @@ -50,7 +50,6 @@ namespace CalamityMod.Items.Weapons 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; @@ -66,7 +65,6 @@ namespace CalamityMod.Items.Weapons Vector2 value6 = Vector2.Normalize(new Vector2(num78, num79)) * 40f * item.scale; if (Collision.CanHit(vector2, 0, 0, vector2 + value6, 0, 0)) { - vector2 += value6; } float ai = new Vector2(num78, num79).ToRotation(); float num96 = 2.09439516f; diff --git a/Items/Weapons/WrathoftheAncients.cs b/Items/Weapons/WrathoftheAncients.cs index b5f64de287..ccc4bf7b20 100644 --- a/Items/Weapons/WrathoftheAncients.cs +++ b/Items/Weapons/WrathoftheAncients.cs @@ -48,12 +48,9 @@ namespace CalamityMod.Items.Weapons 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; - num79 = 0f; - num80 = num72; } else { diff --git a/Items/Weapons/XerocsGreatsword.cs b/Items/Weapons/XerocsGreatsword.cs index 7b3b013796..4b9ae4880f 100644 --- a/Items/Weapons/XerocsGreatsword.cs +++ b/Items/Weapons/XerocsGreatsword.cs @@ -34,13 +34,9 @@ namespace CalamityMod.Items.Weapons public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float SpeedA = speedX; - float SpeedB = speedY; int num6 = Main.rand.Next(4, 6); for (int index = 0; index < num6; ++index) { - float num7 = speedX; - float num8 = speedY; float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.75), knockBack, player.whoAmI, 0.0f, 0.0f); diff --git a/Items/Weapons/Yharon/DragonRage.cs b/Items/Weapons/Yharon/DragonRage.cs index 4ea130b8db..0df49c35d6 100644 --- a/Items/Weapons/Yharon/DragonRage.cs +++ b/Items/Weapons/Yharon/DragonRage.cs @@ -37,8 +37,6 @@ namespace CalamityMod.Items.Weapons.Yharon { for (int index = 0; index < 5; ++index) { - float num7 = speedX; - float num8 = speedY; float SpeedX = speedX + (float)Main.rand.Next(-25, 26) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-25, 26) * 0.05f; Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.75), knockBack, player.whoAmI, 0.0f, 0.0f); diff --git a/Items/Weapons/Yharon/PhoenixFlameBarrage.cs b/Items/Weapons/Yharon/PhoenixFlameBarrage.cs index 29e26ce194..f9c482e72b 100644 --- a/Items/Weapons/Yharon/PhoenixFlameBarrage.cs +++ b/Items/Weapons/Yharon/PhoenixFlameBarrage.cs @@ -49,7 +49,6 @@ namespace CalamityMod.Items.Weapons.Yharon 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; @@ -60,8 +59,7 @@ namespace CalamityMod.Items.Weapons.Yharon { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num107 = 30; if (Main.rand.NextBool(3)) { diff --git a/Items/Weapons/Yharon/TheBurningSky.cs b/Items/Weapons/Yharon/TheBurningSky.cs index 7b45d3142e..f58ab7a3f5 100644 --- a/Items/Weapons/Yharon/TheBurningSky.cs +++ b/Items/Weapons/Yharon/TheBurningSky.cs @@ -47,7 +47,6 @@ namespace CalamityMod.Items.Weapons.Yharon 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; @@ -58,8 +57,7 @@ namespace CalamityMod.Items.Weapons.Yharon { num80 = num72 / num80; } - num78 *= num80; - num79 *= num80; + int num107 = 10; for (int num108 = 0; num108 < num107; num108++) { diff --git a/NPCs/AbyssNPCs/AquaticScourgeHead.cs b/NPCs/AbyssNPCs/AquaticScourgeHead.cs index f61d6cdbf1..26c50b475c 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeHead.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeHead.cs @@ -116,7 +116,7 @@ namespace CalamityMod.NPCs.AbyssNPCs int Previous = npc.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { - int lol = 0; + int lol; if (num36 >= 0 && num36 < minLength) { if (num36 % 2 == 0) diff --git a/NPCs/AbyssNPCs/AquaticSeekerHead.cs b/NPCs/AbyssNPCs/AquaticSeekerHead.cs index 8fd2b9a694..9f3acd3ca0 100644 --- a/NPCs/AbyssNPCs/AquaticSeekerHead.cs +++ b/NPCs/AbyssNPCs/AquaticSeekerHead.cs @@ -67,7 +67,7 @@ namespace CalamityMod.NPCs.AbyssNPCs int Previous = npc.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { - int lol = 0; + int lol; if (num36 >= 0 && num36 < minLength) { lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AquaticSeekerBody"), npc.whoAmI); diff --git a/NPCs/AbyssNPCs/AquaticUrchin.cs b/NPCs/AbyssNPCs/AquaticUrchin.cs index 292c6e52a4..74dc6f06ba 100644 --- a/NPCs/AbyssNPCs/AquaticUrchin.cs +++ b/NPCs/AbyssNPCs/AquaticUrchin.cs @@ -43,7 +43,6 @@ namespace CalamityMod.NPCs.AbyssNPCs public override void AI() { int num = 30; - int num2 = 10; bool flag2 = false; bool flag3 = false; if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) @@ -51,7 +50,7 @@ namespace CalamityMod.NPCs.AbyssNPCs flag2 = true; npc.ai[3] += 1f; } - num2 = 4; + int num2 = 4; bool flag4 = npc.velocity.Y == 0f; for (int i = 0; i < 200; i++) { diff --git a/NPCs/AbyssNPCs/EidolonWyrmHead.cs b/NPCs/AbyssNPCs/EidolonWyrmHead.cs index ee6dfdff0b..e9470f1b23 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmHead.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmHead.cs @@ -106,7 +106,7 @@ namespace CalamityMod.NPCs.AbyssNPCs int Previous = npc.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { - int lol = 0; + int lol; if (num36 >= 0 && num36 < minLength) { if (num36 % 2 == 0) diff --git a/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs b/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs index 60a5954796..a1250c43e1 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs @@ -105,7 +105,7 @@ namespace CalamityMod.NPCs.AbyssNPCs int Previous = npc.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { - int lol = 0; + int lol; if (num36 >= 0 && num36 < minLength) { if (num36 % 2 == 0) diff --git a/NPCs/AbyssNPCs/Gnasher.cs b/NPCs/AbyssNPCs/Gnasher.cs index 965d3ccf57..d3e93b411a 100644 --- a/NPCs/AbyssNPCs/Gnasher.cs +++ b/NPCs/AbyssNPCs/Gnasher.cs @@ -37,13 +37,13 @@ namespace CalamityMod.NPCs.AbyssNPCs public override void AI() { npc.spriteDirection = (npc.direction > 0) ? -1 : 1; - float num78 = 0.5f; float num79 = (Main.player[npc.target].Center - npc.Center).Length(); num79 *= 0.0025f; if ((double)num79 > 1.5) { num79 = 1.5f; } + float num78; if (Main.expertMode) { num78 = 2.5f - num79; diff --git a/NPCs/AbyssNPCs/GulperEelHead.cs b/NPCs/AbyssNPCs/GulperEelHead.cs index 5b7997a770..9817b59165 100644 --- a/NPCs/AbyssNPCs/GulperEelHead.cs +++ b/NPCs/AbyssNPCs/GulperEelHead.cs @@ -87,7 +87,7 @@ namespace CalamityMod.NPCs.AbyssNPCs int Previous = npc.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { - int lol = 0; + int lol; if (num36 >= 0 && num36 < minLength) { if (num36 == 0) diff --git a/NPCs/AbyssNPCs/LuminousCorvina.cs b/NPCs/AbyssNPCs/LuminousCorvina.cs index 01c72bceb0..64f6d88b87 100644 --- a/NPCs/AbyssNPCs/LuminousCorvina.cs +++ b/NPCs/AbyssNPCs/LuminousCorvina.cs @@ -100,7 +100,6 @@ namespace CalamityMod.NPCs.AbyssNPCs } if ((!Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) { - flag14 = false; } if (npc.collideX) { diff --git a/NPCs/AbyssNPCs/MantisShrimp.cs b/NPCs/AbyssNPCs/MantisShrimp.cs index 62312f9ce7..e5e490c1d9 100644 --- a/NPCs/AbyssNPCs/MantisShrimp.cs +++ b/NPCs/AbyssNPCs/MantisShrimp.cs @@ -33,13 +33,13 @@ namespace CalamityMod.NPCs.AbyssNPCs public override void AI() { npc.spriteDirection = (npc.direction > 0) ? -1 : 1; - float num78 = 1f; float num79 = (Main.player[npc.target].Center - npc.Center).Length(); num79 *= 0.0025f; if ((double)num79 > 1.5) { num79 = 1.5f; } + float num78; if (Main.expertMode) { num78 = 3f - num79; diff --git a/NPCs/AbyssNPCs/OarfishHead.cs b/NPCs/AbyssNPCs/OarfishHead.cs index 207542ff18..59005fd42e 100644 --- a/NPCs/AbyssNPCs/OarfishHead.cs +++ b/NPCs/AbyssNPCs/OarfishHead.cs @@ -63,7 +63,7 @@ namespace CalamityMod.NPCs.AbyssNPCs int Previous = npc.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { - int lol = 0; + int lol; if (num36 >= 0 && num36 < minLength) { lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("OarfishBody"), npc.whoAmI); diff --git a/NPCs/AbyssNPCs/SeaUrchin.cs b/NPCs/AbyssNPCs/SeaUrchin.cs index c80f94dc83..8079ff8f61 100644 --- a/NPCs/AbyssNPCs/SeaUrchin.cs +++ b/NPCs/AbyssNPCs/SeaUrchin.cs @@ -34,7 +34,6 @@ namespace CalamityMod.NPCs.AbyssNPCs public override void AI() { int num = 30; - int num2 = 10; bool flag2 = false; bool flag3 = false; if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) @@ -42,7 +41,7 @@ namespace CalamityMod.NPCs.AbyssNPCs flag2 = true; npc.ai[3] += 1f; } - num2 = 4; + int num2 = 4; bool flag4 = npc.velocity.Y == 0f; for (int i = 0; i < 200; i++) { diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index 108ebf204a..656c1e9485 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -209,7 +209,7 @@ namespace CalamityMod.NPCs.AstrumDeus int Previous = npc.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { - int lol = 0; + int lol; if (num36 >= 0 && num36 < minLength) { lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AstrumDeusBody"), npc.whoAmI); diff --git a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs index d79a7309ea..b4c49c7b9a 100644 --- a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs @@ -99,7 +99,6 @@ namespace CalamityMod.NPCs.AstrumDeus CalamityGlobalNPC.astrumDeusHeadMain = npc.whoAmI; colorChange = NPC.AnyNPCs(mod.NPCType("AstrumDeusHead")); int astrumDeusTotalHP = 0; - double astrumDeusHPRatio = 0; double mainDeusHPRatio = (double)npc.life / (double)npc.lifeMax; if (colorChange) { @@ -115,7 +114,7 @@ namespace CalamityMod.NPCs.AstrumDeus } } } - astrumDeusHPRatio = (double)astrumDeusTotalHP / (double)astrumDeusTotalHPMax; + double astrumDeusHPRatio = (double)astrumDeusTotalHP / (double)astrumDeusTotalHPMax; if (astrumDeusHPRatio < 0.33) { if (mainDeusHPRatio > 0.33) @@ -180,7 +179,7 @@ namespace CalamityMod.NPCs.AstrumDeus int Previous = npc.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { - int lol = 0; + int lol; if (num36 >= 0 && num36 < minLength) { lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("AstrumDeusBodySpectral"), npc.whoAmI); diff --git a/NPCs/CalamityBiomeNPCs/DespairStone.cs b/NPCs/CalamityBiomeNPCs/DespairStone.cs index 6bf627925b..e4334c2797 100644 --- a/NPCs/CalamityBiomeNPCs/DespairStone.cs +++ b/NPCs/CalamityBiomeNPCs/DespairStone.cs @@ -44,7 +44,6 @@ namespace CalamityMod.NPCs.CalamityBiomeNPCs public override void AI() { int num = 30; - int num2 = 10; bool flag = false; bool flag2 = false; bool flag3 = false; @@ -53,7 +52,7 @@ namespace CalamityMod.NPCs.CalamityBiomeNPCs flag2 = true; npc.ai[3] += 1f; } - num2 = 4; + int num2 = 4; bool flag4 = npc.velocity.Y == 0f; for (int i = 0; i < 200; i++) { @@ -148,8 +147,7 @@ namespace CalamityMod.NPCs.CalamityBiomeNPCs npc.direction = 1; } } - float num7 = 6f; - float num8 = 0.07f; + if (!flag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) { if (Math.Sign(npc.velocity.X) != npc.direction) @@ -161,8 +159,8 @@ namespace CalamityMod.NPCs.CalamityBiomeNPCs { num9 = 0f; } - num7 = 5f + num9 * (float)npc.direction * 4f; - num8 = 0.2f; + float num7 = 5f + num9 * (float)npc.direction * 4f; + float num8 = 0.2f; if (npc.velocity.X < -num7 || npc.velocity.X > num7) { if (npc.velocity.Y == 0f) diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index b0aa149f9f..e86a38f59d 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -3852,10 +3852,11 @@ namespace CalamityMod.NPCs num339 = (float)num340; npc.position.Y = num339; - // Speed up if target is too far or if they're hiding behind tiles, slow down if too close - float distanceFromTarget = 0f; float targetPosition = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); float npcPosition = npc.position.X + (float)(npc.width / 2); + + // Speed up if target is too far or if they're hiding behind tiles, slow down if too close + float distanceFromTarget; if (npc.velocity.X < 0f) distanceFromTarget = npcPosition - targetPosition; else @@ -5260,8 +5261,6 @@ namespace CalamityMod.NPCs float num349 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector34.X; float num350 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector34.Y; float num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); - num349 *= num351; - num350 *= num351; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -12778,7 +12777,6 @@ namespace CalamityMod.NPCs num1284 = 0; } int num1285 = num1273 + num1284; - num1273 -= num1285; NPC nPC6 = Main.npc[num1270]; nPC6.life += num1285; NPC.HealEffect(Utils.CenteredRectangle(Main.npc[num1270].Center, new Vector2(50f)), num1285, true); diff --git a/NPCs/Crabulon/CrabulonIdle.cs b/NPCs/Crabulon/CrabulonIdle.cs index b3b5cb3b78..afdf191db0 100644 --- a/NPCs/Crabulon/CrabulonIdle.cs +++ b/NPCs/Crabulon/CrabulonIdle.cs @@ -103,8 +103,6 @@ namespace CalamityMod.NPCs.Crabulon float num349 = player.position.X + (float)(player.width / 2) - vector34.X; float num350 = player.position.Y + (float)(player.height / 2) - vector34.Y; float num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); - num349 *= num351; - num350 *= num351; if (Main.netMode != NetmodeID.MultiplayerClient) { int num352 = 1; diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index fdd538bcea..a665cddab2 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -414,7 +414,6 @@ namespace CalamityMod.NPCs.Cryogen num180 += (float)Main.rand.Next(-100, 101); num182 += (float)Main.rand.Next(-100, 101); num180 *= num183; - num182 *= num183; Projectile.NewProjectile(value9.X, value9.Y, num180, -10f, num185, num184, 0f, Main.myPlayer, 0f, 0f); } } @@ -483,7 +482,6 @@ namespace CalamityMod.NPCs.Cryogen num180 += (float)Main.rand.Next(-100, 101); num182 += (float)Main.rand.Next(-100, 101); num180 *= num183; - num182 *= num183; Projectile.NewProjectile(value9.X, value9.Y, num180, -10f, num185, num184, 0f, Main.myPlayer, 0f, 0f); } } diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index f143624e78..12920d0f49 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -120,7 +120,7 @@ namespace CalamityMod.NPCs.DesertScourge int Previous = npc.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { - int lol = 0; + int lol; if (num36 >= 0 && num36 < minLength) { lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DesertScourgeBody"), npc.whoAmI); diff --git a/NPCs/DesertScourge/DesertScourgeHeadSmall.cs b/NPCs/DesertScourge/DesertScourgeHeadSmall.cs index 5b223c63ef..2af719460e 100644 --- a/NPCs/DesertScourge/DesertScourgeHeadSmall.cs +++ b/NPCs/DesertScourge/DesertScourgeHeadSmall.cs @@ -72,7 +72,7 @@ namespace CalamityMod.NPCs.DesertScourge int Previous = npc.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { - int lol = 0; + int lol; if (num36 >= 0 && num36 < minLength) { lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DesertScourgeBodySmall"), npc.whoAmI); diff --git a/NPCs/DesertScourge/DriedSeekerHead.cs b/NPCs/DesertScourge/DriedSeekerHead.cs index 4e5ef67160..806461c9fa 100644 --- a/NPCs/DesertScourge/DriedSeekerHead.cs +++ b/NPCs/DesertScourge/DriedSeekerHead.cs @@ -44,7 +44,7 @@ namespace CalamityMod.NPCs.DesertScourge int Previous = npc.whoAmI; for (int num36 = 0; num36 < 4; num36++) { - int lol = 0; + int lol; if (num36 >= 0 && num36 < 3) { lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DriedSeekerBody"), npc.whoAmI); diff --git a/NPCs/NormalNPCs/AngryDog.cs b/NPCs/NormalNPCs/AngryDog.cs index eaf81c043c..c94fa814c0 100644 --- a/NPCs/NormalNPCs/AngryDog.cs +++ b/NPCs/NormalNPCs/AngryDog.cs @@ -73,7 +73,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.ai[1] += 1f; } int num = 30; - int num2 = 10; bool flag = false; bool flag2 = false; bool flag3 = false; @@ -82,7 +81,7 @@ namespace CalamityMod.NPCs.NormalNPCs flag2 = true; npc.ai[3] += 1f; } - num2 = 4; + int num2 = 4; bool flag4 = npc.velocity.Y == 0f; for (int i = 0; i < 200; i++) { @@ -176,16 +175,15 @@ namespace CalamityMod.NPCs.NormalNPCs npc.direction = 1; } } - float num7 = 6f; - float num8 = 0.07f; + if (!flag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) { if (Math.Sign(npc.velocity.X) != npc.direction) { npc.velocity.X = npc.velocity.X * 0.92f; } - num7 = 5f; - num8 = 0.2f; + float num7 = 5f; + float num8 = 0.2f; if (npc.velocity.X < -num7 || npc.velocity.X > num7) { if (npc.velocity.Y == 0f) diff --git a/NPCs/NormalNPCs/Bohldohr.cs b/NPCs/NormalNPCs/Bohldohr.cs index d118f11bd3..1d9a9a3cf4 100644 --- a/NPCs/NormalNPCs/Bohldohr.cs +++ b/NPCs/NormalNPCs/Bohldohr.cs @@ -35,7 +35,6 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { int num = 30; - int num2 = 10; bool flag = false; bool flag2 = false; bool flag3 = false; @@ -44,7 +43,7 @@ namespace CalamityMod.NPCs.NormalNPCs flag2 = true; npc.ai[3] += 1f; } - num2 = 4; + int num2 = 4; bool flag4 = npc.velocity.Y == 0f; for (int i = 0; i < 200; i++) { @@ -135,8 +134,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.direction = 1; } } - float num7 = 6f; - float num8 = 0.07f; + if (!flag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) { if (Math.Sign(npc.velocity.X) != npc.direction) @@ -148,8 +146,8 @@ namespace CalamityMod.NPCs.NormalNPCs { num9 = 0f; } - num7 = 5f + num9 * (float)npc.direction * 4f; - num8 = 0.2f; + float num7 = 5f + num9 * (float)npc.direction * 4f; + float num8 = 0.2f; if (npc.velocity.X < -num7 || npc.velocity.X > num7) { if (npc.velocity.Y == 0f) diff --git a/NPCs/NormalNPCs/Cryon.cs b/NPCs/NormalNPCs/Cryon.cs index 8a25ab8f6a..a2afc45bd8 100644 --- a/NPCs/NormalNPCs/Cryon.cs +++ b/NPCs/NormalNPCs/Cryon.cs @@ -35,7 +35,6 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { int num = 30; - int num2 = 10; bool flag = false; bool flag2 = false; bool flag3 = false; @@ -44,7 +43,7 @@ namespace CalamityMod.NPCs.NormalNPCs flag2 = true; npc.ai[3] += 1f; } - num2 = 4; + int num2 = 4; bool flag4 = npc.velocity.Y == 0f; for (int i = 0; i < 200; i++) { @@ -134,8 +133,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.direction = 1; } } - float num7 = 6f; - float num8 = 0.07f; + if (!flag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) { if (Math.Sign(npc.velocity.X) != npc.direction) @@ -147,8 +145,8 @@ namespace CalamityMod.NPCs.NormalNPCs { num9 = 0f; } - num7 = 5f + num9 * (float)npc.direction * 4f; - num8 = 0.1f; + float num7 = 5f + num9 * (float)npc.direction * 4f; + float num8 = 0.1f; if (npc.velocity.X < -num7 || npc.velocity.X > num7) { if (npc.velocity.Y == 0f) diff --git a/NPCs/NormalNPCs/PhantomDebris.cs b/NPCs/NormalNPCs/PhantomDebris.cs index e6572bad6e..1ecbdb13bd 100644 --- a/NPCs/NormalNPCs/PhantomDebris.cs +++ b/NPCs/NormalNPCs/PhantomDebris.cs @@ -42,13 +42,13 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { npc.spriteDirection = (npc.direction > 0) ? 1 : -1; - float num78 = 1f; float num79 = (Main.player[npc.target].Center - npc.Center).Length(); num79 *= 0.0025f; if ((double)num79 > 1.5) { num79 = 1.5f; } + float num78; if (Main.expertMode) { num78 = 4f - num79; diff --git a/NPCs/NormalNPCs/PlaguedDerpling.cs b/NPCs/NormalNPCs/PlaguedDerpling.cs index 3c7dc5ab54..9e8b506a73 100644 --- a/NPCs/NormalNPCs/PlaguedDerpling.cs +++ b/NPCs/NormalNPCs/PlaguedDerpling.cs @@ -69,7 +69,6 @@ namespace CalamityMod.NPCs.NormalNPCs num4 -= vector.X; num5 -= vector.Y; float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); - float num7 = num6; if (num6 == 0f) { num4 = npc.velocity.X; diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index fe52bd72a7..795055cb92 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -79,7 +79,7 @@ namespace CalamityMod.NPCs.Perforator int Previous = npc.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { - int lol = 0; + int lol; if (num36 >= 0 && num36 < minLength) { lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorBodyLarge"), npc.whoAmI); diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index dfbb79a8c3..94875d79d3 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -80,7 +80,7 @@ namespace CalamityMod.NPCs.Perforator int Previous = npc.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { - int lol = 0; + int lol; if (num36 >= 0 && num36 < minLength) { lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorBodyMedium"), npc.whoAmI); diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index 3c60946044..013e5ae974 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -78,7 +78,7 @@ namespace CalamityMod.NPCs.Perforator int Previous = npc.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { - int lol = 0; + int lol; if (num36 >= 0 && num36 < minLength) { lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("PerforatorBodySmall"), npc.whoAmI); diff --git a/NPCs/PlaguebringerGoliath/PlagueBeeG.cs b/NPCs/PlaguebringerGoliath/PlagueBeeG.cs index d6de7e2475..3843d221f1 100644 --- a/NPCs/PlaguebringerGoliath/PlagueBeeG.cs +++ b/NPCs/PlaguebringerGoliath/PlagueBeeG.cs @@ -101,7 +101,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num4 -= vector.X; num5 -= vector.Y; float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); - float num7 = num6; if (num6 == 0f) { num4 = npc.velocity.X; diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index a42d597a67..64dfe14524 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -725,8 +725,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { Vector2 spawn = baseSpawn; spawn.X = spawn.X + i * 30 - (MissileProjectiles * 15); - Vector2 velocity = baseVelocity; - velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-MissileAngleSpread / 2 + (MissileAngleSpread * i / (float)MissileProjectiles))); + Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-MissileAngleSpread / 2 + (MissileAngleSpread * i / (float)MissileProjectiles))); velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; Projectile.NewProjectile(spawn.X, spawn.Y, velocity.X, velocity.Y, mod.ProjectileType("HiveBombGoliath"), damage, 0f, Main.myPlayer, 0f, Main.player[npc.target].position.Y); } diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs index 6fe50c602b..3323ef3c94 100644 --- a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs +++ b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs @@ -201,12 +201,12 @@ namespace CalamityMod.NPCs.ProfanedGuardianBoss float spread = MathHelper.ToRadians(20); double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; // Where the projectiles start spawning at, don't change this double deltaAngle = spread / (float)totalProjectiles; // Angle between each projectile, 0.04363325 - double offsetAngle = 0D; float velocity = 5f; - int i = 0; int damage = expertMode ? 50 : 60; int projectileType = mod.ProjectileType("ProfanedSpear"); + double offsetAngle; + int i; switch (spearType) { case 0: diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index ea1a039905..30f6ee9e91 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -130,7 +130,7 @@ namespace CalamityMod.NPCs.StormWeaver int Previous = npc.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { - int lol = 0; + int lol; if (num36 >= 0 && num36 < minLength) { lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("StormWeaverBody"), npc.whoAmI); @@ -183,8 +183,7 @@ namespace CalamityMod.NPCs.StormWeaver { Vector2 spawn2 = baseSpawn; spawn2.X = spawn2.X + i * 30 - (BoltProjectiles * 15); - Vector2 velocity = baseVelocity; - velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-BoltAngleSpread / 2 + (BoltAngleSpread * i / (float)BoltProjectiles))); + Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-BoltAngleSpread / 2 + (BoltAngleSpread * i / (float)BoltProjectiles))); velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; Vector2 vector94 = Main.player[npc.target].Center - spawn2; float ai = (float)Main.rand.Next(100); diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs index d166b5c933..7073617496 100644 --- a/NPCs/StormWeaver/StormWeaverHeadNaked.cs +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -147,7 +147,7 @@ namespace CalamityMod.NPCs.StormWeaver int Previous = npc.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { - int lol = 0; + int lol; if (num36 >= 0 && num36 < minLength) { lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("StormWeaverBodyNaked"), npc.whoAmI); @@ -200,8 +200,7 @@ namespace CalamityMod.NPCs.StormWeaver { Vector2 spawn2 = baseSpawn; spawn2.X = spawn2.X + i * 30 - (BoltProjectiles * 15); - Vector2 velocity = baseVelocity; - velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-BoltAngleSpread / 2 + (BoltAngleSpread * i / (float)BoltProjectiles))); + Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-BoltAngleSpread / 2 + (BoltAngleSpread * i / (float)BoltProjectiles))); velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; Vector2 vector94 = Main.player[npc.target].Center - spawn2; float ai = (float)Main.rand.Next(100); @@ -267,8 +266,7 @@ namespace CalamityMod.NPCs.StormWeaver { npc.TargetClosest(false); } - float num188 = speed; - float num189 = turnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); @@ -290,8 +288,8 @@ namespace CalamityMod.NPCs.StormWeaver break; } } - num188 = revenge ? 14f : 13f; - num189 = revenge ? 0.44f : 0.4f; + float num188 = revenge ? 14f : 13f; + float num189 = revenge ? 0.44f : 0.4f; if (!Main.player[npc.target].ZoneSkyHeight && CalamityWorld.DoGSecondStageCountdown <= 0) { num188 *= 2f; diff --git a/NPCs/SupremeCalamitas/SCalWormHead.cs b/NPCs/SupremeCalamitas/SCalWormHead.cs index a6338f8d20..8511a445df 100644 --- a/NPCs/SupremeCalamitas/SCalWormHead.cs +++ b/NPCs/SupremeCalamitas/SCalWormHead.cs @@ -100,7 +100,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas int Previous = npc.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { - int lol = 0; + int lol; if (num36 >= 0 && num36 < minLength && num36 % 2 == 0) { lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("SCalWormBodyWeak"), npc.whoAmI); diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHead.cs b/NPCs/TheDevourerofGods/DevourerofGodsHead.cs index dd7814206b..30504a2f64 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsHead.cs @@ -177,7 +177,7 @@ namespace CalamityMod.NPCs.TheDevourerofGods int Previous = npc.whoAmI; for (int segmentSpawn = 0; segmentSpawn < maxLength; segmentSpawn++) { - int segment = 0; + int segment; if (segmentSpawn >= 0 && segmentSpawn < minLength) segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsBody"), npc.whoAmI); else diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHead2.cs b/NPCs/TheDevourerofGods/DevourerofGodsHead2.cs index 19792d1de0..29ad374e0b 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsHead2.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsHead2.cs @@ -105,7 +105,7 @@ namespace CalamityMod.NPCs.TheDevourerofGods int Previous = npc.whoAmI; for (int segmentSpawn = 0; segmentSpawn < maxLength; segmentSpawn++) { - int segment = 0; + int segment; if (segmentSpawn >= 0 && segmentSpawn < minLength) { segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsBody2"), npc.whoAmI); diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs b/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs index 6e43748d3b..fa38cd035c 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs @@ -217,7 +217,7 @@ namespace CalamityMod.NPCs.TheDevourerofGods int Previous = npc.whoAmI; for (int segmentSpawn = 0; segmentSpawn < maxLength; segmentSpawn++) { - int segment = 0; + int segment; if (segmentSpawn >= 0 && segmentSpawn < minLength) segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsBodyS"), npc.whoAmI); else diff --git a/NPCs/TownNPCs/Bandit.cs b/NPCs/TownNPCs/Bandit.cs index b37d4204e8..34144040f7 100644 --- a/NPCs/TownNPCs/Bandit.cs +++ b/NPCs/TownNPCs/Bandit.cs @@ -1,4 +1,5 @@ using CalamityMod.World; +using CalamityMod.Utilities; using System.Collections.Generic; using System.Linq; using Terraria; @@ -31,8 +32,7 @@ namespace CalamityMod.NPCs.TownNPCs NPCID.Sets.AttackType[npc.type] = 0; NPCID.Sets.AttackTime[npc.type] = 60; NPCID.Sets.AttackAverageChance[npc.type] = 10; - } - + } public override void SetDefaults() { npc.townNPC = true; @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.TownNPCs for (int k = 0; k < 255; k++) { Player player = Main.player[k]; - if (player.active && InventoryHas(player, ItemID.PlatinumCoin)) + if (player.active && player.InventoryHas(ItemID.PlatinumCoin)) { return NPC.downedBoss3; } @@ -67,10 +67,6 @@ namespace CalamityMod.NPCs.TownNPCs { return PossibleNames[Main.rand.Next(PossibleNames.Count)]; } - public bool InventoryHas(Player me, params int[] items) - { - return me.inventory.Any(item => items.Contains(item.type)); - } public override string GetChat() { List PossibleDialogs = new List(); @@ -113,7 +109,7 @@ namespace CalamityMod.NPCs.TownNPCs PossibleDialogs.Add("Maybe I'm bitter. It's been a long time, so whatever. Just do a good job out there."); PossibleDialogs.Add("It's not stealing! I'm just borrowing it until I die!"); - if (InventoryHas(Main.LocalPlayer, ItemID.BoneGlove)) + if (Main.LocalPlayer.InventoryHas(ItemID.BoneGlove)) { PossibleDialogs.Add("Wouldn't be the first time I used my friends' remains as weapons."); } @@ -129,8 +125,8 @@ namespace CalamityMod.NPCs.TownNPCs PossibleDialogs.Add("Providence HATES it when you take her stuff. I learned that the hard way."); PossibleDialogs.Add("You think I can get away with looting from ghosts? It ain't like they can pick things up."); } - if (InventoryHas(Main.LocalPlayer, mod.ItemType("Valediction")) || - InventoryHas(Main.LocalPlayer, mod.ItemType("TheReaper"))) + if (Main.LocalPlayer.InventoryHas(mod.ItemType("Valediction")) || + Main.LocalPlayer.InventoryHas(mod.ItemType("TheReaper"))) { PossibleDialogs.Add("Oh man, did you rip that off a shark!? Now that's a weapon!"); } @@ -209,8 +205,68 @@ namespace CalamityMod.NPCs.TownNPCs public override void SetupShop(Chest shop, ref int nextSlot) //charges 50% extra than the original item value { shop.item[nextSlot].SetDefaults(mod.ItemType("Cinquedea")); - shop.item[nextSlot].shopCustomPrice = mod.GetItem("Cinquedea").item.value; nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("Glaive")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("Kylie")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("MonkeyDarts")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("OldDie")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 40, 0, 0); + nextSlot++; + /*if (Main.hardMode) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("SlickCane")); + nextSlot++; + }*/ + /*if (NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("MomentumCapacitator")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 60, 0, 0); + nextSlot++; + }*/ + /*if (NPC.downedMechBoss1 || NPC.downedMechBoss2 || NPC.downedMechBoss3) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("BouncingBetty")); + nextSlot++; + shop.item[nextSlot].SetDefaults(mod.ItemType("LatcherMines")); + nextSlot++; + }*/ + if (NPC.downedPlantBoss) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("GloveOfPrecicion")); + nextSlot++; + /*shop.item[nextSlot].SetDefaults(mod.ItemType("GloveofRecklessness")); + nextSlot++;*/ + /*shop.item[nextSlot].SetDefaults(mod.ItemType("DeepWounder")); + nextSlot++;*/ + } + /*if (NPC.downedGolemBoss) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("EtherealExtorter")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(1, 0, 0, 0); + nextSlot++; + }*/ + /*if (CalamityWorld.downedProvidence) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("SylvanSlasher")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(5, 0, 0, 0); + nextSlot++; + }*/ + if (NPC.downedAncientCultist) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("CelestialReaper")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(2, 0, 0, 0); + nextSlot++; + } + + if (CalamityWorld.buffedEclipse && !CalamityWorld.dragonScalesBought) + { + shop.item[nextSlot].SetDefaults(mod.ItemType("DragonScales")); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(40, 0, 0, 0); + nextSlot++; + } } public override void TownNPCAttackStrength(ref int damage, ref float knockback) diff --git a/Projectiles/Astral/Hive.cs b/Projectiles/Astral/Hive.cs index f1cb1804e1..143b1d769b 100644 --- a/Projectiles/Astral/Hive.cs +++ b/Projectiles/Astral/Hive.cs @@ -69,7 +69,6 @@ namespace CalamityMod.Projectiles.Astral float num646 = Vector2.Distance(npc.Center, projectile.Center); if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) { - num633 = num646; vector46 = npc.Center; flag25 = true; target = npc.whoAmI; diff --git a/Projectiles/Astral/Hiveling.cs b/Projectiles/Astral/Hiveling.cs index 6e371623c7..056e2dc52f 100644 --- a/Projectiles/Astral/Hiveling.cs +++ b/Projectiles/Astral/Hiveling.cs @@ -55,7 +55,6 @@ namespace CalamityMod.Projectiles.Astral float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); if (num478 < num474) { - num474 = num478; centerX = num476; centerY = num477; homeIn = true; diff --git a/Projectiles/Astral/Quasar2.cs b/Projectiles/Astral/Quasar2.cs index 223513dd65..60a537e428 100644 --- a/Projectiles/Astral/Quasar2.cs +++ b/Projectiles/Astral/Quasar2.cs @@ -36,15 +36,13 @@ namespace CalamityMod.Projectiles.Astral } float num472 = projectile.Center.X; float num473 = projectile.Center.Y; - float npcCenterX = 0f; - float npcCenterY = 0f; float num474 = 600f; for (int num475 = 0; num475 < 200; num475++) { if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) { - npcCenterX = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - npcCenterY = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float npcCenterX = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float npcCenterY = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - npcCenterX) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - npcCenterY); if (num478 < num474) { diff --git a/Projectiles/Astral/RadiantStar2.cs b/Projectiles/Astral/RadiantStar2.cs index 06730d80ca..a6810f444a 100644 --- a/Projectiles/Astral/RadiantStar2.cs +++ b/Projectiles/Astral/RadiantStar2.cs @@ -38,15 +38,13 @@ namespace CalamityMod.Projectiles.Astral { float num472 = projectile.Center.X; float num473 = projectile.Center.Y; - float npcCenterX = 0f; - float npcCenterY = 0f; float num474 = 600f; for (int num475 = 0; num475 < 200; num475++) { if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) { - npcCenterX = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - npcCenterY = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float npcCenterX = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float npcCenterY = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - npcCenterX) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - npcCenterY); if (num478 < num474) { diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 5d5fa44b61..edba6ed3d2 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -39,6 +39,7 @@ namespace CalamityMod.Projectiles // Rogue Stuff public bool stealthStrike = false; //Update all existing rogue weapons with this + public bool momentumCapacitatorBoost = false; //Constant acceleration // Iron Heart public int ironHeartDamage = 0; @@ -545,12 +546,11 @@ namespace CalamityMod.Projectiles } } + counter++; if (Main.player[projectile.owner].Calamity().fungalSymbiote && trueMelee) { - counter++; - if (counter >= 6) + if (counter % 6 == 0) { - counter = 0; if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[ProjectileID.Mushroom] < 30) { if (projectile.type == mod.ProjectileType("Nebulash") || projectile.type == mod.ProjectileType("CosmicDischarge") || @@ -579,12 +579,10 @@ namespace CalamityMod.Projectiles } } - if (Main.player[projectile.owner].Calamity().nanotech && rogue && projectile.friendly) + if (Main.player[projectile.owner].Calamity().nanotech && rogue && projectile.friendly && projectile.type != mod.ProjectileType("DragonShit")) { - counter++; - if (counter >= 30) + if (counter % 30 == 0) { - counter = 0; if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("Nanotech")] < 30) { Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("Nanotech"), @@ -593,6 +591,19 @@ namespace CalamityMod.Projectiles } } + if (Main.player[projectile.owner].Calamity().dragonScales && rogue && projectile.friendly && projectile.type != mod.ProjectileType("Nanotech")) + { + if (counter % 50 == 0) + { + if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("DragonShit")] < 15) + { + //spawn a dust that does 1/5th of the original damage + int projectileID = Projectile.NewProjectile(projectile.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi), mod.ProjectileType("DragonShit"), + (int)((double)projectile.damage * 0.2), 0f, projectile.owner, 0f, 0f); + } + } + } + if (Main.player[projectile.owner].Calamity().daedalusSplit && rogue && projectile.friendly) { counter2++; @@ -616,6 +627,11 @@ namespace CalamityMod.Projectiles } } } + //will always be friendly and rogue if it has this boost + if (Main.player[projectile.owner].Calamity().momentumCapacitor && projectile.Calamity().momentumCapacitatorBoost) + { + projectile.velocity *= 1.025f; + } if (Main.player[projectile.owner].Calamity().theBeeDamage > 0 && projectile.owner == Main.myPlayer && projectile.friendly && projectile.damage > 0 && (projectile.melee || projectile.ranged || projectile.magic || rogue)) @@ -680,6 +696,40 @@ namespace CalamityMod.Projectiles { if (projectile.owner == Main.myPlayer) { + if (projectile.Calamity().rogue && projectile.Calamity().stealthStrike && Main.player[projectile.owner].Calamity().dragonScales && CalamityUtils.CountProjectiles(mod.ProjectileType("InfernadoFriendly")) < 2) + { + int projTileX = (int)(projectile.Center.X / 16f); + int projTileY = (int)(projectile.Center.Y / 16f); + int distance = 100; + if (projTileX < 10) + { + projTileX = 10; + } + if (projTileX > Main.maxTilesX - 10) + { + projTileX = Main.maxTilesX - 10; + } + if (projTileY < 10) + { + projTileY = 10; + } + if (projTileY > Main.maxTilesY - distance - 10) + { + projTileY = Main.maxTilesY - distance - 10; + } + for (int x = projTileX; x < projTileX + distance; x++) + { + Tile tile = Main.tile[projTileX, projTileY]; + if (tile.active() && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) + { + projTileX = x; + break; + } + } + int projectileIndex = Projectile.NewProjectile((float)(projTileX * 16 + 8), (float)(projTileY * 16 - 24), 0f, 0f, mod.ProjectileType("InfernadoFriendly"), 420, 15f, Main.myPlayer, 16f, 16f); + Main.projectile[projectileIndex].Calamity().forceRogue = true; + Main.projectile[projectileIndex].netUpdate = true; + } if (projectile.magic && Main.player[projectile.owner].ghostHeal) { float num = 0.1f; diff --git a/Projectiles/Magic/ApothChloro.cs b/Projectiles/Magic/ApothChloro.cs index 019788cbff..541bf38e9a 100644 --- a/Projectiles/Magic/ApothChloro.cs +++ b/Projectiles/Magic/ApothChloro.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Magic float num7 = 300f; bool flag2 = false; int num8 = 0; - float num9 = 0f; + float num9; if ((double)projectile.ai[1] == 0.0) { for (int index = 0; index < 200; ++index) diff --git a/Projectiles/Magic/BlueBubble.cs b/Projectiles/Magic/BlueBubble.cs index 40b016cd06..8f8ce144e5 100644 --- a/Projectiles/Magic/BlueBubble.cs +++ b/Projectiles/Magic/BlueBubble.cs @@ -50,7 +50,6 @@ namespace CalamityMod.Projectiles.Magic } if (num745 < -3.1415926535897931) { - num745 += 6.2831853071795862; } projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; if (Main.myPlayer == projectile.owner && projectile.timeLeft > 120) diff --git a/Projectiles/Magic/GhastlyExplosionShard.cs b/Projectiles/Magic/GhastlyExplosionShard.cs index fa7b406b57..87a99428ec 100644 --- a/Projectiles/Magic/GhastlyExplosionShard.cs +++ b/Projectiles/Magic/GhastlyExplosionShard.cs @@ -23,7 +23,6 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - int num3 = 0; int num332 = (int)projectile.ai[0]; projectile.ai[1] += 1f; float num333 = (60f - projectile.ai[1]) / 60f; @@ -37,6 +36,7 @@ namespace CalamityMod.Projectiles.Magic projectile.velocity.Y = 18f; } projectile.velocity.X = projectile.velocity.X * 0.98f; + int num3; for (int num334 = 0; num334 < 2; num334 = num3 + 1) { int num335 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num332, projectile.velocity.X, projectile.velocity.Y, 50, default, 1.1f); diff --git a/Projectiles/Magic/PlagueFang.cs b/Projectiles/Magic/PlagueFang.cs index e3f20a5ad8..d45c6824e7 100644 --- a/Projectiles/Magic/PlagueFang.cs +++ b/Projectiles/Magic/PlagueFang.cs @@ -20,6 +20,7 @@ namespace CalamityMod.Projectiles.Magic projectile.magic = true; projectile.alpha = 255; projectile.penetrate = 9; + projectile.timeLeft = 300; } public override void AI() diff --git a/Projectiles/Magic/SHPB.cs b/Projectiles/Magic/SHPB.cs index 572dac8009..3322de7fbb 100644 --- a/Projectiles/Magic/SHPB.cs +++ b/Projectiles/Magic/SHPB.cs @@ -77,8 +77,6 @@ namespace CalamityMod.Projectiles.Magic if (num478 < num474) { num474 = num478; - num472 = num476; - num473 = num477; flag17 = true; } } diff --git a/Projectiles/Magic/UberBubble.cs b/Projectiles/Magic/UberBubble.cs index f1e27416fa..5ebec6ae68 100644 --- a/Projectiles/Magic/UberBubble.cs +++ b/Projectiles/Magic/UberBubble.cs @@ -45,7 +45,6 @@ namespace CalamityMod.Projectiles.Magic } if (num745 < -3.1415926535897931) { - num745 += 6.2831853071795862; } projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; if (Main.myPlayer == projectile.owner && projectile.timeLeft > 30) diff --git a/Projectiles/Magic/YharimsCrystal.cs b/Projectiles/Magic/YharimsCrystal.cs index 0c511c7a59..77adb516bb 100644 --- a/Projectiles/Magic/YharimsCrystal.cs +++ b/Projectiles/Magic/YharimsCrystal.cs @@ -155,7 +155,6 @@ namespace CalamityMod.Projectiles.Magic int num215 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; int y7 = num215 * projectile.frame; Vector2 vector27 = (projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition).Floor(); - float scale5 = 1f; if (Main.player[projectile.owner].shroomiteStealth && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) { float num216 = Main.player[projectile.owner].stealth; @@ -165,7 +164,6 @@ namespace CalamityMod.Projectiles.Magic } float arg_97B3_0 = (1f + num216 * 10f) / 11f; color25 *= num216; - scale5 = num216; } if (Main.player[projectile.owner].setVortex && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) { @@ -176,7 +174,6 @@ namespace CalamityMod.Projectiles.Magic } float arg_9854_0 = (1f + num217 * 10f) / 11f; color25 = color25.MultiplyRGBA(new Microsoft.Xna.Framework.Color(Vector4.Lerp(Vector4.One, new Vector4(0.16f, 0.12f, 0f, 0f), 1f - num217))); - scale5 = num217; } Main.spriteBatch.Draw(texture2D14, vector27, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y7, texture2D14.Width, num215)), projectile.GetAlpha(color25), projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)num215 / 2f), projectile.scale, spriteEffects, 0f); float scaleFactor2 = (float)Math.Cos((double)(6.28318548f * (projectile.ai[0] / 30f))) * 2f + 2f; diff --git a/Projectiles/Melee/AccretionDiskMelee.cs b/Projectiles/Melee/AccretionDiskMelee.cs index 624d2a9923..1975d5e989 100644 --- a/Projectiles/Melee/AccretionDiskMelee.cs +++ b/Projectiles/Melee/AccretionDiskMelee.cs @@ -82,8 +82,6 @@ namespace CalamityMod.Projectiles.Melee float num439 = num436 - value10.Y; float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); num440 = num437 / num440; - num438 *= num440; - num439 *= num440; if (Main.rand.NextBool(3)) { if (projectile.owner == Main.myPlayer) diff --git a/Projectiles/Melee/BiomeOrb.cs b/Projectiles/Melee/BiomeOrb.cs index cee008ca1f..92739d1520 100644 --- a/Projectiles/Melee/BiomeOrb.cs +++ b/Projectiles/Melee/BiomeOrb.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Melee bool glow = player.ZoneGlowshroom; bool hell = player.ZoneUnderworldHeight; bool sky = player.ZoneSkyHeight; - int dustType = 0; + int dustType; if (jungle) { dustType = 39; diff --git a/Projectiles/Melee/Cyclone.cs b/Projectiles/Melee/Cyclone.cs index 46ac92612b..e9d204b863 100644 --- a/Projectiles/Melee/Cyclone.cs +++ b/Projectiles/Melee/Cyclone.cs @@ -65,16 +65,14 @@ namespace CalamityMod.Projectiles.Melee } float num472 = projectile.Center.X; float num473 = projectile.Center.Y; - float npcCenterX = 0f; - float npcCenterY = 0f; float num474 = 600f; for (int num475 = 0; num475 < 200; num475++) { NPC npc = Main.npc[num475]; if (npc.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) { - npcCenterX = npc.position.X + (float)(npc.width / 2); - npcCenterY = npc.position.Y + (float)(npc.height / 2); + float npcCenterX = npc.position.X + (float)(npc.width / 2); + float npcCenterY = npc.position.Y + (float)(npc.height / 2); float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - npcCenterX) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - npcCenterY); if (num478 < num474) { diff --git a/Projectiles/Melee/Excelsus.cs b/Projectiles/Melee/Excelsus.cs index 7031eddef2..960e41d55a 100644 --- a/Projectiles/Melee/Excelsus.cs +++ b/Projectiles/Melee/Excelsus.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Melee public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Color color = default; + Color color; if (projectile.timeLeft < 85) { byte b2 = (byte)(projectile.timeLeft * 3); diff --git a/Projectiles/Melee/ExcelsusBlue.cs b/Projectiles/Melee/ExcelsusBlue.cs index 92e77bfcfd..69e51e3264 100644 --- a/Projectiles/Melee/ExcelsusBlue.cs +++ b/Projectiles/Melee/ExcelsusBlue.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Melee public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Color color = default; + Color color; if (projectile.timeLeft < 85) { byte b2 = (byte)(projectile.timeLeft * 3); diff --git a/Projectiles/Melee/ExcelsusPink.cs b/Projectiles/Melee/ExcelsusPink.cs index 7dc0d2af6c..703fd1de5b 100644 --- a/Projectiles/Melee/ExcelsusPink.cs +++ b/Projectiles/Melee/ExcelsusPink.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Melee public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Color color = default; + Color color; if (projectile.timeLeft < 85) { byte b2 = (byte)(projectile.timeLeft * 3); diff --git a/Projectiles/Melee/OmegaBiomeOrb.cs b/Projectiles/Melee/OmegaBiomeOrb.cs index 8e64c37feb..c2a1b1cc7f 100644 --- a/Projectiles/Melee/OmegaBiomeOrb.cs +++ b/Projectiles/Melee/OmegaBiomeOrb.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Melee bool stardust = player.ZoneTowerStardust; bool solar = player.ZoneTowerSolar; bool vortex = player.ZoneTowerVortex; - int dustType = 0; + int dustType; if (jungle) { dustType = 39; diff --git a/Projectiles/Melee/SolsticeBeam.cs b/Projectiles/Melee/SolsticeBeam.cs index 7bdb95332d..fc2a4c24b5 100644 --- a/Projectiles/Melee/SolsticeBeam.cs +++ b/Projectiles/Melee/SolsticeBeam.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Melee } int dustType = 0; - switch (CalamityMod.season) + switch (CalamityMod.CurrentSeason) { case Season.Spring: dustType = Utils.SelectRandom(Main.rand, new int[] @@ -102,7 +102,7 @@ namespace CalamityMod.Projectiles.Melee byte red = 255; byte green = 255; byte blue = 255; - switch (CalamityMod.season) + switch (CalamityMod.CurrentSeason) { case Season.Spring: red = 0; @@ -139,7 +139,7 @@ namespace CalamityMod.Projectiles.Melee { int dustType = 0; - switch (CalamityMod.season) + switch (CalamityMod.CurrentSeason) { case Season.Spring: dustType = Utils.SelectRandom(Main.rand, new int[] diff --git a/Projectiles/Melee/Tornado.cs b/Projectiles/Melee/Tornado.cs index eba641e5ae..08b21f75c7 100644 --- a/Projectiles/Melee/Tornado.cs +++ b/Projectiles/Melee/Tornado.cs @@ -57,16 +57,14 @@ namespace CalamityMod.Projectiles.Melee } float num472 = projectile.Center.X; float num473 = projectile.Center.Y; - float npcCenterX = 0f; - float npcCenterY = 0f; float num474 = 600f; for (int num475 = 0; num475 < 200; num475++) { NPC npc = Main.npc[num475]; if (npc.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) { - npcCenterX = npc.position.X + (float)(npc.width / 2); - npcCenterY = npc.position.Y + (float)(npc.height / 2); + float npcCenterX = npc.position.X + (float)(npc.width / 2); + float npcCenterY = npc.position.Y + (float)(npc.height / 2); float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - npcCenterX) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - npcCenterY); if (num478 < num474) { diff --git a/Projectiles/Melee/TrueBiomeOrb.cs b/Projectiles/Melee/TrueBiomeOrb.cs index f732d84abf..0709ddd3f4 100644 --- a/Projectiles/Melee/TrueBiomeOrb.cs +++ b/Projectiles/Melee/TrueBiomeOrb.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Melee bool hell = player.ZoneUnderworldHeight; bool sky = player.ZoneSkyHeight; bool holy = player.ZoneHoly; - int dustType = 0; + int dustType; if (jungle) { dustType = 39; diff --git a/Projectiles/Melee/Yoyos/QuagmireProjectile.cs b/Projectiles/Melee/Yoyos/QuagmireProjectile.cs index 0ce9ca4191..06b123e90c 100644 --- a/Projectiles/Melee/Yoyos/QuagmireProjectile.cs +++ b/Projectiles/Melee/Yoyos/QuagmireProjectile.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos } if (projectile.owner == Main.myPlayer) { - int proj = 0; + int proj; if (Main.rand.NextBool(10)) { proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, 569, (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); diff --git a/Projectiles/Patreon/DarkSpark.cs b/Projectiles/Patreon/DarkSpark.cs index de83ce9157..848bac0b75 100644 --- a/Projectiles/Patreon/DarkSpark.cs +++ b/Projectiles/Patreon/DarkSpark.cs @@ -181,7 +181,6 @@ namespace CalamityMod.Projectiles.Patreon int num215 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; int y7 = num215 * projectile.frame; Vector2 vector27 = (projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition).Floor(); - float scale5 = 1f; if (Main.player[projectile.owner].shroomiteStealth && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) { float num216 = Main.player[projectile.owner].stealth; @@ -191,7 +190,6 @@ namespace CalamityMod.Projectiles.Patreon } float arg_97B3_0 = (1f + num216 * 10f) / 11f; color25 *= num216; - scale5 = num216; } if (Main.player[projectile.owner].setVortex && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) { @@ -202,7 +200,6 @@ namespace CalamityMod.Projectiles.Patreon } float arg_9854_0 = (1f + num217 * 10f) / 11f; color25 = color25.MultiplyRGBA(new Microsoft.Xna.Framework.Color(Vector4.Lerp(Vector4.One, new Vector4(0.16f, 0.12f, 0f, 0f), 1f - num217))); - scale5 = num217; } Main.spriteBatch.Draw(texture2D14, vector27, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y7, texture2D14.Width, num215)), projectile.GetAlpha(color25), projectile.rotation, new Vector2((float)texture2D14.Width / 2f, (float)num215 / 2f), projectile.scale, spriteEffects, 0f); float scaleFactor2 = (float)Math.Cos((double)(6.28318548f * (projectile.ai[0] / 120f))) * 2f + 2f; diff --git a/Projectiles/Patreon/DragonPowFlail.cs b/Projectiles/Patreon/DragonPowFlail.cs index 0371dd1519..01d8acb911 100644 --- a/Projectiles/Patreon/DragonPowFlail.cs +++ b/Projectiles/Patreon/DragonPowFlail.cs @@ -248,7 +248,6 @@ namespace CalamityMod.Projectiles.Patreon // Stop drawing when closer than 1 chain link away. if (posDiff.Length() < chainTex.Height + 1f) { - keepDrawing = false; break; } diff --git a/Projectiles/Patreon/HandheldTankShell.cs b/Projectiles/Patreon/HandheldTankShell.cs index d9a5fe9ec1..64048b04fd 100644 --- a/Projectiles/Patreon/HandheldTankShell.cs +++ b/Projectiles/Patreon/HandheldTankShell.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Patreon for (int i = 0; i < 30; ++i) { // Pick a random type of smoke (there's a little fire mixed in) - int dustID = -1; + int dustID; switch (Main.rand.Next(6)) { case 0: diff --git a/Projectiles/Patreon/PinkButterfly.cs b/Projectiles/Patreon/PinkButterfly.cs index c4d847cb5b..96b659520c 100644 --- a/Projectiles/Patreon/PinkButterfly.cs +++ b/Projectiles/Patreon/PinkButterfly.cs @@ -131,7 +131,6 @@ namespace CalamityMod.Projectiles.Patreon float num646 = Vector2.Distance(npc.Center, projectile.Center); if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) { - num633 = num646; vector46 = npc.Center; flag25 = true; } diff --git a/Projectiles/Patreon/TimeBolt.cs b/Projectiles/Patreon/TimeBolt.cs index 847deca234..a9c92c9f72 100644 --- a/Projectiles/Patreon/TimeBolt.cs +++ b/Projectiles/Patreon/TimeBolt.cs @@ -276,17 +276,15 @@ namespace CalamityMod.Projectiles.Patreon float angleIncrement = MathHelper.TwoPi / (float)numDust; Vector2 dustOffset = new Vector2(radius, 0f); dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); - int dustType = 0; - int dust = 0; for (int i = 0; i < numDust; i++) { dustOffset = dustOffset.RotatedBy(angleIncrement); - dustType = Utils.SelectRandom(Main.rand, new int[] - { + int dustType = Utils.SelectRandom(Main.rand, new int[] + { 226, 229 - }); - dust = Dust.NewDust(projectile.Center, 1, 1, dustType); + }); + int dust = Dust.NewDust(projectile.Center, 1, 1, dustType); Main.dust[dust].position = projectile.Center + dustOffset; if (Main.rand.Next(6) != 0) Main.dust[dust].noGravity = true; diff --git a/Projectiles/Permafrost/DarkIceZero.cs b/Projectiles/Permafrost/DarkIceZero.cs index 80ce7b34c6..00c62907ce 100644 --- a/Projectiles/Permafrost/DarkIceZero.cs +++ b/Projectiles/Permafrost/DarkIceZero.cs @@ -54,8 +54,6 @@ namespace CalamityMod.Projectiles.Permafrost { if (timeLeft > 0) { - timeLeft = 0; - projectile.position = projectile.Center; projectile.width = projectile.height = 192; projectile.position.X = projectile.position.X - (float)(projectile.width / 2); diff --git a/Projectiles/Ranged/ShockblastRound.cs b/Projectiles/Ranged/ShockblastRound.cs index e2ac9b49ee..2324bcd6e6 100644 --- a/Projectiles/Ranged/ShockblastRound.cs +++ b/Projectiles/Ranged/ShockblastRound.cs @@ -77,7 +77,6 @@ namespace CalamityMod.Projectiles.Ranged if (num139 == 0f) { projectile.localAI[0] = num138; - num139 = num138; } return false; } diff --git a/Projectiles/Ranged/SicknessRound.cs b/Projectiles/Ranged/SicknessRound.cs index 280af5aa45..582f461039 100644 --- a/Projectiles/Ranged/SicknessRound.cs +++ b/Projectiles/Ranged/SicknessRound.cs @@ -61,7 +61,6 @@ namespace CalamityMod.Projectiles.Ranged if (num139 == 0f) { projectile.localAI[0] = num138; - num139 = num138; } return false; } diff --git a/Projectiles/Ranged/SicknessRound2.cs b/Projectiles/Ranged/SicknessRound2.cs index b0c8df05db..12752ae15e 100644 --- a/Projectiles/Ranged/SicknessRound2.cs +++ b/Projectiles/Ranged/SicknessRound2.cs @@ -61,7 +61,6 @@ namespace CalamityMod.Projectiles.Ranged if (num139 == 0f) { projectile.localAI[0] = num138; - num139 = num138; } return false; } diff --git a/Projectiles/Rogue/AccretionDisk.cs b/Projectiles/Rogue/AccretionDisk.cs index 301bf46e32..5a11e44655 100644 --- a/Projectiles/Rogue/AccretionDisk.cs +++ b/Projectiles/Rogue/AccretionDisk.cs @@ -82,8 +82,6 @@ namespace CalamityMod.Projectiles.Rogue float num439 = num436 - value10.Y; float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); num440 = num437 / num440; - num438 *= num440; - num439 *= num440; if (Main.rand.NextBool(3)) { if (projectile.owner == Main.myPlayer) diff --git a/Projectiles/Rogue/BlazingStarProj.cs b/Projectiles/Rogue/BlazingStarProj.cs new file mode 100644 index 0000000000..1ab531ea7f --- /dev/null +++ b/Projectiles/Rogue/BlazingStarProj.cs @@ -0,0 +1,124 @@ +using CalamityMod.Items.CalamityCustomThrowingDamage; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class BlazingStarProj : ModProjectile + { + private static int Lifetime = 1540; + private static int ReboundTime = 75; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blazing Star"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 32; + projectile.friendly = true; + projectile.tileCollide = true; + projectile.penetrate = 5; + projectile.timeLeft = Lifetime; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + // ai[1] = 1 means that the projectile is a stealth strike, in which case it pierces infinitely. + if (projectile.ai[1] == 1f) + projectile.penetrate = projectile.maxPenetrate = -1; + + // Boomerang rotation + projectile.rotation += 0.4f * (float)projectile.direction; + + // Boomerang sound + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + + // Returns after some number of frames in the air + if (projectile.timeLeft < Lifetime - ReboundTime) + projectile.ai[0] = 1f; + + if (projectile.ai[0] != 0f) + { + projectile.tileCollide = false; + + float returnSpeed = BlazingStar.Speed; + float acceleration = 0.35f; + Player owner = Main.player[projectile.owner]; + + // Delete the projectile if it's excessively far away. + Vector2 distance = owner.Center - projectile.Center; + Vector2 ownerDistNorm = projectile.DirectionTo(owner.Center) * returnSpeed; + if (distance.Length() > 3000f) + projectile.Kill(); + + // Home back in on the player. + if (projectile.velocity.X < distance.X) + { + projectile.velocity.X = projectile.velocity.X + acceleration; + if (projectile.velocity.X < 0f && distance.X > 0f) + projectile.velocity.X += acceleration; + } + else if (projectile.velocity.X > distance.X) + { + projectile.velocity.X = projectile.velocity.X - acceleration; + if (projectile.velocity.X > 0f && distance.X < 0f) + projectile.velocity.X -= acceleration; + } + if (projectile.velocity.Y < distance.Y) + { + projectile.velocity.Y = projectile.velocity.Y + acceleration; + if (projectile.velocity.Y < 0f && distance.Y > 0f) + projectile.velocity.Y += acceleration; + } + else if (projectile.velocity.Y > distance.Y) + { + projectile.velocity.Y = projectile.velocity.Y - acceleration; + if (projectile.velocity.Y > 0f && distance.Y < 0f) + projectile.velocity.Y -= acceleration; + } + + // Delete the projectile if it touches its owner. + if (Main.myPlayer == projectile.owner) + if (projectile.Hitbox.Intersects(owner.Hitbox)) + projectile.Kill(); + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + // Make it bounce on tiles. + public override bool OnTileCollide(Vector2 oldVelocity) + { + // Impacts the terrain even though it bounces off. + Main.PlaySound(SoundID.Dig, projectile.Center); + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + projectile.ai[0] = 1f; + return false; + } + } +} diff --git a/Projectiles/Rogue/BlazingStarProj.png b/Projectiles/Rogue/BlazingStarProj.png new file mode 100644 index 0000000000..75c05587da Binary files /dev/null and b/Projectiles/Rogue/BlazingStarProj.png differ diff --git a/Projectiles/Rogue/CelestialReaperProjectile.cs b/Projectiles/Rogue/CelestialReaperProjectile.cs index 8c1e713959..e2ca9cf834 100644 --- a/Projectiles/Rogue/CelestialReaperProjectile.cs +++ b/Projectiles/Rogue/CelestialReaperProjectile.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Rogue } } } - public override bool? CanHitNPC(NPC target) => HomingCooldown == 0; + public override bool? CanHitNPC(NPC target) => HomingCooldown == 0 && !target.townNPC; public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { HomingCooldown = 25; diff --git a/Projectiles/Rogue/DragonShit.cs b/Projectiles/Rogue/DragonShit.cs new file mode 100644 index 0000000000..0636b90d38 --- /dev/null +++ b/Projectiles/Rogue/DragonShit.cs @@ -0,0 +1,146 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using System; + +namespace CalamityMod.Projectiles.Rogue +{ + public class DragonShit : ModProjectile + { + public NPC target; + public Vector2 rotationVector = Vector2.UnitY * -13f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.scale = 1f; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 420; + projectile.Calamity().rogue = true; + cooldownSlot = 1; + } + + public override void AI() + { + target = projectile.Center.ClosestNPCAt(1200f); + if (projectile.localAI[0] == 0f) + { + projectile.ai[0] = Utils.SelectRandom(Main.rand, -1f, 1f); + projectile.localAI[0] = 1f; + } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if (projectile.timeLeft >= 380) + { + projectile.velocity *= 1.07f; + } + else if (target != null) + { + projectile.velocity = (projectile.velocity * 23f + projectile.DirectionTo(target.Center) * 14.975f) / 24f; + } + else + { + projectile.timeLeft = Math.Min(projectile.timeLeft,15); + projectile.alpha += 17; + projectile.velocity = rotationVector; + rotationVector = rotationVector.RotatedBy(MathHelper.ToRadians(14.975f * projectile.ai[0])); + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, projectile.alpha); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D projectileTexture = Main.projectileTexture[projectile.type]; + int frameHeight = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int frameY = frameHeight * projectile.frame; + Main.spriteBatch.Draw(projectileTexture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameY, projectileTexture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)projectileTexture.Width / 2f, (float)frameHeight / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position = projectile.Center; + projectile.width = projectile.height = 80; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 8; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X += 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X -= 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X += 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X -= 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y -= 1f; + } + projectile.damage = Main.expertMode ? 300 : 180; + projectile.Damage(); + } + } +} diff --git a/Projectiles/Rogue/DragonShit.png b/Projectiles/Rogue/DragonShit.png new file mode 100644 index 0000000000..24f7e7a2b3 Binary files /dev/null and b/Projectiles/Rogue/DragonShit.png differ diff --git a/Projectiles/Rogue/EnchantedAxe.cs b/Projectiles/Rogue/EnchantedAxe.cs new file mode 100644 index 0000000000..276c14583b --- /dev/null +++ b/Projectiles/Rogue/EnchantedAxe.cs @@ -0,0 +1,145 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class EnchantedAxe : ModProjectile + { + private bool recall = false; + private bool summonAxe = true; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Enchanted Axe"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft = 600; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + if (projectile.Calamity().stealthStrike) + { + if (projectile.timeLeft < 585) + { + recall = true; + } + //Periodically emit + } + else + { + if (projectile.timeLeft < 590) + { + recall = true; + } + } + + projectile.rotation += 0.4f * projectile.direction; + + if (recall) + { + Vector2 posDiff = Main.player[projectile.owner].position - projectile.position; + if (posDiff.Length() > 30f) + { + posDiff.Normalize(); + projectile.velocity = posDiff * 30f; + } + else + { + projectile.timeLeft = 0; + Kill(projectile.timeLeft); + } + + if (summonAxe) + { + float minDist = 999f; + int index = 0; + // Get the closest enemy to the axe + for (int i = 0; i < Main.npc.Length; i++) + { + NPC npc = Main.npc[i]; + if (!npc.friendly && !npc.townNPC && npc.active) + { + float dist = (projectile.Center - npc.Center).Length(); + if (dist < minDist) + { + minDist = dist; + index = i; + } + } + } + Vector2 newAxeVelocity; + if (minDist < 999f) + { + newAxeVelocity = Main.npc[index].Center - projectile.Center; + } + else + { + newAxeVelocity = -projectile.velocity; + } + newAxeVelocity.Normalize(); + newAxeVelocity *= 30f; + int p = Projectile.NewProjectile(projectile.position, newAxeVelocity, mod.ProjectileType("EnchantedAxe2"), 15, 2, projectile.owner, 0, 0); + Main.projectile[p].Calamity().stealthStrike = projectile.Calamity().stealthStrike; + summonAxe = false; + } + } + else + { + if (projectile.timeLeft % 5 == 1 && projectile.Calamity().stealthStrike) + { + float axeSpeed = 15f; + Projectile.NewProjectile(projectile.position, new Vector2(1f, 0f) * axeSpeed, mod.ProjectileType("EnchantedAxe2"), 20, 2, projectile.owner, 0, 0); + Projectile.NewProjectile(projectile.position, new Vector2(0f, 1f) * axeSpeed, mod.ProjectileType("EnchantedAxe2"), 20, 2, projectile.owner, 0, 0); + Projectile.NewProjectile(projectile.position, new Vector2(-1f, 0f) * axeSpeed, mod.ProjectileType("EnchantedAxe2"), 20, 2, projectile.owner, 0, 0); + Projectile.NewProjectile(projectile.position, new Vector2(0f, -1f) * axeSpeed, mod.ProjectileType("EnchantedAxe2"), 20, 2, projectile.owner, 0, 0); + Projectile.NewProjectile(projectile.position, Vector2.Normalize(new Vector2(1f, 1f)) * axeSpeed, mod.ProjectileType("EnchantedAxe2"), 20, 2, projectile.owner, 0, 0); + Projectile.NewProjectile(projectile.position, Vector2.Normalize(new Vector2(1f, -1f)) * axeSpeed, mod.ProjectileType("EnchantedAxe2"), 20, 2, projectile.owner, 0, 0); + Projectile.NewProjectile(projectile.position, Vector2.Normalize(new Vector2(-1f, -1f)) * axeSpeed, mod.ProjectileType("EnchantedAxe2"), 20, 2, projectile.owner, 0, 0); + Projectile.NewProjectile(projectile.position, Vector2.Normalize(new Vector2(-1f, 1f)) * axeSpeed, mod.ProjectileType("EnchantedAxe2"), 20, 2, projectile.owner, 0, 0); + } + } + + if (projectile.position == Main.player[projectile.owner].position) + { + Kill(projectile.timeLeft); + } + return; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 3); + return false; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (recall) + { + return false; + } + Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, projectile.position); + recall = true; + projectile.tileCollide = false; + return false; + } + } +} diff --git a/Projectiles/Rogue/EnchantedAxe.png b/Projectiles/Rogue/EnchantedAxe.png new file mode 100644 index 0000000000..cdae20aa68 Binary files /dev/null and b/Projectiles/Rogue/EnchantedAxe.png differ diff --git a/Projectiles/Rogue/EnchantedAxe2.cs b/Projectiles/Rogue/EnchantedAxe2.cs new file mode 100644 index 0000000000..d00671ff2e --- /dev/null +++ b/Projectiles/Rogue/EnchantedAxe2.cs @@ -0,0 +1,41 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class EnchantedAxe2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Enchanted Axe"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = 2; + projectile.timeLeft = 600; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + projectile.rotation += 0.4f * projectile.direction; + return; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, new Color(255, 255, 255, 128), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } +} diff --git a/Projectiles/Rogue/EnchantedAxe2.png b/Projectiles/Rogue/EnchantedAxe2.png new file mode 100644 index 0000000000..cdae20aa68 Binary files /dev/null and b/Projectiles/Rogue/EnchantedAxe2.png differ diff --git a/Projectiles/Rogue/MonkeyDart.cs b/Projectiles/Rogue/MonkeyDart.cs index 5c1092af5e..b84f564d57 100644 --- a/Projectiles/Rogue/MonkeyDart.cs +++ b/Projectiles/Rogue/MonkeyDart.cs @@ -65,7 +65,6 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[d].position = projectile.Center; dustsplash += 1; } - dustsplash = 0; //Randomly not consume item if it wasnt a stealth strike if (Main.rand.Next(4) == 0 && projectile.ai[0] != 1) diff --git a/Projectiles/Summon/BigBustyRose.cs b/Projectiles/Summon/BigBustyRose.cs index 07b9a1571c..1617efa967 100644 --- a/Projectiles/Summon/BigBustyRose.cs +++ b/Projectiles/Summon/BigBustyRose.cs @@ -143,7 +143,6 @@ namespace CalamityMod.Projectiles.Summon float num646 = Vector2.Distance(npc.Center, projectile.Center); if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { - num633 = num646; vector46 = npc.Center; flag25 = true; } diff --git a/Projectiles/Summon/BlackHawkSummon.cs b/Projectiles/Summon/BlackHawkSummon.cs index 48d9a56249..abbaeffbc1 100644 --- a/Projectiles/Summon/BlackHawkSummon.cs +++ b/Projectiles/Summon/BlackHawkSummon.cs @@ -149,7 +149,6 @@ namespace CalamityMod.Projectiles.Summon float num646 = Vector2.Distance(npc.Center, projectile.Center); if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) { - num633 = num646; vector46 = npc.Center; flag25 = true; } diff --git a/Projectiles/Summon/BloodClotMinion.cs b/Projectiles/Summon/BloodClotMinion.cs index e68098a888..9f39a3d42a 100644 --- a/Projectiles/Summon/BloodClotMinion.cs +++ b/Projectiles/Summon/BloodClotMinion.cs @@ -139,7 +139,6 @@ namespace CalamityMod.Projectiles.Summon float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); if (num541 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { - num537 = num541; num535 = num539; num536 = num540; flag19 = true; diff --git a/Projectiles/Summon/Calamari.cs b/Projectiles/Summon/Calamari.cs index abdfe33ec5..3e6fe48721 100644 --- a/Projectiles/Summon/Calamari.cs +++ b/Projectiles/Summon/Calamari.cs @@ -157,7 +157,6 @@ namespace CalamityMod.Projectiles.Summon Vector2 vector = projectile.position; float num10 = 300f; //300 bool flag = false; - int num11 = -1; Vector2 center = Main.player[projectile.owner].Center; Vector2 value = new Vector2(0.5f); value.Y = 0f; @@ -170,10 +169,9 @@ namespace CalamityMod.Projectiles.Summon float num12 = Vector2.Distance(vector2, center); if (((Vector2.Distance(center, vector) > num12 && num12 < num10) || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { - num10 = num12; vector = vector2; flag = true; - num11 = npc.whoAmI; + int num11 = npc.whoAmI; } } } @@ -191,7 +189,6 @@ namespace CalamityMod.Projectiles.Summon num10 = num13; vector = vector3; flag = true; - num11 = k; } } } diff --git a/Projectiles/Summon/Calamitamini.cs b/Projectiles/Summon/Calamitamini.cs index a0d6974d85..03d486567f 100644 --- a/Projectiles/Summon/Calamitamini.cs +++ b/Projectiles/Summon/Calamitamini.cs @@ -124,7 +124,6 @@ namespace CalamityMod.Projectiles.Summon float num646 = Vector2.Distance(npc.Center, projectile.Center); if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { - num633 = num646; vector46 = npc.Center; flag25 = true; } diff --git a/Projectiles/Summon/Cataclymini.cs b/Projectiles/Summon/Cataclymini.cs index 448c2aece8..803ac68ba6 100644 --- a/Projectiles/Summon/Cataclymini.cs +++ b/Projectiles/Summon/Cataclymini.cs @@ -123,7 +123,6 @@ namespace CalamityMod.Projectiles.Summon float num646 = Vector2.Distance(npc.Center, projectile.Center); if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { - num633 = num646; vector46 = npc.Center; flag25 = true; } diff --git a/Projectiles/Summon/ChaosSpirit.cs b/Projectiles/Summon/ChaosSpirit.cs index f6037a6cb4..624d46f00d 100644 --- a/Projectiles/Summon/ChaosSpirit.cs +++ b/Projectiles/Summon/ChaosSpirit.cs @@ -120,7 +120,6 @@ namespace CalamityMod.Projectiles.Summon float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); if (num541 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { - num508 = num541; num506 = num539; num507 = num540; flag18 = true; diff --git a/Projectiles/Summon/CosmicBlast.cs b/Projectiles/Summon/CosmicBlast.cs index de6f6bc836..a2e407251d 100644 --- a/Projectiles/Summon/CosmicBlast.cs +++ b/Projectiles/Summon/CosmicBlast.cs @@ -61,7 +61,6 @@ namespace CalamityMod.Projectiles.Summon float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); if (num478 < num474) { - num474 = num478; num472 = num476; num473 = num477; flag17 = true; diff --git a/Projectiles/Summon/CosmicBlastBig.cs b/Projectiles/Summon/CosmicBlastBig.cs index ae40edaae9..59397ee16c 100644 --- a/Projectiles/Summon/CosmicBlastBig.cs +++ b/Projectiles/Summon/CosmicBlastBig.cs @@ -75,7 +75,6 @@ namespace CalamityMod.Projectiles.Summon float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); if (num478 < num474) { - num474 = num478; num472 = num476; num473 = num477; flag17 = true; diff --git a/Projectiles/Summon/CosmicEnergy.cs b/Projectiles/Summon/CosmicEnergy.cs index 07315b7aae..944b46cdd4 100644 --- a/Projectiles/Summon/CosmicEnergy.cs +++ b/Projectiles/Summon/CosmicEnergy.cs @@ -106,7 +106,6 @@ namespace CalamityMod.Projectiles.Summon float num646 = Vector2.Distance(npc.Center, projectile.Center); if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) { - num633 = num646; vector46 = npc.Center; flag25 = true; target = npc.whoAmI; diff --git a/Projectiles/Summon/Cosmilamp.cs b/Projectiles/Summon/Cosmilamp.cs index ed1dacc4af..5754446e60 100644 --- a/Projectiles/Summon/Cosmilamp.cs +++ b/Projectiles/Summon/Cosmilamp.cs @@ -133,7 +133,6 @@ namespace CalamityMod.Projectiles.Summon float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); if (num541 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { - num537 = num541; num535 = num539; num536 = num540; flag19 = true; diff --git a/Projectiles/Summon/DaedalusCrystal.cs b/Projectiles/Summon/DaedalusCrystal.cs index c9d3f042dc..89b979f307 100644 --- a/Projectiles/Summon/DaedalusCrystal.cs +++ b/Projectiles/Summon/DaedalusCrystal.cs @@ -112,7 +112,6 @@ namespace CalamityMod.Projectiles.Summon float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); if (num541 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { - num508 = num541; num506 = num539; num507 = num540; flag18 = true; diff --git a/Projectiles/Summon/DankCreeper.cs b/Projectiles/Summon/DankCreeper.cs index 8c37dcb528..10b2d737c8 100644 --- a/Projectiles/Summon/DankCreeper.cs +++ b/Projectiles/Summon/DankCreeper.cs @@ -128,7 +128,6 @@ namespace CalamityMod.Projectiles.Summon float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); if (num541 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { - num537 = num541; num535 = num539; num536 = num540; flag19 = true; diff --git a/Projectiles/Summon/FlameBlast.cs b/Projectiles/Summon/FlameBlast.cs index 0e744a301b..ee8a28e625 100644 --- a/Projectiles/Summon/FlameBlast.cs +++ b/Projectiles/Summon/FlameBlast.cs @@ -78,7 +78,6 @@ namespace CalamityMod.Projectiles.Summon float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); if (num478 < num474) { - num474 = num478; num472 = num476; num473 = num477; flag17 = true; diff --git a/Projectiles/Summon/FlameBurst.cs b/Projectiles/Summon/FlameBurst.cs index 92a2b086c7..76662669a6 100644 --- a/Projectiles/Summon/FlameBurst.cs +++ b/Projectiles/Summon/FlameBurst.cs @@ -78,7 +78,6 @@ namespace CalamityMod.Projectiles.Summon float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); if (num478 < num474) { - num474 = num478; num472 = num476; num473 = num477; flag17 = true; diff --git a/Projectiles/Summon/GhostlyMine.cs b/Projectiles/Summon/GhostlyMine.cs index f3fc126826..1d5ffef5b6 100644 --- a/Projectiles/Summon/GhostlyMine.cs +++ b/Projectiles/Summon/GhostlyMine.cs @@ -48,7 +48,6 @@ namespace CalamityMod.Projectiles.Summon } Vector2 direction = Main.player[projectile.owner].Center - projectile.Center; direction.Normalize(); - direction *= 9f; Player player = Main.player[projectile.owner]; double deg = (double)projectile.ai[1]; double rad = deg * (Math.PI / 180); diff --git a/Projectiles/Summon/MechwormBody.cs b/Projectiles/Summon/MechwormBody.cs index 4232946ba0..344b84a2aa 100644 --- a/Projectiles/Summon/MechwormBody.cs +++ b/Projectiles/Summon/MechwormBody.cs @@ -68,15 +68,15 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } Vector2 value68 = Vector2.Zero; - float num1064 = 0f; - float scaleFactor17 = 0f; - float scaleFactor18 = 1f; if (projectile.ai[1] == 1f) { projectile.ai[1] = 0f; projectile.netUpdate = true; } int chase = (int)projectile.ai[0]; + float num1064; + float scaleFactor17; + float scaleFactor18; if (chase >= 0 && Main.projectile[chase].active) { value68 = Main.projectile[chase].Center; diff --git a/Projectiles/Summon/MechwormBody2.cs b/Projectiles/Summon/MechwormBody2.cs index 3b2717ea32..dba4f74489 100644 --- a/Projectiles/Summon/MechwormBody2.cs +++ b/Projectiles/Summon/MechwormBody2.cs @@ -68,15 +68,15 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } Vector2 value68 = Vector2.Zero; - float num1064 = 0f; - float scaleFactor17 = 0f; - float scaleFactor18 = 1f; if (projectile.ai[1] == 1f) { projectile.ai[1] = 0f; projectile.netUpdate = true; } int chase = (int)projectile.ai[0]; + float num1064; + float scaleFactor17; + float scaleFactor18; if (chase >= 0 && Main.projectile[chase].active) { value68 = Main.projectile[chase].Center; diff --git a/Projectiles/Summon/MechwormTail.cs b/Projectiles/Summon/MechwormTail.cs index ac3822a6b3..91b121c1a6 100644 --- a/Projectiles/Summon/MechwormTail.cs +++ b/Projectiles/Summon/MechwormTail.cs @@ -68,15 +68,15 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } Vector2 value68 = Vector2.Zero; - float num1064 = 0f; - float scaleFactor17 = 0f; - float scaleFactor18 = 1f; if (projectile.ai[1] == 1f) { projectile.ai[1] = 0f; projectile.netUpdate = true; } int chase = (int)projectile.ai[0]; + float num1064; + float scaleFactor17; + float scaleFactor18; if (chase >= 0 && Main.projectile[chase].active) { value68 = Main.projectile[chase].Center; diff --git a/Projectiles/Summon/PhantomGuy.cs b/Projectiles/Summon/PhantomGuy.cs index d830c2857b..a6f58a5ad7 100644 --- a/Projectiles/Summon/PhantomGuy.cs +++ b/Projectiles/Summon/PhantomGuy.cs @@ -109,7 +109,6 @@ namespace CalamityMod.Projectiles.Summon float num646 = Vector2.Distance(npc.Center, projectile.Center); if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) { - num633 = num646; vector46 = npc.Center; flag25 = true; } diff --git a/Projectiles/Summon/ProfanedEnergy.cs b/Projectiles/Summon/ProfanedEnergy.cs index d9d75eeac4..637a1969df 100644 --- a/Projectiles/Summon/ProfanedEnergy.cs +++ b/Projectiles/Summon/ProfanedEnergy.cs @@ -94,7 +94,6 @@ namespace CalamityMod.Projectiles.Summon float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); if (num541 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { - num508 = num541; num506 = num539; num507 = num540; flag18 = true; diff --git a/Projectiles/Summon/RedDevil.cs b/Projectiles/Summon/RedDevil.cs index ff81c873e4..261165ed3d 100644 --- a/Projectiles/Summon/RedDevil.cs +++ b/Projectiles/Summon/RedDevil.cs @@ -151,7 +151,6 @@ namespace CalamityMod.Projectiles.Summon float num646 = Vector2.Distance(npc.Center, projectile.Center); if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) { - num633 = num646; vector46 = npc.Center; flag25 = true; } diff --git a/Projectiles/Summon/Sandnado.cs b/Projectiles/Summon/Sandnado.cs index 61a3dbb316..1165cc1b0c 100644 --- a/Projectiles/Summon/Sandnado.cs +++ b/Projectiles/Summon/Sandnado.cs @@ -104,7 +104,6 @@ namespace CalamityMod.Projectiles.Summon Vector2 vector = projectile.position; float num10 = 400f; bool flag = false; - int num11 = -1; if (Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { projectile.alpha += 20; @@ -132,10 +131,9 @@ namespace CalamityMod.Projectiles.Summon float num12 = Vector2.Distance(vector2, center); if (((Vector2.Distance(center, vector) > num12 && num12 < num10) || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { - num10 = num12; vector = vector2; flag = true; - num11 = npc.whoAmI; + int num11 = npc.whoAmI; } } } @@ -153,7 +151,6 @@ namespace CalamityMod.Projectiles.Summon num10 = num13; vector = vector3; flag = true; - num11 = k; } } } diff --git a/Projectiles/Summon/SandyWaifu.cs b/Projectiles/Summon/SandyWaifu.cs index 9851713ceb..663fe185b3 100644 --- a/Projectiles/Summon/SandyWaifu.cs +++ b/Projectiles/Summon/SandyWaifu.cs @@ -135,7 +135,6 @@ namespace CalamityMod.Projectiles.Summon float num646 = Vector2.Distance(npc.Center, projectile.Center); if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) { - num633 = num646; vector46 = npc.Center; flag25 = true; } diff --git a/Projectiles/Summon/SirenLure.cs b/Projectiles/Summon/SirenLure.cs index 3910f9e0fa..4bf406bf46 100644 --- a/Projectiles/Summon/SirenLure.cs +++ b/Projectiles/Summon/SirenLure.cs @@ -120,7 +120,6 @@ namespace CalamityMod.Projectiles.Summon float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); if (num541 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { - num508 = num541; num506 = num539; num507 = num540; flag18 = true; diff --git a/Projectiles/Summon/SolarGod.cs b/Projectiles/Summon/SolarGod.cs index 2120d6cee7..e9e8c3599b 100644 --- a/Projectiles/Summon/SolarGod.cs +++ b/Projectiles/Summon/SolarGod.cs @@ -106,7 +106,6 @@ namespace CalamityMod.Projectiles.Summon float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); if (num541 < num398 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { - num398 = num541; num396 = num539; num397 = num540; flag11 = true; diff --git a/Projectiles/Summon/SolarPixie.cs b/Projectiles/Summon/SolarPixie.cs index 64c5545478..9cad40cf8e 100644 --- a/Projectiles/Summon/SolarPixie.cs +++ b/Projectiles/Summon/SolarPixie.cs @@ -106,7 +106,6 @@ namespace CalamityMod.Projectiles.Summon float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); if (num541 < num398 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { - num398 = num541; num396 = num539; num397 = num540; flag11 = true; diff --git a/Projectiles/SunkenSea/SerpentineBody.cs b/Projectiles/SunkenSea/SerpentineBody.cs index c851a6138e..cadb99739c 100644 --- a/Projectiles/SunkenSea/SerpentineBody.cs +++ b/Projectiles/SunkenSea/SerpentineBody.cs @@ -31,15 +31,15 @@ namespace CalamityMod.Projectiles.SunkenSea Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.55f / 255f, (255 - projectile.alpha) * 0.55f / 255f); int num1051 = 10; Vector2 value68 = Vector2.Zero; - float num1064 = 0f; - float scaleFactor17 = 0f; - float scaleFactor18 = 1f; if (projectile.ai[1] == 1f) { projectile.ai[1] = 0f; projectile.netUpdate = true; } int chase = (int)projectile.ai[0]; + float num1064; + float scaleFactor17; + float scaleFactor18; if (chase >= 0 && Main.projectile[chase].active) { value68 = Main.projectile[chase].Center; diff --git a/Projectiles/SunkenSea/SerpentineTail.cs b/Projectiles/SunkenSea/SerpentineTail.cs index 1689650786..ef2c2d3ffd 100644 --- a/Projectiles/SunkenSea/SerpentineTail.cs +++ b/Projectiles/SunkenSea/SerpentineTail.cs @@ -31,15 +31,15 @@ namespace CalamityMod.Projectiles.SunkenSea Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.25f / 255f); int num1051 = 10; Vector2 value68 = Vector2.Zero; - float num1064 = 0f; - float scaleFactor17 = 0f; - float scaleFactor18 = 1f; if (projectile.ai[1] == 1f) { projectile.ai[1] = 0f; projectile.netUpdate = true; } int chase = (int)projectile.ai[0]; + float num1064; + float scaleFactor17; + float scaleFactor18; if (chase >= 0 && Main.projectile[chase].active) { value68 = Main.projectile[chase].Center; diff --git a/Projectiles/Typeless/MomentumCapacitorOrb.cs b/Projectiles/Typeless/MomentumCapacitorOrb.cs new file mode 100644 index 0000000000..389a26c07e --- /dev/null +++ b/Projectiles/Typeless/MomentumCapacitorOrb.cs @@ -0,0 +1,59 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class MomentumCapacitorOrb : ModProjectile + { + public const float Radius = 180f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 4; + projectile.timeLeft = 600; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 8; + } + public override void AI() + { + if (Main.rand.NextBool(4)) + { + float numDust = MathHelper.TwoPi * Radius / 5f; + float angleIncrement = MathHelper.TwoPi / numDust; + Vector2 dustOffset = Vector2.UnitX * Radius; + dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); + for (int i = 0; i < (int)numDust; i++) + { + dustOffset = dustOffset.RotatedBy(angleIncrement); + int dustIndex = Dust.NewDust(projectile.Center, 1, 1, 226); + Main.dust[dustIndex].position = projectile.Center + dustOffset; + Main.dust[dustIndex].noGravity = true; + Main.dust[dustIndex].fadeIn = 1f; + Main.dust[dustIndex].velocity *= 0f; + Main.dust[dustIndex].scale = 0.5f; + } + } + for (int k = 0; k < Main.projectile.Length; k++) + { + if (Main.projectile[k].owner == projectile.owner && Main.projectile[k].Calamity().rogue && + !Main.projectile[k].Calamity().momentumCapacitatorBoost && Main.projectile[k].friendly) + { + Main.projectile[k].damage = (int)(Main.projectile[k].damage * 1.15f); + Main.projectile[k].Calamity().momentumCapacitatorBoost = true; + } + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Typeless/MomentumCapacitorOrb.png b/Projectiles/Typeless/MomentumCapacitorOrb.png new file mode 100644 index 0000000000..b676ed6204 Binary files /dev/null and b/Projectiles/Typeless/MomentumCapacitorOrb.png differ diff --git a/Projectiles/Typeless/TarraEnergy.cs b/Projectiles/Typeless/TarraEnergy.cs index 7a9d1344d1..3aa7c8b5eb 100644 --- a/Projectiles/Typeless/TarraEnergy.cs +++ b/Projectiles/Typeless/TarraEnergy.cs @@ -59,7 +59,6 @@ namespace CalamityMod.Projectiles.Typeless if (num139 == 0f) { projectile.localAI[0] = num138; - num139 = num138; } return false; } diff --git a/Tiles/FurnitureAshen/AshenSlab.cs b/Tiles/FurnitureAshen/AshenSlab.cs index 39e0cadaec..408a0f003a 100644 --- a/Tiles/FurnitureAshen/AshenSlab.cs +++ b/Tiles/FurnitureAshen/AshenSlab.cs @@ -33,11 +33,11 @@ namespace CalamityMod.Tiles.FurnitureAshen //Main.NewText(GetTileVariant(i, j)); int uniqueAnimationFrameX = Main.tileFrame[Type] + i; int uniqueAnimationFrameY = Main.tileFrame[Type] + j; - int xOffset = 0; //Used to shift the pattern tiles patterns int xPos = i % 2; int yPos = j % 3; int xPattern = i % 20 / 2; int yPattern = j % 30 / 3; + int xOffset; switch (xPattern) { case 0: @@ -272,11 +272,11 @@ namespace CalamityMod.Tiles.FurnitureAshen { int uniqueAnimationFrameX = 0; int uniqueAnimationFrameY = 0; - int xOffset = 0; //Used to shift the pattern tiles patterns int xPos = i % 2; int yPos = j % 3; int xPattern = i % 20 / 2; int yPattern = j % 30 / 3; + int xOffset; switch (xPattern) { case 0: diff --git a/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index 52f1a5de82..89d67aedd2 100644 --- a/Utilities/CalamityUtils.cs +++ b/Utilities/CalamityUtils.cs @@ -5,6 +5,7 @@ using CalamityMod.Projectiles; using CalamityMod.World; using Microsoft.Xna.Framework; using System.Collections.Generic; +using System.Linq; using Terraria; namespace CalamityMod @@ -43,6 +44,11 @@ namespace CalamityMod return player.Calamity().ZoneAbyss; } } + + public static bool InventoryHas(this Player player, params int[] items) + { + return player.inventory.Any(item => items.Contains(item.type)); + } #endregion #region NPC Utilities @@ -137,5 +143,9 @@ namespace CalamityMod list.Add(type); } #endregion + + #region Projectile Utilities + public static int CountProjectiles(int Type) => Main.projectile.Count(proj => proj.type == Type && proj.active); + #endregion } } diff --git a/Utilities/CustomTileFraming.cs b/Utilities/CustomTileFraming.cs index 75ab3a7b24..3586611b10 100644 --- a/Utilities/CustomTileFraming.cs +++ b/Utilities/CustomTileFraming.cs @@ -192,49 +192,38 @@ namespace CalamityMod.Utilities Tile tile7 = Main.tile[x + 1, y + 1]; Tile tile8 = Main.tile[x - 1, y - 1]; Tile tile9 = Main.tile[x + 1, y - 1]; - int num52 = -1; - int num53 = -1; - int num54 = -1; - int num55 = -1; - int num56 = -1; - int num57 = -1; - int num58 = -1; - int num59 = -1; if (tile4 != null && tile4.active()) { if (Main.tileStone[(int)tile4.type]) { - num55 = 1; } else { - num55 = (int)tile4.type; + int num55 = (int)tile4.type; } if (tile4.slope() == 1 || tile4.slope() == 3) { - num55 = -1; } } if (tile5 != null && tile5.active()) { if (Main.tileStone[(int)tile5.type]) { - num56 = 1; } else { - num56 = (int)tile5.type; + int num56 = (int)tile5.type; } if (tile5.slope() == 2 || tile5.slope() == 4) { - num56 = -1; } } + + int num53; if (tile2 != null && tile2.active()) { if (Main.tileStone[(int)tile2.type]) { - num53 = 1; } else { @@ -242,87 +231,72 @@ namespace CalamityMod.Utilities } if (tile2.slope() == 3 || tile2.slope() == 4) { - num53 = -1; } } if (tile3 != null && tile3.active()) { if (Main.tileStone[(int)tile3.type]) { - num58 = 1; } else { - num58 = (int)tile3.type; + int num58 = (int)tile3.type; } if (tile3.slope() == 1 || tile3.slope() == 2) { - num58 = -1; } } if (tile8 != null && tile8.active()) { if (Main.tileStone[(int)tile8.type]) { - num52 = 1; } else { - num52 = (int)tile8.type; + int num52 = (int)tile8.type; } } if (tile9 != null && tile9.active()) { if (Main.tileStone[(int)tile9.type]) { - num54 = 1; } else { - num54 = (int)tile9.type; + int num54 = (int)tile9.type; } } if (tile6 != null && tile6.active()) { if (Main.tileStone[(int)tile6.type]) { - num57 = 1; } else { - num57 = (int)tile6.type; + int num57 = (int)tile6.type; } } if (tile7 != null && tile7.active()) { if (Main.tileStone[(int)tile7.type]) { - num59 = 1; } else { - num59 = (int)tile7.type; + int num59 = (int)tile7.type; } } if (tile.slope() == 2) { - num53 = -1; - num55 = -1; } if (tile.slope() == 1) { - num53 = -1; - num56 = -1; } if (tile.slope() == 4) { - num58 = -1; - num55 = -1; } if (tile.slope() == 3) { - num58 = -1; - num56 = -1; } if (tile2 != null) diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index ea06957022..0ad1a91ad5 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -19,7 +19,7 @@ namespace CalamityMod.World { #region Vars public static int DoGSecondStageCountdown = 0; - + public static bool dragonScalesBought = false; private const int saveVersion = 0; //Boss Rush @@ -176,6 +176,7 @@ namespace CalamityMod.World defiled = false; armageddon = false; ironHeart = false; + dragonScalesBought = false; } #endregion @@ -265,6 +266,8 @@ namespace CalamityMod.World downed.Add("bossRushActive"); if (downedCLAM) downed.Add("clam"); + if (dragonScalesBought) + downed.Add("scales"); return new TagCompound { @@ -323,6 +326,7 @@ namespace CalamityMod.World abyssSide = downed.Contains("abyssSide"); bossRushActive = downed.Contains("bossRushActive"); downedCLAM = downed.Contains("clam"); + dragonScalesBought = downed.Contains("scales"); abyssChasmBottom = tag.GetInt("abyssChasmBottom"); } @@ -402,6 +406,7 @@ namespace CalamityMod.World bossRushActive = flags7[0]; downedOldDuke = flags7[1]; downedCLAM = flags7[2]; + dragonScalesBought = flags7[3]; } else { @@ -479,6 +484,7 @@ namespace CalamityMod.World flags7[0] = bossRushActive; flags7[1] = downedOldDuke; flags7[2] = downedCLAM; + flags7[3] = dragonScalesBought; writer.Write(flags); writer.Write(flags2); @@ -560,6 +566,7 @@ namespace CalamityMod.World bossRushActive = flags7[0]; downedOldDuke = flags7[1]; downedCLAM = flags7[2]; + dragonScalesBought = flags7[3]; abyssChasmBottom = reader.ReadInt32(); } diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index a742d96582..ccbd3a2f34 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -312,7 +312,6 @@ namespace CalamityMod.World Point point = new Point(WorldGen.UndergroundDesertLocation.Left + (WorldGen.UndergroundDesertLocation.Width / 2), WorldGen.UndergroundDesertLocation.Bottom + (WorldGen.UndergroundDesertLocation.Height / 3)); //Around the center of the Sunken Sea area ShapeData holeShape = new ShapeData(); - int radiusSmall = 0; float outerRadiusPercentage = (float)((double)WorldGen.genRand.Next(40, 56) * 0.01); //Small radius for ore patch to fit inside holes int sunkenSeaBottom = WorldGen.UndergroundDesertLocation.Bottom + (int)((double)WorldGen.UndergroundDesertLocation.Height * 0.7); int smallHoles = 0; @@ -382,7 +381,7 @@ namespace CalamityMod.World if (smallHoles < amt && WorldGen.genRand.Next(3) == 0 && !rectangle.Contains(point)) { smallHoles++; - radiusSmall = (int)(((float)WorldGen.genRand.Next(8, 11)) * size); + int radiusSmall = (int)(((float)WorldGen.genRand.Next(8, 11)) * size); WorldUtils.Gen(point, new Shapes.Circle(radiusSmall), Actions.Chain(new GenAction[] { new Modifiers.Blotches(2, 0.45).Output(holeShape), diff --git a/World/WorldGenerationMethods.cs b/World/WorldGenerationMethods.cs index 605091371a..81c86df98c 100644 --- a/World/WorldGenerationMethods.cs +++ b/World/WorldGenerationMethods.cs @@ -794,7 +794,7 @@ namespace CalamityMod.World case TileID.SmallPiles: if (tile.frameY == 18) { - ushort newType = 9999; + ushort newType; if (tile.frameX >= 1476 && tile.frameX <= 1674) { newType = (ushort)mod.TileType("AstralDesertMediumPiles"); @@ -830,7 +830,7 @@ namespace CalamityMod.World } else if (tile.frameY == 0) { - ushort newType3 = 9999; + ushort newType3; if (tile.frameX >= 972 && tile.frameX <= 1062) { newType3 = (ushort)mod.TileType("AstralDesertSmallPiles"); @@ -858,7 +858,7 @@ namespace CalamityMod.World int topMost = tile.frameY <= 54 ? (tile.frameY % 36 == 0 ? y : y - 1) : y; bool twoTall = tile.frameY <= 54; bool hanging = tile.frameY <= 18 || tile.frameY == 72; - ushort newType2 = 9999; + ushort newType2; if (tile.frameX >= 378 && tile.frameX <= 414) //DESERT { newType2 = (ushort)mod.TileType("AstralDesertStalactite"); @@ -1715,7 +1715,7 @@ namespace CalamityMod.World Main.tile[num9, num12].halfBrick(false); Main.tile[num9, num12].slope(0); } - int contain = 0; + int contain; if (WorldGen.crimson) { contain = 1571; //scourge