From 4e0de0e1305094e6f6ceab46279ce4a0cb0b9529 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 26 Feb 2020 15:18:11 -0500 Subject: [PATCH 1/8] various weapon balancing --- Items/Armor/VictideHeadgear.cs | 6 +- Items/Weapons/Magic/AbyssShocker.cs | 6 +- Items/Weapons/Magic/AlphaRay.cs | 2 +- Items/Weapons/Magic/Genisis.cs | 10 +-- Items/Weapons/Magic/MagnaCannon.cs | 4 +- Items/Weapons/Magic/Tradewinds.cs | 6 +- Items/Weapons/Melee/DevilsDevastation.cs | 2 +- Items/Weapons/Ranged/AquashardShotgun.cs | 6 +- Items/Weapons/Ranged/Barinade.cs | 4 +- Items/Weapons/Ranged/Norfleet.cs | 4 +- Items/Weapons/Ranged/Pumpler.cs | 10 +-- Items/Weapons/Ranged/SDFMG.cs | 4 +- Items/Weapons/Ranged/Seabow.cs | 4 +- Items/Weapons/Ranged/StarfleetMK2.cs | 4 +- Items/Weapons/Ranged/ThePack.cs | 8 +- Items/Weapons/Rogue/HeavenfallenStardisk.cs | 4 +- Items/Weapons/Rogue/SeafoamBomb.cs | 6 +- Projectiles/CalamityGlobalProjectile.cs | 4 +- Projectiles/Magic/BigBeamofDeath.cs | 2 +- Projectiles/Melee/Yoyos/CnidarianYoyo.cs | 2 +- Projectiles/Rogue/BallisticPoisonBombProj.cs | 2 +- Projectiles/Rogue/StellarKnifeProj.cs | 73 ++++++++++--------- Projectiles/Typeless/BallisticPoisonCloud.cs | 2 +- Projectiles/Typeless/BallisticPoisonCloud2.cs | 2 +- Projectiles/Typeless/BallisticPoisonCloud3.cs | 2 +- 25 files changed, 93 insertions(+), 86 deletions(-) diff --git a/Items/Armor/VictideHeadgear.cs b/Items/Armor/VictideHeadgear.cs index 93531458f1..50a02d3f2e 100644 --- a/Items/Armor/VictideHeadgear.cs +++ b/Items/Armor/VictideHeadgear.cs @@ -34,14 +34,14 @@ namespace CalamityMod.Items.Armor player.setBonus = "Increased life regen and rogue damage while submerged in liquid\n" + "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + "This seashell does true damage and does not benefit from any damage class\n" + - "Slightly reduces breath loss in the abyss\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 100\n" + + "Provides increased underwater mobility and slightly reduces breath loss in the abyss\n" + + "Rogue stealth builds while not attacking and not moving, up to a max of 90\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.victideSet = true; - modPlayer.rogueStealthMax += 1f; + modPlayer.rogueStealthMax += 0.9f; modPlayer.wearingRogueArmor = true; player.ignoreWater = true; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) diff --git a/Items/Weapons/Magic/AbyssShocker.cs b/Items/Weapons/Magic/AbyssShocker.cs index cd84a9747a..0d192ab7ec 100644 --- a/Items/Weapons/Magic/AbyssShocker.cs +++ b/Items/Weapons/Magic/AbyssShocker.cs @@ -17,14 +17,14 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 21; + item.damage = 28; item.noMelee = true; item.magic = true; item.channel = true; item.width = 86; item.height = 32; - item.useTime = 20; - item.useAnimation = 20; + item.useTime = 19; + item.useAnimation = 19; item.UseSound = SoundID.Item13; item.useStyle = 5; item.mana = 10; diff --git a/Items/Weapons/Magic/AlphaRay.cs b/Items/Weapons/Magic/AlphaRay.cs index 1a4ba247c4..0e77c061bf 100644 --- a/Items/Weapons/Magic/AlphaRay.cs +++ b/Items/Weapons/Magic/AlphaRay.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Items.Weapons.Magic value9 -= vector7; } Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, (int)((double)damage * 0.8), knockBack, player.whoAmI, 0.0f, 0.0f); - int laser = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX * 2f, speedY * 2f, 440, (int)((double)damage * 0.4), knockBack, player.whoAmI, 0.0f, 0.0f); + int laser = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX * 2f, speedY * 2f, ProjectileID.LaserMachinegunLaser, (int)((double)damage * 0.4), knockBack, player.whoAmI, 0.0f, 0.0f); Main.projectile[laser].timeLeft = 120; Main.projectile[laser].tileCollide = false; } diff --git a/Items/Weapons/Magic/Genisis.cs b/Items/Weapons/Magic/Genisis.cs index 16c7e991e4..4e3358bc7b 100644 --- a/Items/Weapons/Magic/Genisis.cs +++ b/Items/Weapons/Magic/Genisis.cs @@ -17,13 +17,13 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 65; + item.damage = 55; item.magic = true; item.mana = 4; item.width = 74; item.height = 28; - item.useTime = 3; - item.useAnimation = 3; + item.useTime = 4; + item.useAnimation = 4; item.useStyle = 5; item.noMelee = true; item.knockBack = 1.5f; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Magic item.autoReuse = true; item.shootSpeed = 6f; item.shoot = ModContent.ProjectileType(); - item.Calamity().customRarity = CalamityRarity.Turquoise; + item.Calamity().customRarity = CalamityRarity.Turquoise; //12 } public override Vector2? HoldoutOffset() @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Magic float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; for (int index = 0; index < num6; ++index) { - int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX * 1.05f, SpeedY * 1.05f, 440, (int)((double)damage * 0.75), knockBack, player.whoAmI, 0f, 0f); + int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX * 1.05f, SpeedY * 1.05f, ProjectileID.LaserMachinegunLaser, (int)((double)damage * 0.65), knockBack * 0.6f, player.whoAmI, 0f, 0f); Main.projectile[projectile].timeLeft = 120; } return false; diff --git a/Items/Weapons/Magic/MagnaCannon.cs b/Items/Weapons/Magic/MagnaCannon.cs index e95d0c25d1..2c2865967f 100644 --- a/Items/Weapons/Magic/MagnaCannon.cs +++ b/Items/Weapons/Magic/MagnaCannon.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 19; + item.damage = 16; item.magic = true; item.mana = 12; item.width = 56; @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Magic { for (int index = 0; index < 3; ++index) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)(double)damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Magic/Tradewinds.cs b/Items/Weapons/Magic/Tradewinds.cs index ea52e1d093..3da96ef656 100644 --- a/Items/Weapons/Magic/Tradewinds.cs +++ b/Items/Weapons/Magic/Tradewinds.cs @@ -16,13 +16,13 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 17; + item.damage = 22; item.magic = true; item.mana = 7; item.width = 28; item.height = 30; - item.useTime = 13; - item.useAnimation = 13; + item.useTime = 12; + item.useAnimation = 12; item.useStyle = 5; item.noMelee = true; item.knockBack = 5; diff --git a/Items/Weapons/Melee/DevilsDevastation.cs b/Items/Weapons/Melee/DevilsDevastation.cs index f451606dfd..6f8066883e 100644 --- a/Items/Weapons/Melee/DevilsDevastation.cs +++ b/Items/Weapons/Melee/DevilsDevastation.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 74; - item.damage = 470; + item.damage = 520; item.melee = true; item.useAnimation = 20; item.useTime = 20; diff --git a/Items/Weapons/Ranged/AquashardShotgun.cs b/Items/Weapons/Ranged/AquashardShotgun.cs index bab1525b74..65456aa44e 100644 --- a/Items/Weapons/Ranged/AquashardShotgun.cs +++ b/Items/Weapons/Ranged/AquashardShotgun.cs @@ -17,13 +17,13 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 12; + item.damage = 11; item.ranged = true; item.width = 62; item.height = 26; item.crit += 6; - item.useTime = 25; - item.useAnimation = 25; + item.useTime = 26; + item.useAnimation = 26; item.useStyle = 5; item.noMelee = true; item.knockBack = 5.5f; diff --git a/Items/Weapons/Ranged/Barinade.cs b/Items/Weapons/Ranged/Barinade.cs index 8267315809..5330a5f4bd 100644 --- a/Items/Weapons/Ranged/Barinade.cs +++ b/Items/Weapons/Ranged/Barinade.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Weapons.Ranged item.ranged = true; item.width = 30; item.height = 44; - item.useTime = 20; - item.useAnimation = 20; + item.useTime = 25; + item.useAnimation = 25; item.useStyle = 5; item.noMelee = true; item.knockBack = 2f; diff --git a/Items/Weapons/Ranged/Norfleet.cs b/Items/Weapons/Ranged/Norfleet.cs index ee010d0502..e0b2e0c08c 100644 --- a/Items/Weapons/Ranged/Norfleet.cs +++ b/Items/Weapons/Ranged/Norfleet.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 1280; + item.damage = 1000; item.knockBack = 15f; item.shootSpeed = 30f; item.useStyle = 5; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.ranged = true; item.channel = true; item.useTurn = false; - item.useAmmo = 75; + item.useAmmo = AmmoID.FallenStar; item.autoReuse = true; item.Calamity().customRarity = CalamityRarity.RareVariant; } diff --git a/Items/Weapons/Ranged/Pumpler.cs b/Items/Weapons/Ranged/Pumpler.cs index b4284b5287..a44e6dca1b 100644 --- a/Items/Weapons/Ranged/Pumpler.cs +++ b/Items/Weapons/Ranged/Pumpler.cs @@ -16,12 +16,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 9; + item.damage = 8; item.ranged = true; item.width = 50; item.height = 28; - item.useTime = 9; - item.useAnimation = 9; + item.useTime = 10; + item.useAnimation = 10; item.useStyle = 5; item.noMelee = true; item.knockBack = 1.25f; @@ -54,8 +54,8 @@ namespace CalamityMod.Items.Weapons.Ranged } else { - item.useTime = 9; - item.useAnimation = 9; + item.useTime = 10; + item.useAnimation = 10; item.shootSpeed = 11f; } return base.CanUseItem(player); diff --git a/Items/Weapons/Ranged/SDFMG.cs b/Items/Weapons/Ranged/SDFMG.cs index 2828158778..bff89b53bd 100644 --- a/Items/Weapons/Ranged/SDFMG.cs +++ b/Items/Weapons/Ranged/SDFMG.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 250; + item.damage = 240; item.ranged = true; item.width = 74; item.height = 34; - item.crit += 16; + item.crit += 15; item.useTime = 2; item.useAnimation = 2; item.useStyle = 5; diff --git a/Items/Weapons/Ranged/Seabow.cs b/Items/Weapons/Ranged/Seabow.cs index af9f165277..d1c96c3770 100644 --- a/Items/Weapons/Ranged/Seabow.cs +++ b/Items/Weapons/Ranged/Seabow.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 14; + item.damage = 11; item.ranged = true; item.width = 22; item.height = 46; @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Ranged { 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 * 0.5f, SpeedY * 0.5f, ModContent.ProjectileType(), (int)((double)damage * 0.5), 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX * 0.5f, SpeedY * 0.5f, ModContent.ProjectileType(), (int)((double)damage * 0.4), 0f, player.whoAmI, 0f, 0f); return true; } diff --git a/Items/Weapons/Ranged/StarfleetMK2.cs b/Items/Weapons/Ranged/StarfleetMK2.cs index e00d679049..cfa9d84948 100644 --- a/Items/Weapons/Ranged/StarfleetMK2.cs +++ b/Items/Weapons/Ranged/StarfleetMK2.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 308; + item.damage = 291; item.knockBack = 15f; item.shootSpeed = 16f; item.useStyle = 5; @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.ranged = true; item.channel = true; item.useTurn = false; - item.useAmmo = 75; + item.useAmmo = AmmoID.FallenStar; item.autoReuse = true; item.Calamity().customRarity = CalamityRarity.DarkBlue; } diff --git a/Items/Weapons/Ranged/ThePack.cs b/Items/Weapons/Ranged/ThePack.cs index ee0a5f47b7..ae752a3fb3 100644 --- a/Items/Weapons/Ranged/ThePack.cs +++ b/Items/Weapons/Ranged/ThePack.cs @@ -18,13 +18,13 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 3000; - item.crit += 10; + item.damage = 2750; + item.crit += 9; item.ranged = true; item.width = 96; item.height = 40; - item.useTime = 50; - item.useAnimation = 50; + item.useTime = 51; + item.useAnimation = 51; item.useStyle = 5; item.noMelee = true; item.knockBack = 7.5f; diff --git a/Items/Weapons/Rogue/HeavenfallenStardisk.cs b/Items/Weapons/Rogue/HeavenfallenStardisk.cs index 8fca139416..cfc0d8be80 100644 --- a/Items/Weapons/Rogue/HeavenfallenStardisk.cs +++ b/Items/Weapons/Rogue/HeavenfallenStardisk.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Rogue { item.width = 38; item.height = 34; - item.damage = 165; + item.damage = 145; item.crit += 20; item.noMelee = true; item.noUseGraphic = true; @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Rogue } else { - Projectile.NewProjectile(position.X, position.Y, 0f, -10f, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, 0f, -10f, type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Rogue/SeafoamBomb.cs b/Items/Weapons/Rogue/SeafoamBomb.cs index bdd5e761b4..a51080fc3b 100644 --- a/Items/Weapons/Rogue/SeafoamBomb.cs +++ b/Items/Weapons/Rogue/SeafoamBomb.cs @@ -20,12 +20,12 @@ Stealth strikes are faster and explode into 5 bubbles"); { item.width = 26; item.height = 44; - item.damage = 16; + item.damage = 12; item.noMelee = true; item.noUseGraphic = true; - item.useAnimation = 22; + item.useAnimation = 25; item.useStyle = 1; - item.useTime = 22; + item.useTime = 25; item.knockBack = 8f; item.UseSound = SoundID.Item1; item.autoReuse = true; diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 7d584fd0c2..891ad1a274 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -2002,7 +2002,7 @@ namespace CalamityMod.Projectiles float maxDistance = distanceRequired; bool homeIn = false; - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].CanBeChasedBy(projectile, false)) { @@ -2038,7 +2038,7 @@ namespace CalamityMod.Projectiles int[] targetArray = new int[maxTargets]; int targetArrayIndex = 0; - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].CanBeChasedBy(projectile, false)) { diff --git a/Projectiles/Magic/BigBeamofDeath.cs b/Projectiles/Magic/BigBeamofDeath.cs index 9bb29400e4..38c81d0612 100644 --- a/Projectiles/Magic/BigBeamofDeath.cs +++ b/Projectiles/Magic/BigBeamofDeath.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), (int)(double)projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Melee/Yoyos/CnidarianYoyo.cs b/Projectiles/Melee/Yoyos/CnidarianYoyo.cs index 72979280f7..9417f5e7fe 100644 --- a/Projectiles/Melee/Yoyos/CnidarianYoyo.cs +++ b/Projectiles/Melee/Yoyos/CnidarianYoyo.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void AI() { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 60f, 5, ModContent.ProjectileType(), 0.33); + CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 60f, 5, ModContent.ProjectileType(), 0.5); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/BallisticPoisonBombProj.cs b/Projectiles/Rogue/BallisticPoisonBombProj.cs index a7ebd15eee..eca2c6479b 100644 --- a/Projectiles/Rogue/BallisticPoisonBombProj.cs +++ b/Projectiles/Rogue/BallisticPoisonBombProj.cs @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); vector15.Normalize(); vector15 *= (float)Main.rand.Next(10, 201) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType() + Main.rand.Next(3), (int)((double)projectile.damage * 0.5), 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType() + Main.rand.Next(3), (int)((double)projectile.damage * 0.3), 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); num3 = num321; } } diff --git a/Projectiles/Rogue/StellarKnifeProj.cs b/Projectiles/Rogue/StellarKnifeProj.cs index 811ed0ff72..c5eebf5606 100644 --- a/Projectiles/Rogue/StellarKnifeProj.cs +++ b/Projectiles/Rogue/StellarKnifeProj.cs @@ -32,6 +32,11 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { + //synthesized timeLeft + projectile.localAI[1]++; + if (projectile.localAI[1] > 600f) + projectile.Kill(); + if (projectile.ai[0] == 1f) { projectile.ai[0] = 0f; @@ -52,39 +57,41 @@ namespace CalamityMod.Projectiles.Rogue { projectile.rotation -= 1.57f; } - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 600f; - bool homeIn = false; - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) - { - float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); - float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); - 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; - } - } - } - if (homeIn) - { - float num483 = 30f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 10f + num484) / 11f; - projectile.velocity.Y = (projectile.velocity.Y * 10f + num485) / 11f; - } + projectile.localAI[0]++; + + Vector2 center = projectile.Center; + float maxDistance = 600f; + bool homeIn = false; + + if (projectile.localAI[0] >= 20f && !homeIn) //shorten knife lifespan if it hasn't found a target + if (projectile.timeLeft >= 60) + projectile.timeLeft = 60; + + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + { + float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); + + if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance)) + { + center = Main.npc[i].Center; + homeIn = true; + break; + } + } + } + + if (homeIn) + { + projectile.timeLeft = 600; //when homing in, the projectile cannot run out of timeLeft, but synthesized timeLeft still runs + + Vector2 homeInVector = projectile.DirectionTo(center); + if (homeInVector.HasNaNs()) + homeInVector = Vector2.UnitY; + + projectile.velocity = (projectile.velocity * 10f + homeInVector * 30f) / (10f + 1f); + } else { projectile.velocity.X *= 0.92f; diff --git a/Projectiles/Typeless/BallisticPoisonCloud.cs b/Projectiles/Typeless/BallisticPoisonCloud.cs index ecdde6f8f6..d2a0a701dd 100644 --- a/Projectiles/Typeless/BallisticPoisonCloud.cs +++ b/Projectiles/Typeless/BallisticPoisonCloud.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.ignoreWater = true; projectile.timeLeft = 3600; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + projectile.localNPCHitCooldown = 40; } public override void AI() diff --git a/Projectiles/Typeless/BallisticPoisonCloud2.cs b/Projectiles/Typeless/BallisticPoisonCloud2.cs index 0e44037c13..06e12c4d98 100644 --- a/Projectiles/Typeless/BallisticPoisonCloud2.cs +++ b/Projectiles/Typeless/BallisticPoisonCloud2.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.ignoreWater = true; projectile.timeLeft = 3600; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + projectile.localNPCHitCooldown = 40; } public override void AI() diff --git a/Projectiles/Typeless/BallisticPoisonCloud3.cs b/Projectiles/Typeless/BallisticPoisonCloud3.cs index caa48fea6e..29ff512173 100644 --- a/Projectiles/Typeless/BallisticPoisonCloud3.cs +++ b/Projectiles/Typeless/BallisticPoisonCloud3.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.ignoreWater = true; projectile.timeLeft = 3600; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + projectile.localNPCHitCooldown = 40; } public override void AI() From fbb23e2ed6029aefdd2591c9c0308b9b5880b2d8 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 26 Feb 2020 16:09:59 -0500 Subject: [PATCH 2/8] buffs to hoverboard and leaf wings, nerf to spooky wings --- CalPlayer/CalamityPlayer.cs | 5 +- CalPlayer/CalamityPlayerMiscEffects.cs | 2 +- Items/CalamityGlobalItem.cs | 63 ++++++++++++++++++++++---- 3 files changed, 58 insertions(+), 12 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 43525deca8..b8ea136de2 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -482,6 +482,7 @@ namespace CalamityMod.CalPlayer public bool reaverSpore = false; public bool reaverDoubleTap = false; public bool flamethrowerBoost = false; + public bool hoverboardBoost = false; //hoverboard + shroomite visage public bool shadeRegen = false; public bool shadowSpeed = false; public bool dsSetBonus = false; @@ -1091,6 +1092,7 @@ namespace CalamityMod.CalPlayer shadeRegen = false; flamethrowerBoost = false; + hoverboardBoost = false; //hoverboard + shroomite visage shadowSpeed = false; dsSetBonus = false; @@ -1711,6 +1713,7 @@ namespace CalamityMod.CalPlayer #region Armorbonuses flamethrowerBoost = false; + hoverboardBoost = false; //hoverboard + shroomite visage shadowSpeed = false; godSlayer = false; godSlayerDamage = false; @@ -3417,7 +3420,7 @@ namespace CalamityMod.CalPlayer } if (flamethrowerBoost && item.ranged && (item.useAmmo == 23 || item.type == ModContent.ItemType())) { - add += 0.25f; + add += hoverboardBoost ? 0.35f : 0.25f; } if (cinnamonRoll && CalamityMod.fireWeaponList.Contains(item.type)) { diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index c21bd0a59f..b2769ab4d2 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -2459,7 +2459,7 @@ namespace CalamityMod.CalPlayer } if (player.ZoneJungle && CalamityMod.natureWeaponList.Contains(player.inventory[player.selectedItem].type)) - player.AddBuff(165, 5, true); // Dryad's Blessing + player.AddBuff(BuffID.DryadsWard, 5, true); // Dryad's Blessing if (modPlayer.ZoneAbyss) { diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 1c2c1897de..705e2cf3e6 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -1424,7 +1424,9 @@ Provides heat and cold protection in Death Mode"; "Horizontal speed: 6.75\n" + "Acceleration multiplier: 1\n" + "Average vertical speed\n" + - "Flight time: 160"; + "Flight time: 160\n" + + "+10 defense, 10% increased damage reduction,\n" + + "and the Dryad's permanent blessing while wearing the Tiki Armor"; } } } @@ -1488,7 +1490,7 @@ Provides heat and cold protection in Death Mode"; "Acceleration multiplier: 1\n" + "Average vertical speed\n" + "Flight time: 180\n" + - "+1 max minion and 10% increased minion damage while wearing the Spooky Armor"; + "+1 max minion and 5% increased minion damage while wearing the Spooky Armor"; } } } @@ -1499,10 +1501,13 @@ Provides heat and cold protection in Death Mode"; if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { line2.text = "Allows flight and slow fall\n" + + "Hold DOWN and JUMP to hover\n" + "Horizontal speed: 6.25\n" + "Acceleration multiplier: 1\n" + "Average vertical speed\n" + - "Flight time: 170"; + "Flight time: 170\n" + + "10% increased damage to bows, guns, rocket launchers, and flamethrowers while wearing the Shroomite Armor\n" + + "Boosted weapon type depends on the Shroomite Helmet worn"; } } } @@ -1576,6 +1581,7 @@ Provides heat and cold protection in Death Mode"; if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { line2.text = "Allows flight and slow fall\n" + + "Hold DOWN and JUMP to hover\n" + "Horizontal speed: 6.5\n" + "Acceleration multiplier: 1.5\n" + "Good vertical speed\n" + @@ -1592,6 +1598,7 @@ Provides heat and cold protection in Death Mode"; if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { line2.text = "Allows flight and slow fall\n" + + "Hold DOWN and JUMP to hover\n" + "Horizontal speed: 6.5\n" + "Acceleration multiplier: 1.5\n" + "Good vertical speed\n" + @@ -1609,6 +1616,7 @@ Provides heat and cold protection in Death Mode"; { line2.text = "Equipable\n" + "Allows flight and slow fall\n" + + "Hold DOWN and JUMP to hover\n" + "Horizontal speed: 6\n" + "Acceleration multiplier: 2.5\n" + "Good vertical speed\n" + @@ -2279,12 +2287,12 @@ Provides heat and cold protection in Death Mode"; #region Head if (item.type == ItemID.SpectreHood) player.magicDamage += 0.2f; - else if (item.type == (ItemID.GladiatorHelmet | ItemID.ObsidianHelm)) + else if (item.type == ItemID.GladiatorHelmet || item.type == ItemID.ObsidianHelm) player.Calamity().throwingDamage += 0.03f; #endregion #region Body - if (item.type == (ItemID.GladiatorBreastplate | ItemID.ObsidianShirt)) + if (item.type == ItemID.GladiatorBreastplate || item.type == ItemID.ObsidianShirt) player.Calamity().throwingCrit += 3; else if (item.type == ItemID.PalladiumBreastplate) player.Calamity().throwingCrit += 2; @@ -2303,7 +2311,7 @@ Provides heat and cold protection in Death Mode"; #endregion #region Legs - if (item.type == (ItemID.GladiatorLeggings | ItemID.ObsidianPants)) + if (item.type == ItemID.GladiatorLeggings || item.type == ItemID.ObsidianPants) player.Calamity().throwingVelocity += 0.03f; else if (item.type == ItemID.PalladiumLeggings) player.Calamity().throwingCrit += 1; @@ -2465,6 +2473,39 @@ Provides heat and cold protection in Death Mode"; } } } + else if (item.type == ItemID.Hoverboard) // Boosted ranged stats while wearing shroomite armor + { + player.noFallDmg = true; + if (player.body == ArmorIDs.Body.ShroomiteBreastplate && player.legs == ArmorIDs.Legs.ShroomiteLeggings) + { + if (player.head == ArmorIDs.Head.ShroomiteHeadgear) //arrows + { + player.arrowDamage += 0.05f; + } + else if (player.head == ArmorIDs.Head.ShroomiteMask) //bullets + { + player.bulletDamage += 0.05f; + } + else if (player.head == ArmorIDs.Head.ShroomiteHelmet) //rockets + { + player.rocketDamage += 0.05f; + } + else if (player.Calamity().flamethrowerBoost) //flamethrowers + { + player.Calamity().hoverboardBoost = true; + } + } + } + else if (item.type == ItemID.LeafWings) // Bonus to defensive stats while wearing tiki armor + { + player.noFallDmg = true; + if (player.head == ArmorIDs.Head.TikiMask && player.body == ArmorIDs.Body.TikiShirt && player.legs == ArmorIDs.Legs.TikiPants) + { + player.statDefense += 10; + player.endurance += 0.1f; + player.AddBuff(BuffID.DryadsWard, 5, true); // Dryad's Blessing + } + } else if (item.type == ItemID.FestiveWings) // Drop powerful homing christmas tree bulbs while in flight { player.noFallDmg = true; @@ -2476,7 +2517,7 @@ Provides heat and cold protection in Death Mode"; if (player.head == ArmorIDs.Head.SpookyHelmet && player.body == ArmorIDs.Body.SpookyBreastplate && player.legs == ArmorIDs.Legs.SpookyLeggings) { player.maxMinions++; - player.minionDamage += 0.1f; + player.minionDamage += 0.05f; } } else if (item.type == ItemID.TatteredFairyWings) @@ -2531,9 +2572,11 @@ Provides heat and cold protection in Death Mode"; player.minionDamage += 0.05f; } } - else if (item.type == (ItemID.FishronWings | ItemID.BetsyWings | ItemID.Yoraiz0rWings | ItemID.JimsWings | ItemID.SkiphsWings | - ItemID.LokisWings | ItemID.ArkhalisWings | ItemID.LeinforsWings | ItemID.BejeweledValkyrieWing | ItemID.RedsWings | ItemID.DTownsWings | - ItemID.WillsWings | ItemID.CrownosWings | ItemID.CenxsWings | ItemID.Hoverboard | ItemID.LeafWings)) + else if (item.type == ItemID.FishronWings || item.type == ItemID.BetsyWings || item.type == ItemID.Yoraiz0rWings || + item.type == ItemID.JimsWings || item.type == ItemID.SkiphsWings || item.type == ItemID.LokisWings || + item.type == ItemID.ArkhalisWings || item.type == ItemID.LeinforsWings || item.type == ItemID.BejeweledValkyrieWing || + item.type == ItemID.RedsWings || item.type == ItemID.DTownsWings || item.type == ItemID.WillsWings || + item.type == ItemID.CrownosWings || item.type == ItemID.CenxsWings) { player.noFallDmg = true; } From 5938795f54aa2d4d1ee3c0bcaff3137d2fb3c68f Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 26 Feb 2020 16:58:08 -0500 Subject: [PATCH 3/8] slayer of the ancients, a god rises to the top --- .../Vanity/AncientGodSlayerChestplate.cs | 22 ++++++++++++ .../Vanity/AncientGodSlayerChestplate.png | Bin 0 -> 471 bytes .../AncientGodSlayerChestplate_Arms.png | Bin 0 -> 2436 bytes .../AncientGodSlayerChestplate_Body.png | Bin 0 -> 3831 bytes .../AncientGodSlayerChestplate_FemaleBody.png | Bin 0 -> 3831 bytes Items/Armor/Vanity/AncientGodSlayerHelm.cs | 32 ++++++++++++++++++ Items/Armor/Vanity/AncientGodSlayerHelm.png | Bin 0 -> 384 bytes .../Vanity/AncientGodSlayerHelm_Head.png | Bin 0 -> 1914 bytes .../Armor/Vanity/AncientGodSlayerLeggings.cs | 22 ++++++++++++ .../Armor/Vanity/AncientGodSlayerLeggings.png | Bin 0 -> 405 bytes .../Vanity/AncientGodSlayerLeggings_Legs.png | Bin 0 -> 2673 bytes NPCs/CeaselessVoid/CeaselessVoid.cs | 6 ++++ NPCs/Signus/Signus.cs | 6 ++++ NPCs/StormWeaver/StormWeaverHeadNaked.cs | 6 ++++ 14 files changed, 94 insertions(+) create mode 100644 Items/Armor/Vanity/AncientGodSlayerChestplate.cs create mode 100644 Items/Armor/Vanity/AncientGodSlayerChestplate.png create mode 100644 Items/Armor/Vanity/AncientGodSlayerChestplate_Arms.png create mode 100644 Items/Armor/Vanity/AncientGodSlayerChestplate_Body.png create mode 100644 Items/Armor/Vanity/AncientGodSlayerChestplate_FemaleBody.png create mode 100644 Items/Armor/Vanity/AncientGodSlayerHelm.cs create mode 100644 Items/Armor/Vanity/AncientGodSlayerHelm.png create mode 100644 Items/Armor/Vanity/AncientGodSlayerHelm_Head.png create mode 100644 Items/Armor/Vanity/AncientGodSlayerLeggings.cs create mode 100644 Items/Armor/Vanity/AncientGodSlayerLeggings.png create mode 100644 Items/Armor/Vanity/AncientGodSlayerLeggings_Legs.png diff --git a/Items/Armor/Vanity/AncientGodSlayerChestplate.cs b/Items/Armor/Vanity/AncientGodSlayerChestplate.cs new file mode 100644 index 0000000000..c1f2a160e7 --- /dev/null +++ b/Items/Armor/Vanity/AncientGodSlayerChestplate.cs @@ -0,0 +1,22 @@ +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Body)] + public class AncientGodSlayerChestplate : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ancient God Slayer Chestplate"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.Calamity().customRarity = (CalamityRarity)14; + item.vanity = true; + item.value = Item.buyPrice(0, 60, 0, 0); + } + } +} diff --git a/Items/Armor/Vanity/AncientGodSlayerChestplate.png b/Items/Armor/Vanity/AncientGodSlayerChestplate.png new file mode 100644 index 0000000000000000000000000000000000000000..c7da0556f990ac04caa93baadfca5eae21d7c6c3 GIT binary patch literal 471 zcmV;|0Vw{7P)Yhp?l58#Cs#j)VRW|`W}%^mIf^I5ge1ZIoyRtSX36pZ0IPfT z?m3D%=Wm=u(GT}A-7OXr6i10u0d8Kf%U~{-lTrZlWmUw%bX`X!)~If(Xa|cwzVi}H zKYI26C8R!l{fwfIalkD$*0l$_=fFgSe(P+8WsXDAEEPMaSMx6m`~Bohx>TI zES3O+CC<@PD=gyBQ$Gin09Nx}ynYN8hx?fB7Qo0x%zzuVMLi_L>P`aai2G zcm>JF??1f3TE^on_y^2lc-%vM4v%vlNNPm~AHG0RKMdgVDNLSVRR{C=fLUy;=Y--T zQzK(A|Ma=DDB@=??ZX?lB>Q;4EQY1-0IyIKpTc~;VcTl3IHA-`vXAL*F?#BT1vz>g z6C1Zg`*^@D#^nG~eM+*A2i#(G2M{WuuoiR3wG%D{xWr*48o3q&06~>YdV`m4%m4rY N07*qoM6N<$f&edy&dLA) literal 0 HcmV?d00001 diff --git a/Items/Armor/Vanity/AncientGodSlayerChestplate_Arms.png b/Items/Armor/Vanity/AncientGodSlayerChestplate_Arms.png new file mode 100644 index 0000000000000000000000000000000000000000..3b6792331610275e831c3fecde6b6b84476ab562 GIT binary patch literal 2436 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 WLzZtjYDkZ$0I<33CF-}HG5-Xd?k`yY literal 0 HcmV?d00001 diff --git a/Items/Armor/Vanity/AncientGodSlayerChestplate_FemaleBody.png b/Items/Armor/Vanity/AncientGodSlayerChestplate_FemaleBody.png new file mode 100644 index 0000000000000000000000000000000000000000..7992b4d30a3c938161d5038db2e150d66a9a71f7 GIT binary patch literal 3831 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 VvV6-?LwZC7fX!_$Q@`() && legs.type == ModContent.ItemType(); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + } +} diff --git a/Items/Armor/Vanity/AncientGodSlayerHelm.png b/Items/Armor/Vanity/AncientGodSlayerHelm.png new file mode 100644 index 0000000000000000000000000000000000000000..95687a9e9aefe45f5aded5959ff49c8a41dbcf93 GIT binary patch literal 384 zcmV-`0e}99P)pE1(hVDvEEx^)}aC8w_+Kyj(NzY~g2VpC(ld}CD$6!mZy)68I47^AyTNksw0 zg{s<0C}G+(p$^Rd_vZ&nI>!iOsu>J(4tjEf`GEJXD~gNl@>s$ALz8}k=>z|o!Sut2 zcTqAM&U8$%!7!JqD_etYzIpd3m~JTP!WyaAd!0BSD8;l-ixPk`V<=b~{h2*qrC-J8W^khdUNJusqSGq>`850W!R+qxm5v)Pb e4TSLt84Li(8~msGqR=A%0000i(P=vF< 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 bYb+b+i2WJq?(), 10); DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + if (Main.rand.NextBool(20)) + { + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + } // Other bool lastSentinelKilled = !CalamityWorld.downedSentinel1 && CalamityWorld.downedSentinel2 && CalamityWorld.downedSentinel3; diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index 3104d9ec74..96683ae9ce 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -757,6 +757,12 @@ namespace CalamityMod.NPCs.Signus // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + if (Main.rand.NextBool(20)) + { + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + } // Other bool lastSentinelKilled = CalamityWorld.downedSentinel1 && CalamityWorld.downedSentinel2 && !CalamityWorld.downedSentinel3; diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs index 44261b12fd..e0dc7a035d 100644 --- a/NPCs/StormWeaver/StormWeaverHeadNaked.cs +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -624,6 +624,12 @@ namespace CalamityMod.NPCs.StormWeaver // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + if (Main.rand.NextBool(20)) + { + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + } // Other bool lastSentinelKilled = CalamityWorld.downedSentinel1 && !CalamityWorld.downedSentinel2 && CalamityWorld.downedSentinel3; From b4254933f9397bb15cec9e1ebc3757b0a8e2b7e5 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 26 Feb 2020 16:58:40 -0500 Subject: [PATCH 4/8] perf worms and clone bros have their own health bar now --- UI/BossHealthBarManager.cs | 82 +++++++------------------------------- 1 file changed, 14 insertions(+), 68 deletions(-) diff --git a/UI/BossHealthBarManager.cs b/UI/BossHealthBarManager.cs index 1b11466aa5..849db2c543 100644 --- a/UI/BossHealthBarManager.cs +++ b/UI/BossHealthBarManager.cs @@ -136,24 +136,12 @@ namespace CalamityMod.UI OneToMany[ModContent.NPCType()] = StarWorm; OneToMany[ModContent.NPCType()] = StarWorm; - int[] Cal = new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }; - OneToMany[ModContent.NPCType()] = Cal; - OneToMany[ModContent.NPCType()] = Cal; - OneToMany[ModContent.NPCType()] = Cal; - int[] Void = new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }; OneToMany[ModContent.NPCType()] = Void; OneToMany[ModContent.NPCType()] = Void; OneToMany[ModContent.NPCType()] = Void; OneToMany[ModContent.NPCType()] = Void; - int[] Perfs = new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), - ModContent.NPCType() }; - OneToMany[ModContent.NPCType()] = Perfs; - OneToMany[ModContent.NPCType()] = Perfs; - OneToMany[ModContent.NPCType()] = Perfs; - OneToMany[ModContent.NPCType()] = Perfs; - int[] Rav = new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }; OneToMany[ModContent.NPCType()] = Rav; @@ -243,6 +231,9 @@ namespace CalamityMod.UI //Prehardmode ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType() //Hardmode ModContent.NPCType(), @@ -250,6 +241,8 @@ namespace CalamityMod.UI ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), //Clone's brothers + ModContent.NPCType() //Abyss ModContent.NPCType(), @@ -453,9 +446,7 @@ namespace CalamityMod.UI enum SpecialType2 : byte { None, - Calam, Ceaseless, - Perforator, Ravage, SlimeCore } @@ -494,18 +485,10 @@ namespace CalamityMod.UI { _special2 = SpecialType2.Ravage; } - else if (type == ModContent.NPCType()) - { - _special2 = SpecialType2.Perforator; - } else if (type == ModContent.NPCType()) { _special2 = SpecialType2.Ceaseless; } - else if (type == ModContent.NPCType()) - { - _special2 = SpecialType2.Calam; - } else if (type == ModContent.NPCType()) { _special = SpecialType.Astrum; @@ -700,22 +683,11 @@ namespace CalamityMod.UI { default: break; - case SpecialType2.Calam: - int count = NPC.CountNPCS(ModContent.NPCType()) + - NPC.CountNPCS(ModContent.NPCType()); - _specialData2[0] = count; - break; case SpecialType2.Ceaseless: int count2 = NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()); - _specialData2[1] = count2; - break; - case SpecialType2.Perforator: - int count3 = NPC.CountNPCS(ModContent.NPCType()) + - NPC.CountNPCS(ModContent.NPCType()) + - NPC.CountNPCS(ModContent.NPCType()); - _specialData2[2] = count3; + _specialData2[0] = count; break; case SpecialType2.Ravage: int count4 = NPC.CountNPCS(ModContent.NPCType()) + @@ -723,14 +695,14 @@ namespace CalamityMod.UI NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()); - _specialData2[3] = count4; + _specialData2[1] = count3; break; case SpecialType2.SlimeCore: int count5 = NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()); - _specialData2[4] = count5; + _specialData2[2] = count4; break; } } @@ -842,32 +814,20 @@ namespace CalamityMod.UI { default: break; - case SpecialType2.Calam: - string count = "(Brothers left: " + _specialData2[0] + ")"; - Vector2 countSize = Main.fontItemStack.MeasureString(count) * textScale; - float countX = Math.Max(x, x + mainBarWidth - countSize.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count, new Vector2(countX, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; case SpecialType2.Ceaseless: - string count2 = "(Dark Energy left: " + _specialData2[1] + ")"; + string count2 = "(Dark Energy left: " + _specialData2[0] + ")"; Vector2 countSize2 = Main.fontItemStack.MeasureString(count2) * textScale; float countX2 = Math.Max(x, x + mainBarWidth - countSize2.X); DrawBorderStringEightWay(sb, Main.fontItemStack, count2, new Vector2(countX2, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); return; - case SpecialType2.Perforator: - string count3 = "(Worms left: " + _specialData2[2] + ")"; - Vector2 countSize3 = Main.fontItemStack.MeasureString(count3) * textScale; - float countX3 = Math.Max(x, x + mainBarWidth - countSize3.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count3, new Vector2(countX3, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; case SpecialType2.Ravage: - string count4 = "(Body Parts left: " + _specialData2[3] + ")"; + string count4 = "(Body Parts left: " + _specialData2[1] + ")"; Vector2 countSize4 = Main.fontItemStack.MeasureString(count4) * textScale; float countX4 = Math.Max(x, x + mainBarWidth - countSize4.X); DrawBorderStringEightWay(sb, Main.fontItemStack, count4, new Vector2(countX4, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); return; case SpecialType2.SlimeCore: - string count5 = "(Large Slimes left: " + _specialData2[4] + ")"; + string count5 = "(Large Slimes left: " + _specialData2[2] + ")"; Vector2 countSize5 = Main.fontItemStack.MeasureString(count5) * textScale; float countX5 = Math.Max(x, x + mainBarWidth - countSize5.X); DrawBorderStringEightWay(sb, Main.fontItemStack, count5, new Vector2(countX5, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); @@ -974,36 +934,22 @@ namespace CalamityMod.UI { default: break; - case SpecialType2.Calam: - string count = "(Brothers left: " + _specialData2[0] + ")"; - Vector2 countSize = Main.fontItemStack.MeasureString(count) * textScale; - float countX = Math.Max(x, x + mainBarWidth - countSize.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count, new Vector2(countX, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; case SpecialType2.Ceaseless: - string count2 = "(Dark Energy left: " + _specialData2[1] + ")"; + string count2 = "(Dark Energy left: " + _specialData2[0] + ")"; Vector2 countSize2 = Main.fontItemStack.MeasureString(count2) * textScale; float countX2 = Math.Max(x, x + mainBarWidth - countSize2.X); DrawBorderStringEightWay(sb, Main.fontItemStack, count2, new Vector2(countX2, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); _openAnimCounter--; return; - case SpecialType2.Perforator: - string count3 = "(Worms left: " + _specialData2[2] + ")"; - Vector2 countSize3 = Main.fontItemStack.MeasureString(count3) * textScale; - float countX3 = Math.Max(x, x + mainBarWidth - countSize3.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count3, new Vector2(countX3, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; case SpecialType2.Ravage: - string count4 = "(Body Parts left: " + _specialData2[3] + ")"; + string count4 = "(Body Parts left: " + _specialData2[1] + ")"; Vector2 countSize4 = Main.fontItemStack.MeasureString(count4) * textScale; float countX4 = Math.Max(x, x + mainBarWidth - countSize4.X); DrawBorderStringEightWay(sb, Main.fontItemStack, count4, new Vector2(countX4, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); _openAnimCounter--; return; case SpecialType2.SlimeCore: - string count5 = "(Large Slimes left: " + _specialData2[4] + ")"; + string count5 = "(Large Slimes left: " + _specialData2[2] + ")"; Vector2 countSize5 = Main.fontItemStack.MeasureString(count5) * textScale; float countX5 = Math.Max(x, x + mainBarWidth - countSize5.X); DrawBorderStringEightWay(sb, Main.fontItemStack, count5, new Vector2(countX5, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); From 7232656664d0cba92aac758da525d6d4337ddda2 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 26 Feb 2020 17:01:18 -0500 Subject: [PATCH 5/8] ichor spear resprite --- Items/Weapons/Rogue/IchorSpear.png | Bin 915 -> 508 bytes Projectiles/Rogue/IchorSpearProj.cs | 2 +- Projectiles/Rogue/IchorSpearProj.png | Bin 903 -> 508 bytes 3 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Rogue/IchorSpear.png b/Items/Weapons/Rogue/IchorSpear.png index 6c8e3be05f04d8b725527a2af40f36d0e04709bc..e564266e89a08b7995d5e9d854f2a7199c9962e8 100644 GIT binary patch literal 508 zcmVV4e5JmR}rXT?!3i{PbZ~>YX#nzN4HBz`hPJ_}=a-$SfxyGdWQTB_8y%JvIk-s#> zdX4xGecNNI>PhtGUgche&L7k3zseru+EsGxD*5_+>6K=X=NFJi2?oAz@4bRiHqHP% zFPWYmWHwvK-_ihlQQ~2*m+TFO{6xjfI#i4k#^Pm z0(84wuMjZ+`C1MwV$lyqb0Ej2m1EP&dA*nOdM_V`L$3e?KsL&YTLX^PwwnQAAb`U+aP)!|Sm2OOD0(QQtt&{BB$g6Y22|5#0gxdNPsM}r2^J5uB2*Yr_hPTkBM7znUzi z_+>6hk@q27Z^|wHVV)5ZBZxZ`UA0~7H&0f6pi>%Z>M7R0E73@`bgZN8-}loRvC2|K z3@`Kj35ZX1Q36! zCWH3QZi?tbn7+9gn9c{&YI4BrXCh~{-!&nzf{;5$rbe`?hKb?uwHWQk`iKv+eD>r0 zjIXOqq&y=eMiBZA?>A$UA2k!X!yttI1d_Oj=U(0ji4$aZ>CJ!he5gg0bDBH2zv~V4e5JmR}rXT?!3i{PbZ~>YX#nzN4HBz`hPJ_}=a-$SfxyGdWQTB_8y%JvIk-s#> zdX4xGecNNI>PhtGUgche&L7k3zseru+EsGxD*5_+>6K=X=NFJi2?oAz@4bRiHqHP% zFPWYmWHwvK-_ihlQQ~2*m+TFO{6xjfI#i4k#^Pm z0(84wuMjZ+`C1MwV$lyqb0Ej2m1EP&dA*nOdM_V`L$3e?KsL&YTLX^PwwnQAAb`U+aP~Q@SS+QR5ULw>qf&}H zp`|WeNE?tS2=3yhkuC~_Mr;)#sa-TSP=Am}nvRQ?6Z)P>I+~#!hIckeX5LK5d^z`? z`wUpr)mFb*?fA2AIRg%o2QE_+-#qkJCvZC_2n2SD&sT=UvdNg?$RFfhLe#O-IRL=I zjK3-=#01G})4k$EC~g8k`nNMY<$gjWL$8ns3Gp=@6l8{H1*u=jNwI!VtlutDt|L_Q zDYELRRjuMBr9btAbJF!MQvPl6l>0oyC(J&hdc|s03(Uyt7DDl=U%30gajD;}F3lU7 zkd-R8Sydw$5>TreiCNX9&IkbD)l|Z?lazZ2v5JuZ`wTro0wgp0{3}FtlW)lL`BEnU zAle2K07mi&0|0!j`vCwK0vAb0SGl@`{^}DUIRQW+MbD5-c=VQZc`PWZ+ubuI0Kiyk z2LRyE$u1KB_B4B?^(3~sG_MI+%5th#dcwjh>@%BHvwckhou~VRIFR}P0O$&YB=3y8 zd>|c9LU?WQebUf`tYkSgqp4mY!Fz*-MCN8#c<0@sh#v9GPXNGM-{-2|Ll04!kX1q| zDP}z?Uy_MyqAwsphK=H||BB}oIK8bM0-opTZf#o?-{fh0H zkS$fNmX|82IX!JDlkq+q_7-f}1=1c;pCBhq&NEhZy&&eLr)4rvZj1r|h9>SeG#6

