From 54ad62fb96edef4723217e17b082eb53b1e652d7 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Fri, 11 Dec 2020 23:03:15 -0500 Subject: [PATCH] draedon's arsenal doesn't exist. It can't hurt you --- Items/Fishing/AstralCatches/GacruxianMollusk.cs | 3 ++- .../Weapons/DraedonsArsenal/FrequencyManipulator.cs | 4 +++- Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs | 5 +++-- Items/Weapons/DraedonsArsenal/SystemBane.cs | 4 +++- Items/Weapons/DraedonsArsenal/TrackingDisk.cs | 4 +++- Items/Weapons/DraedonsArsenal/WavePounder.cs | 4 +++- .../DraedonsArsenal/WavePounderProjectile.cs | 13 ++++++++----- 7 files changed, 25 insertions(+), 12 deletions(-) diff --git a/Items/Fishing/AstralCatches/GacruxianMollusk.cs b/Items/Fishing/AstralCatches/GacruxianMollusk.cs index f8d29162a1..fe953cf8bb 100644 --- a/Items/Fishing/AstralCatches/GacruxianMollusk.cs +++ b/Items/Fishing/AstralCatches/GacruxianMollusk.cs @@ -47,7 +47,8 @@ namespace CalamityMod.Items.Fishing.AstralCatches if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[stealth].Calamity().stealthStrike = true; + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs b/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs index 00c8889fbe..7c4d99b2c1 100644 --- a/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs +++ b/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs @@ -52,7 +52,9 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectileDirect(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f).Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs index 5b676a6029..35115c48ee 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs @@ -48,8 +48,9 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile grenade = Projectile.NewProjectileDirect(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - grenade.Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/DraedonsArsenal/SystemBane.cs b/Items/Weapons/DraedonsArsenal/SystemBane.cs index 7245254edf..43cb0cfddf 100644 --- a/Items/Weapons/DraedonsArsenal/SystemBane.cs +++ b/Items/Weapons/DraedonsArsenal/SystemBane.cs @@ -52,7 +52,9 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectileDirect(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f).Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs index 804e77c63f..08db5e5ffc 100644 --- a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs +++ b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs @@ -52,7 +52,9 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectileDirect(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f).Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/DraedonsArsenal/WavePounder.cs b/Items/Weapons/DraedonsArsenal/WavePounder.cs index 17a57f20e0..a56b4f7923 100644 --- a/Items/Weapons/DraedonsArsenal/WavePounder.cs +++ b/Items/Weapons/DraedonsArsenal/WavePounder.cs @@ -50,7 +50,9 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectileDirect(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f).Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Projectiles/DraedonsArsenal/WavePounderProjectile.cs b/Projectiles/DraedonsArsenal/WavePounderProjectile.cs index 2ac7b1e5d5..0e6b376d8d 100644 --- a/Projectiles/DraedonsArsenal/WavePounderProjectile.cs +++ b/Projectiles/DraedonsArsenal/WavePounderProjectile.cs @@ -68,11 +68,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int i = 0; i < 7; i++) { Projectile explosion = Projectile.NewProjectileDirect(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), projectile.knockBack, projectile.owner); - explosion.ai[1] = Main.rand.NextFloat(320f, 870f) + i * 45f; // Randomize the maximum radius. - explosion.localAI[1] = Main.rand.NextFloat(0.08f, 0.25f); // And the interpolation step. - explosion.Opacity = MathHelper.Lerp(0.18f, 0.6f, i / 7f) + Main.rand.NextFloat(-0.08f, 0.08f); - explosion.Calamity().stealthStrike = true; - explosion.netUpdate = true; + if (explosion.whoAmI.WithinBounds(Main.maxProjectiles)) + { + explosion.ai[1] = Main.rand.NextFloat(320f, 870f) + i * 45f; // Randomize the maximum radius. + explosion.localAI[1] = Main.rand.NextFloat(0.08f, 0.25f); // And the interpolation step. + explosion.Opacity = MathHelper.Lerp(0.18f, 0.6f, i / 7f) + Main.rand.NextFloat(-0.08f, 0.08f); + explosion.Calamity().stealthStrike = true; + explosion.netUpdate = true; + } } } }