diff --git a/Items/Weapons/Rogue/AccretionDisk.cs b/Items/Weapons/Rogue/AccretionDisk.cs index d570a0c637..3bfe07bb07 100644 --- a/Items/Weapons/Rogue/AccretionDisk.cs +++ b/Items/Weapons/Rogue/AccretionDisk.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -36,13 +37,13 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - speedX *= 0.7f; - speedY *= 0.7f; - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + velocity.X *= 0.7f; + velocity.Y *= 0.7f; + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().stealthStrike = true; @@ -56,7 +57,15 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType()). + AddIngredient(ModContent.ItemType()). + AddIngredient(ModContent.ItemType()). + AddIngredient(ModContent.ItemType(), 5). + AddIngredient(ModContent.ItemType(), 5). + AddIngredient(ItemID.LunarBar, 5). + AddTile(TileID.LunarCraftingStation). + Register(); } } } diff --git a/Items/Weapons/Rogue/AcidicRainBarrel.cs b/Items/Weapons/Rogue/AcidicRainBarrel.cs index 83c0c2f8a4..0a40b57467 100644 --- a/Items/Weapons/Rogue/AcidicRainBarrel.cs +++ b/Items/Weapons/Rogue/AcidicRainBarrel.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -35,12 +36,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 14f; Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - speedY *= 0.667f; - Vector2 initialVelocity = new Vector2(speedX, speedY); + velocity.Y *= 0.667f; + Vector2 initialVelocity = velocity; - int p = Projectile.NewProjectile(position - Vector2.UnitY * 12f, initialVelocity, type, damage, knockBack, player.whoAmI); + int p = Projectile.NewProjectile(source, position - Vector2.UnitY * 12f, initialVelocity, type, damage, knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; diff --git a/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs b/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs index 87aa437492..2d39467dd3 100644 --- a/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs +++ b/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -35,11 +36,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/AlphaVirus.cs b/Items/Weapons/Rogue/AlphaVirus.cs index 2786c0bd6a..c4e9a910ba 100644 --- a/Items/Weapons/Rogue/AlphaVirus.cs +++ b/Items/Weapons/Rogue/AlphaVirus.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -38,11 +39,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, Item.shootSpeed, 0f); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, Item.shootSpeed, 0f); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/Apoctolith.cs b/Items/Weapons/Rogue/Apoctolith.cs index e75131a990..6b56d6d9b1 100644 --- a/Items/Weapons/Rogue/Apoctolith.cs +++ b/Items/Weapons/Rogue/Apoctolith.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Rogue; @@ -40,14 +41,14 @@ namespace CalamityMod.Items.Weapons.Rogue } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 20; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 20; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { //Check if stealth is full if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)(damage * 1.25f), knockBack, player.whoAmI); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, (int)(damage * 1.25f), knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/AshenStalactite.cs b/Items/Weapons/Rogue/AshenStalactite.cs index dd8bcb3187..368847609f 100644 --- a/Items/Weapons/Rogue/AshenStalactite.cs +++ b/Items/Weapons/Rogue/AshenStalactite.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -36,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { @@ -44,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Rogue float stealthSpeedMult = 0.6f; float stealthDamageMult = 1.15f; float stealthKnockbackMult = 2.5f; - int p = Projectile.NewProjectile(position.X, position.Y, speedX * stealthSpeedMult, speedY * stealthSpeedMult, stealthType, (int)(damage * stealthDamageMult), (int)(knockBack * stealthKnockbackMult), player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X * stealthSpeedMult, velocity.Y * stealthSpeedMult, stealthType, (int)(damage * stealthDamageMult), (int)(knockback * stealthKnockbackMult), player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/AuroradicalThrow.cs b/Items/Weapons/Rogue/AuroradicalThrow.cs index 0992859e6f..acd4306b09 100644 --- a/Items/Weapons/Rogue/AuroradicalThrow.cs +++ b/Items/Weapons/Rogue/AuroradicalThrow.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -37,12 +38,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) damage = (int)(damage * 1.2f); - int star = Projectile.NewProjectile(player.Center, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int star = Projectile.NewProjectile(source, player.Center, velocity, type, damage, knockback, player.whoAmI); if (star.WithinBounds(Main.maxProjectiles)) Main.projectile[star].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; diff --git a/Items/Weapons/Rogue/BallisticPoisonBomb.cs b/Items/Weapons/Rogue/BallisticPoisonBomb.cs index ff616310cf..8cebf5cc63 100644 --- a/Items/Weapons/Rogue/BallisticPoisonBomb.cs +++ b/Items/Weapons/Rogue/BallisticPoisonBomb.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Rogue; @@ -38,15 +39,15 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { int spread = 5; for (int i = 0; i < 3; i++) { - Vector2 perturbedspeed = new Vector2(speedX + Main.rand.Next(-3,4), speedY + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(position, perturbedspeed, type, Math.Max(damage / 3, 1), knockBack, player.whoAmI); + Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3,4), velocity.Y + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); + int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, Math.Max(damage / 3, 1), knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; spread -= Main.rand.Next(2,6); diff --git a/Items/Weapons/Rogue/BlastBarrel.cs b/Items/Weapons/Rogue/BlastBarrel.cs index 565438d191..8190f33f41 100644 --- a/Items/Weapons/Rogue/BlastBarrel.cs +++ b/Items/Weapons/Rogue/BlastBarrel.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -36,13 +37,13 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 12f; Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - speedY *= 0.85f; - Vector2 initialVelocity = new Vector2(speedX, speedY); + velocity.Y *= 0.85f; + Vector2 initialVelocity = velocity; // A vertical offset is added to ensure that the barrel does not immediately collide with tiles and explode. - int p = Projectile.NewProjectile(position - Vector2.UnitY * 12f, initialVelocity, type, damage, knockBack, player.whoAmI); + int p = Projectile.NewProjectile(source, position - Vector2.UnitY * 12f, initialVelocity, type, damage, knockback, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/BlazingStar.cs b/Items/Weapons/Rogue/BlazingStar.cs index bb94c35516..5c157881b8 100644 --- a/Items/Weapons/Rogue/BlazingStar.cs +++ b/Items/Weapons/Rogue/BlazingStar.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -39,9 +40,9 @@ namespace CalamityMod.Items.Weapons.Rogue } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 4; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 4; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { @@ -51,12 +52,12 @@ namespace CalamityMod.Items.Weapons.Rogue for (int i = 0; i < Item.stack; i++) { - Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-MathHelper.ToRadians(8f), MathHelper.ToRadians(8f), i / (float)(Item.stack - 1))); - Projectile proj = Projectile.NewProjectileDirect(position, perturbedSpeed, type, damage, knockBack, player.whoAmI); + Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.Lerp(-MathHelper.ToRadians(8f), MathHelper.ToRadians(8f), i / (float)(Item.stack - 1))); + Projectile proj = Projectile.NewProjectileDirect(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI); if (proj.whoAmI.WithinBounds(Main.maxProjectiles)) proj.Calamity().stealthStrike = true; - Projectile projectile = Projectile.NewProjectileDirect(position, perturbedSpeed, type, damage, knockBack, player.whoAmI); + Projectile projectile = Projectile.NewProjectileDirect(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI); if (projectile.whoAmI.WithinBounds(Main.maxProjectiles)) { projectile.penetrate = -1; diff --git a/Items/Weapons/Rogue/BloodsoakedCrasher.cs b/Items/Weapons/Rogue/BloodsoakedCrasher.cs index 21ab5add3c..85f454edc7 100644 --- a/Items/Weapons/Rogue/BloodsoakedCrasher.cs +++ b/Items/Weapons/Rogue/BloodsoakedCrasher.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -38,9 +39,9 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().customRarity = CalamityRarity.Turquoise; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, 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/Rogue/BouncingBetty.cs b/Items/Weapons/Rogue/BouncingBetty.cs index 32665d720c..051121f796 100644 --- a/Items/Weapons/Rogue/BouncingBetty.cs +++ b/Items/Weapons/Rogue/BouncingBetty.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -36,10 +37,10 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 16f; Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Vector2 velocity = new Vector2(speedX, speedY); - int projectileIndex = Projectile.NewProjectile(position, velocity, type, damage, knockBack, player.whoAmI); + + int projectileIndex = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && projectileIndex.WithinBounds(Main.maxProjectiles)) { Main.projectile[projectileIndex].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/BouncingEyeball.cs b/Items/Weapons/Rogue/BouncingEyeball.cs index bf836541aa..ea2bf7855d 100644 --- a/Items/Weapons/Rogue/BouncingEyeball.cs +++ b/Items/Weapons/Rogue/BouncingEyeball.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -34,18 +35,18 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 10f; Item.autoReuse = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { bool bloodMoon = Main.bloodMoon; - Vector2 initialVelocity = new Vector2(speedX, speedY); + Vector2 initialVelocity = velocity; if (bloodMoon) { - knockBack *= 3f; + knockback *= 3f; } if (player.Calamity().StealthStrikeAvailable()) { initialVelocity *= 2f; - int p = Projectile.NewProjectile(position, initialVelocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + int p = Projectile.NewProjectile(source, position, initialVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; } @@ -53,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Rogue { initialVelocity *= Main.rand.NextFloat(0.85f, 1.3f); initialVelocity = initialVelocity.RotatedByRandom(MathHelper.ToRadians(10f)); //random spread - Projectile.NewProjectile(position, initialVelocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, initialVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Rogue/BouncySpikyBall.cs b/Items/Weapons/Rogue/BouncySpikyBall.cs index 10a4dadf4a..ae8e1b9ea4 100644 --- a/Items/Weapons/Rogue/BouncySpikyBall.cs +++ b/Items/Weapons/Rogue/BouncySpikyBall.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -38,11 +39,11 @@ Stealth strikes provide a bigger boost after richocheting"); Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/BrackishFlask.cs b/Items/Weapons/Rogue/BrackishFlask.cs index 6581dcdd04..e56bd15d43 100644 --- a/Items/Weapons/Rogue/BrackishFlask.cs +++ b/Items/Weapons/Rogue/BrackishFlask.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -35,11 +36,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 0.85f), knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 0.85f), knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/Brimblade.cs b/Items/Weapons/Rogue/Brimblade.cs index 8046193a96..b2f515ca95 100644 --- a/Items/Weapons/Rogue/Brimblade.cs +++ b/Items/Weapons/Rogue/Brimblade.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Magic; @@ -37,18 +38,18 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int blade = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int blade = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (blade.WithinBounds(Main.maxProjectiles)) Main.projectile[blade].Calamity().stealthStrike = true; for (int i = -6; i <= 6; i += 4) { - Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); - int dart = Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType(), damage, knockBack * 0.5f, player.whoAmI); + Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i)); + int dart = Projectile.NewProjectile(source, position, perturbedSpeed, ModContent.ProjectileType(), damage, knockback * 0.5f, player.whoAmI); if (dart.WithinBounds(Main.maxProjectiles)) Main.projectile[dart].Calamity().forceRogue = true; } diff --git a/Items/Weapons/Rogue/BurningStrife.cs b/Items/Weapons/Rogue/BurningStrife.cs index 28804a155a..b369dcf335 100644 --- a/Items/Weapons/Rogue/BurningStrife.cs +++ b/Items/Weapons/Rogue/BurningStrife.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -38,9 +39,9 @@ namespace CalamityMod.Items.Weapons.Rogue } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 8; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 8; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float speedMult = 1f; if (player.Calamity().StealthStrikeAvailable()) @@ -48,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Rogue speedMult = 1.25f; damage = (int)(damage * 1.3f); } - int proj = Projectile.NewProjectile(position, new Vector2(speedX * speedMult, speedY * speedMult), type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, new Vector2(velocity.X * speedMult, velocity.Y * speedMult), type, damage, knockback, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/CelestialReaper.cs b/Items/Weapons/Rogue/CelestialReaper.cs index 734515a4e2..328218439c 100644 --- a/Items/Weapons/Rogue/CelestialReaper.cs +++ b/Items/Weapons/Rogue/CelestialReaper.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -38,15 +39,15 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { bool usingStealth = player.Calamity().StealthStrikeAvailable(); float strikeValue = usingStealth.ToInt(); //0 if false, 1 if true - Vector2 velocity = new Vector2(speedX, speedY); + // Directly nerf stealth strikes by 10%, but only stealth strikes. int finalDamage = (int)(damage * (usingStealth ? 0.9f : 1.0f)); - int p = Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), finalDamage, knockBack, player.whoAmI, strikeValue); + int p = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), finalDamage, knockback, player.whoAmI, strikeValue); if (player.Calamity().StealthStrikeAvailable() && p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/Celestus.cs b/Items/Weapons/Rogue/Celestus.cs index 97e642d958..de76bbf86e 100644 --- a/Items/Weapons/Rogue/Celestus.cs +++ b/Items/Weapons/Rogue/Celestus.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -37,11 +38,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().customRarity = CalamityRarity.Violet; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 0.4), knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 0.4), knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; } diff --git a/Items/Weapons/Rogue/Cinquedea.cs b/Items/Weapons/Rogue/Cinquedea.cs index 1b2213367d..cc43c8ba22 100644 --- a/Items/Weapons/Rogue/Cinquedea.cs +++ b/Items/Weapons/Rogue/Cinquedea.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -39,13 +40,13 @@ namespace CalamityMod.Items.Weapons.Rogue } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 8; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 8; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/CobaltKunai.cs b/Items/Weapons/Rogue/CobaltKunai.cs index fb61051941..61157ab083 100644 --- a/Items/Weapons/Rogue/CobaltKunai.cs +++ b/Items/Weapons/Rogue/CobaltKunai.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -35,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { @@ -43,8 +44,8 @@ namespace CalamityMod.Items.Weapons.Rogue for (int i = -6; i <= 6; i += 6) { - Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); - int stealth = Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i)); + int stealth = Projectile.NewProjectile(source, position, perturbedSpeed, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; } diff --git a/Items/Weapons/Rogue/ConsecratedWater.cs b/Items/Weapons/Rogue/ConsecratedWater.cs index 837e12c46d..76f7b0ddc1 100644 --- a/Items/Weapons/Rogue/ConsecratedWater.cs +++ b/Items/Weapons/Rogue/ConsecratedWater.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -39,11 +40,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Vector2 velocity = new Vector2(speedX, speedY); + float strikeValue = player.Calamity().StealthStrikeAvailable().ToInt(); //0 if false, 1 if true - int p = Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, ai1: strikeValue); + int p = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, ai1: strikeValue); if (player.Calamity().StealthStrikeAvailable() && p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/ContaminatedBile.cs b/Items/Weapons/Rogue/ContaminatedBile.cs index 991a41961f..33298301f9 100644 --- a/Items/Weapons/Rogue/ContaminatedBile.cs +++ b/Items/Weapons/Rogue/ContaminatedBile.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -33,10 +34,10 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 15f; Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Vector2 velocity = new Vector2(speedX, speedY); - int p = Projectile.NewProjectile(position, velocity, type, damage, knockBack, player.whoAmI); + + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; diff --git a/Items/Weapons/Rogue/CorpusAvertor.cs b/Items/Weapons/Rogue/CorpusAvertor.cs index 3d6315bc6a..fad1b15fc4 100644 --- a/Items/Weapons/Rogue/CorpusAvertor.cs +++ b/Items/Weapons/Rogue/CorpusAvertor.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -47,11 +48,11 @@ namespace CalamityMod.Items.Weapons.Rogue flat += lifeAmount * 0.1f * player.RogueDamage(); } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int dagger = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), (int)(damage * 3.5f), knockBack * 2f, player.whoAmI); + int dagger = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), (int)(damage * 3.5f), knockback * 2f, player.whoAmI); if (dagger.WithinBounds(Main.maxProjectiles)) Main.projectile[dagger].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/CosmicKunai.cs b/Items/Weapons/Rogue/CosmicKunai.cs index 701b62de1a..9941d68f69 100644 --- a/Items/Weapons/Rogue/CosmicKunai.cs +++ b/Items/Weapons/Rogue/CosmicKunai.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -40,9 +41,9 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && player.ownedProjectileCounts[ModContent.ProjectileType()] < 10 && counter == 0 && stealth.WithinBounds(Main.maxProjectiles)) { damage = (int)(damage * 3.21); @@ -51,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Rogue for (float i = 0; i < 5; i++) { float angle = MathHelper.TwoPi / 5f * i; - Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)(damage * 0.8f), knockBack, player.whoAmI, angle, 0f); + Projectile.NewProjectile(source, player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)(damage * 0.8f), knockback, player.whoAmI, angle, 0f); } } diff --git a/Items/Weapons/Rogue/CraniumSmasher.cs b/Items/Weapons/Rogue/CraniumSmasher.cs index abf8de41ab..50f7de4399 100644 --- a/Items/Weapons/Rogue/CraniumSmasher.cs +++ b/Items/Weapons/Rogue/CraniumSmasher.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -35,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { @@ -51,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Rogue { type = ModContent.ProjectileType(); } - int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, 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/Rogue/CrushsawCrasher.cs b/Items/Weapons/Rogue/CrushsawCrasher.cs index 5c8f257dc9..539521b8ff 100644 --- a/Items/Weapons/Rogue/CrushsawCrasher.cs +++ b/Items/Weapons/Rogue/CrushsawCrasher.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -35,15 +36,15 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { int spread = 3; for (int i = 0; i < 5; i++) { - Vector2 perturbedspeed = new Vector2(speedX + Main.rand.Next(-3,4), speedY + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(position, perturbedspeed, type, Math.Max(damage / 5, 1), knockBack, player.whoAmI); + Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3,4), velocity.Y + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); + int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, Math.Max(damage / 5, 1), knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/CrystalPiercer.cs b/Items/Weapons/Rogue/CrystalPiercer.cs index 8bb0d10f05..df673ea15e 100644 --- a/Items/Weapons/Rogue/CrystalPiercer.cs +++ b/Items/Weapons/Rogue/CrystalPiercer.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -38,11 +39,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/Crystalline.cs b/Items/Weapons/Rogue/Crystalline.cs index fefd183c32..2077d2abd0 100644 --- a/Items/Weapons/Rogue/Crystalline.cs +++ b/Items/Weapons/Rogue/Crystalline.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -36,18 +37,18 @@ namespace CalamityMod.Items.Weapons.Rogue } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 4; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 4; public override void AddRecipes() { CreateRecipe(1).AddIngredient(ModContent.ItemType(), 50).AddIngredient(ItemID.Diamond, 3).AddIngredient(ItemID.FallenStar, 3).AddTile(TileID.Anvils).Register(); } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/CursedDagger.cs b/Items/Weapons/Rogue/CursedDagger.cs index a4a5f52ff0..3b936af10b 100644 --- a/Items/Weapons/Rogue/CursedDagger.cs +++ b/Items/Weapons/Rogue/CursedDagger.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -35,11 +36,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/DeepSeaDumbbell.cs b/Items/Weapons/Rogue/DeepSeaDumbbell.cs index 9995c17ad4..51769bcbf0 100644 --- a/Items/Weapons/Rogue/DeepSeaDumbbell.cs +++ b/Items/Weapons/Rogue/DeepSeaDumbbell.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -73,11 +74,11 @@ namespace CalamityMod.Items.Weapons.Rogue } // Reset flex multiplier on direct hits. - public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) => flexMult = 1f; + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) => flexMult = 1f; public override void OnHitPvp(Player player, Player target, int damage, bool crit) => flexMult = 1f; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { // Alt fire doesn't actually shoot anything. It flexes, increasing the damage of the next attack. if (player.altFunctionUse == 2) @@ -89,7 +90,7 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) damage = (int)(damage * 1.3); - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/DeepWounder.cs b/Items/Weapons/Rogue/DeepWounder.cs index 5b45298109..26ab60d075 100644 --- a/Items/Weapons/Rogue/DeepWounder.cs +++ b/Items/Weapons/Rogue/DeepWounder.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -36,16 +37,16 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { float stealthSpeedMult = 1.5f; - Vector2 velocity = new Vector2(speedX, speedY); + velocity.Normalize(); velocity *= Item.shootSpeed * stealthSpeedMult; - int p = Projectile.NewProjectile(position, velocity, type, damage, knockBack, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/DefectiveSphere.cs b/Items/Weapons/Rogue/DefectiveSphere.cs index 1310b9c3c6..d1944e68b3 100644 --- a/Items/Weapons/Rogue/DefectiveSphere.cs +++ b/Items/Weapons/Rogue/DefectiveSphere.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -61,7 +62,7 @@ Stealth strikes launch all 4 sphere types at once"); } } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int sphereType = Utils.SelectRandom(Main.rand, new int[] { @@ -85,15 +86,15 @@ Stealth strikes launch all 4 sphere types at once"); foreach (int projectileType in projectilesToShoot) { - Vector2 shootVelocity = new Vector2(speedX, speedY) + Main.rand.NextVector2Square(-1.5f, 1.5f); - int stealth = Projectile.NewProjectile(position, shootVelocity, projectileType, (int)(damage * 0.625f), knockBack, player.whoAmI); + Vector2 shootVelocity = velocity + Main.rand.NextVector2Square(-1.5f, 1.5f); + int stealth = Projectile.NewProjectile(source, position, shootVelocity, projectileType, (int)(damage * 0.625f), knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; } } else { - Projectile.NewProjectile(position, new Vector2(speedX, speedY), sphereType, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity, sphereType, damage, knockback, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Rogue/DeificThunderbolt.cs b/Items/Weapons/Rogue/DeificThunderbolt.cs index 55d7535c99..f338d659fe 100644 --- a/Items/Weapons/Rogue/DeificThunderbolt.cs +++ b/Items/Weapons/Rogue/DeificThunderbolt.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Terraria; @@ -42,9 +43,9 @@ Stealth strikes summon more lightning and travel faster"); } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 12; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 12; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float stealthSpeedMult = 1f; if (player.Calamity().StealthStrikeAvailable()) @@ -53,7 +54,7 @@ Stealth strikes summon more lightning and travel faster"); if (Main.raining) rainSpeedMult = 1.5f; - int thunder = Projectile.NewProjectile(position.X, position.Y, speedX * rainSpeedMult * stealthSpeedMult, speedY * rainSpeedMult * stealthSpeedMult, type, damage, knockBack, player.whoAmI, 0f, 0f); + int thunder = Projectile.NewProjectile(source, position.X, position.Y, velocity.X * rainSpeedMult * stealthSpeedMult, velocity.Y * rainSpeedMult * stealthSpeedMult, type, damage, knockback, player.whoAmI, 0f, 0f); if (player.Calamity().StealthStrikeAvailable() && thunder.WithinBounds(Main.maxProjectiles)) //setting the stealth strike { Main.projectile[thunder].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/DesecratedWater.cs b/Items/Weapons/Rogue/DesecratedWater.cs index cfe7e389ac..eaf8150aa8 100644 --- a/Items/Weapons/Rogue/DesecratedWater.cs +++ b/Items/Weapons/Rogue/DesecratedWater.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -36,11 +37,11 @@ Stealth strikes spawn additional bubbles that inflict Ichor and Cursed Inferno") Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/DukesDecapitator.cs b/Items/Weapons/Rogue/DukesDecapitator.cs index a5c2bf669d..4a1fc67aa5 100644 --- a/Items/Weapons/Rogue/DukesDecapitator.cs +++ b/Items/Weapons/Rogue/DukesDecapitator.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue { DisplayName.SetDefault("Duke's Decapitator"); Tooltip.SetDefault("Throws a hydro axe which shreds enemies when it comes into contact with them\n" - +"The faster it’s spinning, the more times it hits before disappearing\n" + +"The faster it�s spinning, the more times it hits before disappearing\n" +"Stealth Strikes make it emit short-ranged bubbles."); } @@ -36,12 +37,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) damage = (int)(damage * 1.2f); - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(proj)) Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; diff --git a/Items/Weapons/Rogue/DuneHopper.cs b/Items/Weapons/Rogue/DuneHopper.cs index f4f3c34919..ff010d2c6c 100644 --- a/Items/Weapons/Rogue/DuneHopper.cs +++ b/Items/Weapons/Rogue/DuneHopper.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Rogue; @@ -38,7 +39,7 @@ Stealth strikes throw three high speed spears"); Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { @@ -46,8 +47,8 @@ Stealth strikes throw three high speed spears"); float rotation = MathHelper.ToRadians(3); for (int i = 0; i < numProj + 1; i++) { - Vector2 perturbedSpeed = new Vector2(speedX - 3f, speedY - 3f).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - int stealth = Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType(), Math.Max(damage / 3, 1), knockBack, player.whoAmI); + Vector2 perturbedSpeed = new Vector2(velocity.X - 3f, velocity.Y - 3f).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + int stealth = Projectile.NewProjectile(source, position, perturbedSpeed, ModContent.ProjectileType(), Math.Max(damage / 3, 1), knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; } diff --git a/Items/Weapons/Rogue/DuststormInABottle.cs b/Items/Weapons/Rogue/DuststormInABottle.cs index af7fdc6b36..cb9dbb4d0a 100644 --- a/Items/Weapons/Rogue/DuststormInABottle.cs +++ b/Items/Weapons/Rogue/DuststormInABottle.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -36,11 +37,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/EclipsesFall.cs b/Items/Weapons/Rogue/EclipsesFall.cs index 57b5d730c4..99ada4060b 100644 --- a/Items/Weapons/Rogue/EclipsesFall.cs +++ b/Items/Weapons/Rogue/EclipsesFall.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -38,12 +39,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().customRarity = CalamityRarity.DarkBlue; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) type = ModContent.ProjectileType(); - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, 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/Rogue/EnchantedAxe.cs b/Items/Weapons/Rogue/EnchantedAxe.cs index a395f449ab..0bdc660bc5 100644 --- a/Items/Weapons/Rogue/EnchantedAxe.cs +++ b/Items/Weapons/Rogue/EnchantedAxe.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -39,11 +40,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/EpidemicShredder.cs b/Items/Weapons/Rogue/EpidemicShredder.cs index 8fa78e34fb..63d016478f 100644 --- a/Items/Weapons/Rogue/EpidemicShredder.cs +++ b/Items/Weapons/Rogue/EpidemicShredder.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -36,11 +37,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 18f; Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Vector2 velocity = new Vector2(speedX, speedY); + float strikeValue = player.Calamity().StealthStrikeAvailable().ToInt(); //0 if false, 1 if true - int projectileIndex = Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, ai1: strikeValue); + int projectileIndex = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, ai1: strikeValue); if (player.Calamity().StealthStrikeAvailable() && projectileIndex.WithinBounds(Main.maxProjectiles)) { Main.projectile[projectileIndex].Calamity().stealthStrike = strikeValue == 1f; diff --git a/Items/Weapons/Rogue/Equanimity.cs b/Items/Weapons/Rogue/Equanimity.cs index f337037440..3c83cfc75e 100644 --- a/Items/Weapons/Rogue/Equanimity.cs +++ b/Items/Weapons/Rogue/Equanimity.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -37,11 +38,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/Eradicator.cs b/Items/Weapons/Rogue/Eradicator.cs index 4aaa496cdb..1e966a822c 100644 --- a/Items/Weapons/Rogue/Eradicator.cs +++ b/Items/Weapons/Rogue/Eradicator.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -39,12 +40,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) damage = (int)(damage * 0.5f); - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].timeLeft += EradicatorProjectile.StealthExtraLifetime; diff --git a/Items/Weapons/Rogue/ExecutionersBlade.cs b/Items/Weapons/Rogue/ExecutionersBlade.cs index ffea2434a8..2485c376d0 100644 --- a/Items/Weapons/Rogue/ExecutionersBlade.cs +++ b/Items/Weapons/Rogue/ExecutionersBlade.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -52,13 +53,13 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddTile(ModContent.TileType()).Register(); } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { bool usingStealth = player.Calamity().StealthStrikeAvailable() && counter == 0; if (usingStealth) damage = (int)(damage * 3.61); - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (usingStealth && stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/Exorcism.cs b/Items/Weapons/Rogue/Exorcism.cs index d5cccbc85f..3fd6b6d452 100644 --- a/Items/Weapons/Rogue/Exorcism.cs +++ b/Items/Weapons/Rogue/Exorcism.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -37,17 +38,17 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)(damage * 1.15f), knockBack, player.whoAmI, 2f, damage); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, (int)(damage * 1.15f), knockback, player.whoAmI, 2f, damage); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; } else { - int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 1f, damage); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 1f, damage); } return false; } diff --git a/Items/Weapons/Rogue/FantasyTalisman.cs b/Items/Weapons/Rogue/FantasyTalisman.cs index 66ca4028e2..5ce09b9dd8 100644 --- a/Items/Weapons/Rogue/FantasyTalisman.cs +++ b/Items/Weapons/Rogue/FantasyTalisman.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -39,11 +40,11 @@ Stealth strikes release more souls and leave behind souls as they travel"); Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), (int)(damage * 0.8f), knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), (int)(damage * 0.8f), knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/FeatherKnife.cs b/Items/Weapons/Rogue/FeatherKnife.cs index fbb9f47b32..8b91e7264d 100644 --- a/Items/Weapons/Rogue/FeatherKnife.cs +++ b/Items/Weapons/Rogue/FeatherKnife.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -44,15 +45,15 @@ Stealth strike throws a volley of knives"); CreateRecipe(100).AddIngredient(ModContent.ItemType()).AddTile(TileID.SkyMill).Register(); } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { int spread = 6; for (int i = 0; i < 5; i++) { - Vector2 perturbedspeed = new Vector2(speedX + Main.rand.Next(-3, 4), speedY + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(position, perturbedspeed, type, damage, knockBack, player.whoAmI); + Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3, 4), velocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); + int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/FlameScythe.cs b/Items/Weapons/Rogue/FlameScythe.cs index d88f95ebd2..61773a2818 100644 --- a/Items/Weapons/Rogue/FlameScythe.cs +++ b/Items/Weapons/Rogue/FlameScythe.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -36,9 +37,9 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, 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/Rogue/FrostcrushValari.cs b/Items/Weapons/Rogue/FrostcrushValari.cs index 649592c4ac..b7668d076d 100644 --- a/Items/Weapons/Rogue/FrostcrushValari.cs +++ b/Items/Weapons/Rogue/FrostcrushValari.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Rogue; using CalamityMod.Items.Materials; @@ -42,9 +43,9 @@ Stealth strikes throw three short ranged boomerangs along with a spread of icicl } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 16; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 16; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityPlayer modPlayer = Main.player[Main.myPlayer].Calamity(); //If stealth is full, shoot a spread of 3 boomerangs with reduced range and 6 to 10 icicles @@ -53,8 +54,8 @@ Stealth strikes throw three short ranged boomerangs along with a spread of icicl int spread = 10; for (int i = 0; i < 3; i++) { - Vector2 perturbedspeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(position, perturbedspeed, type, Math.Max((int)(damage / 2.7272f), 1), knockBack / 3f, player.whoAmI, 0f, 1f); + Vector2 perturbedspeed = velocity.RotatedBy(MathHelper.ToRadians(spread)); + int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, Math.Max((int)(damage / 2.7272f), 1), knockback / 3f, player.whoAmI, 0f, 1f); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; spread -= 10; @@ -63,8 +64,8 @@ Stealth strikes throw three short ranged boomerangs along with a spread of icicl int icicleAmt = Main.rand.Next(6,11); for (int i = 0; i < icicleAmt; i++) { - Vector2 perturbedspeed = new Vector2(speedX + Main.rand.Next(-3,4), speedY + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread2)); - Projectile.NewProjectile(position, perturbedspeed, (Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType()), Math.Max((int)(damage / 2.7272f), 1), 0f, player.whoAmI, 0f, 0f); + Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3,4), velocity.Y + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread2)); + Projectile.NewProjectile(source, position, perturbedspeed, (Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType()), Math.Max((int)(damage / 2.7272f), 1), 0f, player.whoAmI, 0f, 0f); spread2 -= Main.rand.Next(1,4); } return false; diff --git a/Items/Weapons/Rogue/FrostyFlare.cs b/Items/Weapons/Rogue/FrostyFlare.cs index d2c8da0145..b0fadeb42e 100644 --- a/Items/Weapons/Rogue/FrostyFlare.cs +++ b/Items/Weapons/Rogue/FrostyFlare.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -40,11 +41,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int flare = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), (int)(damage * 0.9f), knockBack, player.whoAmI); + int flare = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), (int)(damage * 0.9f), knockback, player.whoAmI); if (flare.WithinBounds(Main.maxProjectiles)) Main.projectile[flare].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/GelDart.cs b/Items/Weapons/Rogue/GelDart.cs index d9451ba326..a2da66f373 100644 --- a/Items/Weapons/Rogue/GelDart.cs +++ b/Items/Weapons/Rogue/GelDart.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -38,11 +39,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/GhoulishGouger.cs b/Items/Weapons/Rogue/GhoulishGouger.cs index ef72586ff6..53875da370 100644 --- a/Items/Weapons/Rogue/GhoulishGouger.cs +++ b/Items/Weapons/Rogue/GhoulishGouger.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -44,9 +45,9 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Rogue/GhoulishGougerGlow")); } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, 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/Rogue/GildedDagger.cs b/Items/Weapons/Rogue/GildedDagger.cs index 72d20715c8..61e07a45fb 100644 --- a/Items/Weapons/Rogue/GildedDagger.cs +++ b/Items/Weapons/Rogue/GildedDagger.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -37,11 +38,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) { Main.projectile[p].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/Glaive.cs b/Items/Weapons/Rogue/Glaive.cs index eb36dfba3e..62379c0078 100644 --- a/Items/Weapons/Rogue/Glaive.cs +++ b/Items/Weapons/Rogue/Glaive.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -42,19 +43,19 @@ Stealth strikes are super fast and pierce infinitely"); } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 4; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 4; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float ai1 = 0f; if (player.Calamity().StealthStrikeAvailable()) { - speedX *= StealthSpeedMult; - speedY *= StealthSpeedMult; + velocity.X *= StealthSpeedMult; + velocity.Y *= StealthSpeedMult; ai1 = 1f; } - int p = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, ai1); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, ai1); if (player.Calamity().StealthStrikeAvailable() && p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/GleamingDagger.cs b/Items/Weapons/Rogue/GleamingDagger.cs index 29c30692db..a3ab1fef92 100644 --- a/Items/Weapons/Rogue/GleamingDagger.cs +++ b/Items/Weapons/Rogue/GleamingDagger.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -37,11 +38,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) { Main.projectile[p].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/GodsParanoia.cs b/Items/Weapons/Rogue/GodsParanoia.cs index 00fce5d392..a85f356f14 100644 --- a/Items/Weapons/Rogue/GodsParanoia.cs +++ b/Items/Weapons/Rogue/GodsParanoia.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; @@ -64,14 +65,14 @@ Right click to delete all existing spiky balls"); } } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.killSpikyBalls = false; if (modPlayer.StealthStrikeAvailable()) //setting the stealth strike { damage = (int)(damage * 1.345); - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/HardenedHoneycomb.cs b/Items/Weapons/Rogue/HardenedHoneycomb.cs index 9c63feaf90..07b046afe2 100644 --- a/Items/Weapons/Rogue/HardenedHoneycomb.cs +++ b/Items/Weapons/Rogue/HardenedHoneycomb.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -38,11 +39,11 @@ Stealth strikes can bounce off walls and enemies"); Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/HeavenfallenStardisk.cs b/Items/Weapons/Rogue/HeavenfallenStardisk.cs index b691453de5..7baa2038b9 100644 --- a/Items/Weapons/Rogue/HeavenfallenStardisk.cs +++ b/Items/Weapons/Rogue/HeavenfallenStardisk.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -37,19 +38,19 @@ namespace CalamityMod.Items.Weapons.Rogue } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 20; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 20; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int proj = Projectile.NewProjectile(position.X, position.Y, 0f, -10f, type, (int)(damage * 1.25f), knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position.X, position.Y, 0f, -10f, type, (int)(damage * 1.25f), knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; } else { - Projectile.NewProjectile(position.X, position.Y, 0f, -10f, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, 0f, -10f, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Rogue/HellsSun.cs b/Items/Weapons/Rogue/HellsSun.cs index cfa0b8cd5f..5003e16683 100644 --- a/Items/Weapons/Rogue/HellsSun.cs +++ b/Items/Weapons/Rogue/HellsSun.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -63,13 +64,13 @@ namespace CalamityMod.Items.Weapons.Rogue } } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.killSpikyBalls = false; if (modPlayer.StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), (int)(damage * SdamageMult), knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), (int)(damage * SdamageMult), knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/Hypothermia.cs b/Items/Weapons/Rogue/Hypothermia.cs index 1c18da969f..c174941a54 100644 --- a/Items/Weapons/Rogue/Hypothermia.cs +++ b/Items/Weapons/Rogue/Hypothermia.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -45,17 +46,17 @@ namespace CalamityMod.Items.Weapons.Rogue } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 16; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 16; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { int stealthDamage = (int)(damage * 1.2f); for (int i = 0; i < 4; ++i) { - Vector2 chunkVelocity = new Vector2(speedX, speedY).RotatedByRandom(0.07f) * Main.rand.NextFloat(1.1f, 1.18f); - int stealth = Projectile.NewProjectile(position, chunkVelocity, ModContent.ProjectileType(), stealthDamage, knockBack, player.whoAmI); + Vector2 chunkVelocity = velocity.RotatedByRandom(0.07f) * Main.rand.NextFloat(1.1f, 1.18f); + int stealth = Projectile.NewProjectile(source, position, chunkVelocity, ModContent.ProjectileType(), stealthDamage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; } @@ -70,10 +71,10 @@ namespace CalamityMod.Items.Weapons.Rogue for (int i = 0; i < projAmt; ++i) { - float SpeedX = speedX + Main.rand.NextFloat(-2f, 2f); - float SpeedY = speedY + Main.rand.NextFloat(-2f, 2f); + float SpeedX = velocity.X + Main.rand.NextFloat(-2f, 2f); + float SpeedY = velocity.Y + Main.rand.NextFloat(-2f, 2f); int texID = Main.rand.Next(4); - Projectile.NewProjectile(position, new Vector2(SpeedX, SpeedY), type, damage, knockBack, player.whoAmI, texID, 0f); + Projectile.NewProjectile(source, position, new Vector2(SpeedX, SpeedY), type, damage, knockback, player.whoAmI, texID, 0f); } return false; diff --git a/Items/Weapons/Rogue/IceStar.cs b/Items/Weapons/Rogue/IceStar.cs index 755e489b8f..e941c1c190 100644 --- a/Items/Weapons/Rogue/IceStar.cs +++ b/Items/Weapons/Rogue/IceStar.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -38,13 +39,13 @@ namespace CalamityMod.Items.Weapons.Rogue } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 7; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 7; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/Icebreaker.cs b/Items/Weapons/Rogue/Icebreaker.cs index b8c8c5ecad..366d7e82b6 100644 --- a/Items/Weapons/Rogue/Icebreaker.cs +++ b/Items/Weapons/Rogue/Icebreaker.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -34,11 +35,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/IchorSpear.cs b/Items/Weapons/Rogue/IchorSpear.cs index 3eb1bb7126..6312c71a3a 100644 --- a/Items/Weapons/Rogue/IchorSpear.cs +++ b/Items/Weapons/Rogue/IchorSpear.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -35,11 +36,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 1.6), knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 1.6), knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/InfernalKris.cs b/Items/Weapons/Rogue/InfernalKris.cs index fc4b1fb991..ad62a52955 100644 --- a/Items/Weapons/Rogue/InfernalKris.cs +++ b/Items/Weapons/Rogue/InfernalKris.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -37,11 +38,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/IronFrancisca.cs b/Items/Weapons/Rogue/IronFrancisca.cs index 5b09718f8b..eabac002d5 100644 --- a/Items/Weapons/Rogue/IronFrancisca.cs +++ b/Items/Weapons/Rogue/IronFrancisca.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -37,11 +38,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/JawsOfOblivion.cs b/Items/Weapons/Rogue/JawsOfOblivion.cs index 01b484f78d..0525cd068e 100644 --- a/Items/Weapons/Rogue/JawsOfOblivion.cs +++ b/Items/Weapons/Rogue/JawsOfOblivion.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; @@ -38,10 +39,10 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().customRarity = CalamityRarity.PureGreen; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float spreadAngle = MathHelper.ToRadians(2.5f); - Vector2 direction = new Vector2(speedX, speedY); + Vector2 direction = velocity; Vector2 baseDirection = direction.RotatedBy(-spreadAngle * 2.5f); for (int i = 0; i < 6; i++) @@ -51,13 +52,13 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(position, currentDirection, type, (int)(damage * 1.8), knockBack + 6f, player.whoAmI); + int p = Projectile.NewProjectile(source, position, currentDirection, type, (int)(damage * 1.8), knockback + 6f, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; } else { - Projectile.NewProjectile(position, currentDirection, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, currentDirection, type, damage, knockback, player.whoAmI); } } return false; diff --git a/Items/Weapons/Rogue/KelvinCatalyst.cs b/Items/Weapons/Rogue/KelvinCatalyst.cs index 9a3365a049..979a3d3190 100644 --- a/Items/Weapons/Rogue/KelvinCatalyst.cs +++ b/Items/Weapons/Rogue/KelvinCatalyst.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; @@ -40,9 +41,9 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, 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/Rogue/Kylie.cs b/Items/Weapons/Rogue/Kylie.cs index 2f80cd8ce5..fa32bfca71 100644 --- a/Items/Weapons/Rogue/Kylie.cs +++ b/Items/Weapons/Rogue/Kylie.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -38,9 +39,9 @@ namespace CalamityMod.Items.Weapons.Rogue } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 16; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 16; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityPlayer p = Main.player[Main.myPlayer].Calamity(); //If stealth is full, shoot a spread of 3 boomerangs with reduced range @@ -49,8 +50,8 @@ namespace CalamityMod.Items.Weapons.Rogue int spread = 10; for (int i = 0; i < 3; i++) { - Vector2 perturbedspeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(position, perturbedspeed, ModContent.ProjectileType(), Math.Max(damage / 3, 1), knockBack / 3f, player.whoAmI, 0f, 1f); + Vector2 perturbedspeed = velocity.RotatedBy(MathHelper.ToRadians(spread)); + int proj = Projectile.NewProjectile(source, position, perturbedspeed, ModContent.ProjectileType(), Math.Max(damage / 3, 1), knockback / 3f, player.whoAmI, 0f, 1f); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; spread -= 10; diff --git a/Items/Weapons/Rogue/LatcherMine.cs b/Items/Weapons/Rogue/LatcherMine.cs index 84c971dae5..84e7eb872e 100644 --- a/Items/Weapons/Rogue/LatcherMine.cs +++ b/Items/Weapons/Rogue/LatcherMine.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -39,9 +40,9 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; diff --git a/Items/Weapons/Rogue/LeadTomahawk.cs b/Items/Weapons/Rogue/LeadTomahawk.cs index 01c09c54cd..cd435a7c6f 100644 --- a/Items/Weapons/Rogue/LeadTomahawk.cs +++ b/Items/Weapons/Rogue/LeadTomahawk.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -37,11 +38,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/LeonidProgenitor.cs b/Items/Weapons/Rogue/LeonidProgenitor.cs index 7a4b051a0d..9942ecf24e 100644 --- a/Items/Weapons/Rogue/LeonidProgenitor.cs +++ b/Items/Weapons/Rogue/LeonidProgenitor.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -65,13 +66,13 @@ namespace CalamityMod.Items.Weapons.Rogue return 0.75f; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float stealthDamageFactor = player.Calamity().StealthStrikeAvailable() ? 1.25f : 1f; if (player.Calamity().StealthStrikeAvailable() || player.altFunctionUse != 2) { - int bomb = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * stealthDamageFactor), knockBack, player.whoAmI); + int bomb = Projectile.NewProjectile(source, position, velocity, type, (int)(damage * stealthDamageFactor), knockback, player.whoAmI); if (bomb.WithinBounds(Main.maxProjectiles)) Main.projectile[bomb].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; @@ -81,8 +82,8 @@ namespace CalamityMod.Items.Weapons.Rogue float dmgMult = 0.5f; for (float i = -2.5f; i < 3f; ++i) { - Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); - Projectile.NewProjectile(position, perturbedSpeed, type, (int)(damage * dmgMult * stealthDamageFactor), knockBack, player.whoAmI); + Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i)); + Projectile.NewProjectile(source, position, perturbedSpeed, type, (int)(damage * dmgMult * stealthDamageFactor), knockback, player.whoAmI); } } return false; diff --git a/Items/Weapons/Rogue/LeviathanTeeth.cs b/Items/Weapons/Rogue/LeviathanTeeth.cs index a9bb9e4413..167159f511 100644 --- a/Items/Weapons/Rogue/LeviathanTeeth.cs +++ b/Items/Weapons/Rogue/LeviathanTeeth.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -36,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { bool stealthStrike = false; int teethCount; @@ -55,12 +56,12 @@ namespace CalamityMod.Items.Weapons.Rogue for (int i = 0; i < teethCount; i++) { - float offsetSpeedX = speedX + Main.rand.NextFloat(-4f, 4f); - float offsetSpeedY = speedY + Main.rand.NextFloat(-4f, 4f); + float offsetSpeedX = velocity.X + Main.rand.NextFloat(-4f, 4f); + float offsetSpeedY = velocity.Y + Main.rand.NextFloat(-4f, 4f); if (stealthStrike) { - int tooth = Projectile.NewProjectile(position.X, position.Y, offsetSpeedX * 1.5f, offsetSpeedY * 1.5f, type, damage, knockBack * 10f, player.whoAmI); + int tooth = Projectile.NewProjectile(source, position.X, position.Y, offsetSpeedX * 1.5f, offsetSpeedY * 1.5f, type, damage, knockback * 10f, player.whoAmI); if (tooth.WithinBounds(Main.maxProjectiles)) { Main.projectile[tooth].Calamity().stealthStrike = true; @@ -69,7 +70,7 @@ namespace CalamityMod.Items.Weapons.Rogue } else { - int tooth = Projectile.NewProjectile(position.X, position.Y, offsetSpeedX, offsetSpeedY, type, damage, knockBack, player.whoAmI); + int tooth = Projectile.NewProjectile(source, position.X, position.Y, offsetSpeedX, offsetSpeedY, type, damage, knockback, player.whoAmI); if (tooth.WithinBounds(Main.maxProjectiles)) Main.projectile[tooth].Calamity().lineColor = Main.rand.Next(3); } diff --git a/Items/Weapons/Rogue/Lionfish.cs b/Items/Weapons/Rogue/Lionfish.cs index 907fc096ca..871deab890 100644 --- a/Items/Weapons/Rogue/Lionfish.cs +++ b/Items/Weapons/Rogue/Lionfish.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -35,11 +36,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/LuminousStriker.cs b/Items/Weapons/Rogue/LuminousStriker.cs index 2d52342008..061bcdeea7 100644 --- a/Items/Weapons/Rogue/LuminousStriker.cs +++ b/Items/Weapons/Rogue/LuminousStriker.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -38,9 +39,9 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 1.25f), knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 1.25f), knockback, player.whoAmI); if (Main.projectile.IndexInRange(proj)) Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; diff --git a/Items/Weapons/Rogue/LunarKunai.cs b/Items/Weapons/Rogue/LunarKunai.cs index 3168e58c32..2ee033b1fb 100644 --- a/Items/Weapons/Rogue/LunarKunai.cs +++ b/Items/Weapons/Rogue/LunarKunai.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using System; using Microsoft.Xna.Framework; using Terraria; @@ -39,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); @@ -77,7 +78,7 @@ namespace CalamityMod.Items.Weapons.Rogue num149 *= num80; float x4 = vector2.X; float y4 = vector2.Y; - int stealth = Projectile.NewProjectile(x4, y4, num148, num149, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + int stealth = Projectile.NewProjectile(source, x4, y4, num148, num149, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; } @@ -97,7 +98,7 @@ namespace CalamityMod.Items.Weapons.Rogue num149 *= num80; float x4 = vector2.X; float y4 = vector2.Y; - Projectile.NewProjectile(x4, y4, num148, num149, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, x4, y4, num148, num149, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); } } return false; diff --git a/Items/Weapons/Rogue/Malachite.cs b/Items/Weapons/Rogue/Malachite.cs index 679a76f434..b90fc36282 100644 --- a/Items/Weapons/Rogue/Malachite.cs +++ b/Items/Weapons/Rogue/Malachite.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -65,15 +66,15 @@ namespace CalamityMod.Items.Weapons.Rogue return 2f; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float dmgMult = 1f; if (player.Calamity().StealthStrikeAvailable()) { for (float i = -6.5f; i <= 6.5f; i += 6.5f) { - Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); - int stealth = Projectile.NewProjectile(position, perturbedSpeed, type, damage * 2, knockBack, player.whoAmI); + Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i)); + int stealth = Projectile.NewProjectile(source, position, perturbedSpeed, type, damage * 2, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; } @@ -87,7 +88,7 @@ namespace CalamityMod.Items.Weapons.Rogue { dmgMult = 1f; } - Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * dmgMult), knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, (int)(damage * dmgMult), knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Rogue/MangroveChakram.cs b/Items/Weapons/Rogue/MangroveChakram.cs index 813eed513b..ba053009bd 100644 --- a/Items/Weapons/Rogue/MangroveChakram.cs +++ b/Items/Weapons/Rogue/MangroveChakram.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -35,12 +36,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) damage = (int)(damage * 1.25f); - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, 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/Rogue/MetalMonstrosity.cs b/Items/Weapons/Rogue/MetalMonstrosity.cs index 4a998f0caf..2632234880 100644 --- a/Items/Weapons/Rogue/MetalMonstrosity.cs +++ b/Items/Weapons/Rogue/MetalMonstrosity.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -38,9 +39,9 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/MeteorFist.cs b/Items/Weapons/Rogue/MeteorFist.cs index 7139d04e82..0d77a0b6b6 100644 --- a/Items/Weapons/Rogue/MeteorFist.cs +++ b/Items/Weapons/Rogue/MeteorFist.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -41,11 +42,11 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(1).AddIngredient(ItemID.MeteoriteBar, 10).AddTile(TileID.Anvils).Register(); } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 4f); + int proj = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 4f); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/MoltenAmputator.cs b/Items/Weapons/Rogue/MoltenAmputator.cs index aa45ec57f9..976bc97ed3 100644 --- a/Items/Weapons/Rogue/MoltenAmputator.cs +++ b/Items/Weapons/Rogue/MoltenAmputator.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -38,12 +39,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { damage = (int)(damage * 1.07); - int ss = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int ss = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (ss.WithinBounds(Main.maxProjectiles)) Main.projectile[ss].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/MonkeyDarts.cs b/Items/Weapons/Rogue/MonkeyDarts.cs index f44d467cb4..61f09b8917 100644 --- a/Items/Weapons/Rogue/MonkeyDarts.cs +++ b/Items/Weapons/Rogue/MonkeyDarts.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using System; @@ -38,9 +39,9 @@ namespace CalamityMod.Items.Weapons.Rogue } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 18; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 18; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { //Checks if stealth is avalaible to shoot a spread of 3 darts if (player.Calamity().StealthStrikeAvailable()) @@ -48,8 +49,8 @@ namespace CalamityMod.Items.Weapons.Rogue float spread = 7; for (int i = 0; i < 3; i++) { - Vector2 perturbedspeed = new Vector2(speedX * 1.25f, speedY * 1.25f).RotatedBy(MathHelper.ToRadians(spread)); - int p = Projectile.NewProjectile(position, perturbedspeed, ModContent.ProjectileType(), Math.Max(damage / 3, 1), knockBack, player.whoAmI, 1); + Vector2 perturbedspeed = new Vector2(velocity.X * 1.25f, velocity.Y * 1.25f).RotatedBy(MathHelper.ToRadians(spread)); + int p = Projectile.NewProjectile(source, position, perturbedspeed, ModContent.ProjectileType(), Math.Max(damage / 3, 1), knockback, player.whoAmI, 1); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; spread -= 7; diff --git a/Items/Weapons/Rogue/Mycoroot.cs b/Items/Weapons/Rogue/Mycoroot.cs index 4914ced72f..c73a2d162d 100644 --- a/Items/Weapons/Rogue/Mycoroot.cs +++ b/Items/Weapons/Rogue/Mycoroot.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -35,16 +36,16 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); if (player.Calamity().StealthStrikeAvailable() && player.ownedProjectileCounts[ModContent.ProjectileType()] < 20 && stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().stealthStrike = true; for (float i = 0; i < Main.rand.Next(7,11); i++) { - Vector2 velocity = CalamityUtils.RandomVelocity(50f, 10f, 50f, 0.01f); - int spore = Projectile.NewProjectile(player.Center, velocity, ModContent.ProjectileType(), (int)(damage * 0.5f), knockBack, player.whoAmI); + + int spore = Projectile.NewProjectile(source, player.Center, velocity, ModContent.ProjectileType(), (int)(damage * 0.5f), knockback, player.whoAmI); if (spore.WithinBounds(Main.maxProjectiles)) Main.projectile[spore].ai[1] = 1f; } diff --git a/Items/Weapons/Rogue/MythrilKnife.cs b/Items/Weapons/Rogue/MythrilKnife.cs index 5115762940..ea7e095dfb 100644 --- a/Items/Weapons/Rogue/MythrilKnife.cs +++ b/Items/Weapons/Rogue/MythrilKnife.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -35,11 +36,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/NanoblackReaperRogue.cs b/Items/Weapons/Rogue/NanoblackReaperRogue.cs index 769f3dfa35..10b0d31444 100644 --- a/Items/Weapons/Rogue/NanoblackReaperRogue.cs +++ b/Items/Weapons/Rogue/NanoblackReaperRogue.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -47,12 +48,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = Speed; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { damage = (int)(damage * 1.2); - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; diff --git a/Items/Weapons/Rogue/NastyCholla.cs b/Items/Weapons/Rogue/NastyCholla.cs index 78b6cb5f03..f51b4f65f3 100644 --- a/Items/Weapons/Rogue/NastyCholla.cs +++ b/Items/Weapons/Rogue/NastyCholla.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -40,15 +41,15 @@ Stealth strikes throw five at once"); Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { int spread = 3; for (int i = 0; i < 5; i++) { - Vector2 perturbedspeed = new Vector2(speedX + Main.rand.Next(-3,4), speedY + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, type, damage, knockBack, player.whoAmI); + Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3,4), velocity.Y + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); + int proj = Projectile.NewProjectile(source, position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; spread -= Main.rand.Next(1,4); diff --git a/Items/Weapons/Rogue/NightsGaze.cs b/Items/Weapons/Rogue/NightsGaze.cs index 0cdf250a21..d45c08f78e 100644 --- a/Items/Weapons/Rogue/NightsGaze.cs +++ b/Items/Weapons/Rogue/NightsGaze.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; @@ -40,12 +41,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { damage = (int)(damage * 1.22); - int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/Nychthemeron.cs b/Items/Weapons/Rogue/Nychthemeron.cs index f9468fd514..689ed2027e 100644 --- a/Items/Weapons/Rogue/Nychthemeron.cs +++ b/Items/Weapons/Rogue/Nychthemeron.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using System; @@ -53,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Rogue return true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int orbDamage = (int)(damage * 0.75f); @@ -62,21 +63,21 @@ namespace CalamityMod.Items.Weapons.Rogue for (int j = 0; j < Item.stack - player.ownedProjectileCounts[ModContent.ProjectileType()]; j++) { float spread = 2; - int pIndex = Projectile.NewProjectile(position.X, position.Y, speedX + Main.rand.NextFloat(-spread, spread), speedY + Main.rand.NextFloat(-spread, spread), type, Math.Max(damage / 3, 1), knockBack, player.whoAmI, 0f, 1f); + int pIndex = Projectile.NewProjectile(source, position.X, position.Y, velocity.X + Main.rand.NextFloat(-spread, spread), velocity.Y + Main.rand.NextFloat(-spread, spread), type, Math.Max(damage / 3, 1), knockback, player.whoAmI, 0f, 1f); Projectile p = Main.projectile[pIndex]; if (pIndex.WithinBounds(Main.maxProjectiles)) p.Calamity().stealthStrike = true; int pID = p.identity; - CreateOrbs(position, (int)(orbDamage * 0.675f), knockBack, pID, player, true); + CreateOrbs(position, (int)(orbDamage * 0.675f), knockback, pID, player, true); } } else { - int pIndex = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + int pIndex = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); int pID = Main.projectile[pIndex].identity; - CreateOrbs(position, orbDamage, knockBack, pID, player, false); + CreateOrbs(position, orbDamage, knockback, pID, player, false); } return false; } @@ -103,7 +104,7 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(1).AddIngredient(ItemID.SpikyBall, 30).AddIngredient(ItemID.LightShard).AddIngredient(ItemID.DarkShard).AddRecipeGroup("AnyMythrilBar", 2).AddTile(TileID.MythrilAnvil).Register(); } - private static void CreateOrbs(Vector2 position, int damage, float knockBack, int projectileID, Player player, bool stealth) + private static void CreateOrbs(Vector2 position, int damage, float knockback, int projectileID, Player player, bool stealth) { float rotationOffset = 0f; @@ -149,8 +150,8 @@ namespace CalamityMod.Items.Weapons.Rogue rotationOffset += MathHelper.ToRadians(72f); } - int orb1 = Projectile.NewProjectile(position, Vector2.Zero, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, orb1Col, projectileID); - int orb2 = Projectile.NewProjectile(position, Vector2.Zero, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, orb2Col, projectileID); + int orb1 = Projectile.NewProjectile(source, position, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, orb1Col, projectileID); + int orb2 = Projectile.NewProjectile(source, position, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, orb2Col, projectileID); if (orb1.WithinBounds(Main.maxProjectiles)) { Main.projectile[orb1].localAI[1] = pos; diff --git a/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs b/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs index c0c7d83b04..eb499e827c 100644 --- a/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs +++ b/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -36,11 +37,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int gemstone = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int gemstone = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (gemstone.WithinBounds(Main.maxProjectiles)) { Main.projectile[gemstone].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/PalladiumJavelin.cs b/Items/Weapons/Rogue/PalladiumJavelin.cs index 2038007069..47dc43a43b 100644 --- a/Items/Weapons/Rogue/PalladiumJavelin.cs +++ b/Items/Weapons/Rogue/PalladiumJavelin.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -36,12 +37,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) damage = (int)(damage * 1.425f); - int javelin = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int javelin = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (javelin.WithinBounds(Main.maxProjectiles)) { Main.projectile[javelin].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); diff --git a/Items/Weapons/Rogue/Penumbra.cs b/Items/Weapons/Rogue/Penumbra.cs index 451ab21370..b140cb9f0d 100644 --- a/Items/Weapons/Rogue/Penumbra.cs +++ b/Items/Weapons/Rogue/Penumbra.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -42,9 +43,9 @@ namespace CalamityMod.Items.Weapons.Rogue } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 16; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 16; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { @@ -61,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Rogue num79 = 0f; } vector2 += new Vector2(num78, num79); - int proj = Projectile.NewProjectile(vector2, new Vector2(0f,-0.5f), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 1f); + int proj = Projectile.NewProjectile(source, vector2, new Vector2(0f,-0.5f), ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 1f); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/PhantasmalRuin.cs b/Items/Weapons/Rogue/PhantasmalRuin.cs index fbc7b40427..eae5f20226 100644 --- a/Items/Weapons/Rogue/PhantasmalRuin.cs +++ b/Items/Weapons/Rogue/PhantasmalRuin.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Terraria; @@ -39,12 +40,12 @@ Stealth strikes continuously leave spectral clones in their wake"); Item.Calamity().customRarity = CalamityRarity.PureGreen; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { damage = (int)(damage * 1.22); - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/PhantomLance.cs b/Items/Weapons/Rogue/PhantomLance.cs index 320db831d0..734d09ddce 100644 --- a/Items/Weapons/Rogue/PhantomLance.cs +++ b/Items/Weapons/Rogue/PhantomLance.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Terraria; @@ -43,11 +44,11 @@ Stealth strikes don't slow down and souls always deal full damage"); Item.shoot = ModContent.ProjectileType(); } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 1.75f), knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 1.75f), knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/Plaguenade.cs b/Items/Weapons/Rogue/Plaguenade.cs index d0965c7421..d8b9a07b23 100644 --- a/Items/Weapons/Rogue/Plaguenade.cs +++ b/Items/Weapons/Rogue/Plaguenade.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -39,11 +40,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/PoisonPack.cs b/Items/Weapons/Rogue/PoisonPack.cs index 4c0ed90166..a28ab64486 100644 --- a/Items/Weapons/Rogue/PoisonPack.cs +++ b/Items/Weapons/Rogue/PoisonPack.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -42,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Rogue } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 4; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 4; public override bool CanUseItem(Player player) { @@ -61,13 +62,13 @@ namespace CalamityMod.Items.Weapons.Rogue } } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.killSpikyBalls = false; if (modPlayer.StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/Prismalline.cs b/Items/Weapons/Rogue/Prismalline.cs index 7e0cf738a0..465df75665 100644 --- a/Items/Weapons/Rogue/Prismalline.cs +++ b/Items/Weapons/Rogue/Prismalline.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Rogue; @@ -38,13 +39,13 @@ namespace CalamityMod.Items.Weapons.Rogue } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 4; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 4; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 1.15f), knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 1.15f), knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/ProfanedPartisan.cs b/Items/Weapons/Rogue/ProfanedPartisan.cs index 10c4668350..924be1e6ca 100644 --- a/Items/Weapons/Rogue/ProfanedPartisan.cs +++ b/Items/Weapons/Rogue/ProfanedPartisan.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Terraria; @@ -41,13 +42,13 @@ Stealth strikes spawn smaller spears to fly along side it"); } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 15; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 15; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/ProfanedTrident.cs b/Items/Weapons/Rogue/ProfanedTrident.cs index 79fb68a305..dd2b8c4926 100644 --- a/Items/Weapons/Rogue/ProfanedTrident.cs +++ b/Items/Weapons/Rogue/ProfanedTrident.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -35,12 +36,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) damage = (int)(damage * 0.85f); - int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, 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/Rogue/RadiantStar.cs b/Items/Weapons/Rogue/RadiantStar.cs index b85fa11cf4..c701bb8716 100644 --- a/Items/Weapons/Rogue/RadiantStar.cs +++ b/Items/Weapons/Rogue/RadiantStar.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Rogue; @@ -38,18 +39,18 @@ namespace CalamityMod.Items.Weapons.Rogue } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 8; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 8; public override void AddRecipes() { CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ItemID.FallenStar, 10).AddTile(TileID.LunarCraftingStation).Register(); } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/RefractionRotor.cs b/Items/Weapons/Rogue/RefractionRotor.cs index f6e802384b..d9724b0cfd 100644 --- a/Items/Weapons/Rogue/RefractionRotor.cs +++ b/Items/Weapons/Rogue/RefractionRotor.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -36,12 +37,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().customRarity = CalamityRarity.Violet; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) damage = (int)(damage * 0.75D); - int shuriken = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int shuriken = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && Main.projectile.IndexInRange(shuriken)) Main.projectile[shuriken].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/RegulusRiot.cs b/Items/Weapons/Rogue/RegulusRiot.cs index b5218894b3..20bbbf5440 100644 --- a/Items/Weapons/Rogue/RegulusRiot.cs +++ b/Items/Weapons/Rogue/RegulusRiot.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Terraria; using Terraria.ID; @@ -38,11 +39,11 @@ Stealth strikes explode into energy stars"); Item.shoot = ModContent.ProjectileType(); } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 1.2f), knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 1.2f), knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/RogueWeapon.cs b/Items/Weapons/Rogue/RogueWeapon.cs index 6598dc6c81..16410a50a7 100644 --- a/Items/Weapons/Rogue/RogueWeapon.cs +++ b/Items/Weapons/Rogue/RogueWeapon.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using Terraria.DataStructures; +using CalamityMod.CalPlayer; using System; using System.Collections.Generic; using System.Linq; @@ -96,7 +97,7 @@ namespace CalamityMod.Items.Weapons.Rogue // Simply add the player's dedicated rogue crit chance. // Rogue crit isn't boosted by Calamity universal crit boosts, so this won't double-add universal crit. - public override void GetWeaponCrit(Player player, ref int crit) + public override void ModifyWeaponCrit(Player player, ref int crit) { crit += player.Calamity().throwingCrit; } diff --git a/Items/Weapons/Rogue/RotBall.cs b/Items/Weapons/Rogue/RotBall.cs index 33467b8a4b..0a70ad74b3 100644 --- a/Items/Weapons/Rogue/RotBall.cs +++ b/Items/Weapons/Rogue/RotBall.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -38,13 +39,13 @@ namespace CalamityMod.Items.Weapons.Rogue } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 8; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 8; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/Sacrifice.cs b/Items/Weapons/Rogue/Sacrifice.cs index 72d2c00570..ba4a4362ac 100644 --- a/Items/Weapons/Rogue/Sacrifice.cs +++ b/Items/Weapons/Rogue/Sacrifice.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -40,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool AltFunctionUse(Player player) => player.ownedProjectileCounts[Item.shoot] > 0; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.altFunctionUse == 2) { @@ -60,9 +61,9 @@ namespace CalamityMod.Items.Weapons.Rogue return false; } - Vector2 velocity = new Vector2(speedX, speedY); + position += velocity * 3f; - int proj = Projectile.NewProjectile(position, velocity, type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && Main.projectile.IndexInRange(proj)) Main.projectile[proj].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/SandDollar.cs b/Items/Weapons/Rogue/SandDollar.cs index 8e844392a1..adae0ef330 100644 --- a/Items/Weapons/Rogue/SandDollar.cs +++ b/Items/Weapons/Rogue/SandDollar.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using System; @@ -52,15 +53,15 @@ namespace CalamityMod.Items.Weapons.Rogue } } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { int spread = 2; for (int i = 0; i < 2; i++) { - Vector2 perturbedspeed = new Vector2(speedX + Main.rand.Next(-2,3), speedY + Main.rand.Next(-2,3)).RotatedBy(MathHelper.ToRadians(spread)); - int stealth = Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X * 1.5f, perturbedspeed.Y * 1.5f, ModContent.ProjectileType(), Math.Max((int)(damage * 0.75), 1), knockBack, player.whoAmI); + Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-2,3), velocity.Y + Main.rand.Next(-2,3)).RotatedBy(MathHelper.ToRadians(spread)); + int stealth = Projectile.NewProjectile(source, position.X, position.Y, perturbedspeed.X * 1.5f, perturbedspeed.Y * 1.5f, ModContent.ProjectileType(), Math.Max((int)(damage * 0.75), 1), knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; spread -= Main.rand.Next(1,3); diff --git a/Items/Weapons/Rogue/Sandslasher.cs b/Items/Weapons/Rogue/Sandslasher.cs index b15fdbb610..2a185ffd18 100644 --- a/Items/Weapons/Rogue/Sandslasher.cs +++ b/Items/Weapons/Rogue/Sandslasher.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -37,11 +38,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/ScarletDevil.cs b/Items/Weapons/Rogue/ScarletDevil.cs index 53bde0443a..06b0509d87 100644 --- a/Items/Weapons/Rogue/ScarletDevil.cs +++ b/Items/Weapons/Rogue/ScarletDevil.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -40,16 +41,16 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().devItem = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(proj)) Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 20; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 20; public override void AddRecipes() { diff --git a/Items/Weapons/Rogue/ScourgeoftheDesert.cs b/Items/Weapons/Rogue/ScourgeoftheDesert.cs index b45533b181..da3826b87e 100644 --- a/Items/Weapons/Rogue/ScourgeoftheDesert.cs +++ b/Items/Weapons/Rogue/ScourgeoftheDesert.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -35,11 +36,11 @@ Stealth strikes gain damage as they damage enemies"); Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/ScourgeoftheSeas.cs b/Items/Weapons/Rogue/ScourgeoftheSeas.cs index 442141ac91..59d17da7d1 100644 --- a/Items/Weapons/Rogue/ScourgeoftheSeas.cs +++ b/Items/Weapons/Rogue/ScourgeoftheSeas.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -35,11 +36,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.value = Item.buyPrice(0, 36, 0, 0); } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { 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); + int stealth = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 1f); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/SeafoamBomb.cs b/Items/Weapons/Rogue/SeafoamBomb.cs index e4c42d3c0a..3f64d36577 100644 --- a/Items/Weapons/Rogue/SeafoamBomb.cs +++ b/Items/Weapons/Rogue/SeafoamBomb.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -41,11 +42,11 @@ Stealth strikes are faster and explode into 5 bubbles"); CreateRecipe(1).AddIngredient(ItemID.Bomb, 25).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.Anvils).Register(); } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX + speedX / 3, speedY + speedY / 3), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, new Vector2(velocity.X + velocity.X / 3, velocity.Y + velocity.Y / 3), type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/SealedSingularity.cs b/Items/Weapons/Rogue/SealedSingularity.cs index 60d6134ebe..5d32672712 100644 --- a/Items/Weapons/Rogue/SealedSingularity.cs +++ b/Items/Weapons/Rogue/SealedSingularity.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -36,13 +37,13 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().donorItem = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { // Directly nerf stealth strikes by 32%, but only stealth strikes. int stealthDamage = (int)(damage * 0.72f); - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, stealthDamage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, stealthDamage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/SearedPan.cs b/Items/Weapons/Rogue/SearedPan.cs index 081d58eee5..a1b1474ebf 100644 --- a/Items/Weapons/Rogue/SearedPan.cs +++ b/Items/Weapons/Rogue/SearedPan.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -46,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().donorItem = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float mode = 1f; if (player.Calamity().searedPanCounter >= 3) @@ -59,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Rogue player.Calamity().searedPanCounter = 0; mode = 3f; } - int pan = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, mode); + int pan = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, mode); if (mode > 1f && pan.WithinBounds(Main.maxProjectiles)) { Main.projectile[pan].extraUpdates++; diff --git a/Items/Weapons/Rogue/SeashellBoomerang.cs b/Items/Weapons/Rogue/SeashellBoomerang.cs index 5b3d647923..35cd2aa6a8 100644 --- a/Items/Weapons/Rogue/SeashellBoomerang.cs +++ b/Items/Weapons/Rogue/SeashellBoomerang.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -34,9 +35,9 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, 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/Rogue/Seraphim.cs b/Items/Weapons/Rogue/Seraphim.cs index 03569bc0a0..1fef726748 100644 --- a/Items/Weapons/Rogue/Seraphim.cs +++ b/Items/Weapons/Rogue/Seraphim.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Projectiles.Rogue; @@ -47,10 +48,10 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Vector2 velocity = new Vector2(speedX, speedY); - int knife = Projectile.NewProjectile(position + velocity, velocity, type, damage, knockBack, player.whoAmI); + + int knife = Projectile.NewProjectile(source, position + velocity, velocity, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(knife)) Main.projectile[knife].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); @@ -62,7 +63,7 @@ namespace CalamityMod.Items.Weapons.Rogue { float offsetAngle = MathHelper.Lerp(-0.97f, 0.97f, i / (float)(StealthStrikeLightCount - 1f)); Vector2 lightShootVelocity = velocity.SafeNormalize(Vector2.UnitY).RotatedBy(offsetAngle) * 23f; - Projectile.NewProjectile(position, lightShootVelocity, ModContent.ProjectileType(), stealthDamage, knife, player.whoAmI, 1f); + Projectile.NewProjectile(source, position, lightShootVelocity, ModContent.ProjectileType(), stealthDamage, knife, player.whoAmI, 1f); } } return false; diff --git a/Items/Weapons/Rogue/ShatteredSun.cs b/Items/Weapons/Rogue/ShatteredSun.cs index d1d971cb88..5a4de3c49f 100644 --- a/Items/Weapons/Rogue/ShatteredSun.cs +++ b/Items/Weapons/Rogue/ShatteredSun.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -38,19 +39,19 @@ namespace CalamityMod.Items.Weapons.Rogue } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 10; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 10; public override void AddRecipes() { CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 6).AddTile(TileID.LunarCraftingStation).Register(); } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { damage = (int)(damage * 1.2); - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/ShinobiBlade.cs b/Items/Weapons/Rogue/ShinobiBlade.cs index ebded0e6cc..a8fb789ca8 100644 --- a/Items/Weapons/Rogue/ShinobiBlade.cs +++ b/Items/Weapons/Rogue/ShinobiBlade.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -36,19 +37,19 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { float spreadAngle = MathHelper.ToRadians(7.5f); - Vector2 direction = new Vector2(speedX, speedY); + Vector2 direction = velocity; Vector2 baseDirection = direction.RotatedBy(-spreadAngle); for (int i = 0; i < 3; i++) { Vector2 currentDirection = baseDirection.RotatedBy(spreadAngle * i); - int p = Projectile.NewProjectile(position, currentDirection, type, damage, knockBack, player.whoAmI); + int p = Projectile.NewProjectile(source, position, currentDirection, type, damage, knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; } diff --git a/Items/Weapons/Rogue/ShockGrenade.cs b/Items/Weapons/Rogue/ShockGrenade.cs index 5d44dde0e9..a95cf10dbd 100644 --- a/Items/Weapons/Rogue/ShockGrenade.cs +++ b/Items/Weapons/Rogue/ShockGrenade.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -37,11 +38,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/Shroomerang.cs b/Items/Weapons/Rogue/Shroomerang.cs index f32fa2bbf1..50523156ea 100644 --- a/Items/Weapons/Rogue/Shroomerang.cs +++ b/Items/Weapons/Rogue/Shroomerang.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Terraria; using Terraria.ID; @@ -34,11 +35,11 @@ Stealth strikes grant the Mushy buff to the user on enemy hits and summon homing Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/SkyStabber.cs b/Items/Weapons/Rogue/SkyStabber.cs index 7b7a978cd8..b1feedc534 100644 --- a/Items/Weapons/Rogue/SkyStabber.cs +++ b/Items/Weapons/Rogue/SkyStabber.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -43,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Rogue } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 4; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 4; public override bool CanUseItem(Player player) { @@ -62,13 +63,13 @@ namespace CalamityMod.Items.Weapons.Rogue } } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.killSpikyBalls = false; if (modPlayer.StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/SkyfinBombers.cs b/Items/Weapons/Rogue/SkyfinBombers.cs index 026d7fd76d..1b0067c18e 100644 --- a/Items/Weapons/Rogue/SkyfinBombers.cs +++ b/Items/Weapons/Rogue/SkyfinBombers.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -36,11 +37,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/SlickCane.cs b/Items/Weapons/Rogue/SlickCane.cs index cbdba9754f..6bb2f0bd24 100644 --- a/Items/Weapons/Rogue/SlickCane.cs +++ b/Items/Weapons/Rogue/SlickCane.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -40,10 +41,10 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float ai0 = Main.rand.NextFloat() * Item.shootSpeed * 0.75f * (float)player.direction; - int projectileIndex = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, ai0, 0f); + int projectileIndex = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, ai0, 0f); if (projectileIndex.WithinBounds(Main.maxProjectiles)) Main.projectile[projectileIndex].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; diff --git a/Items/Weapons/Rogue/SludgeSplotch.cs b/Items/Weapons/Rogue/SludgeSplotch.cs index a3c257d7ae..5c91acc2a8 100644 --- a/Items/Weapons/Rogue/SludgeSplotch.cs +++ b/Items/Weapons/Rogue/SludgeSplotch.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -38,13 +39,13 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { SoundEngine.PlaySound(SoundID.NPCKilled, (int)player.position.X, (int)player.position.Y, 9, 2, 0); if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(position.X, position.Y, speedX * 1.2f, speedY * 1.2f, type, damage, knockBack * 3, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X * 1.2f, velocity.Y * 1.2f, type, damage, knockback * 3, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/SnapClam.cs b/Items/Weapons/Rogue/SnapClam.cs index ec39686f2f..7e6ebac36b 100644 --- a/Items/Weapons/Rogue/SnapClam.cs +++ b/Items/Weapons/Rogue/SnapClam.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using System; @@ -37,15 +38,15 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { int spread = 3; for (int i = 0; i < 5; i++) { - Vector2 perturbedspeed = new Vector2(speedX + Main.rand.Next(-3,4), speedY + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(position, perturbedspeed, ModContent.ProjectileType(), Math.Max(damage / 5, 1), knockBack / 5f, player.whoAmI); + Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3,4), velocity.Y + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); + int proj = Projectile.NewProjectile(source, position, perturbedspeed, ModContent.ProjectileType(), Math.Max(damage / 5, 1), knockback / 5f, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; spread -= Main.rand.Next(1,3); diff --git a/Items/Weapons/Rogue/SpearofDestiny.cs b/Items/Weapons/Rogue/SpearofDestiny.cs index da9fbe03bc..09d290f03c 100644 --- a/Items/Weapons/Rogue/SpearofDestiny.cs +++ b/Items/Weapons/Rogue/SpearofDestiny.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -35,14 +36,14 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int index = 7; for (int i = -index; i <= index; i += index) { int projType = (i != 0 || player.Calamity().StealthStrikeAvailable()) ? type : ModContent.ProjectileType(); - Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); - int spear = Projectile.NewProjectile(position, perturbedSpeed, projType, damage, knockBack, player.whoAmI); + Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i)); + int spear = Projectile.NewProjectile(source, position, perturbedSpeed, projType, damage, knockback, player.whoAmI); if (spear.WithinBounds(Main.maxProjectiles)) Main.projectile[spear].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); } diff --git a/Items/Weapons/Rogue/SpearofPaleolith.cs b/Items/Weapons/Rogue/SpearofPaleolith.cs index 24a244b4aa..4182f8dea6 100644 --- a/Items/Weapons/Rogue/SpearofPaleolith.cs +++ b/Items/Weapons/Rogue/SpearofPaleolith.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -41,11 +42,11 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(1).AddIngredient(ItemID.AncientBattleArmorMaterial, 2).AddRecipeGroup("AnyAdamantiteBar", 4).AddTile(TileID.MythrilAnvil).Register(); } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int stabDevice = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stabDevice = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stabDevice.WithinBounds(Main.maxProjectiles)) Main.projectile[stabDevice].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/SpentFuelContainer.cs b/Items/Weapons/Rogue/SpentFuelContainer.cs index f5b6ea2113..992bdd9018 100644 --- a/Items/Weapons/Rogue/SpentFuelContainer.cs +++ b/Items/Weapons/Rogue/SpentFuelContainer.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -37,11 +38,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 15f; Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Vector2 velocity = new Vector2(speedX, speedY); + bool stealthAvailable = player.Calamity().StealthStrikeAvailable(); - int p = Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, stealthAvailable ? 1f : 0f); + int p = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, stealthAvailable ? 1f : 0f); if (stealthAvailable && p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/StarofDestruction.cs b/Items/Weapons/Rogue/StarofDestruction.cs index cd2ba9cb1e..ee890824c9 100644 --- a/Items/Weapons/Rogue/StarofDestruction.cs +++ b/Items/Weapons/Rogue/StarofDestruction.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -36,11 +37,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 0.8f), knockBack, player.whoAmI, 0f, 1f); + int stealth = Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 0.8f), knockback, player.whoAmI, 0f, 1f); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/StellarKnife.cs b/Items/Weapons/Rogue/StellarKnife.cs index a0cbcfdefb..16a905bd2f 100644 --- a/Items/Weapons/Rogue/StellarKnife.cs +++ b/Items/Weapons/Rogue/StellarKnife.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -39,9 +40,9 @@ namespace CalamityMod.Items.Weapons.Rogue } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 4; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 4; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable() && player.ownedProjectileCounts[Item.shoot] < knifeLimit) { @@ -52,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Rogue knifeAmt = knifeLimit - player.ownedProjectileCounts[Item.shoot]; if (knifeAmt <= 0) { - int knife = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int knife = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (knife.WithinBounds(Main.maxProjectiles)) Main.projectile[knife].Calamity().stealthStrike = true; } @@ -60,9 +61,9 @@ namespace CalamityMod.Items.Weapons.Rogue int spread = 20; for (int i = 0; i < knifeCount; i++) { - speedX *= 0.9f; - Vector2 perturbedspeed = new Vector2(speedX, speedY + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); - int knife2 = Projectile.NewProjectile(position, perturbedspeed, type, damage, knockBack, player.whoAmI, 1f, i % 5 == 0 ? 1f : 0f); + velocity.X *= 0.9f; + Vector2 perturbedspeed = new Vector2(velocity.X, velocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); + int knife2 = Projectile.NewProjectile(source, position, perturbedspeed, type, damage, knockback, player.whoAmI, 1f, i % 5 == 0 ? 1f : 0f); if (knife2.WithinBounds(Main.maxProjectiles)) Main.projectile[knife2].Calamity().stealthStrike = true; spread -= Main.rand.Next(1, 3); diff --git a/Items/Weapons/Rogue/StickySpikyBall.cs b/Items/Weapons/Rogue/StickySpikyBall.cs index 42aca75eb6..32bcd8ac67 100644 --- a/Items/Weapons/Rogue/StickySpikyBall.cs +++ b/Items/Weapons/Rogue/StickySpikyBall.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -36,15 +37,15 @@ Stealth strikes throw seven at once and last a lot longer"); Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { int spread = 3; for (int i = 0; i < 7; i++) { - Vector2 perturbedspeed = new Vector2(speedX + Main.rand.Next(-3,4), speedY + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(position, perturbedspeed, type, damage, knockBack, player.whoAmI); + Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3,4), velocity.Y + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); + int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/StormfrontRazor.cs b/Items/Weapons/Rogue/StormfrontRazor.cs index 0d8beb6270..90dbf2cfe6 100644 --- a/Items/Weapons/Rogue/StormfrontRazor.cs +++ b/Items/Weapons/Rogue/StormfrontRazor.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Rogue; @@ -40,25 +41,25 @@ namespace CalamityMod.Items.Weapons.Rogue } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 8; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 8; public override void AddRecipes() { CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddRecipeGroup("AnyMythrilBar", 6).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.MythrilAnvil).Register(); } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(position, new Vector2(speedX, speedY) * 1.6f, ModContent.ProjectileType(), (int)(damage * 1.1f), knockBack, player.whoAmI, 0, 10f); + int p = Projectile.NewProjectile(source, position, velocity * 1.6f, ModContent.ProjectileType(), (int)(damage * 1.1f), knockback, player.whoAmI, 0, 10f); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; } else { - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0, 1f); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 1f); return false; } } diff --git a/Items/Weapons/Rogue/Supernova.cs b/Items/Weapons/Rogue/Supernova.cs index 5d7024e1d5..a89cdc0a9f 100644 --- a/Items/Weapons/Rogue/Supernova.cs +++ b/Items/Weapons/Rogue/Supernova.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -39,12 +40,12 @@ Stealth strikes release energy as they fly"); Item.Calamity().customRarity = CalamityRarity.Violet; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { damage = (int)(damage * 1.08f); - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/SylvanSlasher.cs b/Items/Weapons/Rogue/SylvanSlasher.cs index 7da5182f43..d1d7c00a48 100644 --- a/Items/Weapons/Rogue/SylvanSlasher.cs +++ b/Items/Weapons/Rogue/SylvanSlasher.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -36,9 +37,9 @@ Does not consume stealth and cannot stealth strike"); Item.shootSpeed = 24f; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Rogue/TarragonThrowingDart.cs b/Items/Weapons/Rogue/TarragonThrowingDart.cs index 3d4ae62fde..0331413d57 100644 --- a/Items/Weapons/Rogue/TarragonThrowingDart.cs +++ b/Items/Weapons/Rogue/TarragonThrowingDart.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -39,11 +40,11 @@ Stealth strikes erupt into thorns on enemy hits"); Item.Calamity().customRarity = CalamityRarity.Turquoise; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/TerraDisk.cs b/Items/Weapons/Rogue/TerraDisk.cs index d4e91a1ed1..5683d3863e 100644 --- a/Items/Weapons/Rogue/TerraDisk.cs +++ b/Items/Weapons/Rogue/TerraDisk.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -62,15 +63,15 @@ Stealth strikes travel slower and are rapidly orbited by the smaller disks"); return terraDiskCount < 3; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - speedX *= 0.75f; - speedY *= 0.75f; + velocity.X *= 0.75f; + velocity.Y *= 0.75f; damage = (int)(damage * 0.9f); } - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/TerrorTalons.cs b/Items/Weapons/Rogue/TerrorTalons.cs index e3dfb84e7c..bd2ebc114e 100644 --- a/Items/Weapons/Rogue/TerrorTalons.cs +++ b/Items/Weapons/Rogue/TerrorTalons.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -37,19 +38,19 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { float stealthDamageMult = 4.875f; - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), (int)(damage * stealthDamageMult), knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), (int)(damage * stealthDamageMult), knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; } else { // flip flop every standard projectile - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, sign); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, sign); sign = -sign; } return false; diff --git a/Items/Weapons/Rogue/TheAtomSplitter.cs b/Items/Weapons/Rogue/TheAtomSplitter.cs index bf98f0f2e7..5b1565d66e 100644 --- a/Items/Weapons/Rogue/TheAtomSplitter.cs +++ b/Items/Weapons/Rogue/TheAtomSplitter.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -35,9 +36,9 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().customRarity = CalamityRarity.Violet; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int javelin = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, -1f); + int javelin = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, -1f); if (player.Calamity().StealthStrikeAvailable() && Main.projectile.IndexInRange(javelin)) { Main.projectile[javelin].Calamity().stealthStrike = true; Main.projectile[javelin].damage = (int)(1.10 * Main.projectile[javelin].damage); diff --git a/Items/Weapons/Rogue/TheReaper.cs b/Items/Weapons/Rogue/TheReaper.cs index f41e71a7eb..bd4a1ccea7 100644 --- a/Items/Weapons/Rogue/TheReaper.cs +++ b/Items/Weapons/Rogue/TheReaper.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ItemRarityID.Purple; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { @@ -46,8 +47,8 @@ namespace CalamityMod.Items.Weapons.Rogue int spread = 10; for (int i = 0; i < 4; i++) { - Vector2 perturbedspeed = new Vector2(speedX + Main.rand.Next(-3,4), speedY + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(position, perturbedspeed, type, damage / 2, knockBack, player.whoAmI); + Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3,4), velocity.Y + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); + int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, damage / 2, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/TheSyringe.cs b/Items/Weapons/Rogue/TheSyringe.cs index c633369cdd..ffe0c31ead 100644 --- a/Items/Weapons/Rogue/TheSyringe.cs +++ b/Items/Weapons/Rogue/TheSyringe.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -41,11 +42,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 1.2f), knockBack, player.whoAmI, 0f, 1f); + int stealth = Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 1.2f), knockback, player.whoAmI, 0f, 1f); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/ThrowingBrick.cs b/Items/Weapons/Rogue/ThrowingBrick.cs index bcacbb22cf..5bbf1c86f0 100644 --- a/Items/Weapons/Rogue/ThrowingBrick.cs +++ b/Items/Weapons/Rogue/ThrowingBrick.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -35,14 +36,14 @@ namespace CalamityMod.Items.Weapons.Rogue } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 20; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 20; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { //Check if stealth is full if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 1); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 1); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/TimeBolt.cs b/Items/Weapons/Rogue/TimeBolt.cs index 36415e21de..ee1647d999 100644 --- a/Items/Weapons/Rogue/TimeBolt.cs +++ b/Items/Weapons/Rogue/TimeBolt.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -38,12 +39,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) damage = (int)(damage * 0.68); - int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/TitaniumShuriken.cs b/Items/Weapons/Rogue/TitaniumShuriken.cs index cd504fb49f..07aebcba4a 100644 --- a/Items/Weapons/Rogue/TitaniumShuriken.cs +++ b/Items/Weapons/Rogue/TitaniumShuriken.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -36,13 +37,13 @@ namespace CalamityMod.Items.Weapons.Rogue } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 10; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 10; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/ToothBall.cs b/Items/Weapons/Rogue/ToothBall.cs index faf5083ae0..3601a69a2d 100644 --- a/Items/Weapons/Rogue/ToothBall.cs +++ b/Items/Weapons/Rogue/ToothBall.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -38,13 +39,13 @@ namespace CalamityMod.Items.Weapons.Rogue } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 8; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 8; - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/TotalityBreakers.cs b/Items/Weapons/Rogue/TotalityBreakers.cs index 29cd5d0eb1..a1d692a358 100644 --- a/Items/Weapons/Rogue/TotalityBreakers.cs +++ b/Items/Weapons/Rogue/TotalityBreakers.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Terraria; @@ -37,11 +38,11 @@ Stealth strikes leak tar as they fly"); Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 1.15f), knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 1.15f), knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/ToxicantTwister.cs b/Items/Weapons/Rogue/ToxicantTwister.cs index 506035316d..bc1699dbf5 100644 --- a/Items/Weapons/Rogue/ToxicantTwister.cs +++ b/Items/Weapons/Rogue/ToxicantTwister.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -36,9 +37,9 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().customRarity = CalamityRarity.PureGreen; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int boomer = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int boomer = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (boomer.WithinBounds(Main.maxProjectiles)) Main.projectile[boomer].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; diff --git a/Items/Weapons/Rogue/Turbulance.cs b/Items/Weapons/Rogue/Turbulance.cs index add584ec7d..ef025e88a9 100644 --- a/Items/Weapons/Rogue/Turbulance.cs +++ b/Items/Weapons/Rogue/Turbulance.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; @@ -37,11 +38,11 @@ Stealth strikes are trailed by homing wind slashes"); Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/UrchinStinger.cs b/Items/Weapons/Rogue/UrchinStinger.cs index 439ddf074c..6e25e06bd9 100644 --- a/Items/Weapons/Rogue/UrchinStinger.cs +++ b/Items/Weapons/Rogue/UrchinStinger.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -35,9 +36,9 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + int proj = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); if (player.Calamity().StealthStrikeAvailable()) Main.projectile[proj].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/UtensilPoker.cs b/Items/Weapons/Rogue/UtensilPoker.cs index 71a41e71a3..c535ed065d 100644 --- a/Items/Weapons/Rogue/UtensilPoker.cs +++ b/Items/Weapons/Rogue/UtensilPoker.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -40,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 12f; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityPlayer mp = player.Calamity(); @@ -48,8 +49,8 @@ namespace CalamityMod.Items.Weapons.Rogue { int stealthDamage = damage * 2; float stealthSpeedMult = 1.4f; - Vector2 stealthVelocity = new Vector2(speedX, speedY) * stealthSpeedMult; - int stealth = Projectile.NewProjectile(position, stealthVelocity, ModContent.ProjectileType(), stealthDamage, knockBack, player.whoAmI); + Vector2 stealthVelocity = velocity * stealthSpeedMult; + int stealth = Projectile.NewProjectile(source, position, stealthVelocity, ModContent.ProjectileType(), stealthDamage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; } @@ -78,7 +79,7 @@ namespace CalamityMod.Items.Weapons.Rogue default: break; } - Projectile.NewProjectile(position, new Vector2(speedX, speedY), utensil, (int)(damage * dmgMult), knockBack * kbMult, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, utensil, (int)(damage * dmgMult), knockback * kbMult, player.whoAmI); } counter++; diff --git a/Items/Weapons/Rogue/Valediction.cs b/Items/Weapons/Rogue/Valediction.cs index 7d66c3aad4..bc4e8d0490 100644 --- a/Items/Weapons/Rogue/Valediction.cs +++ b/Items/Weapons/Rogue/Valediction.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -36,11 +37,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().customRarity = CalamityRarity.PureGreen; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/WebBall.cs b/Items/Weapons/Rogue/WebBall.cs index 1e12f62249..ed0546aee5 100644 --- a/Items/Weapons/Rogue/WebBall.cs +++ b/Items/Weapons/Rogue/WebBall.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -36,11 +37,11 @@ Stealth strikes slow enemies down longer"); Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/WulfrumKnife.cs b/Items/Weapons/Rogue/WulfrumKnife.cs index d376279fd0..6b5e12afab 100644 --- a/Items/Weapons/Rogue/WulfrumKnife.cs +++ b/Items/Weapons/Rogue/WulfrumKnife.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -42,11 +43,11 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(100).AddIngredient(ModContent.ItemType()).AddTile(TileID.Anvils).Register(); } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(position, new Vector2(speedX, speedY) * 1.3f, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + int p = Projectile.NewProjectile(source, position, velocity * 1.3f, ModContent.ProjectileType(), damage, knockback, player.whoAmI); Projectile proj = Main.projectile[p]; if (p.WithinBounds(Main.maxProjectiles)) { diff --git a/Items/Weapons/Rogue/XerocPitchfork.cs b/Items/Weapons/Rogue/XerocPitchfork.cs index 78d8e41e51..b9303fb609 100644 --- a/Items/Weapons/Rogue/XerocPitchfork.cs +++ b/Items/Weapons/Rogue/XerocPitchfork.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -37,11 +38,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().rogue = true; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 1.5f), knockBack, player.whoAmI); + int stealth = Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 1.5f), knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; }