sx%>|h$)@()JmbK`;enaRT4#c4%393 dM#%M9?ho8tX4>=5+K~VN002ovPDHLkV1l}{j!OUl From efca114610e07da2d25ab03ae903d62cd1b7979c Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Wed, 26 Feb 2020 17:32:24 -0500 Subject: [PATCH 6/8] Cave darkness smoothly fades away as you reach hell --- CalPlayer/CalamityPlayerMiscEffects.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index b2769ab4d2..c163c8913f 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -418,7 +418,15 @@ namespace CalamityMod.CalPlayer double playerUndergroundDepth = point.Y - Main.worldSurface; double depthRatio = playerUndergroundDepth / totalUndergroundDepth; int lightStrength = modPlayer.GetTotalLightStrength(); - float darknessStrength = (float)depthRatio; + + // In the last 50 blocks before hell, the darkness smoothly fades away. + float FadeAwayStart = (float)(1D - 50D / totalUndergroundDepth); + float darknessStrength = (float)(depthRatio / FadeAwayStart); + if (depthRatio > FadeAwayStart) + { + // Varies from 1.0 to 0.0 as depthRatio varies from FadeAwayStart to 1.0. + darknessStrength = (1f - (float)depthRatio) / (1f - FadeAwayStart); + } // Reduce the power of cave darkness based on your light level. 5+ is enough to totally eliminate it. switch (lightStrength) From 5fa013c12b533aee08728e0ec049b82a5d8604de Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 26 Feb 2020 22:14:11 -0500 Subject: [PATCH 7/8] bug fixes because I didn't have a chance to test it earlier also some ghastly visage refactoring --- Projectiles/Magic/GhastlyBlast.cs | 52 ++++++++++++------------------- UI/BossHealthBarManager.cs | 14 ++++----- 2 files changed, 27 insertions(+), 39 deletions(-) diff --git a/Projectiles/Magic/GhastlyBlast.cs b/Projectiles/Magic/GhastlyBlast.cs index eafdeb18df..881e97db47 100644 --- a/Projectiles/Magic/GhastlyBlast.cs +++ b/Projectiles/Magic/GhastlyBlast.cs @@ -33,10 +33,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - float[] var_2_2DDF8_cp_0 = projectile.ai; - int var_2_2DDF8_cp_1 = 0; - float num73 = var_2_2DDF8_cp_0[var_2_2DDF8_cp_1]; - var_2_2DDF8_cp_0[var_2_2DDF8_cp_1] = num73 + 1f; + projectile.ai[0] += 1f; int num1013 = 0; if (projectile.velocity.Length() <= 8f) //4 { @@ -109,7 +106,6 @@ namespace CalamityMod.Projectiles.Magic dust30.fadeIn = 0.5f; dust30.customData = projectile; vector142 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); - dust30 = Main.dust[Dust.NewDust(projectile.Center - vector142 * 30f, 0, 0, 60, 0f, 0f, 0, default, 1f)]; dust30.noGravity = true; dust30.position = projectile.Center - vector142 * (float)Main.rand.Next(10, 21); dust30.velocity = vector142.RotatedBy(1.5707963705062866, default) * 6f; @@ -142,7 +138,7 @@ namespace CalamityMod.Projectiles.Magic int num1016 = 0; if (projectile.ai[1] == 0f) { - for (int num1017 = 0; num1017 < 200; num1017 = num3 + 1) + for (int num1017 = 0; num1017 < Main.maxNPCs; num1017 = num3 + 1) { if (Main.npc[num1017].CanBeChasedBy(projectile, false)) { @@ -229,56 +225,50 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = -1; projectile.Damage(); Main.PlaySound(SoundID.Item14, projectile.position); - int num3; - for (int num95 = 0; num95 < 4; num95 = num3 + 1) + + for (int num95 = 0; num95 < 4; num95++) { int num96 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); Main.dust[num96].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - num3 = num95; } - for (int num97 = 0; num97 < 30; num97 = num3 + 1) + for (int num97 = 0; num97 < 30; num97++) { int num98 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 200, default, 3.7f); - Main.dust[num98].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num98].noGravity = true; Dust dust = Main.dust[num98]; + dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust.noGravity = true; dust.velocity *= 3f; num98 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.5f); - Main.dust[num98].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - dust = Main.dust[num98]; + dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; dust.velocity *= 2f; - Main.dust[num98].noGravity = true; - Main.dust[num98].fadeIn = 1f; - Main.dust[num98].color = Color.Crimson * 0.5f; - num3 = num97; + dust.noGravity = true; + dust.fadeIn = 1f; + dust.color = Color.Crimson * 0.5f; } - for (int num99 = 0; num99 < 10; num99 = num3 + 1) + for (int num99 = 0; num99 < 10; num99++) { int num100 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 2.7f); - Main.dust[num100].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; - Main.dust[num100].noGravity = true; Dust dust = Main.dust[num100]; + dust.position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; + dust.noGravity = true; dust.velocity *= 3f; - num3 = num99; } - for (int num101 = 0; num101 < 10; num101 = num3 + 1) + for (int num101 = 0; num101 < 10; num101++) { int num102 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 0, default, 1.5f); - Main.dust[num102].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; - Main.dust[num102].noGravity = true; Dust dust = Main.dust[num102]; + dust.position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; + dust.noGravity = true; dust.velocity *= 3f; - num3 = num101; } if (Main.myPlayer == projectile.owner) { - for (int num105 = 0; num105 < 1000; num105 = num3 + 1) + for (int num105 = 0; num105 < Main.maxProjectiles; num105++) { if (Main.projectile[num105].active && Main.projectile[num105].type == ModContent.ProjectileType() && Main.projectile[num105].ai[1] == (float)projectile.whoAmI) { Main.projectile[num105].Kill(); } - num3 = num105; } int num106 = Main.rand.Next(5, 9); int num107 = Main.rand.Next(5, 9); @@ -288,7 +278,7 @@ namespace CalamityMod.Projectiles.Magic 180 }); int num109 = (num108 == 60) ? 180 : 60; - for (int num110 = 0; num110 < num106; num110 = num3 + 1) + for (int num110 = 0; num110 < num106; num110++) { Vector2 vector4 = projectile.Center + Utils.RandomVector2(Main.rand, -30f, 30f); Vector2 vector5 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); @@ -303,9 +293,8 @@ namespace CalamityMod.Projectiles.Magic } vector5 *= (float)Main.rand.Next(70, 101) * 0.1f; Projectile.NewProjectile(vector4.X, vector4.Y, vector5.X, vector5.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.8), projectile.knockBack * 0.8f, projectile.owner, (float)num108, 0f); - num3 = num110; } - for (int num111 = 0; num111 < num107; num111 = num3 + 1) + for (int num111 = 0; num111 < num107; num111++) { Vector2 vector6 = projectile.Center + Utils.RandomVector2(Main.rand, -30f, 30f); Vector2 vector7 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); @@ -320,7 +309,6 @@ namespace CalamityMod.Projectiles.Magic } vector7 *= (float)Main.rand.Next(40, 81) * 0.1f; Projectile.NewProjectile(vector6.X, vector6.Y, vector7.X, vector7.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.8), projectile.knockBack * 0.8f, projectile.owner, (float)num109, 0f); - num3 = num111; } } } diff --git a/UI/BossHealthBarManager.cs b/UI/BossHealthBarManager.cs index 849db2c543..38b312bd33 100644 --- a/UI/BossHealthBarManager.cs +++ b/UI/BossHealthBarManager.cs @@ -233,7 +233,7 @@ namespace CalamityMod.UI ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), - ModContent.NPCType() + ModContent.NPCType(), //Hardmode ModContent.NPCType(), @@ -242,7 +242,7 @@ namespace CalamityMod.UI ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), //Clone's brothers - ModContent.NPCType() + ModContent.NPCType(), //Abyss ModContent.NPCType(), @@ -684,25 +684,25 @@ namespace CalamityMod.UI default: break; case SpecialType2.Ceaseless: - int count2 = NPC.CountNPCS(ModContent.NPCType()) + + int count = NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()); _specialData2[0] = count; break; case SpecialType2.Ravage: - int count4 = NPC.CountNPCS(ModContent.NPCType()) + + int count2 = NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()); - _specialData2[1] = count3; + _specialData2[1] = count2; break; case SpecialType2.SlimeCore: - int count5 = NPC.CountNPCS(ModContent.NPCType()) + + int count3 = NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()); - _specialData2[2] = count4; + _specialData2[2] = count3; break; } } From 1c1f918a23d9aaaf79e32a6a26a4e7e96b9b1759 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 26 Feb 2020 23:16:38 -0500 Subject: [PATCH 8/8] homing code updates and some other stuff --- Projectiles/Magic/ApothChloro.cs | 8 +-- Projectiles/Magic/BlackAnurianPlankton.cs | 2 +- Projectiles/Magic/BlueBubble.cs | 34 +--------- Projectiles/Magic/EventHorizonStar.cs | 34 +++++----- Projectiles/Magic/LightBead.cs | 34 +--------- Projectiles/Magic/LightningArc.cs | 10 +-- Projectiles/Rogue/CinquedeaProj.cs | 34 +--------- Projectiles/Rogue/CosmicKunaiProj.cs | 34 +--------- Projectiles/Rogue/CosmicScythe.cs | 34 +--------- Projectiles/Rogue/Crushax.cs | 34 +--------- Projectiles/Rogue/DeepSeaDumbbell2.cs | 36 +--------- Projectiles/Rogue/DeepSeaDumbbell3.cs | 36 +--------- Projectiles/Rogue/DesecratedBubble.cs | 34 +--------- Projectiles/Rogue/DestructionBolt.cs | 2 +- Projectiles/Rogue/EclipsesSmol.cs | 38 +---------- Projectiles/Rogue/EmpyreanKnife.cs | 34 +--------- Projectiles/Rogue/EnchantedAxeProj.cs | 2 +- Projectiles/Rogue/ExecutionersBladeProj.cs | 34 +--------- Projectiles/Rogue/GacruxianHome.cs | 34 +--------- Projectiles/Rogue/GodsParanoiaProj.cs | 34 +--------- Projectiles/Rogue/IceStarProjectile.cs | 34 +--------- Projectiles/Rogue/IllustriousKnife.cs | 34 +--------- Projectiles/Rogue/InfernalSpearProjectile.cs | 34 +--------- Projectiles/Rogue/LunarKunaiProj.cs | 34 +--------- Projectiles/Rogue/MoonSigil.cs | 36 +--------- Projectiles/Rogue/PenumbraSoul.cs | 32 +-------- Projectiles/Rogue/PhantasmalRuinGhost.cs | 34 +--------- Projectiles/Rogue/PhantasmalSoul.cs | 34 +--------- Projectiles/Rogue/PlaguenadeBee.cs | 4 +- Projectiles/Rogue/Prismalline3.cs | 35 +--------- Projectiles/Rogue/ProfanedPartisanspear.cs | 32 +-------- Projectiles/Rogue/RadiantStar2.cs | 36 +--------- Projectiles/Rogue/ReaperProjectile.cs | 36 +--------- Projectiles/Rogue/RegulusEnergy.cs | 58 +++++++---------- Projectiles/Rogue/ScarletDevilBullet.cs | 64 +++++++++--------- .../Rogue/ShatteredSunScorchedBlade.cs | 34 +--------- Projectiles/Rogue/ShroomerangSpore.cs | 2 +- Projectiles/Rogue/SpearofDestinyProjectile.cs | 65 +++++++++---------- Projectiles/Rogue/SphereBlue.cs | 34 +--------- Projectiles/Rogue/SupernovaHoming.cs | 58 +++++++---------- Projectiles/Rogue/TurbulanceWindSlash.cs | 34 +--------- Projectiles/Rogue/ValedictionBoomerang.cs | 34 +--------- 42 files changed, 179 insertions(+), 1161 deletions(-) diff --git a/Projectiles/Magic/ApothChloro.cs b/Projectiles/Magic/ApothChloro.cs index 9b0d7d14d0..7a7a88882a 100644 --- a/Projectiles/Magic/ApothChloro.cs +++ b/Projectiles/Magic/ApothChloro.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Magic float num2 = (float)(projectile.position.Y - projectile.velocity.Y / 10.0 * 9.0); float num3 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); float num4 = projectile.localAI[0]; - if ((double)num4 == 0.0) + if (num4 == 0f) { projectile.localAI[0] = num3; num4 = num3; @@ -57,9 +57,9 @@ namespace CalamityMod.Projectiles.Magic bool flag2 = false; int num8 = 0; float num9; - if ((double)projectile.ai[1] == 0.0) + if (projectile.ai[1] == 0f) { - for (int index = 0; index < 200; ++index) + for (int index = 0; index < Main.maxNPCs; ++index) { if (Main.npc[index].CanBeChasedBy((object)this, false) && ((double)projectile.ai[1] == 0.0 || (double)projectile.ai[1] == (double)(index + 1))) { @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Magic projectile.ai[1] = (float)(num8 + 1); flag2 = false; } - if ((double)projectile.ai[1] > 0.0) + if (projectile.ai[1] > 0f) { int index = (int)((double)projectile.ai[1] - 1.0); if (Main.npc[index].active && Main.npc[index].CanBeChasedBy((object)this, true) && !Main.npc[index].dontTakeDamage) diff --git a/Projectiles/Magic/BlackAnurianPlankton.cs b/Projectiles/Magic/BlackAnurianPlankton.cs index b5b2c163c6..639bda17f7 100644 --- a/Projectiles/Magic/BlackAnurianPlankton.cs +++ b/Projectiles/Magic/BlackAnurianPlankton.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Magic if (projectile.ai[0] > 30f) { projectile.ai[0] = 30f; - for (int num376 = 0; num376 < 200; num376++) + for (int num376 = 0; num376 < Main.maxNPCs; num376++) { if (Main.npc[num376].CanBeChasedBy(projectile, false) && !Main.npc[num376].wet) { diff --git a/Projectiles/Magic/BlueBubble.cs b/Projectiles/Magic/BlueBubble.cs index b1a8273b55..f680b30f3f 100644 --- a/Projectiles/Magic/BlueBubble.cs +++ b/Projectiles/Magic/BlueBubble.cs @@ -55,39 +55,7 @@ namespace CalamityMod.Projectiles.Magic { projectile.timeLeft = 120; } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 150f; - bool flag17 = false; - 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)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - if (flag17) - { - float num483 = 8f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 150f, 8f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Magic/EventHorizonStar.cs b/Projectiles/Magic/EventHorizonStar.cs index faa4bcabf3..d41955a085 100644 --- a/Projectiles/Magic/EventHorizonStar.cs +++ b/Projectiles/Magic/EventHorizonStar.cs @@ -86,37 +86,35 @@ namespace CalamityMod.Projectiles.Magic //homing if (projectile.localAI[0] >= 100) { + Vector2 center = projectile.Center; float homingRange = 800f; bool homeIn = false; - for (int i = 0; i < Main.npc.Length; i++) + float N = 30f; + float homingVelocity = 20f; + + for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].CanBeChasedBy(projectile, false)) { - float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); - float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < homingRange) + float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); + + if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (homingRange + extraDistance)) { - homingRange = num478; - centerX = num476; - centerY = num477; + center = Main.npc[i].Center; homeIn = true; + break; } } } + if (homeIn) { projectile.extraUpdates = 1; - float homingStrength = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = homingStrength / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 30f + num484) / 31f; - projectile.velocity.Y = (projectile.velocity.Y * 30f + num485) / 31f; + Vector2 homeInVector = projectile.DirectionTo(center); + if (homeInVector.HasNaNs()) + homeInVector = Vector2.UnitY; + + projectile.velocity = (projectile.velocity * N + homeInVector * homingVelocity) / (N + 1f); } else projectile.extraUpdates = 0; diff --git a/Projectiles/Magic/LightBead.cs b/Projectiles/Magic/LightBead.cs index e0656ba0d2..07c6ba41a1 100644 --- a/Projectiles/Magic/LightBead.cs +++ b/Projectiles/Magic/LightBead.cs @@ -45,39 +45,7 @@ namespace CalamityMod.Projectiles.Magic return; } } - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 500f; - bool homeIn = false; - 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)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - if (homeIn) - { - float num483 = 18f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 10f + num484) / 11f; - projectile.velocity.Y = (projectile.velocity.Y * 10f + num485) / 11f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 500f, 18f, 10f); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Magic/LightningArc.cs b/Projectiles/Magic/LightningArc.cs index b5c0dab6a1..fdaceac136 100644 --- a/Projectiles/Magic/LightningArc.cs +++ b/Projectiles/Magic/LightningArc.cs @@ -44,8 +44,9 @@ namespace CalamityMod.Projectiles.Magic bool target = false; NPC npc = null; bool pastNPC = false; - if (projectile.timeLeft < 18) { - for (int k = 0; k < 200; k++) + if (projectile.timeLeft < 18) + { + for (int k = 0; k < Main.maxNPCs; k++) { if (Main.npc[k].active && !Main.npc[k].dontTakeDamage && !Main.npc[k].friendly && Main.npc[k].lifeMax > 5 && !shockedbefore.Contains(Main.npc[k])) { @@ -62,7 +63,7 @@ namespace CalamityMod.Projectiles.Magic } } } - //if not found, lokk thru npcs that have been shocked before + //if not found, look through npcs that have been shocked before if (!target) { foreach (NPC pastnpc in shockedbefore) { Vector2 newMove = pastnpc.Center -(projectile.velocity + projectile.Center); @@ -140,7 +141,8 @@ namespace CalamityMod.Projectiles.Magic projectile.timeLeft -= 12; return false; } - private void AdjustMagnitude(ref Vector2 vector) + + private void AdjustMagnitude(ref Vector2 vector) { float magnitude = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y); if (magnitude > 6f) diff --git a/Projectiles/Rogue/CinquedeaProj.cs b/Projectiles/Rogue/CinquedeaProj.cs index 892076ff51..774a353bed 100644 --- a/Projectiles/Rogue/CinquedeaProj.cs +++ b/Projectiles/Rogue/CinquedeaProj.cs @@ -69,39 +69,7 @@ namespace CalamityMod.Projectiles.Rogue //Stealth strike if (stealthstrike) { - float pcx = projectile.Center.X; - float pcy = projectile.Center.Y; - float var1 = 800f; - bool flag = false; - for (int npcvar = 0; npcvar < 200; npcvar++) - { - if (Main.npc[npcvar].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[npcvar].Center, 1, 1)) - { - float var2 = Main.npc[npcvar].position.X + (Main.npc[npcvar].width / 2); - float var3 = Main.npc[npcvar].position.Y + (Main.npc[npcvar].height / 2); - float var4 = Math.Abs(projectile.position.X + (projectile.width / 2) - var2) + Math.Abs(projectile.position.Y + (projectile.height / 2) - var3); - if (var4 < var1) - { - var1 = var4; - pcx = var2; - pcy = var3; - flag = true; - } - } - } - if (flag) - { - float homingstrenght = 7f; - Vector2 vector1 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); - float var6 = pcx - vector1.X; - float var7 = pcy - vector1.Y; - float var8 = (float)Math.Sqrt(var6 * var6 + var7 * var7); - var8 = homingstrenght / var8; - var6 *= var8; - var7 *= var8; - projectile.velocity.X = (projectile.velocity.X * 20f + var6) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + var7) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, 7f, 20f); } //Gravity code else diff --git a/Projectiles/Rogue/CosmicKunaiProj.cs b/Projectiles/Rogue/CosmicKunaiProj.cs index 5e7e734678..e4093f4dbc 100644 --- a/Projectiles/Rogue/CosmicKunaiProj.cs +++ b/Projectiles/Rogue/CosmicKunaiProj.cs @@ -30,39 +30,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.Kill(); } Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.5f / 255f); - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 300f; - bool flag17 = false; - 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)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - if (flag17) - { - float num483 = 28f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 28f, 20f); } } } diff --git a/Projectiles/Rogue/CosmicScythe.cs b/Projectiles/Rogue/CosmicScythe.cs index 5996091ff6..b82bfc24ca 100644 --- a/Projectiles/Rogue/CosmicScythe.cs +++ b/Projectiles/Rogue/CosmicScythe.cs @@ -50,39 +50,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.timeLeft > 350) projectile.velocity *= 1.06f; projectile.damage = (int) ((double)originalDamage * 1.25); - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 1500f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - if (flag17) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 21f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 21f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 1500f, 20f, 20f); } } diff --git a/Projectiles/Rogue/Crushax.cs b/Projectiles/Rogue/Crushax.cs index 42c14c09d5..6f0c6af21c 100644 --- a/Projectiles/Rogue/Crushax.cs +++ b/Projectiles/Rogue/Crushax.cs @@ -27,39 +27,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 350f; - bool flag17 = false; - 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)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - if (flag17) - { - float num483 = 12f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 350f, 12f, 20f); } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Rogue/DeepSeaDumbbell2.cs b/Projectiles/Rogue/DeepSeaDumbbell2.cs index 2ec13e5b9a..fc72f80c83 100644 --- a/Projectiles/Rogue/DeepSeaDumbbell2.cs +++ b/Projectiles/Rogue/DeepSeaDumbbell2.cs @@ -28,41 +28,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0] += 1f; else { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - - 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)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - - if (flag17) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 20f, 20f); } projectile.rotation += Math.Abs(projectile.velocity.X) * 0.01f * (float)projectile.direction; diff --git a/Projectiles/Rogue/DeepSeaDumbbell3.cs b/Projectiles/Rogue/DeepSeaDumbbell3.cs index 1d8069a60c..11bf71d687 100644 --- a/Projectiles/Rogue/DeepSeaDumbbell3.cs +++ b/Projectiles/Rogue/DeepSeaDumbbell3.cs @@ -28,41 +28,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0] += 1f; else { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - - 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)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - - if (flag17) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 20f, 20f); } projectile.rotation += Math.Abs(projectile.velocity.X) * 0.01f * (float)projectile.direction; diff --git a/Projectiles/Rogue/DesecratedBubble.cs b/Projectiles/Rogue/DesecratedBubble.cs index bb76ee6c12..5de9d71e66 100644 --- a/Projectiles/Rogue/DesecratedBubble.cs +++ b/Projectiles/Rogue/DesecratedBubble.cs @@ -47,39 +47,7 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.ai[1] == 0f) { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - 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)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - if (flag17) - { - float num483 = 8f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 8f, 20f); } } } diff --git a/Projectiles/Rogue/DestructionBolt.cs b/Projectiles/Rogue/DestructionBolt.cs index 4b7f92b90a..b5e2ed4139 100644 --- a/Projectiles/Rogue/DestructionBolt.cs +++ b/Projectiles/Rogue/DestructionBolt.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Rogue { int num35 = -1; float num36 = num30; - for (int num37 = 0; num37 < 200; num37++) + for (int num37 = 0; num37 < Main.maxNPCs; num37++) { if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(projectile, false)) { diff --git a/Projectiles/Rogue/EclipsesSmol.cs b/Projectiles/Rogue/EclipsesSmol.cs index dc59b5e2f3..58e287a9bc 100644 --- a/Projectiles/Rogue/EclipsesSmol.cs +++ b/Projectiles/Rogue/EclipsesSmol.cs @@ -28,39 +28,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - 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)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - if (flag17) - { - float num483 = 24f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 24f, 20f); } public override void Kill(int timeLeft) @@ -68,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); for (int num621 = 0; num621 < 20; num621++) { - if (Main.rand.Next(10) == 0) + if (Main.rand.NextBool(10)) { int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; @@ -81,7 +49,7 @@ namespace CalamityMod.Projectiles.Rogue } for (int num623 = 0; num623 < 35; num623++) { - if (Main.rand.Next(10) == 0) + if (Main.rand.NextBool(10)) { int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; diff --git a/Projectiles/Rogue/EmpyreanKnife.cs b/Projectiles/Rogue/EmpyreanKnife.cs index a8139055b9..83d372c9ee 100644 --- a/Projectiles/Rogue/EmpyreanKnife.cs +++ b/Projectiles/Rogue/EmpyreanKnife.cs @@ -55,39 +55,7 @@ namespace CalamityMod.Projectiles.Rogue { projectile.rotation += 0.5f; } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 250f; - bool flag17 = false; - 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)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - if (flag17) - { - float num483 = 15f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 250f, 15f, 20f); if (Main.rand.NextBool(6)) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 58, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); diff --git a/Projectiles/Rogue/EnchantedAxeProj.cs b/Projectiles/Rogue/EnchantedAxeProj.cs index fae4fa688b..2b1cc1eb5c 100644 --- a/Projectiles/Rogue/EnchantedAxeProj.cs +++ b/Projectiles/Rogue/EnchantedAxeProj.cs @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.timeLeft % 7 == 1 && projectile.Calamity().stealthStrike) { float axeSpeed = 15f; - int axeDamage = 25; + int axeDamage = projectile.damage / 2; Projectile.NewProjectile(projectile.position, new Vector2(1f, 0f) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, projectile.owner, 0, 0); Projectile.NewProjectile(projectile.position, new Vector2(0f, 1f) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, projectile.owner, 0, 0); Projectile.NewProjectile(projectile.position, new Vector2(-1f, 0f) * axeSpeed, ModContent.ProjectileType(), axeDamage, 2, projectile.owner, 0, 0); diff --git a/Projectiles/Rogue/ExecutionersBladeProj.cs b/Projectiles/Rogue/ExecutionersBladeProj.cs index ebb9cc2dad..75d5df723c 100644 --- a/Projectiles/Rogue/ExecutionersBladeProj.cs +++ b/Projectiles/Rogue/ExecutionersBladeProj.cs @@ -54,39 +54,7 @@ namespace CalamityMod.Projectiles.Rogue { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 1200f; - bool flag17 = false; - 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)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - if (flag17) - { - float num483 = 26f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 1200f, 26f, 20f); } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/GacruxianHome.cs b/Projectiles/Rogue/GacruxianHome.cs index 73025c6167..6073018dd0 100644 --- a/Projectiles/Rogue/GacruxianHome.cs +++ b/Projectiles/Rogue/GacruxianHome.cs @@ -46,39 +46,7 @@ namespace CalamityMod.Projectiles.Rogue Main.projectile[proj].penetrate = 3; stealthTrailTimer = 10; } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 500f; - bool flag17 = false; - 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)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - if (flag17) - { - float num483 = 16f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 500f, 16f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/GodsParanoiaProj.cs b/Projectiles/Rogue/GodsParanoiaProj.cs index b777df0ca0..177c8a1393 100644 --- a/Projectiles/Rogue/GodsParanoiaProj.cs +++ b/Projectiles/Rogue/GodsParanoiaProj.cs @@ -108,39 +108,7 @@ namespace CalamityMod.Projectiles.Rogue else { projectile.rotation += 0.2f * (float)projectile.direction; - float pcx = projectile.Center.X; - float pcy = projectile.Center.Y; - float var1 = 800f; - bool flag = false; - for (int npcvar = 0; npcvar < Main.npc.Length; npcvar++) - { - if (Main.npc[npcvar].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[npcvar].Center, 1, 1)) - { - float var2 = Main.npc[npcvar].position.X + (Main.npc[npcvar].width / 2); - float var3 = Main.npc[npcvar].position.Y + (Main.npc[npcvar].height / 2); - float var4 = Math.Abs(projectile.position.X + (projectile.width / 2) - var2) + Math.Abs(projectile.position.Y + (projectile.height / 2) - var3); - if (var4 < var1) - { - var1 = var4; - pcx = var2; - pcy = var3; - flag = true; - } - } - } - if (flag) - { - float homingstrenght = (projectile.Calamity().stealthStrike ? 14f : 7f); - Vector2 vector1 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); - float var6 = pcx - vector1.X; - float var7 = pcy - vector1.Y; - float var8 = (float)Math.Sqrt(var6 * var6 + var7 * var7); - var8 = homingstrenght / var8; - var6 *= var8; - var7 *= var8; - projectile.velocity.X = (projectile.velocity.X * 20f + var6) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + var7) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, (projectile.Calamity().stealthStrike ? 14f : 7f), 20f); } Player player = Main.player[projectile.owner]; diff --git a/Projectiles/Rogue/IceStarProjectile.cs b/Projectiles/Rogue/IceStarProjectile.cs index 37fdea1ec1..93ad7842c7 100644 --- a/Projectiles/Rogue/IceStarProjectile.cs +++ b/Projectiles/Rogue/IceStarProjectile.cs @@ -46,39 +46,7 @@ namespace CalamityMod.Projectiles.Rogue { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = projectile.Calamity().stealthStrike ? 800f : 400f; - bool flag17 = false; - 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)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - if (flag17) - { - float num483 = 14f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, projectile.Calamity().stealthStrike ? 800f : 400f, 14f, 20f); projectile.velocity = initStealth && !flag17 ? initialVelocity : projectile.velocity; } diff --git a/Projectiles/Rogue/IllustriousKnife.cs b/Projectiles/Rogue/IllustriousKnife.cs index 2c7926c5e3..4d27eeea5e 100644 --- a/Projectiles/Rogue/IllustriousKnife.cs +++ b/Projectiles/Rogue/IllustriousKnife.cs @@ -44,39 +44,7 @@ namespace CalamityMod.Projectiles.Rogue { projectile.rotation += 0.5f; } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 800f; - bool flag17 = false; - 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)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - if (flag17) - { - float num483 = 35f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, 35f, 20f); if (Main.rand.NextBool(6)) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); diff --git a/Projectiles/Rogue/InfernalSpearProjectile.cs b/Projectiles/Rogue/InfernalSpearProjectile.cs index f8f689c90a..304057b306 100644 --- a/Projectiles/Rogue/InfernalSpearProjectile.cs +++ b/Projectiles/Rogue/InfernalSpearProjectile.cs @@ -41,39 +41,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.frame = 0; } projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - 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)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - if (flag17) - { - float num483 = 24f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 24f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/LunarKunaiProj.cs b/Projectiles/Rogue/LunarKunaiProj.cs index 7683a9041f..9408b4c5e6 100644 --- a/Projectiles/Rogue/LunarKunaiProj.cs +++ b/Projectiles/Rogue/LunarKunaiProj.cs @@ -46,39 +46,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.frame = 0; projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = (lunarEnhance ? 1000f : 500f); - bool flag17 = false; - 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)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - if (flag17) - { - float num483 = (lunarEnhance ? 35f : 15f); - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, (lunarEnhance ? 1000f : 500f), (lunarEnhance ? 35f : 15f), 20f); if (Main.rand.Next(6) == 0 && lunarEnhance) Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 229, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } diff --git a/Projectiles/Rogue/MoonSigil.cs b/Projectiles/Rogue/MoonSigil.cs index a8bc0dd30e..b60308be26 100644 --- a/Projectiles/Rogue/MoonSigil.cs +++ b/Projectiles/Rogue/MoonSigil.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 20; projectile.friendly = true; projectile.alpha = 0; - projectile.penetrate = -1; + projectile.penetrate = 10; projectile.tileCollide = true; projectile.ignoreWater = true; projectile.timeLeft = 250; @@ -41,39 +41,7 @@ namespace CalamityMod.Projectiles.Rogue return; } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - 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)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - if (flag17) - { - float num483 = 8f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 8f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/PenumbraSoul.cs b/Projectiles/Rogue/PenumbraSoul.cs index db14b0e295..ce7b0f3c88 100644 --- a/Projectiles/Rogue/PenumbraSoul.cs +++ b/Projectiles/Rogue/PenumbraSoul.cs @@ -61,37 +61,7 @@ namespace CalamityMod.Projectiles.Rogue private void HomingAI() { - // Find the closest NPC within range. - int targetIdx = -1; - float maxHomingRange = 400f; - bool hasHomingTarget = false; - for (int i = 0; i < Main.npc.Length; ++i) - { - NPC npc = Main.npc[i]; - if (npc == null || !npc.active) - continue; - - // Won't home in through walls and won't chase invulnerable targets. - if (npc.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1)) - { - float dist = (projectile.Center - npc.Center).Length(); - if (dist < maxHomingRange) - { - targetIdx = i; - maxHomingRange = dist; - hasHomingTarget = true; - } - } - } - - // Home in on said closest NPC. - if (hasHomingTarget) - { - NPC target = Main.npc[targetIdx]; - Vector2 homingVector = (target.Center - projectile.Center).SafeNormalize(Vector2.Zero) * (Penumbra.ShootSpeed * 1.5f); - float homingRatio = 35f; - projectile.velocity = (projectile.velocity * homingRatio + homingVector) / (homingRatio + 1f); - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, (Penumbra.ShootSpeed * 1.5f), 35f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/PhantasmalRuinGhost.cs b/Projectiles/Rogue/PhantasmalRuinGhost.cs index 2f15cb74d6..87a20a8a60 100644 --- a/Projectiles/Rogue/PhantasmalRuinGhost.cs +++ b/Projectiles/Rogue/PhantasmalRuinGhost.cs @@ -35,39 +35,7 @@ namespace CalamityMod.Projectiles.Rogue } projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 175, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, default(Color), 0.85f); - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - 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)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - if (flag17) - { - float num483 = 18f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 18f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/PhantasmalSoul.cs b/Projectiles/Rogue/PhantasmalSoul.cs index fa1df00e7d..692c26b81c 100644 --- a/Projectiles/Rogue/PhantasmalSoul.cs +++ b/Projectiles/Rogue/PhantasmalSoul.cs @@ -85,39 +85,7 @@ namespace CalamityMod.Projectiles.Rogue } if (projectile.ai[0] == 0f) { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - if (flag17) - { - float num483 = 10f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 10f, 20f); } } else diff --git a/Projectiles/Rogue/PlaguenadeBee.cs b/Projectiles/Rogue/PlaguenadeBee.cs index 9bac794afc..64b285965a 100644 --- a/Projectiles/Rogue/PlaguenadeBee.cs +++ b/Projectiles/Rogue/PlaguenadeBee.cs @@ -55,8 +55,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.ai[0] > 30f) { projectile.ai[0] = 30f; - int num3; - for (int num376 = 0; num376 < 200; num376 = num3 + 1) + for (int num376 = 0; num376 < Main.maxNPCs; num376++) { if (Main.npc[num376].CanBeChasedBy(projectile, false) && (!Main.npc[num376].wet || projectile.type == 307)) { @@ -71,7 +70,6 @@ namespace CalamityMod.Projectiles.Rogue flag10 = true; } } - num3 = num376; } } if (!flag10) diff --git a/Projectiles/Rogue/Prismalline3.cs b/Projectiles/Rogue/Prismalline3.cs index 73a4de25e4..aee61d2fda 100644 --- a/Projectiles/Rogue/Prismalline3.cs +++ b/Projectiles/Rogue/Prismalline3.cs @@ -29,40 +29,7 @@ namespace CalamityMod.Projectiles.Rogue { projectile.rotation -= 1.57f; } - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 300f; - bool homeIn = false; - 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)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - if (homeIn) - { - float num483 = 25f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - return; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 25f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/ProfanedPartisanspear.cs b/Projectiles/Rogue/ProfanedPartisanspear.cs index 8f9af9bf4e..44f713f455 100644 --- a/Projectiles/Rogue/ProfanedPartisanspear.cs +++ b/Projectiles/Rogue/ProfanedPartisanspear.cs @@ -94,37 +94,7 @@ namespace CalamityMod.Projectiles.Rogue float pcy = projectile.Center.Y; if (timer >= 10) { - float var1 = 800f; - bool flag = false; - for (int npcvar = 0; npcvar < 200; npcvar++) - { - if (Main.npc[npcvar].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[npcvar].Center, 1, 1)) - { - float var2 = Main.npc[npcvar].position.X + (Main.npc[npcvar].width / 2); - float var3 = Main.npc[npcvar].position.Y + (Main.npc[npcvar].height / 2); - float var4 = Math.Abs(projectile.position.X + (projectile.width / 2) - var2) + Math.Abs(projectile.position.Y + (projectile.height / 2) - var3); - if (var4 < var1) - { - var1 = var4; - pcx = var2; - pcy = var3; - flag = true; - } - } - } - if (flag) - { - float homingstrenght = 7f; - Vector2 vector1 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); - float var6 = pcx - vector1.X; - float var7 = pcy - vector1.Y; - float var8 = (float)Math.Sqrt(var6 * var6 + var7 * var7); - var8 = homingstrenght / var8; - var6 *= var8; - var7 *= var8; - projectile.velocity.X = (projectile.velocity.X * 20f + var6) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + var7) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, 7f, 20f); } } diff --git a/Projectiles/Rogue/RadiantStar2.cs b/Projectiles/Rogue/RadiantStar2.cs index 08e5034d68..9bf3f81f5a 100644 --- a/Projectiles/Rogue/RadiantStar2.cs +++ b/Projectiles/Rogue/RadiantStar2.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Rogue float num473 = projectile.Center.Y; float num474 = projectile.Calamity().stealthStrike ? 1800f : 600f; float homingSpeed = 0.25f; - for (int num475 = 0; num475 < 200; num475++) + for (int num475 = 0; num475 < Main.maxNPCs; num475++) { if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) { @@ -73,39 +73,7 @@ namespace CalamityMod.Projectiles.Rogue } else { - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = projectile.Calamity().stealthStrike ? 1800f : 600f; - bool homeIn = false; - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) - { - float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); - float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); - 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; - } - } - } - if (homeIn) - { - float num483 = 24f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, projectile.Calamity().stealthStrike ? 1800f : 600f, 24f, 20f); } } diff --git a/Projectiles/Rogue/ReaperProjectile.cs b/Projectiles/Rogue/ReaperProjectile.cs index e946070476..93ab84cc8c 100644 --- a/Projectiles/Rogue/ReaperProjectile.cs +++ b/Projectiles/Rogue/ReaperProjectile.cs @@ -48,39 +48,7 @@ namespace CalamityMod.Projectiles.Rogue } else { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - 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)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - if (flag17) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 20f, 20f); } } else @@ -107,7 +75,7 @@ namespace CalamityMod.Projectiles.Rogue } Vector2 vector46 = projectile.position; bool flag25 = false; - for (int num645 = 0; num645 < 200; num645++) + for (int num645 = 0; num645 < Main.maxNPCs; num645++) { NPC nPC2 = Main.npc[num645]; if (nPC2.CanBeChasedBy(projectile, false)) diff --git a/Projectiles/Rogue/RegulusEnergy.cs b/Projectiles/Rogue/RegulusEnergy.cs index 591845f492..5aed541a88 100644 --- a/Projectiles/Rogue/RegulusEnergy.cs +++ b/Projectiles/Rogue/RegulusEnergy.cs @@ -54,41 +54,33 @@ namespace CalamityMod.Projectiles.Rogue { projectile.extraUpdates = 1; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 500f; - bool flag17 = false; + Vector2 center = projectile.Center; + float maxDistance = 500f; + bool homeIn = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); - if (flag17) - { - float num483 = 12f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + { + center = Main.npc[i].Center; + homeIn = true; + break; + } + } + } + + if (homeIn) + { + Vector2 homeInVector = projectile.DirectionTo(center); + if (homeInVector.HasNaNs()) + homeInVector = Vector2.UnitY; + + projectile.velocity = (projectile.velocity * 20f + homeInVector * 12f) / (21f); + } else projectile.Kill(); } diff --git a/Projectiles/Rogue/ScarletDevilBullet.cs b/Projectiles/Rogue/ScarletDevilBullet.cs index 5db3ec264f..d75b3b6236 100644 --- a/Projectiles/Rogue/ScarletDevilBullet.cs +++ b/Projectiles/Rogue/ScarletDevilBullet.cs @@ -32,39 +32,37 @@ namespace CalamityMod.Projectiles.Rogue } else { - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 1000f; - bool homeIn = false; - for (int i = 0; i < 200; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); - float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); - 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; - } - } - } - if (homeIn) - { - float num483 = 30f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 10f + num484) / 11f; - projectile.velocity.Y = (projectile.velocity.Y * 10f + num485) / 11f; - } + Vector2 center = projectile.Center; + float maxDistance = 1000f; + bool homeIn = false; + + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); + + bool canHit = true; + if (extraDistance < maxDistance && !ignoreTiles) + canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1); + + if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance) && canHit) + { + center = Main.npc[i].Center; + homeIn = true; + break; + } + } + } + + if (homeIn) + { + Vector2 homeInVector = projectile.DirectionTo(center); + if (homeInVector.HasNaNs()) + homeInVector = Vector2.UnitY; + + projectile.velocity = (projectile.velocity * 10f + homeInVector * 30f) / (11f); + } else { projectile.velocity.X = 0f; diff --git a/Projectiles/Rogue/ShatteredSunScorchedBlade.cs b/Projectiles/Rogue/ShatteredSunScorchedBlade.cs index f08993ef5f..dfb1422fc9 100644 --- a/Projectiles/Rogue/ShatteredSunScorchedBlade.cs +++ b/Projectiles/Rogue/ShatteredSunScorchedBlade.cs @@ -77,39 +77,7 @@ namespace CalamityMod.Projectiles.Rogue } Lighting.AddLight(projectile.Center, 0.7f, 0.3f, 0f); - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - 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)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - if (flag17) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 20f, 20f); float num633 = 700f; Vector2 vector46 = projectile.position; bool flag25 = false; diff --git a/Projectiles/Rogue/ShroomerangSpore.cs b/Projectiles/Rogue/ShroomerangSpore.cs index 2bf75fdea7..65fd621786 100644 --- a/Projectiles/Rogue/ShroomerangSpore.cs +++ b/Projectiles/Rogue/ShroomerangSpore.cs @@ -143,7 +143,7 @@ namespace CalamityMod.Projectiles.Rogue bool flag49 = false; Vector2 center12 = new Vector2(0f, 0f); float num948 = 600f; - for (int num949 = 0; num949 < 200; num949++) + for (int num949 = 0; num949 < Main.maxNPCs; num949++) { if (Main.npc[num949].CanBeChasedBy(projectile, false)) { diff --git a/Projectiles/Rogue/SpearofDestinyProjectile.cs b/Projectiles/Rogue/SpearofDestinyProjectile.cs index 24526ffae5..a314d723ed 100644 --- a/Projectiles/Rogue/SpearofDestinyProjectile.cs +++ b/Projectiles/Rogue/SpearofDestinyProjectile.cs @@ -39,40 +39,39 @@ namespace CalamityMod.Projectiles.Rogue { projectile.rotation -= 1.57f; } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 300f; - bool flag17 = false; - 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)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - if (flag17) - { + + Vector2 center = projectile.Center; + float maxDistance = 300f; + bool homeIn = false; + + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); + + bool canHit = true; + if (extraDistance < maxDistance && !ignoreTiles) + canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1); + + if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + { + center = Main.npc[i].Center; + homeIn = true; + break; + } + } + } + + if (homeIn) + { projectile.extraUpdates = 2; - float num483 = 12f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + Vector2 homeInVector = projectile.DirectionTo(center); + if (homeInVector.HasNaNs()) + homeInVector = Vector2.UnitY; + + projectile.velocity = (projectile.velocity * 20f + homeInVector * 12f) / (21f); + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/SphereBlue.cs b/Projectiles/Rogue/SphereBlue.cs index 2b063098c7..7448e97c94 100644 --- a/Projectiles/Rogue/SphereBlue.cs +++ b/Projectiles/Rogue/SphereBlue.cs @@ -42,39 +42,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.rotation += projectile.velocity.X * 0.02f; projectile.velocity.Y = projectile.velocity.Y + 0.085f; projectile.velocity.X = projectile.velocity.X * 0.99f; - float pcx = projectile.Center.X; - float pcy = projectile.Center.Y; - float var1 = 800f; - bool flag = false; - for (int npcvar = 0; npcvar < 200; npcvar++) - { - if (Main.npc[npcvar].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[npcvar].Center, 1, 1)) - { - float var2 = Main.npc[npcvar].position.X + (Main.npc[npcvar].width / 2); - float var3 = Main.npc[npcvar].position.Y + (Main.npc[npcvar].height / 2); - float var4 = Math.Abs(projectile.position.X + (projectile.width / 2) - var2) + Math.Abs(projectile.position.Y + (projectile.height / 2) - var3); - if (var4 < var1) - { - var1 = var4; - pcx = var2; - pcy = var3; - flag = true; - } - } - } - if (flag) - { - float homingstrenght = 16f; - Vector2 vector1 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); - float var6 = pcx - vector1.X; - float var7 = pcy - vector1.Y; - float var8 = (float)Math.Sqrt(var6 * var6 + var7 * var7); - var8 = homingstrenght / var8; - var6 *= var8; - var7 *= var8; - projectile.velocity.X = (projectile.velocity.X * 20f + var6) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + var7) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, 16f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/SupernovaHoming.cs b/Projectiles/Rogue/SupernovaHoming.cs index 8b0cf83d00..e3daa514b1 100644 --- a/Projectiles/Rogue/SupernovaHoming.cs +++ b/Projectiles/Rogue/SupernovaHoming.cs @@ -51,41 +51,33 @@ namespace CalamityMod.Projectiles.Rogue { projectile.extraUpdates = 1; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 500f; - bool flag17 = false; + Vector2 center = projectile.Center; + float maxDistance = 500f; + bool homeIn = false; - for (int num475 = 0; num475 < Main.npc.Length; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); - if (flag17) - { - float num483 = 12f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + { + center = Main.npc[i].Center; + homeIn = true; + break; + } + } + } + + if (homeIn) + { + Vector2 homeInVector = projectile.DirectionTo(center); + if (homeInVector.HasNaNs()) + homeInVector = Vector2.UnitY; + + projectile.velocity = (projectile.velocity * 20f + homeInVector * 12f) / (21f); + } else projectile.Kill(); } diff --git a/Projectiles/Rogue/TurbulanceWindSlash.cs b/Projectiles/Rogue/TurbulanceWindSlash.cs index 4085026e09..e548f4f7a1 100644 --- a/Projectiles/Rogue/TurbulanceWindSlash.cs +++ b/Projectiles/Rogue/TurbulanceWindSlash.cs @@ -61,39 +61,7 @@ namespace CalamityMod.Projectiles.Rogue } if (projectile.ai[1] == 1f) { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 150f; - bool flag17 = false; - 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)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - if (flag17) - { - float num483 = 8f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 150f, 8f, 20f); } } diff --git a/Projectiles/Rogue/ValedictionBoomerang.cs b/Projectiles/Rogue/ValedictionBoomerang.cs index 07cf60313d..b965ea877c 100644 --- a/Projectiles/Rogue/ValedictionBoomerang.cs +++ b/Projectiles/Rogue/ValedictionBoomerang.cs @@ -48,39 +48,7 @@ namespace CalamityMod.Projectiles.Rogue } else { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - 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)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - 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; - } - } - } - if (flag17) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 20f, 20f); } } else