diff --git a/CustomRecipes/ArsenalTierGatedRecipe.cs b/CustomRecipes/ArsenalTierGatedRecipe.cs index acbfd15a89..554ba91f09 100644 --- a/CustomRecipes/ArsenalTierGatedRecipe.cs +++ b/CustomRecipes/ArsenalTierGatedRecipe.cs @@ -1,55 +1,28 @@ -using CalamityMod.World; -using Terraria.ModLoader; +using System; +using Terraria; +using Terraria.Localization; namespace CalamityMod.CustomRecipes { - public class ArsenalTierGatedRecipe : ModRecipe + public static class ArsenalTierGatedRecipe { - public int Tier; - public bool AllowedInOldWorlds; - public ArsenalTierGatedRecipe(Mod mod, int tier, bool allowedInOldWorlds = false) : base(mod) + public static NetworkText ConstructRecipeCondition(int tier, out Predicate condition) { - Tier = tier; - AllowedInOldWorlds = allowedInOldWorlds; + condition = r => HasTierBeenLearned(tier); + return NetworkText.FromKey($"Mods.Calamity.Tier{tier}ArsenalRecipeCondition"); } public static bool HasTierBeenLearned(int tier) { - switch (tier) + return tier switch { - case 1: - return RecipeUnlockHandler.HasUnlockedT1ArsenalRecipes; - case 2: - return RecipeUnlockHandler.HasUnlockedT2ArsenalRecipes; - case 3: - return RecipeUnlockHandler.HasUnlockedT3ArsenalRecipes; - case 4: - return RecipeUnlockHandler.HasUnlockedT4ArsenalRecipes; - case 5: - return RecipeUnlockHandler.HasUnlockedT5ArsenalRecipes; - } - return false; - } - - public override bool RecipeAvailable() - { - if (AllowedInOldWorlds && !CalamityWorld.IsWorldAfterDraedonUpdate) - return true; - - switch (Tier) - { - case 1: - return RecipeUnlockHandler.HasUnlockedT1ArsenalRecipes; - case 2: - return RecipeUnlockHandler.HasUnlockedT2ArsenalRecipes; - case 3: - return RecipeUnlockHandler.HasUnlockedT3ArsenalRecipes; - case 4: - return RecipeUnlockHandler.HasUnlockedT4ArsenalRecipes; - case 5: - return RecipeUnlockHandler.HasUnlockedT5ArsenalRecipes; - } - return false; + 1 => RecipeUnlockHandler.HasUnlockedT1ArsenalRecipes, + 2 => RecipeUnlockHandler.HasUnlockedT2ArsenalRecipes, + 3 => RecipeUnlockHandler.HasUnlockedT3ArsenalRecipes, + 4 => RecipeUnlockHandler.HasUnlockedT4ArsenalRecipes, + 5 => RecipeUnlockHandler.HasUnlockedT5ArsenalRecipes, + _ => false, + }; } } } diff --git a/DataStructures/DeadMinionProperties.cs b/DataStructures/DeadMinionProperties.cs index c6758a11f5..bddb84a9e5 100644 --- a/DataStructures/DeadMinionProperties.cs +++ b/DataStructures/DeadMinionProperties.cs @@ -1,7 +1,8 @@ -using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ModLoader; namespace CalamityMod.DataStructures @@ -29,7 +30,7 @@ namespace CalamityMod.DataStructures return; Player owner = Main.player[ownerIndex]; - int copy = Projectile.NewProjectile(owner.Center, Vector2.Zero, Type, OriginalDamage, OriginalKnockback, ownerIndex, AIValues[0], AIValues[1]); + int copy = Projectile.NewProjectile(new EntitySource_ByProjectileSourceId(1), owner.Center, Vector2.Zero, Type, OriginalDamage, OriginalKnockback, ownerIndex, AIValues[0], AIValues[1]); if (Main.projectile.IndexInRange(copy)) { @@ -62,7 +63,7 @@ namespace CalamityMod.DataStructures return; Player owner = Main.player[ownerIndex]; - int body = Projectile.NewProjectile(owner.Center, Vector2.Zero, ModContent.ProjectileType(), OriginalDamage, OriginalKnockback, owner.whoAmI); + int body = Projectile.NewProjectile(new EntitySource_ByProjectileSourceId(1), owner.Center, Vector2.Zero, ModContent.ProjectileType(), OriginalDamage, OriginalKnockback, owner.whoAmI); // If there was not enough space for even the body to be created, don't both trying to create even more projectiles needlessly. if (!Main.projectile.IndexInRange(body)) @@ -70,7 +71,7 @@ namespace CalamityMod.DataStructures while (HeadCount > 0) { - Projectile.NewProjectile(owner.Center, Main.rand.NextVector2Unit(), ModContent.ProjectileType(), OriginalDamage, OriginalKnockback, owner.whoAmI, body); + Projectile.NewProjectile(new EntitySource_ByProjectileSourceId(1), owner.Center, Main.rand.NextVector2Unit(), ModContent.ProjectileType(), OriginalDamage, OriginalKnockback, owner.whoAmI, body); HeadCount--; } } @@ -92,7 +93,7 @@ namespace CalamityMod.DataStructures return; Player owner = Main.player[ownerIndex]; - Endogenesis.SummonEndoCooper(AttackMode, Main.MouseWorld, OriginalDamage, OriginalKnockback, owner, out int bodyIndex, out int limbsIndex); + Endogenesis.SummonEndoCooper(new EntitySource_ByProjectileSourceId(1), AttackMode, Main.MouseWorld, OriginalDamage, OriginalKnockback, owner, out int bodyIndex, out int limbsIndex); Main.projectile[bodyIndex].Calamity().RequiresManualResurrection = true; Main.projectile[limbsIndex].Calamity().RequiresManualResurrection = true; } diff --git a/Items/DraedonMisc/AdvancedDisplay.cs b/Items/DraedonMisc/AdvancedDisplay.cs index ffdfb7c13b..53b076709a 100644 --- a/Items/DraedonMisc/AdvancedDisplay.cs +++ b/Items/DraedonMisc/AdvancedDisplay.cs @@ -7,6 +7,7 @@ using Microsoft.Xna.Framework; using CalamityMod.TileEntities; using CalamityMod.CustomRecipes; using System.Collections.Generic; +using System; namespace CalamityMod.Items.DraedonMisc { @@ -55,7 +56,14 @@ namespace CalamityMod.Items.DraedonMisc public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ItemID.Glass, 20).AddTile(TileID.MythrilAnvil).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 10). + AddIngredient(ModContent.ItemType(), 10). + AddIngredient(ModContent.ItemType(), 3). + AddIngredient(ItemID.Glass, 20). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(3, out Predicate condition), condition). + AddTile(TileID.MythrilAnvil). + Register(); } } } diff --git a/Items/DraedonMisc/AuricQuantumCoolingCell.cs b/Items/DraedonMisc/AuricQuantumCoolingCell.cs index 573a57c411..7c5a62c141 100644 --- a/Items/DraedonMisc/AuricQuantumCoolingCell.cs +++ b/Items/DraedonMisc/AuricQuantumCoolingCell.cs @@ -9,6 +9,7 @@ using Terraria.ModLoader; using Microsoft.Xna.Framework; using System.Collections.Generic; using System.Linq; +using System; namespace CalamityMod.Items.DraedonMisc { @@ -70,8 +71,15 @@ namespace CalamityMod.Items.DraedonMisc public override void AddRecipes() { - // Old worlds can craft the cell immediately for the sake of being able to easily fight Draedon in endgame worlds. - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 40).AddIngredient(ModContent.ItemType(), 6).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 2). + AddIngredient(ModContent.ItemType(), 8). + AddIngredient(ModContent.ItemType(), 8). + AddIngredient(ModContent.ItemType(), 40). + AddIngredient(ModContent.ItemType(), 6). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(5, out Predicate condition), condition). + AddTile(ModContent.TileType()). + Register(); } } } diff --git a/Items/DraedonMisc/CodebreakerBase.cs b/Items/DraedonMisc/CodebreakerBase.cs index 57fabe5f45..ba8ac85f5d 100644 --- a/Items/DraedonMisc/CodebreakerBase.cs +++ b/Items/DraedonMisc/CodebreakerBase.cs @@ -1,4 +1,4 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; using Terraria.ID; using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonSummoner; @@ -27,7 +27,12 @@ namespace CalamityMod.Items.DraedonMisc public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 35).AddTile(TileID.Anvils).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType()). + AddIngredient(ModContent.ItemType(), 20). + AddIngredient(ModContent.ItemType(), 35). + AddTile(TileID.Anvils). + Register(); } } } diff --git a/Items/DraedonMisc/DecryptionComputer.cs b/Items/DraedonMisc/DecryptionComputer.cs index 4d42af9cd8..63be1a2708 100644 --- a/Items/DraedonMisc/DecryptionComputer.cs +++ b/Items/DraedonMisc/DecryptionComputer.cs @@ -7,6 +7,7 @@ using Microsoft.Xna.Framework; using CalamityMod.TileEntities; using CalamityMod.CustomRecipes; using System.Collections.Generic; +using System; namespace CalamityMod.Items.DraedonMisc { @@ -57,7 +58,15 @@ namespace CalamityMod.Items.DraedonMisc public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 18).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.Wire, 100).AddRecipeGroup("AnyCopperBar", 10).AddIngredient(ItemID.Glass, 15).AddTile(TileID.Anvils).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 18). + AddIngredient(ModContent.ItemType(), 10). + AddIngredient(ItemID.Wire, 100). + AddRecipeGroup("AnyCopperBar", 10). + AddIngredient(ItemID.Glass, 15). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(1, out Predicate condition), condition). + AddTile(TileID.Anvils). + Register(); } } } diff --git a/Items/DraedonMisc/LongRangedSensorArray.cs b/Items/DraedonMisc/LongRangedSensorArray.cs index e2933aca97..53c7405d24 100644 --- a/Items/DraedonMisc/LongRangedSensorArray.cs +++ b/Items/DraedonMisc/LongRangedSensorArray.cs @@ -7,6 +7,7 @@ using Microsoft.Xna.Framework; using CalamityMod.TileEntities; using CalamityMod.CustomRecipes; using System.Collections.Generic; +using System; namespace CalamityMod.Items.DraedonMisc { @@ -55,7 +56,14 @@ namespace CalamityMod.Items.DraedonMisc public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddRecipeGroup("AnyMythrilBar", 10).AddIngredient(ItemID.Wire, 50).AddTile(TileID.MythrilAnvil).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 10). + AddIngredient(ModContent.ItemType(), 10). + AddRecipeGroup("AnyMythrilBar", 10). + AddIngredient(ItemID.Wire, 50). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(2, out Predicate condition), condition). + AddTile(TileID.MythrilAnvil). + Register(); } } } diff --git a/Items/DraedonMisc/VoltageRegulationSystem.cs b/Items/DraedonMisc/VoltageRegulationSystem.cs index ed7362c224..d2b20e8f05 100644 --- a/Items/DraedonMisc/VoltageRegulationSystem.cs +++ b/Items/DraedonMisc/VoltageRegulationSystem.cs @@ -7,6 +7,7 @@ using Microsoft.Xna.Framework; using CalamityMod.TileEntities; using CalamityMod.CustomRecipes; using System.Collections.Generic; +using System; namespace CalamityMod.Items.DraedonMisc { @@ -56,7 +57,14 @@ namespace CalamityMod.Items.DraedonMisc public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.LunarBar, 5).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 10). + AddIngredient(ModContent.ItemType(), 10). + AddIngredient(ModContent.ItemType(), 5). + AddIngredient(ItemID.LunarBar, 5). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(4, out Predicate condition), condition). + AddTile(TileID.LunarCraftingStation). + Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs b/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs index d2c470048d..b61e300a44 100644 --- a/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs +++ b/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using Terraria; using Terraria.DataStructures; @@ -68,7 +69,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 12).AddRecipeGroup("AnyMythrilBar", 10).AddIngredient(ItemID.SoulofSight, 20).AddTile(TileID.MythrilAnvil).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 8). + AddIngredient(ModContent.ItemType(), 12). + AddRecipeGroup("AnyMythrilBar", 10). + AddIngredient(ItemID.SoulofSight, 20). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(2, out Predicate condition), condition). + AddTile(TileID.MythrilAnvil). + Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs b/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs index 38e013fbff..ff98a9308d 100644 --- a/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs +++ b/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using Terraria; using Terraria.DataStructures; @@ -64,7 +65,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 18).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 12). + AddIngredient(ModContent.ItemType(), 18). + AddIngredient(ModContent.ItemType(), 5). + AddIngredient(ModContent.ItemType(), 5). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(3, out Predicate condition), condition). + AddTile(TileID.MythrilAnvil). + Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs index 22b773584f..3ce2c123bd 100644 --- a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs +++ b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using Terraria; using Terraria.DataStructures; @@ -67,7 +68,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 15). + AddIngredient(ModContent.ItemType(), 15). + AddIngredient(ModContent.ItemType(), 5). + AddIngredient(ModContent.ItemType(), 5). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(3, out Predicate condition), condition). + AddTile(TileID.MythrilAnvil). + Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/GaussPistol.cs b/Items/Weapons/DraedonsArsenal/GaussPistol.cs index a209df6b52..bf2649945d 100644 --- a/Items/Weapons/DraedonsArsenal/GaussPistol.cs +++ b/Items/Weapons/DraedonsArsenal/GaussPistol.cs @@ -1,7 +1,9 @@ -using CalamityMod.CustomRecipes; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; +using System; using System.Collections.Generic; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -30,7 +32,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Shoot; - Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/GaussWeaponFire"); + Item.UseSound = SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Item/GaussWeaponFire"); Item.noMelee = true; Item.value = CalamityGlobalItem.Rarity5BuyPrice; @@ -49,7 +51,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 8).AddRecipeGroup("AnyMythrilBar", 10).AddIngredient(ItemID.SoulofMight, 20).AddTile(TileID.MythrilAnvil).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 12). + AddIngredient(ModContent.ItemType(), 8). + AddRecipeGroup("AnyMythrilBar", 10). + AddIngredient(ItemID.SoulofMight, 20). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(2, out Predicate condition), condition). + AddTile(TileID.MythrilAnvil). + Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/GaussRifle.cs b/Items/Weapons/DraedonsArsenal/GaussRifle.cs index 4f4f3ac825..94a2467f6f 100644 --- a/Items/Weapons/DraedonsArsenal/GaussRifle.cs +++ b/Items/Weapons/DraedonsArsenal/GaussRifle.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using Terraria; using Terraria.DataStructures; @@ -57,7 +58,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 18).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 18). + AddIngredient(ModContent.ItemType(), 12). + AddIngredient(ModContent.ItemType(), 5). + AddIngredient(ModContent.ItemType(), 5). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(3, out Predicate condition), condition). + AddTile(TileID.MythrilAnvil). + Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs b/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs index 42e891a4ef..e8364b8243 100644 --- a/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs +++ b/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs @@ -1,6 +1,7 @@ -using CalamityMod.CustomRecipes; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; +using System; using System.Collections.Generic; using Terraria; using Terraria.ID; @@ -58,7 +59,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 12).AddRecipeGroup("AnyMythrilBar", 10).AddIngredient(ItemID.SoulofSight, 20).AddTile(TileID.MythrilAnvil).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 8). + AddIngredient(ModContent.ItemType(), 12). + AddRecipeGroup("AnyMythrilBar", 10). + AddIngredient(ItemID.SoulofSight, 20). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(2, out Predicate condition), condition). + AddTile(TileID.MythrilAnvil). + Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/LaserRifle.cs b/Items/Weapons/DraedonsArsenal/LaserRifle.cs index 3225aac6c1..87d5600c04 100644 --- a/Items/Weapons/DraedonsArsenal/LaserRifle.cs +++ b/Items/Weapons/DraedonsArsenal/LaserRifle.cs @@ -7,6 +7,7 @@ using Terraria; using Terraria.ID; using Terraria.DataStructures; using Terraria.ModLoader; +using System; namespace CalamityMod.Items.Weapons.DraedonsArsenal { @@ -72,7 +73,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.LunarBar, 4).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 15). + AddIngredient(ModContent.ItemType(), 15). + AddIngredient(ModContent.ItemType(), 8). + AddIngredient(ItemID.LunarBar, 4). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(4, out Predicate condition), condition). + AddTile(TileID.LunarCraftingStation). + Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/MatterModulator.cs b/Items/Weapons/DraedonsArsenal/MatterModulator.cs index c02299cc1c..174b3b5606 100644 --- a/Items/Weapons/DraedonsArsenal/MatterModulator.cs +++ b/Items/Weapons/DraedonsArsenal/MatterModulator.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using Terraria; using Terraria.DataStructures; @@ -61,7 +62,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 8).AddRecipeGroup("AnyMythrilBar", 10).AddIngredient(ItemID.SoulofFright, 20).AddTile(TileID.MythrilAnvil).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 12). + AddIngredient(ModContent.ItemType(), 8). + AddRecipeGroup("AnyMythrilBar", 10). + AddIngredient(ItemID.SoulofFright, 20). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(2, out Predicate condition), condition). + AddTile(TileID.MythrilAnvil). + Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/MountedScanner.cs b/Items/Weapons/DraedonsArsenal/MountedScanner.cs index ce4704e7ae..ea0566ecce 100644 --- a/Items/Weapons/DraedonsArsenal/MountedScanner.cs +++ b/Items/Weapons/DraedonsArsenal/MountedScanner.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using Terraria; using Terraria.DataStructures; @@ -90,7 +91,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 5).AddRecipeGroup("AnyMythrilBar", 10).AddIngredient(ItemID.SoulofFright, 20).AddTile(TileID.MythrilAnvil).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 15). + AddIngredient(ModContent.ItemType(), 5). + AddRecipeGroup("AnyMythrilBar", 10). + AddIngredient(ItemID.SoulofFright, 20). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(2, out Predicate condition), condition). + AddTile(TileID.MythrilAnvil). + Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs index 4051c21814..e2f1e63c41 100644 --- a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs +++ b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs @@ -1,10 +1,12 @@ -using CalamityMod.CustomRecipes; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -63,10 +65,11 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && Item.Calamity().Charge > 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) { - Projectile blade = Projectile.NewProjectileDirect(position, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile blade = Projectile.NewProjectileDirect(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); blade.rotation = blade.AngleTo(Main.MouseWorld); + blade.netUpdate = true; return false; } @@ -74,7 +77,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 25).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 15). + AddIngredient(ModContent.ItemType(), 25). + AddIngredient(ModContent.ItemType(), 8). + AddIngredient(ModContent.ItemType(), 2). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(5, out Predicate condition), condition). + AddTile(ModContent.TileType()). + Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs index b756ca1b39..7c57c6d329 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using Terraria; using Terraria.DataStructures; @@ -100,7 +101,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 18).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.LunarBar, 4).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 18). + AddIngredient(ModContent.ItemType(), 12). + AddIngredient(ModContent.ItemType(), 8). + AddIngredient(ItemID.LunarBar, 4). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(4, out Predicate condition), condition). + AddTile(TileID.LunarCraftingStation). + Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs index 45ec351032..f4acf4f236 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using Terraria; using Terraria.DataStructures; @@ -63,7 +64,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - CreateRecipe(999).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); + CreateRecipe(999). + AddIngredient(ModContent.ItemType(), 5). + AddIngredient(ModContent.ItemType(), 5). + AddIngredient(ModContent.ItemType()). + AddIngredient(ModContent.ItemType()). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(5, out Predicate condition), condition). + AddTile(ModContent.TileType()). + Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/PoleWarper.cs b/Items/Weapons/DraedonsArsenal/PoleWarper.cs index 7c7dd0f28e..d235fc4720 100644 --- a/Items/Weapons/DraedonsArsenal/PoleWarper.cs +++ b/Items/Weapons/DraedonsArsenal/PoleWarper.cs @@ -1,10 +1,12 @@ -using CalamityMod.CustomRecipes; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -50,10 +52,10 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal modItem.ChargePerAltUse = 0f; } - 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 north = Projectile.NewProjectileDirect(Main.MouseWorld + Vector2.UnitY * 30f, Vector2.Zero, type, damage, knockBack, player.whoAmI); - Projectile south = Projectile.NewProjectileDirect(Main.MouseWorld - Vector2.UnitY * 30f, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile north = Projectile.NewProjectileDirect(source, Main.MouseWorld + Vector2.UnitY * 30f, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile south = Projectile.NewProjectileDirect(source, Main.MouseWorld - Vector2.UnitY * 30f, Vector2.Zero, type, damage, knockBack, player.whoAmI); north.ai[1] = 1f; south.ai[1] = 0f; @@ -74,8 +76,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { if (Main.projectile[i].type == type && Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI) { - ((PoleWarperSummon)Main.projectile[i].modProjectile).Time = 0f; - ((PoleWarperSummon)Main.projectile[i].modProjectile).AngularOffset = MathHelper.TwoPi * magnetIndex / magnetCount; + ((PoleWarperSummon)Main.projectile[i].ModProjectile).Time = 0f; + ((PoleWarperSummon)Main.projectile[i].ModProjectile).AngularOffset = MathHelper.TwoPi * magnetIndex / magnetCount; magnetIndex++; } } @@ -87,7 +89,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 25).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 25). + AddIngredient(ModContent.ItemType(), 15). + AddIngredient(ModContent.ItemType(), 8). + AddIngredient(ModContent.ItemType(), 2). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(5, out Predicate condition), condition). + AddTile(ModContent.TileType()). + Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/PulseDragon.cs b/Items/Weapons/DraedonsArsenal/PulseDragon.cs index 3edcd1899e..0973784e10 100644 --- a/Items/Weapons/DraedonsArsenal/PulseDragon.cs +++ b/Items/Weapons/DraedonsArsenal/PulseDragon.cs @@ -1,9 +1,11 @@ -using CalamityMod.CustomRecipes; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -46,15 +48,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal modItem.ChargePerUse = 0.32f; } - 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 offsetAngle = Main.rand.NextFloat(0.2f, 0.4f); velocity += player.velocity; float velocityAngle = velocity.ToRotation(); - Projectile projectile = Projectile.NewProjectileDirect(position, velocity, type, damage, knockBack, player.whoAmI, velocityAngle, Main.rand.NextFloat(30f, PulseDragonProjectile.MaximumPossibleOutwardness)); + Projectile projectile = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockBack, player.whoAmI, velocityAngle, Main.rand.NextFloat(30f, PulseDragonProjectile.MaximumPossibleOutwardness)); projectile.localAI[0] = 1f; - projectile = Projectile.NewProjectileDirect(position, velocity.RotatedBy(offsetAngle), type, damage, knockBack, player.whoAmI, velocityAngle + offsetAngle, Main.rand.NextFloat(30f, PulseDragonProjectile.MaximumPossibleOutwardness)); + projectile = Projectile.NewProjectileDirect(source, position, velocity.RotatedBy(offsetAngle), type, damage, knockBack, player.whoAmI, velocityAngle + offsetAngle, Main.rand.NextFloat(30f, PulseDragonProjectile.MaximumPossibleOutwardness)); projectile.localAI[0] = -1f; return false; } @@ -63,7 +64,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 18).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.LunarBar, 4).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 12). + AddIngredient(ModContent.ItemType(), 18). + AddIngredient(ModContent.ItemType(), 8). + AddIngredient(ItemID.LunarBar, 4). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(4, out Predicate condition), condition). + AddTile(TileID.LunarCraftingStation). + Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/PulsePistol.cs b/Items/Weapons/DraedonsArsenal/PulsePistol.cs index 4bb5c2bc07..57d26b2522 100644 --- a/Items/Weapons/DraedonsArsenal/PulsePistol.cs +++ b/Items/Weapons/DraedonsArsenal/PulsePistol.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using Terraria; using Terraria.DataStructures; @@ -59,7 +60,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.Anvils).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 5). + AddIngredient(ModContent.ItemType(), 7). + AddIngredient(ModContent.ItemType(), 4). + AddIngredient(ModContent.ItemType(), 7). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(1, out Predicate condition), condition). + AddTile(TileID.Anvils). + Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/PulseRifle.cs b/Items/Weapons/DraedonsArsenal/PulseRifle.cs index 6b9c091ccb..9904004fb6 100644 --- a/Items/Weapons/DraedonsArsenal/PulseRifle.cs +++ b/Items/Weapons/DraedonsArsenal/PulseRifle.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using Terraria; using Terraria.DataStructures; @@ -72,7 +73,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 20). + AddIngredient(ModContent.ItemType(), 20). + AddIngredient(ModContent.ItemType(), 8). + AddIngredient(ModContent.ItemType(), 2). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(5, out Predicate condition), condition). + AddTile(ModContent.TileType()). + Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs index 1e02c314e5..240829b9b5 100644 --- a/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs +++ b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using Terraria; using Terraria.DataStructures; @@ -63,7 +64,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 18).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 12). + AddIngredient(ModContent.ItemType(), 18). + AddIngredient(ModContent.ItemType(), 5). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(3, out Predicate condition), condition). + AddIngredient(ModContent.ItemType(), 5). + AddTile(TileID.MythrilAnvil). + Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs index 6296fe2af4..74e0f2bb3d 100644 --- a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs +++ b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using Terraria; using Terraria.DataStructures; @@ -59,7 +60,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 18).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.LunarBar, 4).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 18). + AddIngredient(ModContent.ItemType(), 12). + AddIngredient(ModContent.ItemType(), 8). + AddIngredient(ItemID.LunarBar, 4). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(4, out Predicate condition), condition). + AddTile(TileID.LunarCraftingStation). + Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs index 06dc0dada5..4dd57d7b82 100644 --- a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs +++ b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using Terraria; using Terraria.DataStructures; @@ -62,7 +63,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.Anvils).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 8). + AddIngredient(ModContent.ItemType(), 4). + AddIngredient(ModContent.ItemType(), 4). + AddIngredient(ModContent.ItemType(), 7). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(1, out Predicate condition), condition). + AddTile(TileID.Anvils). + Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/SystemBane.cs b/Items/Weapons/DraedonsArsenal/SystemBane.cs index 3ae7461543..155b839d1a 100644 --- a/Items/Weapons/DraedonsArsenal/SystemBane.cs +++ b/Items/Weapons/DraedonsArsenal/SystemBane.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using Terraria; using Terraria.DataStructures; @@ -65,7 +66,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.MythrilAnvil).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 20). + AddIngredient(ModContent.ItemType(), 10). + AddIngredient(ModContent.ItemType(), 5). + AddIngredient(ModContent.ItemType(), 5). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(3, out Predicate condition), condition). + AddTile(TileID.MythrilAnvil). + Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/Taser.cs b/Items/Weapons/DraedonsArsenal/Taser.cs index 3d1961fb1e..11f073608c 100644 --- a/Items/Weapons/DraedonsArsenal/Taser.cs +++ b/Items/Weapons/DraedonsArsenal/Taser.cs @@ -1,7 +1,8 @@ -using CalamityMod.CustomRecipes; +using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.DraedonsArsenal; +using System; using System.Collections.Generic; using Terraria; using Terraria.ID; @@ -31,7 +32,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Shoot; - Item.UseSound = Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); + Item.UseSound = SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Item/PlasmaBolt"); Item.noMelee = true; Item.value = CalamityGlobalItem.Rarity3BuyPrice; @@ -52,7 +53,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.Anvils).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 7). + AddIngredient(ModContent.ItemType(), 5). + AddIngredient(ModContent.ItemType(), 4). + AddIngredient(ModContent.ItemType(), 7). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(1, out Predicate condition), condition). + AddTile(TileID.Anvils). + Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs index 08c2889e1b..a34c8c3545 100644 --- a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs +++ b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using Terraria; using Terraria.DataStructures; @@ -73,7 +74,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 25).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 25). + AddIngredient(ModContent.ItemType(), 15). + AddIngredient(ModContent.ItemType(), 8). + AddIngredient(ModContent.ItemType(), 2). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(5, out Predicate condition), condition). + AddTile(ModContent.TileType()). + Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs index b2840ca417..787ffcc3dc 100644 --- a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs +++ b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Placeables; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using Terraria; using Terraria.DataStructures; @@ -65,7 +66,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType(), 7).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.Anvils).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 5). + AddIngredient(ModContent.ItemType(), 7). + AddIngredient(ModContent.ItemType(), 4). + AddIngredient(ModContent.ItemType(), 7). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(1, out Predicate condition), condition). + AddTile(TileID.Anvils). + Register(); } } } diff --git a/Items/Weapons/DraedonsArsenal/WavePounder.cs b/Items/Weapons/DraedonsArsenal/WavePounder.cs index 8447c874fb..bddb308092 100644 --- a/Items/Weapons/DraedonsArsenal/WavePounder.cs +++ b/Items/Weapons/DraedonsArsenal/WavePounder.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using Terraria; using Terraria.DataStructures; @@ -63,7 +64,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 18).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ItemID.LunarBar, 4).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(1). + AddIngredient(ModContent.ItemType(), 12). + AddIngredient(ModContent.ItemType(), 18). + AddIngredient(ModContent.ItemType(), 8). + AddIngredient(ItemID.LunarBar, 4). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(4, out Predicate condition), condition). + AddTile(TileID.LunarCraftingStation). + Register(); } } } diff --git a/Items/Weapons/Ranged/AMR.cs b/Items/Weapons/Ranged/AMR.cs index 40378c32b7..a4bef9a32b 100644 --- a/Items/Weapons/Ranged/AMR.cs +++ b/Items/Weapons/Ranged/AMR.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -42,19 +44,19 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-30, 0); // 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() { CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).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) { if (type == ProjectileID.Bullet) - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 1.3), knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 1.3), knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/AcesHigh.cs b/Items/Weapons/Ranged/AcesHigh.cs index 389d0430ec..4f5afaa553 100644 --- a/Items/Weapons/Ranged/AcesHigh.cs +++ b/Items/Weapons/Ranged/AcesHigh.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Ranged; @@ -53,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(1).AddIngredient(ItemID.Revolver).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 52).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) { int card = Utils.SelectRandom(Main.rand, new int[] { @@ -63,7 +64,7 @@ namespace CalamityMod.Items.Weapons.Ranged ModContent.ProjectileType() }); - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, card, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, card, damage, knockback, player.whoAmI, 0f, 0f); return false; } } diff --git a/Items/Weapons/Ranged/Alluvion.cs b/Items/Weapons/Ranged/Alluvion.cs index f1ff5db2d8..42ced114ba 100644 --- a/Items/Weapons/Ranged/Alluvion.cs +++ b/Items/Weapons/Ranged/Alluvion.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Ranged; @@ -40,12 +41,12 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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 source = player.RotatedRelativePoint(player.MountedCenter); float num117 = MathHelper.Pi * 0.1f; int totalProjectiles = 6; - Vector2 velocity = new Vector2(speedX, speedY); + velocity.Normalize(); velocity *= 35f; bool canHit = Collision.CanHit(source, 0, 0, source + velocity, 0, 0); @@ -74,7 +75,7 @@ namespace CalamityMod.Items.Weapons.Ranged newType = ModContent.ProjectileType(); break; } - int proj = Projectile.NewProjectile(source.X + offset.X, source.Y + offset.Y, speedX, speedY, newType, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source.X + offset.X, source.Y + offset.Y, velocity.X, velocity.Y, newType, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].arrow = true; @@ -83,7 +84,7 @@ namespace CalamityMod.Items.Weapons.Ranged } else { - int proj = Projectile.NewProjectile(source.X + offset.X, source.Y + offset.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source.X + offset.X, source.Y + offset.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); Main.projectile[proj].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/AngelicShotgun.cs b/Items/Weapons/Ranged/AngelicShotgun.cs index aa436705ca..85ba11924c 100644 --- a/Items/Weapons/Ranged/AngelicShotgun.cs +++ b/Items/Weapons/Ranged/AngelicShotgun.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -53,10 +55,10 @@ Fighting 'til the war's won"); return new Vector2(-17, -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) { int NumBullets = Main.rand.Next(5, 8); - Vector2 baseVelocity = new Vector2(speedX, speedY).SafeNormalize(Vector2.Zero) * BulletSpeed; + Vector2 baseVelocity = velocity.SafeNormalize(Vector2.Zero) * BulletSpeed; // Fire a shotgun spread of bullets. for (int i = 0; i < NumBullets; ++i) @@ -66,9 +68,9 @@ Fighting 'til the war's won"); Vector2 randomVelocity = baseVelocity + new Vector2(dx, dy); if (type == ProjectileID.Bullet) - Projectile.NewProjectile(position, randomVelocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, randomVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(position, randomVelocity, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, randomVelocity, type, damage, knockback, player.whoAmI); } // Spawn a beam from the sky ala Deathhail Staff or Lunar Flare @@ -112,7 +114,7 @@ Fighting 'til the war's won"); mouseDist = laserSpeed / mouseDist; mouseDX *= mouseDist; mouseDY *= mouseDist; - Projectile.NewProjectile(rrp, new Vector2(mouseDX, mouseDY + Main.rand.NextFloat(-0.8f, 0.8f)), ModContent.ProjectileType(), laserDamage, laserKB, player.whoAmI); + Projectile.NewProjectile(source, rrp, new Vector2(mouseDX, mouseDY + Main.rand.NextFloat(-0.8f, 0.8f)), ModContent.ProjectileType(), laserDamage, laserKB, player.whoAmI); // Play the sound of the laser beam SoundEngine.PlaySound(SoundID.Item72, player.Center); diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index aae82f7f5e..24940c42ce 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -68,18 +69,18 @@ Right click to fire a burst of bullets"); return base.CanUseItem(player); } - 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) { - float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + float SpeedX = velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); return false; } else { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.BulletHighVelocity, (int)(damage * 5.8f), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ProjectileID.BulletHighVelocity, (int)(damage * 5.8f), knockback, player.whoAmI, 0f, 0f); return false; } } diff --git a/Items/Weapons/Ranged/AquashardShotgun.cs b/Items/Weapons/Ranged/AquashardShotgun.cs index a4ed039613..3f05b6223d 100644 --- a/Items/Weapons/Ranged/AquashardShotgun.cs +++ b/Items/Weapons/Ranged/AquashardShotgun.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Placeables; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; @@ -38,25 +39,25 @@ namespace CalamityMod.Items.Weapons.Ranged } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 6; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 6; public override Vector2? HoldoutOffset() => new Vector2(-10, 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) { int num6 = Main.rand.Next(2, 4); for (int index = 0; index < num6; ++index) { - float SpeedX = speedX + Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + Main.rand.Next(-40, 41) * 0.05f; + float SpeedX = velocity.X + Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = velocity.Y + Main.rand.Next(-40, 41) * 0.05f; if (type == ProjectileID.Bullet) { - int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + int projectile = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); Main.projectile[projectile].timeLeft = 200; } else - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/Arbalest.cs b/Items/Weapons/Ranged/Arbalest.cs index 9f10e0505a..a8a4627a56 100644 --- a/Items/Weapons/Ranged/Arbalest.cs +++ b/Items/Weapons/Ranged/Arbalest.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -42,9 +43,9 @@ namespace CalamityMod.Items.Weapons.Ranged } // 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) { SoundEngine.PlaySound(SoundID.Item5, (int)player.Center.X, (int)player.Center.Y); @@ -60,9 +61,9 @@ namespace CalamityMod.Items.Weapons.Ranged int spread = (int)(30f * spreadScale); for (int i = 0; i < totalProjectiles; i++) { - float SpeedX = speedX + Main.rand.Next(-spread, spread + 1) * 0.05f; - float SpeedY = speedY + Main.rand.Next(-spread, spread + 1) * 0.05f; - int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * arrowScale), knockBack * arrowScale, player.whoAmI); + float SpeedX = velocity.X + Main.rand.Next(-spread, spread + 1) * 0.05f; + float SpeedY = velocity.Y + Main.rand.Next(-spread, spread + 1) * 0.05f; + int proj = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * arrowScale), knockback * arrowScale, player.whoAmI); Main.projectile[proj].scale = arrowScale; Main.projectile[proj].extraUpdates += 1; Main.projectile[proj].noDropItem = true; diff --git a/Items/Weapons/Ranged/Archerfish.cs b/Items/Weapons/Ranged/Archerfish.cs index 9200ffc0db..60cf878ba1 100644 --- a/Items/Weapons/Ranged/Archerfish.cs +++ b/Items/Weapons/Ranged/Archerfish.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -40,12 +41,12 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-10, -5); } - 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 (type == ProjectileID.Bullet) - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - 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/Ranged/ArterialAssault.cs b/Items/Weapons/Ranged/ArterialAssault.cs index 411013e00a..102fd3a2b2 100644 --- a/Items/Weapons/Ranged/ArterialAssault.cs +++ b/Items/Weapons/Ranged/ArterialAssault.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -44,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).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) { float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); @@ -87,12 +88,12 @@ namespace CalamityMod.Items.Weapons.Ranged float speedY5 = num79; if (type == ProjectileID.WoodenArrowFriendly) { - int bloodfire = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 80f); + int bloodfire = Projectile.NewProjectile(source, vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 80f); Main.projectile[bloodfire].tileCollide = false; } else { - int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI); + int num121 = Projectile.NewProjectile(source, vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockback, player.whoAmI); Main.projectile[num121].noDropItem = true; } return false; diff --git a/Items/Weapons/Ranged/AstralBlaster.cs b/Items/Weapons/Ranged/AstralBlaster.cs index f69bbe9413..e6e960c183 100644 --- a/Items/Weapons/Ranged/AstralBlaster.cs +++ b/Items/Weapons/Ranged/AstralBlaster.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -37,16 +38,16 @@ namespace CalamityMod.Items.Weapons.Ranged } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 25; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 25; public override Vector2? HoldoutOffset() => new Vector2(-5, 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 (type == ProjectileID.Bullet) - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - 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/Ranged/AstralRepeater.cs b/Items/Weapons/Ranged/AstralRepeater.cs index c47130ef7b..5150528dff 100644 --- a/Items/Weapons/Ranged/AstralRepeater.cs +++ b/Items/Weapons/Ranged/AstralRepeater.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Placeables; using Terraria; using Terraria.ID; @@ -36,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Ranged } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 25; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 25; public override void AddRecipes() { diff --git a/Items/Weapons/Ranged/AstrealDefeat.cs b/Items/Weapons/Ranged/AstrealDefeat.cs index 1489954aff..72eea07aae 100644 --- a/Items/Weapons/Ranged/AstrealDefeat.cs +++ b/Items/Weapons/Ranged/AstrealDefeat.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -39,9 +40,9 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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 speed = velocity.Length(); if (speed > 8f) velocity *= 8f / speed; @@ -51,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Ranged type = Item.shoot; float aiVar = Main.rand.Next(4); - Projectile.NewProjectile(position, velocity, type, damage, knockBack, player.whoAmI, aiVar); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, aiVar); return false; } diff --git a/Items/Weapons/Ranged/Auralis.cs b/Items/Weapons/Ranged/Auralis.cs index 8997ba63ff..da4e2f4b19 100644 --- a/Items/Weapons/Ranged/Auralis.cs +++ b/Items/Weapons/Ranged/Auralis.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Potions; using CalamityMod.Projectiles.Ranged; @@ -54,9 +56,9 @@ namespace CalamityMod.Items.Weapons.Ranged add += damageMult; } - 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, new Vector2(speedX, speedY), Item.shoot, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, Item.shoot, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/AuroraBlazer.cs b/Items/Weapons/Ranged/AuroraBlazer.cs index 9947099008..2cf1969b02 100644 --- a/Items/Weapons/Ranged/AuroraBlazer.cs +++ b/Items/Weapons/Ranged/AuroraBlazer.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -37,11 +38,11 @@ namespace CalamityMod.Items.Weapons.Ranged Item.rare = ItemRarityID.Lime; } - 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 SpeedX = speedX + Main.rand.NextFloat(-15f, 15f) * 0.05f; - float SpeedY = speedY + Main.rand.NextFloat(-15f, 15f) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, Main.rand.Next(4, 11), 0f); + float SpeedX = velocity.X + Main.rand.NextFloat(-15f, 15f) * 0.05f; + float SpeedY = velocity.Y + Main.rand.NextFloat(-15f, 15f) * 0.05f; + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, Main.rand.Next(4, 11), 0f); return false; } diff --git a/Items/Weapons/Ranged/Barinade.cs b/Items/Weapons/Ranged/Barinade.cs index 98bed2f98d..e3dee2879f 100644 --- a/Items/Weapons/Ranged/Barinade.cs +++ b/Items/Weapons/Ranged/Barinade.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -35,12 +36,12 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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 (type == ProjectileID.WoodenArrowFriendly) - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - 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/Ranged/Barinautical.cs b/Items/Weapons/Ranged/Barinautical.cs index ec028e6fe9..fac328d079 100644 --- a/Items/Weapons/Ranged/Barinautical.cs +++ b/Items/Weapons/Ranged/Barinautical.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -36,12 +37,12 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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 (type == ProjectileID.WoodenArrowFriendly) - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - 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/Ranged/BarracudaGun.cs b/Items/Weapons/Ranged/BarracudaGun.cs index f15ca0f1bf..a99378abce 100644 --- a/Items/Weapons/Ranged/BarracudaGun.cs +++ b/Items/Weapons/Ranged/BarracudaGun.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Ranged; @@ -41,13 +42,13 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-10, 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) { for (int index = 0; index < 2; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + float SpeedX = velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Ranged/BladedgeGreatbow.cs b/Items/Weapons/Ranged/BladedgeGreatbow.cs index d5180ad45e..cba7f39259 100644 --- a/Items/Weapons/Ranged/BladedgeGreatbow.cs +++ b/Items/Weapons/Ranged/BladedgeGreatbow.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -41,19 +43,19 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-10, 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) { for (int i = 0; i < 4; i++) { - float SpeedX = speedX + (float)Main.rand.Next(-60, 61) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-60, 61) * 0.05f; - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + float SpeedX = velocity.X + (float)Main.rand.Next(-60, 61) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-60, 61) * 0.05f; + int index = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); Main.projectile[index].noDropItem = true; } Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num117 = 0.314159274f; int num118 = 2; - Vector2 vector7 = new Vector2(speedX, speedY); + Vector2 vector7 = velocity; vector7.Normalize(); vector7 *= 10f; bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); @@ -65,7 +67,7 @@ namespace CalamityMod.Items.Weapons.Ranged { value9 -= vector7; } - int projectile = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, ProjectileID.Leaf, damage / 2, 0f, player.whoAmI); + int projectile = Projectile.NewProjectile(source, vector2.X + value9.X, vector2.Y + value9.Y, velocity.X, velocity.Y, ProjectileID.Leaf, damage / 2, 0f, player.whoAmI); if (projectile.WithinBounds(Main.maxProjectiles)) Main.projectile[projectile].Calamity().forceRanged = true; } diff --git a/Items/Weapons/Ranged/BlissfulBombardier.cs b/Items/Weapons/Ranged/BlissfulBombardier.cs index 49b376fd7b..630f3c655d 100644 --- a/Items/Weapons/Ranged/BlissfulBombardier.cs +++ b/Items/Weapons/Ranged/BlissfulBombardier.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -38,9 +39,9 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-10, 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/BloodBoiler.cs b/Items/Weapons/Ranged/BloodBoiler.cs index 42df3c6f5a..d7d2aa0e10 100644 --- a/Items/Weapons/Ranged/BloodBoiler.cs +++ b/Items/Weapons/Ranged/BloodBoiler.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -38,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-5, 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 (Main.rand.NextFloat() > 0.75f) --player.statLife; diff --git a/Items/Weapons/Ranged/BlossomFlux.cs b/Items/Weapons/Ranged/BlossomFlux.cs index f038889a2e..f84919b635 100644 --- a/Items/Weapons/Ranged/BlossomFlux.cs +++ b/Items/Weapons/Ranged/BlossomFlux.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -59,15 +60,15 @@ namespace CalamityMod.Items.Weapons.Ranged return base.CanUseItem(player); } - 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 4D), knockBack * 60f, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), (int)(damage * 4D), knockback * 60f, player.whoAmI); } else { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/BrimstoneFury.cs b/Items/Weapons/Ranged/BrimstoneFury.cs index bcec442883..96e7523486 100644 --- a/Items/Weapons/Ranged/BrimstoneFury.cs +++ b/Items/Weapons/Ranged/BrimstoneFury.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -36,19 +38,19 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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 numProj = 2; float rotation = MathHelper.ToRadians(2); for (int i = 0; i < numProj + 1; i++) { - Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); if (type == ProjectileID.WoodenArrowFriendly) - Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, perturbedSpeed, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else { - int proj = Projectile.NewProjectile(position, perturbedSpeed, type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI); Main.projectile[proj].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/BulletFilledShotgun.cs b/Items/Weapons/Ranged/BulletFilledShotgun.cs index 2d7ee0721e..a8ceb8400f 100644 --- a/Items/Weapons/Ranged/BulletFilledShotgun.cs +++ b/Items/Weapons/Ranged/BulletFilledShotgun.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -45,15 +46,15 @@ namespace CalamityMod.Items.Weapons.Ranged // Disable vanilla ammo consumption public override bool ConsumeAmmo(Player player) => false; - 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) { type = Item.shoot; int bulletAmt = Main.rand.Next(25,35); for (int i = 0; i < bulletAmt; i++) { - float newSpeedX = speedX + Main.rand.NextFloat(-15f, 15f); - float newSpeedY = speedY + Main.rand.NextFloat(-15f, 15f); - Projectile.NewProjectile(position.X, position.Y, newSpeedX, newSpeedY, type, damage, knockBack, player.whoAmI); + float newSpeedX = velocity.X + Main.rand.NextFloat(-15f, 15f); + float newSpeedY = velocity.Y + Main.rand.NextFloat(-15f, 15f); + Projectile.NewProjectile(source, position.X, position.Y, newSpeedX, newSpeedY, type, damage, knockback, player.whoAmI); } // Consume 5 ammo per shot diff --git a/Items/Weapons/Ranged/Butcher.cs b/Items/Weapons/Ranged/Butcher.cs index 10406aea23..a3950fb8fd 100644 --- a/Items/Weapons/Ranged/Butcher.cs +++ b/Items/Weapons/Ranged/Butcher.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -40,9 +42,9 @@ namespace CalamityMod.Items.Weapons.Ranged 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) { - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); return false; } diff --git a/Items/Weapons/Ranged/ChargedDartRifle.cs b/Items/Weapons/Ranged/ChargedDartRifle.cs index ab055f7096..f37bd4305e 100644 --- a/Items/Weapons/Ranged/ChargedDartRifle.cs +++ b/Items/Weapons/Ranged/ChargedDartRifle.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -47,11 +48,11 @@ namespace CalamityMod.Items.Weapons.Ranged 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) { if (player.altFunctionUse == 2) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)((double)damage * 2), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), (int)((double)damage * 2), knockback, player.whoAmI, 0f, 0f); return false; } else @@ -59,11 +60,11 @@ namespace CalamityMod.Items.Weapons.Ranged int num6 = Main.rand.Next(2, 5); for (int index = 0; index < num6; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; - int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage / 2, knockBack, player.whoAmI, 0f, 0f); + float SpeedX = velocity.X + (float)Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-40, 41) * 0.05f; + int projectile = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage / 2, knockback, player.whoAmI, 0f, 0f); } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); return false; } } diff --git a/Items/Weapons/Ranged/ChickenCannon.cs b/Items/Weapons/Ranged/ChickenCannon.cs index ab1ecaa356..c0d330ca35 100644 --- a/Items/Weapons/Ranged/ChickenCannon.cs +++ b/Items/Weapons/Ranged/ChickenCannon.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -52,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool CanUseItem(Player player) => player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 || player.altFunctionUse == 2; - 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) { // Play a sound and detonate all in-flight rockets, but don't shoot anything. if (player.altFunctionUse == 2) @@ -62,10 +64,10 @@ namespace CalamityMod.Items.Weapons.Ranged return false; } - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), 0, 0f, player.whoAmI, 1); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 1); // Otherwise just play a grenade launcher sound and fire a rocket. //Main.PlaySound(SoundID.Item61, position); - //Projectile.NewProjectile(position, new Vector2(speedX, speedY), item.shoot, damage, knockBack, player.whoAmI); + //Projectile.NewProjectile(source, position, velocity, item.shoot, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/ClamorRifle.cs b/Items/Weapons/Ranged/ClamorRifle.cs index 7c8b4ac1da..0fb9838927 100644 --- a/Items/Weapons/Ranged/ClamorRifle.cs +++ b/Items/Weapons/Ranged/ClamorRifle.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -37,12 +39,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-5, 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 (type == ProjectileID.Bullet) - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/ClaretCannon.cs b/Items/Weapons/Ranged/ClaretCannon.cs index a181a1a7d7..3acb9390d4 100644 --- a/Items/Weapons/Ranged/ClaretCannon.cs +++ b/Items/Weapons/Ranged/ClaretCannon.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -46,12 +47,12 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).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 (type == ProjectileID.Bullet) - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - 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/Ranged/CleansingBlaze.cs b/Items/Weapons/Ranged/CleansingBlaze.cs index 86cb376a69..9de15ca010 100644 --- a/Items/Weapons/Ranged/CleansingBlaze.cs +++ b/Items/Weapons/Ranged/CleansingBlaze.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -43,14 +44,14 @@ namespace CalamityMod.Items.Weapons.Ranged Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Ranged/CleansingBlazeGlow")); } - 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 num6 = Main.rand.Next(2, 4); for (int index = 0; index < num6; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + float SpeedX = velocity.X + (float)Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-15, 16) * 0.05f; + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Ranged/ClockGatlignum.cs b/Items/Weapons/Ranged/ClockGatlignum.cs index c7d7799166..b49df781f9 100644 --- a/Items/Weapons/Ranged/ClockGatlignum.cs +++ b/Items/Weapons/Ranged/ClockGatlignum.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -39,15 +40,15 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-5, 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 SpeedX = speedX + Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + Main.rand.Next(-15, 16) * 0.05f; + float SpeedX = velocity.X + Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = velocity.Y + Main.rand.Next(-15, 16) * 0.05f; if (type == ProjectileID.Bullet) - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ProjectileID.BulletHighVelocity, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ProjectileID.BulletHighVelocity, damage, knockback, player.whoAmI); else - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/ClockworkBow.cs b/Items/Weapons/Ranged/ClockworkBow.cs index 38d8acf0bd..341406a800 100644 --- a/Items/Weapons/Ranged/ClockworkBow.cs +++ b/Items/Weapons/Ranged/ClockworkBow.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -49,12 +51,12 @@ namespace CalamityMod.Items.Weapons.Ranged return 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) { - Vector2 shootVelocity = new Vector2(speedX, speedY); + Vector2 shootVelocity = velocity; Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); // Charge-up. Done via a holdout projectile. - Projectile.NewProjectile(position, shootDirection, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, shootDirection, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/Condemnation.cs b/Items/Weapons/Ranged/Condemnation.cs index 2951e9cabb..302beee4e9 100644 --- a/Items/Weapons/Ranged/Condemnation.cs +++ b/Items/Weapons/Ranged/Condemnation.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -60,9 +62,9 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool CanUseItem(Player player) => player.ownedProjectileCounts[ModContent.ProjectileType()] <= 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) { - Vector2 shootVelocity = new Vector2(speedX, speedY); + Vector2 shootVelocity = velocity; Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); @@ -71,12 +73,12 @@ namespace CalamityMod.Items.Weapons.Ranged if (player.Calamity().mouseRight) { Vector2 tipPosition = position + shootDirection * 110f; - Projectile.NewProjectile(tipPosition, shootVelocity, Item.shoot, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, tipPosition, shootVelocity, Item.shoot, damage, knockback, player.whoAmI); } // Charge-up. Done via a holdout projectile. else - Projectile.NewProjectile(position, shootDirection, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + Projectile.NewProjectile(source, position, shootDirection, ModContent.ProjectileType(), 0, 0f, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/Contagion.cs b/Items/Weapons/Ranged/Contagion.cs index a32972169c..f1ef302489 100644 --- a/Items/Weapons/Ranged/Contagion.cs +++ b/Items/Weapons/Ranged/Contagion.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -47,9 +48,9 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 20).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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/CoralCannon.cs b/Items/Weapons/Ranged/CoralCannon.cs index 8136c97371..cedd8f35b2 100644 --- a/Items/Weapons/Ranged/CoralCannon.cs +++ b/Items/Weapons/Ranged/CoralCannon.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -35,19 +36,19 @@ namespace CalamityMod.Items.Weapons.Ranged } // 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 Vector2? HoldoutOffset() => new Vector2(-10, 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 (Main.rand.NextBool(5)) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)((double)damage * 2.0), knockBack * 2f, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), (int)((double)damage * 2.0), knockback * 2f, player.whoAmI); } else { - 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/Ranged/CorrodedCaustibow.cs b/Items/Weapons/Ranged/CorrodedCaustibow.cs index 7c7fc16ca7..496dd21842 100644 --- a/Items/Weapons/Ranged/CorrodedCaustibow.cs +++ b/Items/Weapons/Ranged/CorrodedCaustibow.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; @@ -37,14 +38,14 @@ namespace CalamityMod.Items.Weapons.Ranged } // 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 (type == ProjectileID.WoodenArrowFriendly) - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - 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/Ranged/CosmicBolter.cs b/Items/Weapons/Ranged/CosmicBolter.cs index 19d9d3379e..b6181a51e0 100644 --- a/Items/Weapons/Ranged/CosmicBolter.cs +++ b/Items/Weapons/Ranged/CosmicBolter.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -37,12 +39,12 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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 source = player.RotatedRelativePoint(player.MountedCenter, true); float piOver10 = MathHelper.Pi * 0.1f; int projAmt = 3; - Vector2 velocity = new Vector2(speedX, speedY); + velocity.Normalize(); velocity *= 30f; bool canHit = Collision.CanHit(source, 0, 0, source + velocity, 0, 0); @@ -54,10 +56,10 @@ namespace CalamityMod.Items.Weapons.Ranged offset -= velocity; if (type == ProjectileID.WoodenArrowFriendly) - Projectile.NewProjectile(source + offset, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source + offset, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else { - int proj = Projectile.NewProjectile(source + offset, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source + offset, velocity, type, damage, knockback, player.whoAmI); Main.projectile[proj].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/CursedCapper.cs b/Items/Weapons/Ranged/CursedCapper.cs index 351858cf48..8785808a8a 100644 --- a/Items/Weapons/Ranged/CursedCapper.cs +++ b/Items/Weapons/Ranged/CursedCapper.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -34,9 +35,9 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.CursedBullet, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ProjectileID.CursedBullet, damage, knockback, player.whoAmI, 0f, 0f); return false; } diff --git a/Items/Weapons/Ranged/DaemonsFlame.cs b/Items/Weapons/Ranged/DaemonsFlame.cs index 6295dc2964..adba5e8a85 100644 --- a/Items/Weapons/Ranged/DaemonsFlame.cs +++ b/Items/Weapons/Ranged/DaemonsFlame.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -46,9 +47,9 @@ namespace CalamityMod.Items.Weapons.Ranged Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Ranged/DaemonsFlameGlow")); } - 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/DarkechoGreatbow.cs b/Items/Weapons/Ranged/DarkechoGreatbow.cs index d753327f59..239fafae93 100644 --- a/Items/Weapons/Ranged/DarkechoGreatbow.cs +++ b/Items/Weapons/Ranged/DarkechoGreatbow.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -36,16 +37,16 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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) { for (int i = 0; i < 2; i++) { - float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + float SpeedX = velocity.X + (float)Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-30, 31) * 0.05f; + int index = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); Main.projectile[index].noDropItem = true; } - int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.CrystalDart, damage / 2, knockBack, player.whoAmI); + int projectile = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ProjectileID.CrystalDart, damage / 2, knockback, player.whoAmI); Main.projectile[projectile].penetrate = 3; return false; } diff --git a/Items/Weapons/Ranged/Deathwind.cs b/Items/Weapons/Ranged/Deathwind.cs index fb1b95342c..12d0190061 100644 --- a/Items/Weapons/Ranged/Deathwind.cs +++ b/Items/Weapons/Ranged/Deathwind.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -43,19 +44,19 @@ namespace CalamityMod.Items.Weapons.Ranged Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Ranged/DeathwindGlow")); } - 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) { for (int index = 0; index < 4; ++index) { - float SpeedX = speedX + Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = speedY + Main.rand.Next(-20, 21) * 0.05f; + float SpeedX = velocity.X + Main.rand.Next(-20, 21) * 0.05f; + float SpeedY = velocity.Y + Main.rand.Next(-20, 21) * 0.05f; if (type == ProjectileID.WoodenArrowFriendly) { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); } else { - int num121 = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.8), knockBack, player.whoAmI); + int num121 = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.8), knockback, player.whoAmI); Main.projectile[num121].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/DodusHandcannon.cs b/Items/Weapons/Ranged/DodusHandcannon.cs index c5c31e115a..6596fa45bb 100644 --- a/Items/Weapons/Ranged/DodusHandcannon.cs +++ b/Items/Weapons/Ranged/DodusHandcannon.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -43,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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) { type = Item.shoot; return true; diff --git a/Items/Weapons/Ranged/DragonsBreath.cs b/Items/Weapons/Ranged/DragonsBreath.cs index a1cb90e5c2..d711af2563 100644 --- a/Items/Weapons/Ranged/DragonsBreath.cs +++ b/Items/Weapons/Ranged/DragonsBreath.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -65,11 +67,11 @@ namespace CalamityMod.Items.Weapons.Ranged public override float UseTimeMultiplier(Player player) => player.altFunctionUse == 2 ? FullAutoFireRateMult : 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) { SoundEngine.PlaySound(SoundID.Item38, position); bool doDust = false; - Vector2 vel = new Vector2(speedX, speedY); + Vector2 vel = velocity; int[] bulletIDs = new int[PelletsPerShot]; float spreadFactor = 1f; @@ -114,7 +116,7 @@ namespace CalamityMod.Items.Weapons.Ranged for (int i = 0; i < PelletsPerShot; ++i) { Vector2 rotatedVel = vel.RotatedBy(angleOffset); - Projectile.NewProjectile(position, rotatedVel, bulletIDs[i], damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, rotatedVel, bulletIDs[i], damage, knockback, player.whoAmI); angleOffset += Spread * spreadFactor; if (doDust) diff --git a/Items/Weapons/Ranged/Drataliornus.cs b/Items/Weapons/Ranged/Drataliornus.cs index 406a4be7b6..140a7d80f7 100644 --- a/Items/Weapons/Ranged/Drataliornus.cs +++ b/Items/Weapons/Ranged/Drataliornus.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -69,7 +71,7 @@ Right click to fire two devastating barrages of five empowered fireballs. return base.CanUseItem(player); } - 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) //tsunami { @@ -78,19 +80,19 @@ Right click to fire two devastating barrages of five empowered fireballs. int flameDamage = (int)(damage * RightClickDamageRatio); const float num3 = 0.471238898f; - Vector2 spinningpoint = new Vector2(speedX, speedY); + Vector2 spinningpoint = velocity; spinningpoint.Normalize(); spinningpoint *= 36f; for (int index1 = 0; index1 < numFlames; ++index1) { float num8 = index1 - (numFlames - 1) / 2; Vector2 vector2_5 = spinningpoint.RotatedBy(num3 * num8, new Vector2()); - Projectile.NewProjectile(position.X + vector2_5.X, position.Y + vector2_5.Y, speedX, speedY, flameID, flameDamage, knockBack, player.whoAmI, 1f, 0f); + Projectile.NewProjectile(source, position.X + vector2_5.X, position.Y + vector2_5.Y, velocity.X, velocity.Y, flameID, flameDamage, knockback, player.whoAmI, 1f, 0f); } } else { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), 0, 0f, player.whoAmI); } return false; diff --git a/Items/Weapons/Ranged/Dualpoon.cs b/Items/Weapons/Ranged/Dualpoon.cs index a2c9f0ded3..b8430b73da 100644 --- a/Items/Weapons/Ranged/Dualpoon.cs +++ b/Items/Weapons/Ranged/Dualpoon.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -40,12 +41,12 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-5, 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) { Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true); float piOverTen = MathHelper.Pi * 0.1f; int projCount = 2; - Vector2 velocity = new Vector2(speedX, speedY); + velocity.Normalize(); velocity *= 40f; bool canHit = Collision.CanHit(source, 0, 0, source + velocity, 0, 0); @@ -57,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Ranged { offset -= velocity; } - Projectile.NewProjectile(source.X + offset.X, source.Y + offset.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source.X + offset.X, source.Y + offset.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Ranged/EffluviumBow.cs b/Items/Weapons/Ranged/EffluviumBow.cs index a7aacb47bb..a0b9aa5f67 100644 --- a/Items/Weapons/Ranged/EffluviumBow.cs +++ b/Items/Weapons/Ranged/EffluviumBow.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -36,18 +37,18 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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) { for (int index = 0; index < 2; ++index) { - float SpeedX = speedX + Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + Main.rand.Next(-30, 31) * 0.05f; + float SpeedX = velocity.X + Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = velocity.Y + Main.rand.Next(-30, 31) * 0.05f; if (type == ProjectileID.WoodenArrowFriendly) - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else { - int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); Main.projectile[proj].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/ElementalEruption.cs b/Items/Weapons/Ranged/ElementalEruption.cs index 62d6ede0d7..7a07ca324a 100644 --- a/Items/Weapons/Ranged/ElementalEruption.cs +++ b/Items/Weapons/Ranged/ElementalEruption.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -38,14 +39,14 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-10, 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) { int numFirestreams = Main.rand.Next(3, 5); for (int index = 0; index < numFirestreams; ++index) { - float SpeedX = speedX + Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = speedY + Main.rand.Next(-20, 21) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + float SpeedX = velocity.X + Main.rand.Next(-20, 21) * 0.05f; + float SpeedY = velocity.Y + Main.rand.Next(-20, 21) * 0.05f; + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Ranged/EternalBlizzard.cs b/Items/Weapons/Ranged/EternalBlizzard.cs index fb7c1def01..9d564956e6 100644 --- a/Items/Weapons/Ranged/EternalBlizzard.cs +++ b/Items/Weapons/Ranged/EternalBlizzard.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -35,11 +36,11 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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 SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 0.7f), knockBack, player.whoAmI); + float SpeedX = velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; + int index = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 0.7f), knockback, player.whoAmI); Main.projectile[index].noDropItem = true; return true; diff --git a/Items/Weapons/Ranged/Eviscerator.cs b/Items/Weapons/Ranged/Eviscerator.cs index 7b23b2a433..ff1c5e00d0 100644 --- a/Items/Weapons/Ranged/Eviscerator.cs +++ b/Items/Weapons/Ranged/Eviscerator.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -37,16 +38,16 @@ namespace CalamityMod.Items.Weapons.Ranged } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 25; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 25; public override Vector2? HoldoutOffset() => new Vector2(-7, 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 (type == ProjectileID.Bullet) - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - 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/Ranged/FetidEmesis.cs b/Items/Weapons/Ranged/FetidEmesis.cs index d981f0320e..1e3fe98c85 100644 --- a/Items/Weapons/Ranged/FetidEmesis.cs +++ b/Items/Weapons/Ranged/FetidEmesis.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -41,16 +43,16 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-5, 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 (Main.rand.NextBool(8)) { - Projectile.NewProjectile(position, new Vector2(speedX, speedY) * 0.8f, - ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, velocity * 0.8f, + ModContent.ProjectileType(), damage, knockback, player.whoAmI); for (int i = 0; i < 5; i++) { Dust dust = Dust.NewDustDirect(position, 10, 10, 27); - dust.velocity = Vector2.Normalize(new Vector2(speedX, speedY)).RotatedByRandom(MathHelper.ToRadians(15f)); + dust.velocity = Vector2.Normalize(velocity).RotatedByRandom(MathHelper.ToRadians(15f)); dust.noGravity = true; } if (player.Calamity().soundCooldown <= 0) diff --git a/Items/Weapons/Ranged/FirestormCannon.cs b/Items/Weapons/Ranged/FirestormCannon.cs index a0ced23e3b..e5d53dea03 100644 --- a/Items/Weapons/Ranged/FirestormCannon.cs +++ b/Items/Weapons/Ranged/FirestormCannon.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; @@ -49,16 +50,16 @@ namespace CalamityMod.Items.Weapons.Ranged return 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) { if (player.altFunctionUse == 2) { int num6 = Main.rand.Next(4, 6); for (int index = 0; index < num6; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-50, 51) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-50, 51) * 0.05f; - int flare = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 1.4), knockBack, player.whoAmI); + float SpeedX = velocity.X + (float)Main.rand.Next(-50, 51) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-50, 51) * 0.05f; + int flare = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 1.4), knockback, player.whoAmI); if (flare.WithinBounds(Main.maxProjectiles)) { Main.projectile[flare].penetrate = 1; @@ -73,9 +74,9 @@ namespace CalamityMod.Items.Weapons.Ranged int num6 = Main.rand.Next(1, 3); for (int index = 0; index < num6; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; - int flare = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + float SpeedX = velocity.X + (float)Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-40, 41) * 0.05f; + int flare = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); if (flare.WithinBounds(Main.maxProjectiles)) { Main.projectile[flare].Calamity().forceRanged = true; diff --git a/Items/Weapons/Ranged/FlakKraken.cs b/Items/Weapons/Ranged/FlakKraken.cs index cc6a28f458..bd20e1e659 100644 --- a/Items/Weapons/Ranged/FlakKraken.cs +++ b/Items/Weapons/Ranged/FlakKraken.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Ranged; @@ -39,9 +40,9 @@ namespace CalamityMod.Items.Weapons.Ranged 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); return false; } diff --git a/Items/Weapons/Ranged/FlakToxicannon.cs b/Items/Weapons/Ranged/FlakToxicannon.cs index d4d137262e..6512757405 100644 --- a/Items/Weapons/Ranged/FlakToxicannon.cs +++ b/Items/Weapons/Ranged/FlakToxicannon.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using System; @@ -34,16 +36,16 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 9f; } - 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 angle = new Vector2(speedX, speedY).ToRotation() + MathHelper.PiOver2; + float angle = velocity.ToRotation() + MathHelper.PiOver2; if (angle <= -MathHelper.PiOver4 || angle >= MathHelper.PiOver4) return false; angle -= MathHelper.PiOver2; - Vector2 velocity = angle.ToRotationVector2() * (float)Math.Sqrt(speedX * speedX + speedY * speedY) * new Vector2(1f, 2f); - Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/FlarewingBow.cs b/Items/Weapons/Ranged/FlarewingBow.cs index 9f25583d28..630126be93 100644 --- a/Items/Weapons/Ranged/FlarewingBow.cs +++ b/Items/Weapons/Ranged/FlarewingBow.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -37,12 +39,12 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num117 = 0.314159274f; int num118 = 5; - Vector2 vector7 = new Vector2(speedX, speedY); + Vector2 vector7 = velocity; vector7.Normalize(); vector7 *= 50f; bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); @@ -56,12 +58,12 @@ namespace CalamityMod.Items.Weapons.Ranged } if (type == ProjectileID.WoodenArrowFriendly) { - int num123 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + int num123 = Projectile.NewProjectile(source, vector2.X + value9.X, vector2.Y + value9.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); Main.projectile[num123].noDropItem = true; } else { - int num123 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + int num123 = Projectile.NewProjectile(source, vector2.X + value9.X, vector2.Y + value9.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); Main.projectile[num123].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/FlurrystormCannon.cs b/Items/Weapons/Ranged/FlurrystormCannon.cs index 0f90274efa..0c0523e2c8 100644 --- a/Items/Weapons/Ranged/FlurrystormCannon.cs +++ b/Items/Weapons/Ranged/FlurrystormCannon.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; @@ -45,9 +46,9 @@ namespace CalamityMod.Items.Weapons.Ranged 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); return false; } diff --git a/Items/Weapons/Ranged/FrostbiteBlaster.cs b/Items/Weapons/Ranged/FrostbiteBlaster.cs index 99b0bc3c51..6cce2d17dd 100644 --- a/Items/Weapons/Ranged/FrostbiteBlaster.cs +++ b/Items/Weapons/Ranged/FrostbiteBlaster.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -38,22 +39,22 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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.Item36, position); for (int i = 0; i < 2; i++) { - float newSpeedX = speedX + Main.rand.Next(-40, 41) * 0.06f; - float newSpeedY = speedY + Main.rand.Next(-40, 41) * 0.06f; + float newSpeedX = velocity.X + Main.rand.Next(-40, 41) * 0.06f; + float newSpeedY = velocity.Y + Main.rand.Next(-40, 41) * 0.06f; if (type == ProjectileID.Bullet) { - int p = Projectile.NewProjectile(position.X, position.Y, newSpeedX, newSpeedY, ProjectileID.Blizzard, damage, knockBack, player.whoAmI); + int p = Projectile.NewProjectile(source, position.X, position.Y, newSpeedX, newSpeedY, ProjectileID.Blizzard, damage, knockback, player.whoAmI); // Main.projectile[p].magic = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; Main.projectile[p].DamageType = DamageClass.Ranged; } else - Projectile.NewProjectile(position.X, position.Y, newSpeedX, newSpeedY, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, newSpeedX, newSpeedY, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/Fungicide.cs b/Items/Weapons/Ranged/Fungicide.cs index b8dd19628f..d72043f659 100644 --- a/Items/Weapons/Ranged/Fungicide.cs +++ b/Items/Weapons/Ranged/Fungicide.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -40,12 +41,12 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-5, 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 (type == ProjectileID.Bullet) - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - 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/Ranged/Galeforce.cs b/Items/Weapons/Ranged/Galeforce.cs index b61f766a27..a2438d785c 100644 --- a/Items/Weapons/Ranged/Galeforce.cs +++ b/Items/Weapons/Ranged/Galeforce.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -36,12 +38,12 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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) { for (int i = -8; i <= 8; i += 8) { - Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); - Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType(), damage / 4, 0f, player.whoAmI); + Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i)); + Projectile.NewProjectile(source, position, perturbedSpeed, ModContent.ProjectileType(), damage / 4, 0f, player.whoAmI); } return true; } diff --git a/Items/Weapons/Ranged/GoldenEagle.cs b/Items/Weapons/Ranged/GoldenEagle.cs index 96e81be9df..b09e3773ac 100644 --- a/Items/Weapons/Ranged/GoldenEagle.cs +++ b/Items/Weapons/Ranged/GoldenEagle.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -38,15 +39,15 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-5, 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) { - Vector2 velocity = new Vector2(speedX, speedY); + // Fire extra bullets to the left and right for (int i = 0; i < 2; i++) { - Projectile.NewProjectile(position, velocity.RotatedBy(-Spread * (i + 1)), type, damage, knockBack, player.whoAmI); - Projectile.NewProjectile(position, velocity.RotatedBy(+Spread * (i + 1)), type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, velocity.RotatedBy(-Spread * (i + 1)), type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity.RotatedBy(+Spread * (i + 1)), type, damage, knockback, player.whoAmI); } return true; diff --git a/Items/Weapons/Ranged/Goobow.cs b/Items/Weapons/Ranged/Goobow.cs index f0b456bc12..f37229abad 100644 --- a/Items/Weapons/Ranged/Goobow.cs +++ b/Items/Weapons/Ranged/Goobow.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -36,12 +38,12 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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 source = player.RotatedRelativePoint(player.MountedCenter, true); float piOver10 = 0.1f * MathHelper.Pi; int projAmt = 2; - Vector2 velocity = new Vector2(speedX, speedY); + velocity.Normalize(); velocity *= 20f; bool canHit = Collision.CanHit(source, 0, 0, source + velocity, 0, 0); @@ -53,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Ranged { offset -= velocity; } - int index = Projectile.NewProjectile(source + offset, new Vector2(speedX, speedY) * 0.6f, ProjectileID.SlimeGun, damage / 4, 0f, player.whoAmI); + int index = Projectile.NewProjectile(source + offset, velocity * 0.6f, ProjectileID.SlimeGun, damage / 4, 0f, player.whoAmI); if (index.WithinBounds(Main.maxProjectiles)) { Main.projectile[index].Calamity().forceRanged = true; diff --git a/Items/Weapons/Ranged/GreatbowofTurmoil.cs b/Items/Weapons/Ranged/GreatbowofTurmoil.cs index 1338e77f0b..4992719988 100644 --- a/Items/Weapons/Ranged/GreatbowofTurmoil.cs +++ b/Items/Weapons/Ranged/GreatbowofTurmoil.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -37,12 +39,12 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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 source = player.RotatedRelativePoint(player.MountedCenter, true); float piOverTen = MathHelper.Pi * 0.1f; int arrowAmt = 3; - Vector2 velocity = new Vector2(speedX, speedY); + velocity.Normalize(); velocity *= 40f; bool canHit = Collision.CanHit(source, 0, 0, source + velocity, 0, 0); @@ -58,20 +60,20 @@ namespace CalamityMod.Items.Weapons.Ranged { type = ProjectileID.FireArrow; } - int num121 = Projectile.NewProjectile(source + offset, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int num121 = Projectile.NewProjectile(source + offset, velocity, type, damage, knockback, player.whoAmI); Main.projectile[num121].noDropItem = true; } for (int i = 0; i < 2; i++) { - float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; + float SpeedX = velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; type = Utils.SelectRandom(Main.rand, new int[] { ProjectileID.CursedArrow, ProjectileID.HellfireArrow, ProjectileID.IchorArrow }); - int index = Projectile.NewProjectile(position, new Vector2(SpeedX, SpeedY), type, (int)(damage * 0.5f), knockBack, player.whoAmI); + int index = Projectile.NewProjectile(source, position, new Vector2(SpeedX, SpeedY), type, (int)(damage * 0.5f), knockback, player.whoAmI); Main.projectile[index].noDropItem = true; Main.projectile[index].usesLocalNPCImmunity = true; Main.projectile[index].localNPCHitCooldown = 10; diff --git a/Items/Weapons/Ranged/GunkShot.cs b/Items/Weapons/Ranged/GunkShot.cs index cf642224d1..007537e8a7 100644 --- a/Items/Weapons/Ranged/GunkShot.cs +++ b/Items/Weapons/Ranged/GunkShot.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -41,14 +42,14 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-5, 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) { int num6 = Main.rand.Next(3, 5); for (int index = 0; index < num6; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-25, 26) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-25, 26) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + float SpeedX = velocity.X + (float)Main.rand.Next(-25, 26) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-25, 26) * 0.05f; + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Ranged/HalibutCannon.cs b/Items/Weapons/Ranged/HalibutCannon.cs index 6947016cc6..0f25de2cd8 100644 --- a/Items/Weapons/Ranged/HalibutCannon.cs +++ b/Items/Weapons/Ranged/HalibutCannon.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -37,16 +38,16 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-15, 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) { SoundEngine.PlaySound(SoundID.Item38, (int)player.Center.X, (int)player.Center.Y); int bulletAmt = Main.rand.Next(25, 36); for (int index = 0; index < bulletAmt; ++index) { - float SpeedX = speedX + Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + Main.rand.Next(-10, 11) * 0.05f; - int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + float SpeedX = velocity.X + Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = velocity.Y + Main.rand.Next(-10, 11) * 0.05f; + int shot = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); Main.projectile[shot].timeLeft = 120; } diff --git a/Items/Weapons/Ranged/HalleysInferno.cs b/Items/Weapons/Ranged/HalleysInferno.cs index d419d88332..be943d6b79 100644 --- a/Items/Weapons/Ranged/HalleysInferno.cs +++ b/Items/Weapons/Ranged/HalleysInferno.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Ranged; @@ -41,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Ranged } // 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 Vector2? HoldoutOffset() => new Vector2(-15, 0); diff --git a/Items/Weapons/Ranged/HandheldTank.cs b/Items/Weapons/Ranged/HandheldTank.cs index f5ef5ec967..98ec67ff05 100644 --- a/Items/Weapons/Ranged/HandheldTank.cs +++ b/Items/Weapons/Ranged/HandheldTank.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -39,11 +40,11 @@ namespace CalamityMod.Items.Weapons.Ranged } // 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); return false; } diff --git a/Items/Weapons/Ranged/HeavenlyGale.cs b/Items/Weapons/Ranged/HeavenlyGale.cs index 3032c420b1..3550a74f33 100644 --- a/Items/Weapons/Ranged/HeavenlyGale.cs +++ b/Items/Weapons/Ranged/HeavenlyGale.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -55,14 +57,14 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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 source = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 vel = new Vector2(speedX, speedY); + Vector2 vel = velocity; float piOver10 = MathHelper.Pi * 0.1f; // This is not related to speed, but rather placing the arrows correctly along the large bow. - Vector2 baseOffset = new Vector2(speedX, speedY); + Vector2 baseOffset = velocity; baseOffset.Normalize(); baseOffset *= 40f; @@ -82,12 +84,12 @@ namespace CalamityMod.Items.Weapons.Ranged // Teal exo arrows deal less damage. float dmgMult = thisArrowType == ProjectileType() ? 0.66f : 1f; int finalDamage = (int)(damage * dmgMult); - Projectile.NewProjectile(source + offset, vel, thisArrowType, finalDamage, knockBack, player.whoAmI); + Projectile.NewProjectile(source + offset, vel, thisArrowType, finalDamage, knockback, player.whoAmI); } else { int normalArrowDamage = (int)(damage * NormalArrowDamageMult); - int proj = Projectile.NewProjectile(source + offset, vel, type, normalArrowDamage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source + offset, vel, type, normalArrowDamage, knockback, player.whoAmI); Main.projectile[proj].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/Hellborn.cs b/Items/Weapons/Ranged/Hellborn.cs index ab0151ca9d..e50628342a 100644 --- a/Items/Weapons/Ranged/Hellborn.cs +++ b/Items/Weapons/Ranged/Hellborn.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -46,30 +47,30 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-10, 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) { for (int index = 0; index < 3; index++) { - float SpeedX = speedX + Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + Main.rand.Next(-15, 16) * 0.05f; + float SpeedX = velocity.X + Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = velocity.Y + Main.rand.Next(-15, 16) * 0.05f; if (type == ProjectileID.Bullet) { - int bullet = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ProjectileID.ExplosiveBullet, damage, knockBack, player.whoAmI); + int bullet = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ProjectileID.ExplosiveBullet, damage, knockback, player.whoAmI); Main.projectile[bullet].usesLocalNPCImmunity = true; Main.projectile[bullet].localNPCHitCooldown = 10; } else - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); } return false; } - public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) + public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockback, ref bool crit) { player.Calamity().hellbornBoost = 600; damage *= 10; - player.ApplyDamageToNPC(target, (int)(Item.damage * (player.allDamage + player.GetDamage(DamageClass.Ranged) - 1f)), 0f, 0, false); + player.ApplyDamageToNPC(target, (int)(Item.damage * (player.GetDamage(DamageClass.Generic) + player.GetDamage(DamageClass.Ranged) - 1f)), 0f, 0, false); float num50 = 3.4f; float num51 = 1.6f; float num52 = 4f; diff --git a/Items/Weapons/Ranged/Helstorm.cs b/Items/Weapons/Ranged/Helstorm.cs index e2e2917122..d3d241e6b9 100644 --- a/Items/Weapons/Ranged/Helstorm.cs +++ b/Items/Weapons/Ranged/Helstorm.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; @@ -40,13 +41,13 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-5, 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) { for (int index = 0; index < 2; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + float SpeedX = velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Ranged/Impaler.cs b/Items/Weapons/Ranged/Impaler.cs index ebb34ff4cd..1940cc0cc0 100644 --- a/Items/Weapons/Ranged/Impaler.cs +++ b/Items/Weapons/Ranged/Impaler.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -38,21 +39,21 @@ namespace CalamityMod.Items.Weapons.Ranged } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 14; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 14; public override Vector2? HoldoutOffset() => new Vector2(0, -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) { - float SpeedX = speedX + (float)Main.rand.Next(-2, 3) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-2, 3) * 0.05f; + float SpeedX = velocity.X + (float)Main.rand.Next(-2, 3) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-2, 3) * 0.05f; if (Main.rand.NextBool(3)) { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); } else { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/Infinity.cs b/Items/Weapons/Ranged/Infinity.cs index 353c21516c..2b3d1405b3 100644 --- a/Items/Weapons/Ranged/Infinity.cs +++ b/Items/Weapons/Ranged/Infinity.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -53,16 +55,16 @@ namespace CalamityMod.Items.Weapons.Ranged 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) { if (player.altFunctionUse == 2) { //If you right click, shoots an helix of normal bullets - Vector2 num7 = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(rotation)); - Vector2 num8 = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(-rotation)); - int shot1 = Projectile.NewProjectile(position.X, position.Y, num7.X, num7.Y, type, damage, knockBack, player.whoAmI, 0f, 0f); + Vector2 num7 = velocity.RotatedBy(MathHelper.ToRadians(rotation)); + Vector2 num8 = velocity.RotatedBy(MathHelper.ToRadians(-rotation)); + int shot1 = Projectile.NewProjectile(source, position.X, position.Y, num7.X, num7.Y, type, damage, knockback, player.whoAmI, 0f, 0f); Main.projectile[shot1].timeLeft = 180; - int shot2 = Projectile.NewProjectile(position.X, position.Y, num8.X, num8.Y, type, damage, knockBack, player.whoAmI, 0f, 0f); + int shot2 = Projectile.NewProjectile(source, position.X, position.Y, num8.X, num8.Y, type, damage, knockback, player.whoAmI, 0f, 0f); Main.projectile[shot2].timeLeft = 180; //Code to constantly make the shooting go side to side to make the helix if (limit) @@ -86,11 +88,11 @@ namespace CalamityMod.Items.Weapons.Ranged else { //If left click, do the same as above but spawn Charged Blasts instead - Vector2 num7 = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(rotation)); - Vector2 num8 = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(-rotation)); - int shot1 = Projectile.NewProjectile(position.X, position.Y, num7.X, num7.Y, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Vector2 num7 = velocity.RotatedBy(MathHelper.ToRadians(rotation)); + Vector2 num8 = velocity.RotatedBy(MathHelper.ToRadians(-rotation)); + int shot1 = Projectile.NewProjectile(source, position.X, position.Y, num7.X, num7.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); Main.projectile[shot1].timeLeft = 180; - int shot2 = Projectile.NewProjectile(position.X, position.Y, num8.X, num8.Y, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + int shot2 = Projectile.NewProjectile(source, position.X, position.Y, num8.X, num8.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); Main.projectile[shot2].timeLeft = 180; if (limit) { diff --git a/Items/Weapons/Ranged/Interfacer.cs b/Items/Weapons/Ranged/Interfacer.cs index fb5459cd1e..794659cfc3 100644 --- a/Items/Weapons/Ranged/Interfacer.cs +++ b/Items/Weapons/Ranged/Interfacer.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -46,15 +47,15 @@ namespace CalamityMod.Items.Weapons.Ranged 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) { - Vector2 velocity = new Vector2(speedX, speedY); + int bulletAmt = 4; for (int index = 0; index < bulletAmt; ++index) { velocity.X += Main.rand.Next(-15, 16) * 0.05f; velocity.Y += Main.rand.Next(-15, 16) * 0.05f; - int proj = Projectile.NewProjectile(position, velocity, type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); Main.projectile[proj].extraUpdates += 2; } @@ -94,7 +95,7 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 velocity2 = Vector2.Normalize(Main.npc[targets[j]].Center - vector2) * Item.shootSpeed; - int proj = Projectile.NewProjectile(vector2, velocity2, type, extraBulletDamage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, vector2, velocity2, type, extraBulletDamage, knockback, player.whoAmI); Main.projectile[proj].extraUpdates += 2; Main.projectile[proj].tileCollide = false; Main.projectile[proj].timeLeft /= 2; @@ -105,7 +106,7 @@ namespace CalamityMod.Items.Weapons.Ranged velocity2 = Vector2.Normalize(Main.npc[targets[j]].Center - vector2) * Item.shootSpeed; - proj = Projectile.NewProjectile(vector2, velocity2, type, extraBulletDamage, knockBack, player.whoAmI); + proj = Projectile.NewProjectile(source, vector2, velocity2, type, extraBulletDamage, knockback, player.whoAmI); Main.projectile[proj].extraUpdates += 2; Main.projectile[proj].tileCollide = false; Main.projectile[proj].timeLeft /= 2; @@ -125,7 +126,7 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 velocity2 = Vector2.Normalize(Main.npc[targets[randomTarget]].Center - vector2) * Item.shootSpeed; - int proj = Projectile.NewProjectile(vector2, velocity2, type, extraBulletDamage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, vector2, velocity2, type, extraBulletDamage, knockback, player.whoAmI); Main.projectile[proj].extraUpdates += 2; Main.projectile[proj].tileCollide = false; Main.projectile[proj].timeLeft /= 2; @@ -136,7 +137,7 @@ namespace CalamityMod.Items.Weapons.Ranged velocity2 = Vector2.Normalize(Main.npc[targets[randomTarget]].Center - vector2) * Item.shootSpeed; - proj = Projectile.NewProjectile(vector2, velocity2, type, extraBulletDamage, knockBack, player.whoAmI); + proj = Projectile.NewProjectile(source, vector2, velocity2, type, extraBulletDamage, knockback, player.whoAmI); Main.projectile[proj].extraUpdates += 2; Main.projectile[proj].tileCollide = false; Main.projectile[proj].timeLeft /= 2; diff --git a/Items/Weapons/Ranged/Karasawa.cs b/Items/Weapons/Ranged/Karasawa.cs index 778e918668..0cb67169fa 100644 --- a/Items/Weapons/Ranged/Karasawa.cs +++ b/Items/Weapons/Ranged/Karasawa.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -45,15 +46,15 @@ namespace CalamityMod.Items.Weapons.Ranged return CalamityGlobalItem.HasEnoughAmmo(player, Item, 5); } - 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); + if (velocity.Length() > 5f) { velocity.Normalize(); velocity *= 5f; } - Projectile.NewProjectile(position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); // Consume 5 ammo per shot CalamityGlobalItem.ConsumeAdditionalAmmo(player, Item, 5); diff --git a/Items/Weapons/Ranged/Leviatitan.cs b/Items/Weapons/Ranged/Leviatitan.cs index 0d58c2b68b..f07623d0d8 100644 --- a/Items/Weapons/Ranged/Leviatitan.cs +++ b/Items/Weapons/Ranged/Leviatitan.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -40,20 +41,20 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-15, 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 SpeedX = speedX + Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + Main.rand.Next(-10, 11) * 0.05f; + float SpeedX = velocity.X + Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = velocity.Y + Main.rand.Next(-10, 11) * 0.05f; if (type == ProjectileID.Bullet) { if (Main.rand.NextBool(3)) - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 1.5), knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 1.5), knockback, player.whoAmI); else - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); } else - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/LunarianBow.cs b/Items/Weapons/Ranged/LunarianBow.cs index 73002136c7..d3bd98bdf6 100644 --- a/Items/Weapons/Ranged/LunarianBow.cs +++ b/Items/Weapons/Ranged/LunarianBow.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -37,12 +39,12 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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 source = player.RotatedRelativePoint(player.MountedCenter, true); float piOver10 = MathHelper.Pi * 0.1f; int projAmt = 2; - Vector2 velocity = new Vector2(speedX, speedY); + velocity.Normalize(); velocity *= 15f; bool canHit = Collision.CanHit(source, 0, 0, source + velocity, 0, 0); @@ -54,10 +56,10 @@ namespace CalamityMod.Items.Weapons.Ranged offset -= velocity; if (type == ProjectileID.WoodenArrowFriendly) - Projectile.NewProjectile(source + offset, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source + offset, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else { - int proj = Projectile.NewProjectile(source + offset, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source + offset, velocity, type, damage, knockback, player.whoAmI); Main.projectile[proj].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/MagnaStriker.cs b/Items/Weapons/Ranged/MagnaStriker.cs index 84474c6858..80f21ca436 100644 --- a/Items/Weapons/Ranged/MagnaStriker.cs +++ b/Items/Weapons/Ranged/MagnaStriker.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -42,16 +43,16 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-5, 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) { int randomProj = Main.rand.Next(2); if (randomProj == 0) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 0.75), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), (int)(damage * 0.75), knockback, player.whoAmI, 0f, 0f); } else { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Ranged/MagnomalyCannon.cs b/Items/Weapons/Ranged/MagnomalyCannon.cs index b204ede7e6..491dd5db4e 100644 --- a/Items/Weapons/Ranged/MagnomalyCannon.cs +++ b/Items/Weapons/Ranged/MagnomalyCannon.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Typeless; using CalamityMod.Projectiles.Ranged; @@ -45,9 +46,9 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-30, -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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); return false; } diff --git a/Items/Weapons/Ranged/Malevolence.cs b/Items/Weapons/Ranged/Malevolence.cs index aabdb5167c..0e675cd4b8 100644 --- a/Items/Weapons/Ranged/Malevolence.cs +++ b/Items/Weapons/Ranged/Malevolence.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -36,18 +37,18 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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) { for (int i = 0; i < 2; i++) { - float SpeedX = speedX + Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = speedY + Main.rand.Next(-20, 21) * 0.05f; + float SpeedX = velocity.X + Main.rand.Next(-20, 21) * 0.05f; + float SpeedY = velocity.Y + Main.rand.Next(-20, 21) * 0.05f; if (type == ProjectileID.WoodenArrowFriendly) - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else { - int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); Main.projectile[proj].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/MarksmanBow.cs b/Items/Weapons/Ranged/MarksmanBow.cs index 1dbb6e30aa..e7ce2240fe 100644 --- a/Items/Weapons/Ranged/MarksmanBow.cs +++ b/Items/Weapons/Ranged/MarksmanBow.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -38,11 +39,11 @@ namespace CalamityMod.Items.Weapons.Ranged } // 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 Vector2? HoldoutOffset() => new Vector2(-4, 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) { //Convert wooden arrows to Jester's Arrows if (type == ProjectileID.WoodenArrowFriendly) @@ -51,9 +52,9 @@ namespace CalamityMod.Items.Weapons.Ranged for (int i = 0; i < 3; i++) { int randomExtraUpdates = Main.rand.Next(3); - float SpeedX = speedX + Main.rand.NextFloat(-10f, 10f) * 0.05f; - float SpeedY = speedY + Main.rand.NextFloat(-10f, 10f) * 0.05f; - int arrow = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + float SpeedX = velocity.X + Main.rand.NextFloat(-10f, 10f) * 0.05f; + float SpeedY = velocity.Y + Main.rand.NextFloat(-10f, 10f) * 0.05f; + int arrow = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); Main.projectile[arrow].noDropItem = true; Main.projectile[arrow].extraUpdates += randomExtraUpdates; //0 to 2 extra updates if (type == ProjectileID.JestersArrow) diff --git a/Items/Weapons/Ranged/Megafleet.cs b/Items/Weapons/Ranged/Megafleet.cs index d50c3c42fa..b2187f9477 100644 --- a/Items/Weapons/Ranged/Megafleet.cs +++ b/Items/Weapons/Ranged/Megafleet.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -48,22 +49,22 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-10, 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 SpeedX = speedX + (float)Main.rand.Next(-5, 6) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-5, 6) * 0.05f; + float SpeedX = velocity.X + (float)Main.rand.Next(-5, 6) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-5, 6) * 0.05f; if (shotType > 2) shotType = 1; if (shotType == 1) - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0.0f, 0.0f); else - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); shotType++; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, (Main.rand.Next(-160, 160) * 0.001f), (Main.rand.Next(-160, 160) * 0.001f)); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI, (Main.rand.Next(-160, 160) * 0.001f), (Main.rand.Next(-160, 160) * 0.001f)); return false; } diff --git a/Items/Weapons/Ranged/Megalodon.cs b/Items/Weapons/Ranged/Megalodon.cs index 3d677c576d..0abb485d6d 100644 --- a/Items/Weapons/Ranged/Megalodon.cs +++ b/Items/Weapons/Ranged/Megalodon.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; @@ -45,18 +46,18 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-5, 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 SpeedX = speedX + Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + Main.rand.Next(-10, 11) * 0.05f; + float SpeedX = velocity.X + Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = velocity.Y + Main.rand.Next(-10, 11) * 0.05f; if (shotType > 2) shotType = 1; if (shotType == 1) - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0.0f, 0.0f); else - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); shotType++; diff --git a/Items/Weapons/Ranged/Meowthrower.cs b/Items/Weapons/Ranged/Meowthrower.cs index 256410dbed..8bbe7cecee 100644 --- a/Items/Weapons/Ranged/Meowthrower.cs +++ b/Items/Weapons/Ranged/Meowthrower.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -47,13 +48,13 @@ namespace CalamityMod.Items.Weapons.Ranged 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 num6 = Main.rand.Next(1, 3); for (int index = 0; index < num6; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; + float SpeedX = velocity.X + (float)Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-15, 16) * 0.05f; switch (Main.rand.Next(3)) { case 1: @@ -65,7 +66,7 @@ namespace CalamityMod.Items.Weapons.Ranged default: break; } - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0.0f, 0.0f); } return false; } diff --git a/Items/Weapons/Ranged/MineralMortar.cs b/Items/Weapons/Ranged/MineralMortar.cs index 5a6f840a04..50efbcb701 100644 --- a/Items/Weapons/Ranged/MineralMortar.cs +++ b/Items/Weapons/Ranged/MineralMortar.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -39,9 +40,9 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-10, 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); return false; } diff --git a/Items/Weapons/Ranged/Minigun.cs b/Items/Weapons/Ranged/Minigun.cs index 63eb9b05fb..839fda9424 100644 --- a/Items/Weapons/Ranged/Minigun.cs +++ b/Items/Weapons/Ranged/Minigun.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -42,11 +43,11 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-10, 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 SpeedX = speedX + Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + Main.rand.Next(-15, 16) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + float SpeedX = velocity.X + Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = velocity.Y + Main.rand.Next(-15, 16) * 0.05f; + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/MolecularManipulator.cs b/Items/Weapons/Ranged/MolecularManipulator.cs index 6c58b9e305..92f9ef3f7d 100644 --- a/Items/Weapons/Ranged/MolecularManipulator.cs +++ b/Items/Weapons/Ranged/MolecularManipulator.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -42,9 +43,9 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-5, 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/Monsoon.cs b/Items/Weapons/Ranged/Monsoon.cs index f8e1376126..11591f90b6 100644 --- a/Items/Weapons/Ranged/Monsoon.cs +++ b/Items/Weapons/Ranged/Monsoon.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Ranged; @@ -38,12 +39,12 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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 source = player.RotatedRelativePoint(player.MountedCenter); float piOver10 = MathHelper.Pi * 0.1f; int totalProjectiles = 5; - Vector2 velocity = new Vector2(speedX, speedY); + velocity.Normalize(); velocity *= 40f; bool canHit = Collision.CanHit(source, 0, 0, source + velocity, 0, 0); @@ -69,7 +70,7 @@ namespace CalamityMod.Items.Weapons.Ranged newType = ModContent.ProjectileType(); break; } - int proj = Projectile.NewProjectile(source.X + offset.X, source.Y + offset.Y, speedX, speedY, newType, (int)(damage * 1.1), knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source.X + offset.X, source.Y + offset.Y, velocity.X, velocity.Y, newType, (int)(damage * 1.1), knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].arrow = true; @@ -78,7 +79,7 @@ namespace CalamityMod.Items.Weapons.Ranged } else { - int proj = Projectile.NewProjectile(source.X + offset.X, source.Y + offset.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source.X + offset.X, source.Y + offset.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); Main.projectile[proj].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/Needler.cs b/Items/Weapons/Ranged/Needler.cs index b8e491e523..2a1fc2e0bb 100644 --- a/Items/Weapons/Ranged/Needler.cs +++ b/Items/Weapons/Ranged/Needler.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -39,12 +41,12 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-5, 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 (type == ProjectileID.Bullet) - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/NettlelineGreatbow.cs b/Items/Weapons/Ranged/NettlelineGreatbow.cs index 26429bdb35..644b031c32 100644 --- a/Items/Weapons/Ranged/NettlelineGreatbow.cs +++ b/Items/Weapons/Ranged/NettlelineGreatbow.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -37,12 +39,12 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num117 = 0.314159274f; int num118 = 4; - Vector2 vector7 = new Vector2(speedX, speedY); + Vector2 vector7 = velocity; vector7.Normalize(); vector7 *= 40f; bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); @@ -54,13 +56,13 @@ namespace CalamityMod.Items.Weapons.Ranged { value9 -= vector7; } - int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + int num121 = Projectile.NewProjectile(source, vector2.X + value9.X, vector2.Y + value9.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); Main.projectile[num121].noDropItem = true; } for (int i = 0; i < 2; i++) { - float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; + float SpeedX = velocity.X + (float)Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-40, 41) * 0.05f; switch (Main.rand.Next(2)) { case 0: @@ -72,7 +74,7 @@ namespace CalamityMod.Items.Weapons.Ranged default: break; } - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + int index = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); Main.projectile[index].noDropItem = true; } return false; diff --git a/Items/Weapons/Ranged/Norfleet.cs b/Items/Weapons/Ranged/Norfleet.cs index 3e2c009eed..c58c74efba 100644 --- a/Items/Weapons/Ranged/Norfleet.cs +++ b/Items/Weapons/Ranged/Norfleet.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -46,9 +47,9 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-10, 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), 0, 0f, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/NullificationRifle.cs b/Items/Weapons/Ranged/NullificationRifle.cs index 23aa9adff1..971d8db405 100644 --- a/Items/Weapons/Ranged/NullificationRifle.cs +++ b/Items/Weapons/Ranged/NullificationRifle.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -40,9 +41,9 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-5, 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/OnyxChainBlaster.cs b/Items/Weapons/Ranged/OnyxChainBlaster.cs index 00dae3bdc3..bf3758ff5f 100644 --- a/Items/Weapons/Ranged/OnyxChainBlaster.cs +++ b/Items/Weapons/Ranged/OnyxChainBlaster.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -40,22 +41,22 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-5, 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) { - Vector2 velocity = new Vector2(speedX, speedY); + // Fire the Onyx Shard that is characteristic of the Onyx Blaster // The shard deals 250% damage and double knockback int shardDamage = (int)(2.5f * damage); float shardKB = 2f * knockBack; Vector2 offset = new Vector2(Main.rand.Next(-25, 26) * 0.05f, Main.rand.Next(-25, 26) * 0.05f); - Projectile shard = Projectile.NewProjectileDirect(position, velocity + offset, ProjectileID.BlackBolt, shardDamage, shardKB, player.whoAmI, 0f, 0f); + Projectile shard = Projectile.NewProjectileDirect(source, position, velocity + offset, ProjectileID.BlackBolt, shardDamage, shardKB, player.whoAmI, 0f, 0f); shard.timeLeft = (int)(shard.timeLeft * 1.25f); for (int i = 0; i < 4; i++) { offset = new Vector2(Main.rand.Next(-45, 46) * 0.05f, Main.rand.Next(-45, 46) * 0.05f); - Projectile.NewProjectile(position, velocity + offset, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity + offset, type, damage, knockback, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Ranged/Onyxia.cs b/Items/Weapons/Ranged/Onyxia.cs index 279cb0b49d..f97805c674 100644 --- a/Items/Weapons/Ranged/Onyxia.cs +++ b/Items/Weapons/Ranged/Onyxia.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -44,15 +45,15 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-11, 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) { - Vector2 velocity = new Vector2(speedX, speedY); + // Fire the Onyx Shard that is characteristic of the Onyx Blaster // The shard deals 145% damage and double knockback int shardDamage = (int)(1.45f * damage); float shardKB = 2f * knockBack; - Projectile shard = Projectile.NewProjectileDirect(position, velocity, ProjectileID.BlackBolt, shardDamage, shardKB, player.whoAmI, 0f, 0f); + Projectile shard = Projectile.NewProjectileDirect(source, position, velocity, ProjectileID.BlackBolt, shardDamage, shardKB, player.whoAmI, 0f, 0f); shard.timeLeft = (int)(shard.timeLeft * 1.4f); // Fire three symmetric pairs of bullets alongside it @@ -62,8 +63,8 @@ namespace CalamityMod.Items.Weapons.Ranged float randVelMultiplier = Main.rand.NextFloat(0.92f, 1.08f); Vector2 ccwVelocity = velocity.RotatedBy(-randAngle) * randVelMultiplier; Vector2 cwVelocity = velocity.RotatedBy(randAngle) * randVelMultiplier; - Projectile.NewProjectile(position, ccwVelocity, type, damage, knockBack, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(position, cwVelocity, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, ccwVelocity, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, cwVelocity, type, damage, knockback, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Ranged/OpalStriker.cs b/Items/Weapons/Ranged/OpalStriker.cs index e782558d03..021058d6fe 100644 --- a/Items/Weapons/Ranged/OpalStriker.cs +++ b/Items/Weapons/Ranged/OpalStriker.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -38,9 +40,9 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-10, 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) { - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/OverloadedBlaster.cs b/Items/Weapons/Ranged/OverloadedBlaster.cs index 2410ee8692..4e604ca70f 100644 --- a/Items/Weapons/Ranged/OverloadedBlaster.cs +++ b/Items/Weapons/Ranged/OverloadedBlaster.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -47,13 +48,13 @@ namespace CalamityMod.Items.Weapons.Ranged 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) { for (int index = 0; index < 5; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + float SpeedX = velocity.X + (float)Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-40, 41) * 0.05f; + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Ranged/P90.cs b/Items/Weapons/Ranged/P90.cs index 25efb951fa..1b1b7fcae6 100644 --- a/Items/Weapons/Ranged/P90.cs +++ b/Items/Weapons/Ranged/P90.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -40,11 +41,11 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-14, -1); } - 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 SpeedX = speedX + Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + Main.rand.Next(-15, 16) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + float SpeedX = velocity.X + Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = velocity.Y + Main.rand.Next(-15, 16) * 0.05f; + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); return false; } diff --git a/Items/Weapons/Ranged/PaintballBlaster.cs b/Items/Weapons/Ranged/PaintballBlaster.cs index dd16a1e3de..2c75c6af1c 100644 --- a/Items/Weapons/Ranged/PaintballBlaster.cs +++ b/Items/Weapons/Ranged/PaintballBlaster.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Microsoft.Xna.Framework; using System; using Terraria; @@ -35,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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); @@ -63,7 +64,7 @@ namespace CalamityMod.Items.Weapons.Ranged { vector2 += new Vector2(num208, num209); } - Projectile.NewProjectile(position.X, position.Y - player.gravDir * 4f, num208, num209, ProjectileID.PainterPaintball, damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(12) / 6f); + Projectile.NewProjectile(source, position.X, position.Y - player.gravDir * 4f, num208, num209, ProjectileID.PainterPaintball, damage, knockback, player.whoAmI, 0f, (float)Main.rand.Next(12) / 6f); return false; } diff --git a/Items/Weapons/Ranged/PearlGod.cs b/Items/Weapons/Ranged/PearlGod.cs index f5182bf7be..40bd9f2aa3 100644 --- a/Items/Weapons/Ranged/PearlGod.cs +++ b/Items/Weapons/Ranged/PearlGod.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -46,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-5, 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 (spread > 6) { @@ -54,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Ranged finalShot = true; } - Vector2 velocity = new Vector2(speedX, speedY); + float rotation = MathHelper.ToRadians(spread); if (!finalShot) { @@ -76,13 +77,13 @@ namespace CalamityMod.Items.Weapons.Ranged for (int i = 0; i < totalLoops; i++) { - int proj = Projectile.NewProjectile(position, velocity.RotatedBy(-rotation * (i + 1)), type, (int)(damage * 0.5), knockBack * 0.5f, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity.RotatedBy(-rotation * (i + 1)), type, (int)(damage * 0.5), knockback * 0.5f, player.whoAmI); Main.projectile[proj].extraUpdates += spread; - int proj2 = Projectile.NewProjectile(position, velocity.RotatedBy(+rotation * (i + 1)), type, (int)(damage * 0.5), knockBack * 0.5f, player.whoAmI); + int proj2 = Projectile.NewProjectile(source, position, velocity.RotatedBy(+rotation * (i + 1)), type, (int)(damage * 0.5), knockback * 0.5f, player.whoAmI); Main.projectile[proj2].extraUpdates += spread; } - int proj3 = Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, spread); + int proj3 = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, spread); Main.projectile[proj3].extraUpdates += spread; spread++; @@ -91,7 +92,7 @@ namespace CalamityMod.Items.Weapons.Ranged { for (int i = 0; i < 3; i++) { - int proj = Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), damage * 2, knockBack * 2f, player.whoAmI, 0f, 10f); + int proj = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage * 2, knockback * 2f, player.whoAmI, 0f, 10f); Main.projectile[proj].extraUpdates += 9; } diff --git a/Items/Weapons/Ranged/PestilentDefiler.cs b/Items/Weapons/Ranged/PestilentDefiler.cs index 9194ed7674..1e8579f810 100644 --- a/Items/Weapons/Ranged/PestilentDefiler.cs +++ b/Items/Weapons/Ranged/PestilentDefiler.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -40,12 +41,12 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(0, -5); } - 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 (type == ProjectileID.Bullet) - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - 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/Ranged/Phangasm.cs b/Items/Weapons/Ranged/Phangasm.cs index 82b79768f9..0a1e25fd21 100644 --- a/Items/Weapons/Ranged/Phangasm.cs +++ b/Items/Weapons/Ranged/Phangasm.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -42,9 +43,9 @@ namespace CalamityMod.Items.Weapons.Ranged 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/Photoviscerator.cs b/Items/Weapons/Ranged/Photoviscerator.cs index 0f96a50b44..22afc01a5a 100644 --- a/Items/Weapons/Ranged/Photoviscerator.cs +++ b/Items/Weapons/Ranged/Photoviscerator.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -65,15 +66,15 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-15, 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) { // Alt fire: Shoot an Exo Flare Cluster. if (player.altFunctionUse == 2) { int projID = ModContent.ProjectileType(); - Vector2 velocity = new Vector2(speedX, speedY); + position += velocity.ToRotation().ToRotationVector2() * 80f; - Projectile.NewProjectile(position, velocity.SafeNormalize(Vector2.Zero) * AltFireShootSpeed, projID, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, velocity.SafeNormalize(Vector2.Zero) * AltFireShootSpeed, projID, damage, knockback, player.whoAmI); return false; } @@ -81,18 +82,18 @@ namespace CalamityMod.Items.Weapons.Ranged // Left click: Exo Fire, with a chance of Exo Light Bombs. for (int i = 0; i < 2; i++) { - Vector2 velocity = new Vector2(speedX, speedY).RotatedByRandom(0.05f) * Main.rand.NextFloat(0.97f, 1.03f); - Projectile.NewProjectile(position, velocity, type, damage, knockBack, player.whoAmI, 0f, 0f); + + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); } if (player.itemAnimation == 1) { for (int i = 0; i < 2; i++) { - Vector2 velocity = new Vector2(speedX, speedY) * 0.7f; + position += velocity.ToRotation().ToRotationVector2() * 64f; int yDirection = (i == 0).ToDirectionInt(); velocity = velocity.RotatedBy(0.2f * yDirection); - Projectile lightBomb = Projectile.NewProjectileDirect(position, velocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile lightBomb = Projectile.NewProjectileDirect(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); lightBomb.localAI[1] = yDirection; lightBomb.netUpdate = true; diff --git a/Items/Weapons/Ranged/PlanetaryAnnihilation.cs b/Items/Weapons/Ranged/PlanetaryAnnihilation.cs index 563cf8e53f..947d2b1adb 100644 --- a/Items/Weapons/Ranged/PlanetaryAnnihilation.cs +++ b/Items/Weapons/Ranged/PlanetaryAnnihilation.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -42,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-5, 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 num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); @@ -87,7 +88,7 @@ namespace CalamityMod.Items.Weapons.Ranged { float speedX4 = num78 + Main.rand.Next(-120, 121) * 0.02f; float speedY5 = num79 + Main.rand.Next(-120, 121) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, i); + Projectile.NewProjectile(source, vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, i); } } else @@ -96,7 +97,7 @@ namespace CalamityMod.Items.Weapons.Ranged { float speedX4 = num78 + Main.rand.Next(-120, 121) * 0.02f; float speedY5 = num79 + Main.rand.Next(-120, 121) * 0.02f; - int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI); + int num121 = Projectile.NewProjectile(source, vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockback, player.whoAmI); Main.projectile[num121].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/PrideHuntersPlanarRipper.cs b/Items/Weapons/Ranged/PrideHuntersPlanarRipper.cs index 72d9a1dd99..2da67d097c 100644 --- a/Items/Weapons/Ranged/PrideHuntersPlanarRipper.cs +++ b/Items/Weapons/Ranged/PrideHuntersPlanarRipper.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; @@ -51,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool ConsumeAmmo(Player player) => Main.rand.Next(0, 100) >= 33; - 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 using standard musket balls (or Silver Bullets actually), fire the special lightning bolts and have special properties. if (type == ProjectileID.Bullet) diff --git a/Items/Weapons/Ranged/PristineFury.cs b/Items/Weapons/Ranged/PristineFury.cs index 468254cb5d..62a2b1cde8 100644 --- a/Items/Weapons/Ranged/PristineFury.cs +++ b/Items/Weapons/Ranged/PristineFury.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -61,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Ranged return base.CanUseItem(player); } - 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) { @@ -69,15 +70,15 @@ namespace CalamityMod.Items.Weapons.Ranged damage = (int)(damage * 1.2); for (int index = 0; index < flameAmt; ++index) { - float SpeedX = speedX + Main.rand.NextFloat(-1.25f, 1.25f); - float SpeedY = speedY + Main.rand.NextFloat(-1.25f, 1.25f); - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 0.8f), knockBack, player.whoAmI); + float SpeedX = velocity.X + Main.rand.NextFloat(-1.25f, 1.25f); + float SpeedY = velocity.Y + Main.rand.NextFloat(-1.25f, 1.25f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 0.8f), knockback, player.whoAmI); } } else { damage = (int)(damage * 0.94); - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/ProporsePistol.cs b/Items/Weapons/Ranged/ProporsePistol.cs index 4286a239b1..c4d7c6a67a 100644 --- a/Items/Weapons/Ranged/ProporsePistol.cs +++ b/Items/Weapons/Ranged/ProporsePistol.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -34,9 +35,9 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/Pumpler.cs b/Items/Weapons/Ranged/Pumpler.cs index 1580ae8737..ef9196a3db 100644 --- a/Items/Weapons/Ranged/Pumpler.cs +++ b/Items/Weapons/Ranged/Pumpler.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -42,13 +44,13 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool CanUseItem(Player player) => player.ownedProjectileCounts[ModContent.ProjectileType()] <= 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) { - Vector2 shootVelocity = new Vector2(speedX, speedY); + Vector2 shootVelocity = velocity; Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); // Charge-up. Done via a holdout projectile. - Projectile.NewProjectile(position, shootDirection, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + Projectile.NewProjectile(source, position, shootDirection, ModContent.ProjectileType(), 0, 0f, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/RaidersGlory.cs b/Items/Weapons/Ranged/RaidersGlory.cs index a05722b9ed..7624615849 100644 --- a/Items/Weapons/Ranged/RaidersGlory.cs +++ b/Items/Weapons/Ranged/RaidersGlory.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -36,11 +37,11 @@ namespace CalamityMod.Items.Weapons.Ranged } // 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) { - int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.IchorArrow, damage, knockBack, player.whoAmI); + int projectile = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ProjectileID.IchorArrow, damage, knockback, player.whoAmI); Main.projectile[projectile].extraUpdates++; return false; } diff --git a/Items/Weapons/Ranged/RealmRavager.cs b/Items/Weapons/Ranged/RealmRavager.cs index f9ff21111c..117ea6a098 100644 --- a/Items/Weapons/Ranged/RealmRavager.cs +++ b/Items/Weapons/Ranged/RealmRavager.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -38,18 +39,18 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-10, 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) { int numBullets = Main.rand.NextBool() ? 4 : 3; for (int index = 0; index < numBullets; ++index) { - float SpeedX = speedX + Main.rand.Next(-75, 76) * 0.05f; - float SpeedY = speedY + Main.rand.Next(-75, 76) * 0.05f; + float SpeedX = velocity.X + Main.rand.Next(-75, 76) * 0.05f; + float SpeedY = velocity.Y + Main.rand.Next(-75, 76) * 0.05f; if (type == ProjectileID.Bullet) - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/RubicoPrime.cs b/Items/Weapons/Ranged/RubicoPrime.cs index af102d6b4d..3a19a25e3e 100644 --- a/Items/Weapons/Ranged/RubicoPrime.cs +++ b/Items/Weapons/Ranged/RubicoPrime.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -42,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Ranged } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 40; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 40; public override Vector2? HoldoutOffset() => new Vector2(-10, 0); @@ -51,9 +52,9 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 8).AddIngredient(ModContent.ItemType(), 20).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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); return false; } } diff --git a/Items/Weapons/Ranged/SDFMG.cs b/Items/Weapons/Ranged/SDFMG.cs index 9cf1241047..b21d21c460 100644 --- a/Items/Weapons/Ranged/SDFMG.cs +++ b/Items/Weapons/Ranged/SDFMG.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Ranged; @@ -41,19 +42,19 @@ namespace CalamityMod.Items.Weapons.Ranged } // 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 Vector2? HoldoutOffset() => new Vector2(-10, 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 SpeedX = speedX + Main.rand.Next(-5, 6) * 0.05f; - float SpeedY = speedY + Main.rand.Next(-5, 6) * 0.05f; + float SpeedX = velocity.X + Main.rand.Next(-5, 6) * 0.05f; + float SpeedY = velocity.Y + Main.rand.Next(-5, 6) * 0.05f; if (Main.rand.NextBool(5)) { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); } - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/SandstormGun.cs b/Items/Weapons/Ranged/SandstormGun.cs index 0458b8314a..6cd46583c5 100644 --- a/Items/Weapons/Ranged/SandstormGun.cs +++ b/Items/Weapons/Ranged/SandstormGun.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -49,9 +50,9 @@ namespace CalamityMod.Items.Weapons.Ranged 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/ScorchedEarth.cs b/Items/Weapons/Ranged/ScorchedEarth.cs index d428381954..e6d49df49d 100644 --- a/Items/Weapons/Ranged/ScorchedEarth.cs +++ b/Items/Weapons/Ranged/ScorchedEarth.cs @@ -1,4 +1,6 @@ -using CalamityMod.Items.Materials; +using Terraria.DataStructures; +using Terraria.DataStructures; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -47,9 +49,9 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-30, 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) { - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (counter == 0) { diff --git a/Items/Weapons/Ranged/Scorpion.cs b/Items/Weapons/Ranged/Scorpion.cs index 2355b7a680..81f0022592 100644 --- a/Items/Weapons/Ranged/Scorpion.cs +++ b/Items/Weapons/Ranged/Scorpion.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -59,16 +60,16 @@ namespace CalamityMod.Items.Weapons.Ranged return 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) { if (player.altFunctionUse == 2) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 1.25), knockBack * 2f, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), (int)(damage * 1.25), knockback * 2f, player.whoAmI); return false; } else { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/Seabow.cs b/Items/Weapons/Ranged/Seabow.cs index 3d0e9b7d03..21595d1e5a 100644 --- a/Items/Weapons/Ranged/Seabow.cs +++ b/Items/Weapons/Ranged/Seabow.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -36,11 +37,11 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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 SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX * 0.5f, SpeedY * 0.5f, ModContent.ProjectileType(), (int)(damage * 0.4), 0f, player.whoAmI); + float SpeedX = velocity.X + (float)Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-30, 31) * 0.05f; + Projectile.NewProjectile(source, position.X, position.Y, SpeedX * 0.5f, SpeedY * 0.5f, ModContent.ProjectileType(), (int)(damage * 0.4), 0f, player.whoAmI); return true; } diff --git a/Items/Weapons/Ranged/Seadragon.cs b/Items/Weapons/Ranged/Seadragon.cs index 61e9f2bda7..fee5d47178 100644 --- a/Items/Weapons/Ranged/Seadragon.cs +++ b/Items/Weapons/Ranged/Seadragon.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Ranged; @@ -48,10 +49,10 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-10, 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 SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; + float SpeedX = velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; if (shotType > 17) { @@ -62,15 +63,15 @@ namespace CalamityMod.Items.Weapons.Ranged if (!rocket) { if (shotType % 2 == 1) - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0.0f, 0.0f); else - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); shotType++; } else { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 5), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 5), knockback, player.whoAmI, 0f, 0f); rocket = false; } diff --git a/Items/Weapons/Ranged/SeasSearing.cs b/Items/Weapons/Ranged/SeasSearing.cs index 6a0d73c368..10ab0d6389 100644 --- a/Items/Weapons/Ranged/SeasSearing.cs +++ b/Items/Weapons/Ranged/SeasSearing.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -65,15 +66,15 @@ namespace CalamityMod.Items.Weapons.Ranged return base.CanUseItem(player); } - 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 1.22f), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), (int)(damage * 1.22f), knockback, player.whoAmI, 0f, 0f); } else { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 1f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 1f, 0f); } return false; } diff --git a/Items/Weapons/Ranged/Shellshooter.cs b/Items/Weapons/Ranged/Shellshooter.cs index bf84aa898a..22d7a98404 100644 --- a/Items/Weapons/Ranged/Shellshooter.cs +++ b/Items/Weapons/Ranged/Shellshooter.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -36,14 +37,14 @@ namespace CalamityMod.Items.Weapons.Ranged } // 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 (type == ProjectileID.WoodenArrowFriendly) - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - 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/Ranged/Shredder.cs b/Items/Weapons/Ranged/Shredder.cs index d636b9380d..09ccbfed1a 100644 --- a/Items/Weapons/Ranged/Shredder.cs +++ b/Items/Weapons/Ranged/Shredder.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -43,16 +44,16 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool AltFunctionUse(Player player) => 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 bulletAmt = 4; if (player.altFunctionUse == 2) { for (int index = 0; index < bulletAmt; ++index) { - float SpeedX = speedX + Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + Main.rand.Next(-30, 31) * 0.05f; - int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + float SpeedX = velocity.X + Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = velocity.Y + Main.rand.Next(-30, 31) * 0.05f; + int shot = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); Main.projectile[shot].timeLeft = 180; } return false; @@ -61,10 +62,10 @@ namespace CalamityMod.Items.Weapons.Ranged { for (int index = 0; index < bulletAmt; ++index) { - float SpeedX = speedX + Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + Main.rand.Next(-30, 31) * 0.05f; + float SpeedX = velocity.X + Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = velocity.Y + Main.rand.Next(-30, 31) * 0.05f; int shredderBoltDamage = (int)(0.85f * damage); - int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), shredderBoltDamage, knockBack, player.whoAmI, 0f, 0f); + int shot = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), shredderBoltDamage, knockback, player.whoAmI, 0f, 0f); Main.projectile[shot].timeLeft = 180; } return false; diff --git a/Items/Weapons/Ranged/Shroomer.cs b/Items/Weapons/Ranged/Shroomer.cs index 4d678db918..9d9216418e 100644 --- a/Items/Weapons/Ranged/Shroomer.cs +++ b/Items/Weapons/Ranged/Shroomer.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -36,13 +38,13 @@ namespace CalamityMod.Items.Weapons.Ranged } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 35; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 35; public override Vector2? HoldoutOffset() => new Vector2(-25, 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) { - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), (int)(damage * 0.5), knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), (int)(damage * 0.5), knockback, player.whoAmI); return true; } diff --git a/Items/Weapons/Ranged/SlagMagnum.cs b/Items/Weapons/Ranged/SlagMagnum.cs index 009d37a0dd..ae2a0767be 100644 --- a/Items/Weapons/Ranged/SlagMagnum.cs +++ b/Items/Weapons/Ranged/SlagMagnum.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -40,12 +41,12 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-10, 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 (type == ProjectileID.Bullet) - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - 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/Ranged/SomaPrime.cs b/Items/Weapons/Ranged/SomaPrime.cs index 99821949dd..6facb89fcd 100644 --- a/Items/Weapons/Ranged/SomaPrime.cs +++ b/Items/Weapons/Ranged/SomaPrime.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -46,7 +48,7 @@ Replaces standard bullets with High Velocity Bullets } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 30; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 30; public override Vector2? HoldoutOffset() => new Vector2(-25, 0); @@ -55,17 +57,17 @@ Replaces standard bullets with High Velocity Bullets CreateRecipe(1).AddIngredient(ModContent.ItemType()).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) { if (type == ProjectileID.Bullet) { type = ProjectileID.BulletHighVelocity; damage += 4; // in 1.4, HVBs deal 11 damage and Musket Balls deal 7 } - speedX += Main.rand.NextFloat(-XYInaccuracy, XYInaccuracy); - speedY += Main.rand.NextFloat(-XYInaccuracy, XYInaccuracy); - Vector2 vel = new Vector2(speedX, speedY); - Projectile shot = Projectile.NewProjectileDirect(position, vel, type, damage, knockBack, player.whoAmI); + velocity.X += Main.rand.NextFloat(-XYInaccuracy, XYInaccuracy); + velocity.Y += Main.rand.NextFloat(-XYInaccuracy, XYInaccuracy); + Vector2 vel = velocity; + Projectile shot = Projectile.NewProjectileDirect(source, position, vel, type, damage, knockback, player.whoAmI); CalamityGlobalProjectile cgp = shot.Calamity(); cgp.canSupercrit = true; cgp.appliesSomaShred = true; diff --git a/Items/Weapons/Ranged/SpectralstormCannon.cs b/Items/Weapons/Ranged/SpectralstormCannon.cs index 1c56c2ed5a..e54b544fd3 100644 --- a/Items/Weapons/Ranged/SpectralstormCannon.cs +++ b/Items/Weapons/Ranged/SpectralstormCannon.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Terraria; using Terraria.ID; @@ -45,20 +46,20 @@ namespace CalamityMod.Items.Weapons.Ranged 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) { - float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; - int flare = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + float SpeedX = velocity.X + (float)Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-40, 41) * 0.05f; + int flare = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); if (flare.WithinBounds(Main.maxProjectiles)) { Main.projectile[flare].timeLeft = 200; Main.projectile[flare].Calamity().forceRanged = true; } - float SpeedX2 = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; - float SpeedY2 = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; - int soul = Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 2f, 0f); + float SpeedX2 = velocity.X + (float)Main.rand.Next(-20, 21) * 0.05f; + float SpeedY2 = velocity.Y + (float)Main.rand.Next(-20, 21) * 0.05f; + int soul = Projectile.NewProjectile(source, position.X, position.Y, SpeedX2, SpeedY2, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 2f, 0f); if (soul.WithinBounds(Main.maxProjectiles)) { Main.projectile[soul].timeLeft = 600; diff --git a/Items/Weapons/Ranged/SpectreRifle.cs b/Items/Weapons/Ranged/SpectreRifle.cs index 7c42341872..1ae814ccf2 100644 --- a/Items/Weapons/Ranged/SpectreRifle.cs +++ b/Items/Weapons/Ranged/SpectreRifle.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -36,20 +37,20 @@ namespace CalamityMod.Items.Weapons.Ranged } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 22; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 22; public override Vector2? HoldoutOffset() => new Vector2(-10, 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 (type == ProjectileID.Bullet) { - int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.LostSoulFriendly, damage, knockBack, player.whoAmI, 2f, 0f); + int proj = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ProjectileID.LostSoulFriendly, damage, knockback, player.whoAmI, 2f, 0f); Main.projectile[proj].Calamity().forceRanged = true; Main.projectile[proj].extraUpdates += 2; } else - 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/Ranged/Spyker.cs b/Items/Weapons/Ranged/Spyker.cs index 53bdf86e07..2059873068 100644 --- a/Items/Weapons/Ranged/Spyker.cs +++ b/Items/Weapons/Ranged/Spyker.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -41,12 +43,12 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-5, 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 (type == ProjectileID.Bullet) - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/StarCannonEX.cs b/Items/Weapons/Ranged/StarCannonEX.cs index 9c48ba82db..4802a4da55 100644 --- a/Items/Weapons/Ranged/StarCannonEX.cs +++ b/Items/Weapons/Ranged/StarCannonEX.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Potions; using CalamityMod.Projectiles.Ranged; @@ -39,20 +40,20 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-5, 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) { int num6 = Main.rand.Next(1, 3); for (int index = 0; index < num6; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; + float SpeedX = velocity.X + (float)Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-15, 16) * 0.05f; type = Utils.SelectRandom(Main.rand, new int[] { ModContent.ProjectileType(), ProjectileID.Starfury, ModContent.ProjectileType() }); - int star = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + int star = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); if (star.WithinBounds(Main.maxProjectiles)) Main.projectile[star].Calamity().forceRanged = true; } diff --git a/Items/Weapons/Ranged/StarSputter.cs b/Items/Weapons/Ranged/StarSputter.cs index 6951dc0e30..576a35bc0b 100644 --- a/Items/Weapons/Ranged/StarSputter.cs +++ b/Items/Weapons/Ranged/StarSputter.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -51,12 +52,12 @@ namespace CalamityMod.Items.Weapons.Ranged 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) { counter++; if (counter == 10) { - Projectile.NewProjectile(position.X, position.Y, speedX * 0.8f, speedY * 0.8f, ModContent.ProjectileType(), (int)(damage * 1.5f), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X * 0.8f, velocity.Y * 0.8f, ModContent.ProjectileType(), (int)(damage * 1.5f), knockback, player.whoAmI, 0f, 0f); } if (counter >= 12) counter = 0; diff --git a/Items/Weapons/Ranged/Starfleet.cs b/Items/Weapons/Ranged/Starfleet.cs index 10b4939f04..58c88753d1 100644 --- a/Items/Weapons/Ranged/Starfleet.cs +++ b/Items/Weapons/Ranged/Starfleet.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -39,13 +40,13 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-8, -11); } - 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) { for (int index = 0; index < 5; ++index) { - float SpeedX = speedX + Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + float SpeedX = velocity.X + Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = velocity.Y + Main.rand.Next(-40, 41) * 0.05f; + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0.0f, 0.0f); } return false; } diff --git a/Items/Weapons/Ranged/StarfleetMK2.cs b/Items/Weapons/Ranged/StarfleetMK2.cs index 09a582a1a5..12a7a49ec8 100644 --- a/Items/Weapons/Ranged/StarfleetMK2.cs +++ b/Items/Weapons/Ranged/StarfleetMK2.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Ranged; @@ -49,9 +50,9 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-10, 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), 0, 0f, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/StormDragoon.cs b/Items/Weapons/Ranged/StormDragoon.cs index 5aa7087c7b..4e4f9fc705 100644 --- a/Items/Weapons/Ranged/StormDragoon.cs +++ b/Items/Weapons/Ranged/StormDragoon.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -42,11 +43,11 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-25, 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 SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + float SpeedX = velocity.X + (float)Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-40, 41) * 0.05f; + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); return false; } diff --git a/Items/Weapons/Ranged/SurgeDriver.cs b/Items/Weapons/Ranged/SurgeDriver.cs index 609337cd52..80fab35c2f 100644 --- a/Items/Weapons/Ranged/SurgeDriver.cs +++ b/Items/Weapons/Ranged/SurgeDriver.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -61,9 +63,9 @@ namespace CalamityMod.Items.Weapons.Ranged public override float UseTimeMultiplier(Player player) => player.Calamity().mouseRight ? 5f : 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) { - Vector2 shootVelocity = new Vector2(speedX, speedY); + Vector2 shootVelocity = velocity; Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); Vector2 gunTip = position + shootDirection * Item.scale * 126f; gunTip.Y -= 6f; @@ -75,13 +77,13 @@ namespace CalamityMod.Items.Weapons.Ranged { Vector2 newShootVelocity = shootVelocity * Main.rand.NextFloat(1f, 1.45f); newShootVelocity = newShootVelocity.RotatedByRandom(0.15f); - Projectile.NewProjectile(gunTip, newShootVelocity, Item.shoot, (int)(damage * 1.08), knockBack, player.whoAmI); + Projectile.NewProjectile(source, gunTip, newShootVelocity, Item.shoot, (int)(damage * 1.08), knockback, player.whoAmI); } } // Snipe blast. Done via a held projectile. else - Projectile.NewProjectile(gunTip, shootVelocity, ModContent.ProjectileType(), 0, knockBack, player.whoAmI); + Projectile.NewProjectile(source, gunTip, shootVelocity, ModContent.ProjectileType(), 0, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/Svantechnical.cs b/Items/Weapons/Ranged/Svantechnical.cs index 406fc5936c..d822030f86 100644 --- a/Items/Weapons/Ranged/Svantechnical.cs +++ b/Items/Weapons/Ranged/Svantechnical.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -53,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Ranged 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 i = Main.myPlayer; float sSpeed = Item.shootSpeed; @@ -85,13 +86,13 @@ namespace CalamityMod.Items.Weapons.Ranged { vector2 += new Vector2(num208, num209); } - Projectile.NewProjectile(position.X, position.Y - player.gravDir * 4f, num208, num209, type, damage, knockback, i, 0f, (float)Main.rand.Next(12) / 6f); + Projectile.NewProjectile(source, position.X, position.Y - player.gravDir * 4f, num208, num209, type, damage, knockback, i, 0f, (float)Main.rand.Next(12) / 6f); int num6 = Main.rand.Next(2, 4); for (int index = 0; index < num6; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-60, 61) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-60, 61) * 0.05f; - Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); + float SpeedX = velocity.X + (float)Main.rand.Next(-60, 61) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-60, 61) * 0.05f; + Projectile.NewProjectile(source, vector2.X, vector2.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Ranged/TelluricGlare.cs b/Items/Weapons/Ranged/TelluricGlare.cs index 6f80b794bf..c27ff9193a 100644 --- a/Items/Weapons/Ranged/TelluricGlare.cs +++ b/Items/Weapons/Ranged/TelluricGlare.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -41,14 +42,14 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-14f, 0f); - 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) { // Always fires Radiant Arrows regardless of ammo used type = Item.shoot; // The arrow appears from a random location "on the bow". // They are also moved backwards so that they have some time to build up past positions. This helps make them not appear out of thin air. - Vector2 velocity = new Vector2(speedX, speedY); + Vector2 offset = Vector2.Normalize(velocity.RotatedBy(MathHelper.PiOver2)); position += offset * Main.rand.NextFloat(-19f, 19f); position -= 3f * velocity; diff --git a/Items/Weapons/Ranged/TheBallista.cs b/Items/Weapons/Ranged/TheBallista.cs index 04bdb94fe3..f934f09fbd 100644 --- a/Items/Weapons/Ranged/TheBallista.cs +++ b/Items/Weapons/Ranged/TheBallista.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -35,12 +37,12 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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 (type == ProjectileID.WoodenArrowFriendly) - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/TheHive.cs b/Items/Weapons/Ranged/TheHive.cs index 3a84e42d28..2f209a6870 100644 --- a/Items/Weapons/Ranged/TheHive.cs +++ b/Items/Weapons/Ranged/TheHive.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-10, 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) { int rocket = Utils.SelectRandom(Main.rand, new int[] { @@ -46,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Ranged ModContent.ProjectileType(), ModContent.ProjectileType() }); - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, rocket, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, rocket, damage, knockback, player.whoAmI, 0f, 0f); return false; } } diff --git a/Items/Weapons/Ranged/TheJailor.cs b/Items/Weapons/Ranged/TheJailor.cs index c40de0b7a2..fae02963a4 100644 --- a/Items/Weapons/Ranged/TheJailor.cs +++ b/Items/Weapons/Ranged/TheJailor.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -36,13 +38,13 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-40f, -16f); - 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 shootVelocity = new Vector2(speedX, speedY); + Vector2 shootVelocity = velocity; Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); Vector2 gunTip = position + shootDirection * Item.scale * 45f; - Projectile.NewProjectile(gunTip, shootVelocity, Item.shoot, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, gunTip, shootVelocity, Item.shoot, damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/TheMaelstrom.cs b/Items/Weapons/Ranged/TheMaelstrom.cs index e12b479172..afa999eecd 100644 --- a/Items/Weapons/Ranged/TheMaelstrom.cs +++ b/Items/Weapons/Ranged/TheMaelstrom.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Ranged; @@ -39,9 +41,9 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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) { - Projectile.NewProjectile(position, new Vector2(speedX, speedY).SafeNormalize(Vector2.UnitX * player.direction), ModContent.ProjectileType(), 0, 0f, player.whoAmI); + Projectile.NewProjectile(source, position, velocity.SafeNormalize(Vector2.UnitX * player.direction), ModContent.ProjectileType(), 0, 0f, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/ThePack.cs b/Items/Weapons/Ranged/ThePack.cs index ebfa542ab2..c09d97ed47 100644 --- a/Items/Weapons/Ranged/ThePack.cs +++ b/Items/Weapons/Ranged/ThePack.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -39,13 +40,13 @@ namespace CalamityMod.Items.Weapons.Ranged } // 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 Vector2? HoldoutOffset() => new Vector2(-40, 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/TheStorm.cs b/Items/Weapons/Ranged/TheStorm.cs index 73c293ff52..793e842d24 100644 --- a/Items/Weapons/Ranged/TheStorm.cs +++ b/Items/Weapons/Ranged/TheStorm.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using System; @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAmmo = AmmoID.Arrow; } - 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 i = Main.myPlayer; float num72 = Main.rand.Next(25, 30); @@ -87,17 +88,17 @@ namespace CalamityMod.Items.Weapons.Ranged float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.01f; if (type == ProjectileID.WoodenArrowFriendly) { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, ModContent.ProjectileType(), damage, num74, i); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, ModContent.ProjectileType(), damage, num74, i); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.7f, ModContent.ProjectileType(), damage, num74, i); + Projectile.NewProjectile(source, vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, ModContent.ProjectileType(), damage, num74, i); + Projectile.NewProjectile(source, vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, ModContent.ProjectileType(), damage, num74, i); + Projectile.NewProjectile(source, vector2.X, vector2.Y, speedX4, speedY5 * 0.7f, ModContent.ProjectileType(), damage, num74, i); } else { - int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, type, damage, num74, i); + int num121 = Projectile.NewProjectile(source, vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, type, damage, num74, i); Main.projectile[num121].noDropItem = true; - int num122 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, type, damage, num74, i); + int num122 = Projectile.NewProjectile(source, vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, type, damage, num74, i); Main.projectile[num122].noDropItem = true; - int num123 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.7f, type, damage, num74, i); + int num123 = Projectile.NewProjectile(source, vector2.X, vector2.Y, speedX4, speedY5 * 0.7f, type, damage, num74, i); Main.projectile[num123].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/TitaniumRailgun.cs b/Items/Weapons/Ranged/TitaniumRailgun.cs index 087270b42c..242d41a429 100644 --- a/Items/Weapons/Ranged/TitaniumRailgun.cs +++ b/Items/Weapons/Ranged/TitaniumRailgun.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -38,11 +39,11 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-5, 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) { - Vector2 velocity = Vector2.Normalize(new Vector2(speedX, speedY)); + velocity *= Item.shootSpeed; - Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/Toxibow.cs b/Items/Weapons/Ranged/Toxibow.cs index b00804c3c0..debed7f0df 100644 --- a/Items/Weapons/Ranged/Toxibow.cs +++ b/Items/Weapons/Ranged/Toxibow.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Ranged; @@ -36,12 +38,12 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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 (type == ProjectileID.WoodenArrowFriendly) - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, 0f, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, 0f, player.whoAmI); else - Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/Triploon.cs b/Items/Weapons/Ranged/Triploon.cs index 68c2eaa5b1..b95bc53238 100644 --- a/Items/Weapons/Ranged/Triploon.cs +++ b/Items/Weapons/Ranged/Triploon.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Ranged; @@ -41,12 +42,12 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-10, 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) { Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true); float piOverTen = MathHelper.Pi * 0.1f; int projCount = 3; - Vector2 velocity = new Vector2(speedX, speedY); + velocity.Normalize(); velocity *= 30f; bool canHit = Collision.CanHit(source, 0, 0, source + velocity, 0, 0); @@ -58,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Ranged { offset -= velocity; } - Projectile.NewProjectile(source.X + offset.X, source.Y + offset.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source.X + offset.X, source.Y + offset.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Ranged/TrueConferenceCall.cs b/Items/Weapons/Ranged/TrueConferenceCall.cs index 5c56f5432f..2a9715cbc1 100644 --- a/Items/Weapons/Ranged/TrueConferenceCall.cs +++ b/Items/Weapons/Ranged/TrueConferenceCall.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -46,15 +47,15 @@ namespace CalamityMod.Items.Weapons.Ranged 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) { - Vector2 velocity = new Vector2(speedX, speedY); + int bulletAmt = 4; for (int index = 0; index < bulletAmt; ++index) { velocity.X += Main.rand.Next(-15, 16) * 0.05f; velocity.Y += Main.rand.Next(-15, 16) * 0.05f; - int proj = Projectile.NewProjectile(position, velocity, type, damage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); Main.projectile[proj].extraUpdates += 2; } @@ -94,7 +95,7 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 velocity2 = Vector2.Normalize(Main.npc[targets[j]].Center - vector2) * Item.shootSpeed; - int proj = Projectile.NewProjectile(vector2, velocity2, type, extraBulletDamage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, vector2, velocity2, type, extraBulletDamage, knockback, player.whoAmI); Main.projectile[proj].extraUpdates += 2; Main.projectile[proj].tileCollide = false; Main.projectile[proj].timeLeft /= 2; @@ -114,7 +115,7 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 velocity2 = Vector2.Normalize(Main.npc[targets[randomTarget]].Center - vector2) * Item.shootSpeed; - int proj = Projectile.NewProjectile(vector2, velocity2, type, extraBulletDamage, knockBack, player.whoAmI); + int proj = Projectile.NewProjectile(source, vector2, velocity2, type, extraBulletDamage, knockback, player.whoAmI); Main.projectile[proj].extraUpdates += 2; Main.projectile[proj].tileCollide = false; Main.projectile[proj].timeLeft /= 2; diff --git a/Items/Weapons/Ranged/TyrannysEnd.cs b/Items/Weapons/Ranged/TyrannysEnd.cs index 15ca59fd4d..803e2d54ac 100644 --- a/Items/Weapons/Ranged/TyrannysEnd.cs +++ b/Items/Weapons/Ranged/TyrannysEnd.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -43,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Ranged } // Terraria seems to really dislike high crit values in SetDefaults - public override void GetWeaponCrit(Player player, ref int crit) => crit += 35; + public override void ModifyWeaponCrit(Player player, ref int crit) => crit += 35; public override Vector2? HoldoutOffset() => new Vector2(-10, 0); @@ -52,9 +54,9 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(1).AddIngredient(ModContent.ItemType()).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) { - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); return false; } } diff --git a/Items/Weapons/Ranged/Ultima.cs b/Items/Weapons/Ranged/Ultima.cs index 223ccd272a..4482629d06 100644 --- a/Items/Weapons/Ranged/Ultima.cs +++ b/Items/Weapons/Ranged/Ultima.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Ranged; @@ -46,9 +48,9 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = 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) { - Projectile.NewProjectile(position, new Vector2(speedX, speedY).SafeNormalize(Vector2.UnitX * player.direction), ModContent.ProjectileType(), 0, 0f, player.whoAmI); + Projectile.NewProjectile(source, position, velocity.SafeNormalize(Vector2.UnitX * player.direction), ModContent.ProjectileType(), 0, 0f, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/UniversalGenesis.cs b/Items/Weapons/Ranged/UniversalGenesis.cs index 4874f7763c..02f47caa81 100644 --- a/Items/Weapons/Ranged/UniversalGenesis.cs +++ b/Items/Weapons/Ranged/UniversalGenesis.cs @@ -1,3 +1,5 @@ +using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; @@ -46,9 +48,9 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-50f, -8f); - 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 shootVelocity = new Vector2(speedX, speedY); + Vector2 shootVelocity = velocity; Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); Vector2 gunTip = position + shootDirection * Item.scale * 100f; gunTip.Y -= 10f; @@ -58,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Ranged for (float i = -tightness * 5f; i <= tightness * 5f; i += tightness * 2f) { Vector2 perturbedSpeed = shootVelocity.RotatedBy(MathHelper.ToRadians(i)); - Projectile.NewProjectile(gunTip, perturbedSpeed, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, gunTip, perturbedSpeed, type, damage, knockback, player.whoAmI); } // Stars from above @@ -87,7 +89,7 @@ namespace CalamityMod.Items.Weapons.Ranged yDist *= travelDist; float xVel = xDist + Main.rand.NextFloat(-0.6f, 0.6f); float yVel = yDist + Main.rand.NextFloat(-0.6f, 0.6f); - int star = Projectile.NewProjectile(spawnPos.X, spawnPos.Y, xVel, yVel, ModContent.ProjectileType(), starDmg, knockBack, player.whoAmI, i, 1f); + int star = Projectile.NewProjectile(source, spawnPos.X, spawnPos.Y, xVel, yVel, ModContent.ProjectileType(), starDmg, knockback, player.whoAmI, i, 1f); Main.projectile[star].extraUpdates = 2; Main.projectile[star].localNPCHitCooldown = 30; } diff --git a/Items/Weapons/Ranged/Vortexpopper.cs b/Items/Weapons/Ranged/Vortexpopper.cs index 1b1d01a7f3..c6909b0daa 100644 --- a/Items/Weapons/Ranged/Vortexpopper.cs +++ b/Items/Weapons/Ranged/Vortexpopper.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Microsoft.Xna.Framework; using System; using Terraria; @@ -39,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-5, 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 num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); @@ -72,7 +73,7 @@ namespace CalamityMod.Items.Weapons.Ranged { float scaleFactor2 = (float)Main.rand.NextDouble() * 0.2f + 0.05f; Vector2 vector6 = new Vector2(num78, num79).RotatedBy((double)(num96 * (float)Main.rand.NextDouble() - num96 / 2f), default) * scaleFactor2; - int num99 = Projectile.NewProjectile(position.X, position.Y, vector6.X, vector6.Y, ProjectileID.Xenopopper, damage, knockBack, player.whoAmI, ai, 0f); + int num99 = Projectile.NewProjectile(source, position.X, position.Y, vector6.X, vector6.Y, ProjectileID.Xenopopper, damage, knockback, player.whoAmI, ai, 0f); Main.projectile[num99].localAI[0] = (float)type; Main.projectile[num99].localAI[1] = 12f; } @@ -97,7 +98,7 @@ namespace CalamityMod.Items.Weapons.Ranged num79 *= num80; float speedX4 = num78 + (float)Main.rand.Next(-1000, 1001) * 0.02f; float speedY5 = num79 + (float)Main.rand.Next(-1000, 1001) * 0.02f; - int projectile = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ProjectileID.Xenopopper, damage, knockBack, player.whoAmI, ai, 0f); + int projectile = Projectile.NewProjectile(source, vector2.X, vector2.Y, speedX4, speedY5, ProjectileID.Xenopopper, damage, knockback, player.whoAmI, ai, 0f); Main.projectile[projectile].localAI[0] = (float)type; Main.projectile[projectile].localAI[1] = 12f; } 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; } diff --git a/Items/Weapons/Summon/AbandonedSlimeStaff.cs b/Items/Weapons/Summon/AbandonedSlimeStaff.cs index 80be41272e..ce8ea70f50 100644 --- a/Items/Weapons/Summon/AbandonedSlimeStaff.cs +++ b/Items/Weapons/Summon/AbandonedSlimeStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using System; @@ -62,14 +63,14 @@ namespace CalamityMod.Items.Weapons.Summon return slimeSlots >= 1; } - 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) { CalamityUtils.KillShootProjectiles(true, type, player); float damageMult = ((float)Math.Log(slimeSlots, 8f)) + 1f; position = Main.MouseWorld; - speedX = 0; - speedY = 0; - int slime = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)(damage * damageMult), knockBack, player.whoAmI); + velocity.X = 0; + velocity.Y = 0; + int slime = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, (int)(damage * damageMult), knockback, player.whoAmI); Main.projectile[slime].minionSlots = slimeSlots; return false; } diff --git a/Items/Weapons/Summon/AncientIceChunk.cs b/Items/Weapons/Summon/AncientIceChunk.cs index 579c8a710a..de60f19518 100644 --- a/Items/Weapons/Summon/AncientIceChunk.cs +++ b/Items/Weapons/Summon/AncientIceChunk.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using System; @@ -34,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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; player.itemTime = Item.useTime; @@ -58,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Summon num79 = 0f; vector2.X = (float)Main.mouseX + Main.screenPosition.X; vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, vector2.X, vector2.Y, num78, num79, type, damage, knockback, player.whoAmI, 0f, 0f); return false; } } diff --git a/Items/Weapons/Summon/AngryChickenStaff.cs b/Items/Weapons/Summon/AngryChickenStaff.cs index c9a03f82d8..56cbf342ec 100644 --- a/Items/Weapons/Summon/AngryChickenStaff.cs +++ b/Items/Weapons/Summon/AngryChickenStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -37,12 +38,12 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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) { position = Main.MouseWorld; - Projectile.NewProjectile(position, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs index b92732f800..ac486e8e58 100644 --- a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs +++ b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -32,9 +33,9 @@ namespace CalamityMod.Items.Weapons.Summon Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } - 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(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); return false; } public override void AddRecipes() diff --git a/Items/Weapons/Summon/BensUmbrella.cs b/Items/Weapons/Summon/BensUmbrella.cs index 26905971bf..172871e47c 100644 --- a/Items/Weapons/Summon/BensUmbrella.cs +++ b/Items/Weapons/Summon/BensUmbrella.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -41,10 +42,10 @@ namespace CalamityMod.Items.Weapons.Summon public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && player.maxMinions >= 5; - 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) { CalamityUtils.KillShootProjectiles(true, type, player); - Projectile.NewProjectile(position, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Summon/BlackHawkRemote.cs b/Items/Weapons/Summon/BlackHawkRemote.cs index d7dd23636e..98081019d3 100644 --- a/Items/Weapons/Summon/BlackHawkRemote.cs +++ b/Items/Weapons/Summon/BlackHawkRemote.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -33,16 +34,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.LightRed; } - 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) { if (player.whoAmI == Main.myPlayer) { position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + velocity.X = 0; + velocity.Y = 0; + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); } } return false; diff --git a/Items/Weapons/Summon/BlightedEyeStaff.cs b/Items/Weapons/Summon/BlightedEyeStaff.cs index b3b6a17d85..0bbd390d2b 100644 --- a/Items/Weapons/Summon/BlightedEyeStaff.cs +++ b/Items/Weapons/Summon/BlightedEyeStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using System; @@ -35,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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 i = Main.myPlayer; float num72 = Item.shootSpeed; @@ -66,11 +67,11 @@ namespace CalamityMod.Items.Weapons.Summon vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; Vector2 spinningpoint = new Vector2(num78, num79); spinningpoint = spinningpoint.RotatedBy(1.5707963705062866, default); - Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, ModContent.ProjectileType(), damage, num74, i, 0f, 1f); + Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, ModContent.ProjectileType(), damage, num74, i, 0f, 1f); spinningpoint = spinningpoint.RotatedBy(-3.1415927410125732, default); - Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, ModContent.ProjectileType(), damage, num74, i, 0f, 0f); + Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, ModContent.ProjectileType(), damage, num74, i, 0f, 0f); spinningpoint = spinningpoint.RotatedBy(-5.1415927410125732, default); - Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, ModContent.ProjectileType(), damage, num74, i, 0f, 1f); + Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, ModContent.ProjectileType(), damage, num74, i, 0f, 1f); return false; } } diff --git a/Items/Weapons/Summon/BloodClotStaff.cs b/Items/Weapons/Summon/BloodClotStaff.cs index b8667cfe71..b415617f2f 100644 --- a/Items/Weapons/Summon/BloodClotStaff.cs +++ b/Items/Weapons/Summon/BloodClotStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -39,14 +40,14 @@ namespace CalamityMod.Items.Weapons.Summon CreateRecipe(1).AddIngredient(ItemID.Vertebrae, 4).AddIngredient(ItemID.CrimtaneBar, 5).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.DemonAltar).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.altFunctionUse != 2) { position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + velocity.X = 0; + velocity.Y = 0; + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Summon/BorealisBomber.cs b/Items/Weapons/Summon/BorealisBomber.cs index 8ffa425502..bab5e27139 100644 --- a/Items/Weapons/Summon/BorealisBomber.cs +++ b/Items/Weapons/Summon/BorealisBomber.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -41,14 +42,14 @@ namespace CalamityMod.Items.Weapons.Summon return new Vector2(15, 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.altFunctionUse != 2) { position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); + velocity.X = 0; + velocity.Y = 0; + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, Main.myPlayer); } return false; } diff --git a/Items/Weapons/Summon/CadaverousCarrion.cs b/Items/Weapons/Summon/CadaverousCarrion.cs index 822bce77d4..8ad1931bfe 100644 --- a/Items/Weapons/Summon/CadaverousCarrion.cs +++ b/Items/Weapons/Summon/CadaverousCarrion.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -34,10 +35,10 @@ namespace CalamityMod.Items.Weapons.Summon 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) { //CalamityUtils.OnlyOneSentry(player, type); - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); player.UpdateMaxTurrets(); return false; } diff --git a/Items/Weapons/Summon/CalamarisLament.cs b/Items/Weapons/Summon/CalamarisLament.cs index 4050ed279d..9c01159439 100644 --- a/Items/Weapons/Summon/CalamarisLament.cs +++ b/Items/Weapons/Summon/CalamarisLament.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -34,14 +35,14 @@ namespace CalamityMod.Items.Weapons.Summon 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.altFunctionUse != 2) { position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + velocity.X = 0; + velocity.Y = 0; + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Summon/CausticCroakerStaff.cs b/Items/Weapons/Summon/CausticCroakerStaff.cs index 1cdd065243..0366da2376 100644 --- a/Items/Weapons/Summon/CausticCroakerStaff.cs +++ b/Items/Weapons/Summon/CausticCroakerStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -33,11 +34,11 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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) { - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); player.UpdateMaxTurrets(); } return false; diff --git a/Items/Weapons/Summon/CausticStaff.cs b/Items/Weapons/Summon/CausticStaff.cs index bb7d38d507..581c442f3b 100644 --- a/Items/Weapons/Summon/CausticStaff.cs +++ b/Items/Weapons/Summon/CausticStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -37,11 +38,11 @@ namespace CalamityMod.Items.Weapons.Summon 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) { if (player.altFunctionUse != 2) { - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI, 0f, 1f); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); } return false; } diff --git a/Items/Weapons/Summon/CinderBlossomStaff.cs b/Items/Weapons/Summon/CinderBlossomStaff.cs index e8f436d3d0..43c3866c9a 100644 --- a/Items/Weapons/Summon/CinderBlossomStaff.cs +++ b/Items/Weapons/Summon/CinderBlossomStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -33,10 +34,10 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } 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) { CalamityUtils.KillShootProjectiles(true, type, player); - Projectile.NewProjectile(player.Center, Vector2.Zero, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); return false; } public override void AddRecipes() diff --git a/Items/Weapons/Summon/CindersOfLament.cs b/Items/Weapons/Summon/CindersOfLament.cs index a675524022..63d446fbf2 100644 --- a/Items/Weapons/Summon/CindersOfLament.cs +++ b/Items/Weapons/Summon/CindersOfLament.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -40,13 +41,13 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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) { if (Main.rand.NextBool(2)) type = ModContent.ProjectileType(); - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Summon/ColdDivinity.cs b/Items/Weapons/Summon/ColdDivinity.cs index d393126cd1..b08c5846ef 100644 --- a/Items/Weapons/Summon/ColdDivinity.cs +++ b/Items/Weapons/Summon/ColdDivinity.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -39,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Pink; } - 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 totalMinionSlots = 0f; for (int i = 0; i < Main.projectile.Length; i++) @@ -53,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Summon { player.AddBuff(ModContent.BuffType(), 120, true); position = Main.MouseWorld; - Projectile.NewProjectile(position, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); int pointyThingCount = 0; for (int i = 0; i < Main.projectile.Length; i++) { diff --git a/Items/Weapons/Summon/CorroslimeStaff.cs b/Items/Weapons/Summon/CorroslimeStaff.cs index 9100e89508..31c8822641 100644 --- a/Items/Weapons/Summon/CorroslimeStaff.cs +++ b/Items/Weapons/Summon/CorroslimeStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -33,14 +34,14 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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) { position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + velocity.X = 0; + velocity.Y = 0; + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Summon/CorvidHarbringerStaff.cs b/Items/Weapons/Summon/CorvidHarbringerStaff.cs index c90968ce49..2f755dcc66 100644 --- a/Items/Weapons/Summon/CorvidHarbringerStaff.cs +++ b/Items/Weapons/Summon/CorvidHarbringerStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -38,11 +39,11 @@ namespace CalamityMod.Items.Weapons.Summon 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.altFunctionUse != 2) { - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Summon/CosmicImmaterializer.cs b/Items/Weapons/Summon/CosmicImmaterializer.cs index 2a1168b873..cabce977f5 100644 --- a/Items/Weapons/Summon/CosmicImmaterializer.cs +++ b/Items/Weapons/Summon/CosmicImmaterializer.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; @@ -41,12 +42,12 @@ namespace CalamityMod.Items.Weapons.Summon public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && player.maxMinions >= 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) { CalamityUtils.KillShootProjectiles(true, type, player); CalamityPlayer modPlayer = player.Calamity(); bool hasSummonerSet = modPlayer.WearingPostMLSummonerSet; - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, (int)(damage * (hasSummonerSet ? 1 : 0.66)), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, (int)(damage * (hasSummonerSet ? 1 : 0.66)), knockback, player.whoAmI, 0f, 0f); return false; } diff --git a/Items/Weapons/Summon/CosmicViperEngine.cs b/Items/Weapons/Summon/CosmicViperEngine.cs index c5b98cbb6a..5d3db966f5 100644 --- a/Items/Weapons/Summon/CosmicViperEngine.cs +++ b/Items/Weapons/Summon/CosmicViperEngine.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Summon; @@ -38,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Summon 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.altFunctionUse != 2) { @@ -71,7 +72,7 @@ namespace CalamityMod.Items.Weapons.Summon vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; Vector2 spinningpoint = new Vector2(num78, num79); spinningpoint = spinningpoint.RotatedBy(MathHelper.PiOver2, default); - Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, type, damage, knockback, i, 0f, 1f); + Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, type, damage, knockback, i, 0f, 1f); } return false; } diff --git a/Items/Weapons/Summon/Cosmilamp.cs b/Items/Weapons/Summon/Cosmilamp.cs index 9f9998d006..f7b7af10fe 100644 --- a/Items/Weapons/Summon/Cosmilamp.cs +++ b/Items/Weapons/Summon/Cosmilamp.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using System; @@ -38,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool CanUseItem(Player player) => player.maxMinions >= 2; - 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); @@ -61,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Summon num79 = 0f; vector2.X = (float)Main.mouseX + Main.screenPosition.X; vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, vector2.X, vector2.Y, num78, num79, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); return false; } } diff --git a/Items/Weapons/Summon/CrimslimeStaff.cs b/Items/Weapons/Summon/CrimslimeStaff.cs index b906a8dea0..8401005feb 100644 --- a/Items/Weapons/Summon/CrimslimeStaff.cs +++ b/Items/Weapons/Summon/CrimslimeStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -33,14 +34,14 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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) { position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + velocity.X = 0; + velocity.Y = 0; + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Summon/CryogenicStaff.cs b/Items/Weapons/Summon/CryogenicStaff.cs index cfd1c4a0c9..dd674ea662 100644 --- a/Items/Weapons/Summon/CryogenicStaff.cs +++ b/Items/Weapons/Summon/CryogenicStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -37,9 +38,9 @@ Fire rate and range increase the longer it targets an enemy"); 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) { - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); player.UpdateMaxTurrets(); return false; } diff --git a/Items/Weapons/Summon/DaedalusGolemStaff.cs b/Items/Weapons/Summon/DaedalusGolemStaff.cs index 0998b0e758..153b4fc2c6 100644 --- a/Items/Weapons/Summon/DaedalusGolemStaff.cs +++ b/Items/Weapons/Summon/DaedalusGolemStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -34,11 +35,11 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; } - 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) { Point mouseTileCoords = Main.MouseWorld.ToTileCoordinates(); if (!CalamityUtils.ParanoidTileRetrieval(mouseTileCoords.X, mouseTileCoords.Y).IsTileSolidGround()) - Projectile.NewProjectile(Main.MouseWorld, Vector2.UnitY * 4f, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.UnitY * 4f, type, damage, knockback, player.whoAmI, 0f, 0f); return false; } diff --git a/Items/Weapons/Summon/DankStaff.cs b/Items/Weapons/Summon/DankStaff.cs index ab48de2610..b7ed480702 100644 --- a/Items/Weapons/Summon/DankStaff.cs +++ b/Items/Weapons/Summon/DankStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -40,14 +41,14 @@ namespace CalamityMod.Items.Weapons.Summon CreateRecipe(1).AddIngredient(ItemID.RottenChunk, 3).AddIngredient(ItemID.DemoniteBar, 8).AddIngredient(ModContent.ItemType(), 7).AddTile(TileID.DemonAltar).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.altFunctionUse != 2) { position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + velocity.X = 0; + velocity.Y = 0; + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Summon/DazzlingStabberStaff.cs b/Items/Weapons/Summon/DazzlingStabberStaff.cs index ad87e00747..2afb460776 100644 --- a/Items/Weapons/Summon/DazzlingStabberStaff.cs +++ b/Items/Weapons/Summon/DazzlingStabberStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -35,11 +36,11 @@ namespace CalamityMod.Items.Weapons.Summon 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.altFunctionUse != 2) { - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); } float angleMax = MathHelper.ToRadians(45f); if (CalamityUtils.CountProjectiles(type) == 1) diff --git a/Items/Weapons/Summon/DeathstareRod.cs b/Items/Weapons/Summon/DeathstareRod.cs index 47b62b76ba..4faa5b4c1c 100644 --- a/Items/Weapons/Summon/DeathstareRod.cs +++ b/Items/Weapons/Summon/DeathstareRod.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -32,10 +33,10 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } 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) { CalamityUtils.KillShootProjectiles(true, type, player); - Projectile.NewProjectile(player.Center, Vector2.Zero, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); return false; } } diff --git a/Items/Weapons/Summon/DeepseaStaff.cs b/Items/Weapons/Summon/DeepseaStaff.cs index 8f9f6ac578..9029b526c7 100644 --- a/Items/Weapons/Summon/DeepseaStaff.cs +++ b/Items/Weapons/Summon/DeepseaStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -33,14 +34,14 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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) { position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + velocity.X = 0; + velocity.Y = 0; + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Summon/DormantBrimseeker.cs b/Items/Weapons/Summon/DormantBrimseeker.cs index a43b99a3b5..f1e3cd234f 100644 --- a/Items/Weapons/Summon/DormantBrimseeker.cs +++ b/Items/Weapons/Summon/DormantBrimseeker.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = Item.buyPrice(0, 36, 0, 0); Item.rare = ItemRarityID.Pink; } - 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 totalSlots = 0f; for (int i = 0; i < Main.projectile.Length; i++) @@ -49,11 +50,11 @@ namespace CalamityMod.Items.Weapons.Summon } if (totalSlots < player.maxMinions) { - Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); } else if (player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0f) { - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage * 2, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage * 2, knockback, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Summon/DragonbloodDisgorger.cs b/Items/Weapons/Summon/DragonbloodDisgorger.cs index 851e1c982c..71f2a986e8 100644 --- a/Items/Weapons/Summon/DragonbloodDisgorger.cs +++ b/Items/Weapons/Summon/DragonbloodDisgorger.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -36,9 +37,9 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Summon/DreadmineStaff.cs b/Items/Weapons/Summon/DreadmineStaff.cs index 622ec774cd..f7113e9d32 100644 --- a/Items/Weapons/Summon/DreadmineStaff.cs +++ b/Items/Weapons/Summon/DreadmineStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Summon; @@ -36,10 +37,10 @@ namespace CalamityMod.Items.Weapons.Summon Item.sentry = 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) { //CalamityUtils.OnlyOneSentry(player, type); - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); player.UpdateMaxTurrets(); return false; } diff --git a/Items/Weapons/Summon/ElementalAxe.cs b/Items/Weapons/Summon/ElementalAxe.cs index dda30f718a..6248ece035 100644 --- a/Items/Weapons/Summon/ElementalAxe.cs +++ b/Items/Weapons/Summon/ElementalAxe.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -34,14 +35,14 @@ namespace CalamityMod.Items.Weapons.Summon Item.shootSpeed = 10f; } - 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) { position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + velocity.X = 0; + velocity.Y = 0; + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Summon/EndoHydraStaff.cs b/Items/Weapons/Summon/EndoHydraStaff.cs index 21c2b40ba6..a51e77c6bb 100644 --- a/Items/Weapons/Summon/EndoHydraStaff.cs +++ b/Items/Weapons/Summon/EndoHydraStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -38,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Summon 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.altFunctionUse != 2) { @@ -55,12 +56,12 @@ namespace CalamityMod.Items.Weapons.Summon } if (bodyExists) { - Projectile.NewProjectileDirect(player.Center, Main.rand.NextVector2Unit(), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, bodyIndex); + Projectile.NewProjectileDirect(source, player.Center, Main.rand.NextVector2Unit(), ModContent.ProjectileType(), damage, knockback, player.whoAmI, bodyIndex); } else { - bodyIndex = Projectile.NewProjectile(player.Center, Vector2.Zero, type, damage, knockBack, player.whoAmI); - Projectile.NewProjectile(player.Center, Main.rand.NextVector2Unit(), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, bodyIndex); + bodyIndex = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, player.Center, Main.rand.NextVector2Unit(), ModContent.ProjectileType(), damage, knockback, player.whoAmI, bodyIndex); for (int i = 0; i < 72; i++) { Dust dust = Dust.NewDustPerfect(Main.projectile[bodyIndex].Center, 113); diff --git a/Items/Weapons/Summon/Endogenesis.cs b/Items/Weapons/Summon/Endogenesis.cs index e0e8f8e278..8e78933015 100644 --- a/Items/Weapons/Summon/Endogenesis.cs +++ b/Items/Weapons/Summon/Endogenesis.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -51,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool CanUseItem(Player player) => player.maxMinions >= 10f; - 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) { @@ -63,7 +64,7 @@ namespace CalamityMod.Items.Weapons.Summon ModContent.ProjectileType() }); - SummonEndoCooper(AttackMode, Main.MouseWorld, damage, knockBack, player, out _, out _); + SummonEndoCooper(source, AttackMode, Main.MouseWorld, damage, knockback, player, out _, out _); AttackMode++; if (AttackMode > 3) @@ -72,7 +73,7 @@ namespace CalamityMod.Items.Weapons.Summon return false; } - public static void SummonEndoCooper(int attackMode, Vector2 spawnPosition, int damage, float knockBack, Player owner, out int bodyIndex, out int limbsIndex) + public static void SummonEndoCooper(IEntitySource source, int attackMode, Vector2 spawnPosition, int damage, float knockback, Player owner, out int bodyIndex, out int limbsIndex) { bodyIndex = limbsIndex = -1; if (Main.myPlayer != owner.whoAmI) @@ -87,8 +88,8 @@ namespace CalamityMod.Items.Weapons.Summon dmgMult = 0.95f; if (attackMode == 3) //flamethrower dmgMult = 0.9f; - bodyIndex = Projectile.NewProjectile(spawnPosition, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * dmgMult), knockBack, owner.whoAmI, attackMode, 0f); - limbsIndex = Projectile.NewProjectile(spawnPosition, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * dmgMult), knockBack, owner.whoAmI, attackMode, bodyIndex); + bodyIndex = Projectile.NewProjectile(source, spawnPosition, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * dmgMult), knockback, owner.whoAmI, attackMode, 0f); + limbsIndex = Projectile.NewProjectile(source, spawnPosition, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * dmgMult), knockback, owner.whoAmI, attackMode, bodyIndex); Main.projectile[bodyIndex].ai[1] = limbsIndex; } diff --git a/Items/Weapons/Summon/EnergyStaff.cs b/Items/Weapons/Summon/EnergyStaff.cs index 0b152a5661..68649fe00a 100644 --- a/Items/Weapons/Summon/EnergyStaff.cs +++ b/Items/Weapons/Summon/EnergyStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -33,10 +34,10 @@ namespace CalamityMod.Items.Weapons.Summon 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) { //CalamityUtils.OnlyOneSentry(player, type); - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI, 16f); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 16f); player.UpdateMaxTurrets(); return false; } diff --git a/Items/Weapons/Summon/EtherealSubjugator.cs b/Items/Weapons/Summon/EtherealSubjugator.cs index 204125b963..88ffee5c73 100644 --- a/Items/Weapons/Summon/EtherealSubjugator.cs +++ b/Items/Weapons/Summon/EtherealSubjugator.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -42,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Summon/EtherealSubjugatorGlow")); } - 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) { @@ -75,7 +76,7 @@ namespace CalamityMod.Items.Weapons.Summon vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; Vector2 spinningpoint = new Vector2(num78, num79); spinningpoint = spinningpoint.RotatedBy(1.5707963705062866, default); - Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, type, damage, num74, i, 0f, 1f); + Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, type, damage, num74, i, 0f, 1f); } return false; } diff --git a/Items/Weapons/Summon/EyeOfNight.cs b/Items/Weapons/Summon/EyeOfNight.cs index 1bbf5a2eaa..0070654122 100644 --- a/Items/Weapons/Summon/EyeOfNight.cs +++ b/Items/Weapons/Summon/EyeOfNight.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Terraria.ModLoader; using Terraria.ID; using CalamityMod.Projectiles.Summon; @@ -33,10 +34,10 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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) - Projectile.NewProjectile(Main.MouseWorld, Vector2.UnitY * -3f, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.UnitY * -3f, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Summon/FlowersOfMortality.cs b/Items/Weapons/Summon/FlowersOfMortality.cs index d1811df304..cfe3d9e447 100644 --- a/Items/Weapons/Summon/FlowersOfMortality.cs +++ b/Items/Weapons/Summon/FlowersOfMortality.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -36,12 +37,12 @@ namespace CalamityMod.Items.Weapons.Summon public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] < 5; //If you already have all 5, no need to resummon - 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) { CalamityUtils.KillShootProjectiles(false, type, player); for (int i = 0; i < 5; i++) { - Projectile blossom = Projectile.NewProjectileDirect(player.Center, Vector2.Zero, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile blossom = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); blossom.ai[0] = MathHelper.TwoPi * i / 5f; blossom.rotation = blossom.ai[0]; } diff --git a/Items/Weapons/Summon/ForgottenApexWand.cs b/Items/Weapons/Summon/ForgottenApexWand.cs index 6392f94f96..a736788358 100644 --- a/Items/Weapons/Summon/ForgottenApexWand.cs +++ b/Items/Weapons/Summon/ForgottenApexWand.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using Terraria.ModLoader; using Terraria.ID; using Terraria; @@ -40,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Summon CreateRecipe(1).AddRecipeGroup("AnyAdamantiteBar", 5).AddIngredient(ItemID.AncientBattleArmorMaterial, 2).AddIngredient(ItemID.Amethyst, 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.altFunctionUse != 2) { @@ -48,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Summon Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); vector2.X = Main.mouseX + Main.screenPosition.X; vector2.Y = Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2, Vector2.Zero, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, vector2, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Summon/FrostBlossomStaff.cs b/Items/Weapons/Summon/FrostBlossomStaff.cs index f9d8278194..4e832f1b39 100644 --- a/Items/Weapons/Summon/FrostBlossomStaff.cs +++ b/Items/Weapons/Summon/FrostBlossomStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -33,10 +34,10 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } 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) { CalamityUtils.KillShootProjectiles(true, type, player); - Projectile.NewProjectile(player.Center, Vector2.Zero, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); return false; } public override void AddRecipes() diff --git a/Items/Weapons/Summon/FuelCellBundle.cs b/Items/Weapons/Summon/FuelCellBundle.cs index 181b464e36..0610c4378f 100644 --- a/Items/Weapons/Summon/FuelCellBundle.cs +++ b/Items/Weapons/Summon/FuelCellBundle.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -33,11 +34,11 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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) //throws a flask { - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Summon/GammaHeart.cs b/Items/Weapons/Summon/GammaHeart.cs index 89de8c6804..353627defd 100644 --- a/Items/Weapons/Summon/GammaHeart.cs +++ b/Items/Weapons/Summon/GammaHeart.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -34,10 +35,10 @@ namespace CalamityMod.Items.Weapons.Summon 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.altFunctionUse != 2) - Projectile.NewProjectileDirect(player.Center, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Summon/GastricBelcherStaff.cs b/Items/Weapons/Summon/GastricBelcherStaff.cs index 07809c81a0..1c0450f054 100644 --- a/Items/Weapons/Summon/GastricBelcherStaff.cs +++ b/Items/Weapons/Summon/GastricBelcherStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using System; @@ -35,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon 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) { if (player.altFunctionUse != 2) { @@ -64,7 +65,7 @@ namespace CalamityMod.Items.Weapons.Summon playerPos.X = Main.mouseX + Main.screenPosition.X; playerPos.Y = Main.mouseY + Main.screenPosition.Y; spinningpoint = spinningpoint.RotatedBy(Math.PI / 2D, default); - Projectile.NewProjectile(playerPos + spinningpoint, spinningpoint, type, damage, knockBack, player.whoAmI, 0f, 1f); + Projectile.NewProjectile(source, playerPos + spinningpoint, spinningpoint, type, damage, knockback, player.whoAmI, 0f, 1f); } return false; } diff --git a/Items/Weapons/Summon/GodspawnHelixStaff.cs b/Items/Weapons/Summon/GodspawnHelixStaff.cs index 0c59e4446b..473d334128 100644 --- a/Items/Weapons/Summon/GodspawnHelixStaff.cs +++ b/Items/Weapons/Summon/GodspawnHelixStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -32,12 +33,12 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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) { position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + velocity.X = 0; + velocity.Y = 0; + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Summon/HauntedScroll.cs b/Items/Weapons/Summon/HauntedScroll.cs index b9f11a9c2c..1b69e78282 100644 --- a/Items/Weapons/Summon/HauntedScroll.cs +++ b/Items/Weapons/Summon/HauntedScroll.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -33,14 +34,14 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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) { position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 30f); + velocity.X = 0; + velocity.Y = 0; + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 30f); //projectile.ai[1] is attack cooldown. Setting it here prevents immediate attacks } return false; diff --git a/Items/Weapons/Summon/HerringStaff.cs b/Items/Weapons/Summon/HerringStaff.cs index 97a4c27b22..9f47aa38ec 100644 --- a/Items/Weapons/Summon/HerringStaff.cs +++ b/Items/Weapons/Summon/HerringStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -33,14 +34,14 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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) { position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + velocity.X = 0; + velocity.Y = 0; + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Summon/HivePod.cs b/Items/Weapons/Summon/HivePod.cs index ac39b3404d..34655fa003 100644 --- a/Items/Weapons/Summon/HivePod.cs +++ b/Items/Weapons/Summon/HivePod.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -33,10 +34,10 @@ namespace CalamityMod.Items.Weapons.Summon 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) { //CalamityUtils.OnlyOneSentry(player, type); - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); player.UpdateMaxTurrets(); return false; } diff --git a/Items/Weapons/Summon/IgneousExaltation.cs b/Items/Weapons/Summon/IgneousExaltation.cs index 5adb1aa742..4ffde943f6 100644 --- a/Items/Weapons/Summon/IgneousExaltation.cs +++ b/Items/Weapons/Summon/IgneousExaltation.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -35,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } - 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 totalMinionSlots = 0f; for (int i = 0; i < Main.maxProjectiles; i++) @@ -48,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Summon if (player.altFunctionUse != 2 && totalMinionSlots < player.maxMinions) { position = Main.MouseWorld; - Projectile.NewProjectile(position, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); int swordCount = 0; for (int i = 0; i < Main.maxProjectiles; i++) { diff --git a/Items/Weapons/Summon/InfectedRemote.cs b/Items/Weapons/Summon/InfectedRemote.cs index 81222064af..a159b73a06 100644 --- a/Items/Weapons/Summon/InfectedRemote.cs +++ b/Items/Weapons/Summon/InfectedRemote.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using Terraria.DataStructures; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using System; using Terraria; @@ -60,14 +61,14 @@ namespace CalamityMod.Items.Weapons.Summon return viruliSlots >= 1 && 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) { CalamityUtils.KillShootProjectiles(true, type, player); float damageMult = ((float)Math.Log(viruliSlots, 10f)) + 1f; position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)(damage * damageMult), knockBack, player.whoAmI, viruliSlots, 1f); + velocity.X = 0; + velocity.Y = 0; + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, (int)(damage * damageMult), knockback, player.whoAmI, viruliSlots, 1f); return false; } } diff --git a/Items/Weapons/Summon/LanternoftheSoul.cs b/Items/Weapons/Summon/LanternoftheSoul.cs index 0738f9b43c..ae7a1e8142 100644 --- a/Items/Weapons/Summon/LanternoftheSoul.cs +++ b/Items/Weapons/Summon/LanternoftheSoul.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -35,10 +36,10 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.Item44; } - 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) { //CalamityUtils.OnlyOneSentry(player, type); - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); player.UpdateMaxTurrets(); return false; } diff --git a/Items/Weapons/Summon/MagicalConch.cs b/Items/Weapons/Summon/MagicalConch.cs index 999ad15a5f..f492dc1ae7 100644 --- a/Items/Weapons/Summon/MagicalConch.cs +++ b/Items/Weapons/Summon/MagicalConch.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using System; @@ -34,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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 i = Main.myPlayer; float num72 = Item.shootSpeed; @@ -62,7 +63,7 @@ namespace CalamityMod.Items.Weapons.Summon num79 = 0f; vector2.X = (float)Main.mouseX + Main.screenPosition.X; vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, ModContent.ProjectileType(), num73, num74, i, 0f, 0f); + Projectile.NewProjectile(source, vector2.X, vector2.Y, num78, num79, ModContent.ProjectileType(), num73, num74, i, 0f, 0f); return false; } } diff --git a/Items/Weapons/Summon/Metastasis.cs b/Items/Weapons/Summon/Metastasis.cs index f6d59ad19d..91895d7d82 100644 --- a/Items/Weapons/Summon/Metastasis.cs +++ b/Items/Weapons/Summon/Metastasis.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -42,9 +43,9 @@ namespace CalamityMod.Items.Weapons.Summon 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) { - Projectile.NewProjectile(Main.MouseWorld, -Vector2.UnitY * 5f, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, Main.MouseWorld, -Vector2.UnitY * 5f, type, damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Summon/MidnightSunBeacon.cs b/Items/Weapons/Summon/MidnightSunBeacon.cs index 782c3b3389..ca824a1c6e 100644 --- a/Items/Weapons/Summon/MidnightSunBeacon.cs +++ b/Items/Weapons/Summon/MidnightSunBeacon.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -38,9 +39,9 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Purple; 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) { - Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } public override void AddRecipes() diff --git a/Items/Weapons/Summon/OrthoceraShell.cs b/Items/Weapons/Summon/OrthoceraShell.cs index e426aff785..02da2f9f51 100644 --- a/Items/Weapons/Summon/OrthoceraShell.cs +++ b/Items/Weapons/Summon/OrthoceraShell.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -33,13 +34,13 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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) { if (player.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI, 0f, 1f); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); player.UpdateMaxTurrets(); } } diff --git a/Items/Weapons/Summon/Perdition.cs b/Items/Weapons/Summon/Perdition.cs index ebff12307b..002a600127 100644 --- a/Items/Weapons/Summon/Perdition.cs +++ b/Items/Weapons/Summon/Perdition.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -40,12 +41,12 @@ namespace CalamityMod.Items.Weapons.Summon public override bool AltFunctionUse(Player player) => 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.altFunctionUse != 2) { CalamityUtils.OnlyOneSentry(player, type); - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); player.UpdateMaxTurrets(); } else diff --git a/Items/Weapons/Summon/PlantationStaff.cs b/Items/Weapons/Summon/PlantationStaff.cs index fe8e149e5e..4e6b24c3c6 100644 --- a/Items/Weapons/Summon/PlantationStaff.cs +++ b/Items/Weapons/Summon/PlantationStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; @@ -44,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Summon CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.OpticStaff).AddIngredient(ModContent.ItemType(), 10).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.altFunctionUse != 2) { @@ -76,7 +77,7 @@ namespace CalamityMod.Items.Weapons.Summon playerPos.X = (float)Main.mouseX + Main.screenPosition.X; playerPos.Y = (float)Main.mouseY + Main.screenPosition.Y; spinningpoint = spinningpoint.RotatedBy(MathHelper.PiOver2, default); - Projectile.NewProjectile(playerPos + spinningpoint, spinningpoint, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, playerPos + spinningpoint, spinningpoint, type, damage, knockback, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Summon/PolypLauncher.cs b/Items/Weapons/Summon/PolypLauncher.cs index 5f7153a115..d40627979d 100644 --- a/Items/Weapons/Summon/PolypLauncher.cs +++ b/Items/Weapons/Summon/PolypLauncher.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -33,10 +34,10 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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) { //CalamityUtils.OnlyOneSentry(player, type); - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI, 20f); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 20f); player.UpdateMaxTurrets(); return false; } diff --git a/Items/Weapons/Summon/PrototypeAndromechaRing.cs b/Items/Weapons/Summon/PrototypeAndromechaRing.cs index 1ffff739de..dfd55cceff 100644 --- a/Items/Weapons/Summon/PrototypeAndromechaRing.cs +++ b/Items/Weapons/Summon/PrototypeAndromechaRing.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.StatDebuffs; +using Terraria.DataStructures; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Melee; @@ -58,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool CanUseItem(Player player) => !(player.Calamity().andromedaCripple > 0 && CalamityPlayer.areThereAnyDamnBosses); - 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 the player has any robots, kill them all. if (player.ownedProjectileCounts[Item.shoot] > 0) @@ -132,7 +133,7 @@ namespace CalamityMod.Items.Weapons.Summon { damage = (int)(damage * player.MinionDamage()); } - Projectile blade = Projectile.NewProjectileDirect(robot.Center + (robot.spriteDirection > 0).ToDirectionInt() * robot.width / 2 * Vector2.UnitX, + Projectile blade = Projectile.NewProjectileDirect(source, robot.Center + (robot.spriteDirection > 0).ToDirectionInt() * robot.width / 2 * Vector2.UnitX, Vector2.Zero, ModContent.ProjectileType(), damage, 15f, player.whoAmI, Projectile.GetByUUID(robot.owner, robot.whoAmI)); if (blade.whoAmI.WithinBounds(Main.maxProjectiles)) diff --git a/Items/Weapons/Summon/ResurrectionButterfly.cs b/Items/Weapons/Summon/ResurrectionButterfly.cs index b8918e028f..c66f042c42 100644 --- a/Items/Weapons/Summon/ResurrectionButterfly.cs +++ b/Items/Weapons/Summon/ResurrectionButterfly.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -40,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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 i = Main.myPlayer; float num72 = Item.shootSpeed; @@ -71,9 +72,9 @@ namespace CalamityMod.Items.Weapons.Summon vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; Vector2 spinningpoint = new Vector2(num78, num79); spinningpoint = spinningpoint.RotatedBy(1.5707963705062866, default); - Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, ModContent.ProjectileType(), damage, num74, i, 0f, 0f); + Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, ModContent.ProjectileType(), damage, num74, i, 0f, 0f); spinningpoint = spinningpoint.RotatedBy(-3.1415927410125732, default); - Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, ModContent.ProjectileType(), damage, num74, i, 0f, 0f); + Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, ModContent.ProjectileType(), damage, num74, i, 0f, 0f); return false; } diff --git a/Items/Weapons/Summon/RustyBeaconPrototype.cs b/Items/Weapons/Summon/RustyBeaconPrototype.cs index bf819fcbd0..8c5e2a9dae 100644 --- a/Items/Weapons/Summon/RustyBeaconPrototype.cs +++ b/Items/Weapons/Summon/RustyBeaconPrototype.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -34,11 +35,11 @@ namespace CalamityMod.Items.Weapons.Summon Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } - 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) { - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI, 0f, 1f); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); } return false; } diff --git a/Items/Weapons/Summon/SandSharknadoStaff.cs b/Items/Weapons/Summon/SandSharknadoStaff.cs index 8264bcb36c..32e972531a 100644 --- a/Items/Weapons/Summon/SandSharknadoStaff.cs +++ b/Items/Weapons/Summon/SandSharknadoStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -34,14 +35,14 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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) { position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + velocity.X = 0; + velocity.Y = 0; + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); } return false; } diff --git a/Items/Weapons/Summon/SarosPossession.cs b/Items/Weapons/Summon/SarosPossession.cs index 41f9757304..d4b3286a8a 100644 --- a/Items/Weapons/Summon/SarosPossession.cs +++ b/Items/Weapons/Summon/SarosPossession.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -61,10 +62,10 @@ namespace CalamityMod.Items.Weapons.Summon return radianceSlots >= 1; } - 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) { CalamityUtils.KillShootProjectiles(true, type, player); - Projectile.NewProjectile(position, Vector2.Zero, type, damage, knockBack, player.whoAmI, radianceSlots); + Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI, radianceSlots); return false; } diff --git a/Items/Weapons/Summon/ScabRipper.cs b/Items/Weapons/Summon/ScabRipper.cs index 54122777ea..8b58753acd 100644 --- a/Items/Weapons/Summon/ScabRipper.cs +++ b/Items/Weapons/Summon/ScabRipper.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -33,14 +34,14 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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) { position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + velocity.X = 0; + velocity.Y = 0; + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Summon/SeaboundStaff.cs b/Items/Weapons/Summon/SeaboundStaff.cs index a156d8760b..06b475778d 100644 --- a/Items/Weapons/Summon/SeaboundStaff.cs +++ b/Items/Weapons/Summon/SeaboundStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -34,14 +35,14 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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) { position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + velocity.X = 0; + velocity.Y = 0; + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Summon/ShellfishStaff.cs b/Items/Weapons/Summon/ShellfishStaff.cs index bd0b8242f9..b08ff96fef 100644 --- a/Items/Weapons/Summon/ShellfishStaff.cs +++ b/Items/Weapons/Summon/ShellfishStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -34,11 +35,11 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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) { - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Summon/Sirius.cs b/Items/Weapons/Summon/Sirius.cs index edb184044b..6a0ef3293b 100644 --- a/Items/Weapons/Summon/Sirius.cs +++ b/Items/Weapons/Summon/Sirius.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Items.Placeables.Ores; @@ -60,10 +61,10 @@ namespace CalamityMod.Items.Weapons.Summon return siriusSlots >= 1; } - 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) { CalamityUtils.KillShootProjectiles(true, type, player); - Projectile.NewProjectile(position, Vector2.Zero, type, damage, knockBack, player.whoAmI, siriusSlots, 30f); + Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI, siriusSlots, 30f); return false; } diff --git a/Items/Weapons/Summon/SlimePuppetStaff.cs b/Items/Weapons/Summon/SlimePuppetStaff.cs index e188558665..10b5b40f6c 100644 --- a/Items/Weapons/Summon/SlimePuppetStaff.cs +++ b/Items/Weapons/Summon/SlimePuppetStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -37,10 +38,10 @@ namespace CalamityMod.Items.Weapons.Summon public override Vector2? HoldoutOrigin() => new Vector2(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) { if (player.altFunctionUse != 2) - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, Main.myPlayer); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, Main.myPlayer); return false; } diff --git a/Items/Weapons/Summon/SpikecragStaff.cs b/Items/Weapons/Summon/SpikecragStaff.cs index 025b8f0ffc..59b2180eed 100644 --- a/Items/Weapons/Summon/SpikecragStaff.cs +++ b/Items/Weapons/Summon/SpikecragStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -34,10 +35,10 @@ namespace CalamityMod.Items.Weapons.Summon 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) { //CalamityUtils.OnlyOneSentry(player, type); - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI, 120f, 0f); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 120f, 0f); player.UpdateMaxTurrets(); return false; } diff --git a/Items/Weapons/Summon/SquirrelSquireStaff.cs b/Items/Weapons/Summon/SquirrelSquireStaff.cs index 2455107975..afd94d2fd3 100644 --- a/Items/Weapons/Summon/SquirrelSquireStaff.cs +++ b/Items/Weapons/Summon/SquirrelSquireStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -34,14 +35,14 @@ namespace CalamityMod.Items.Weapons.Summon Item.sentry = 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.altFunctionUse != 2) { position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 30f); + velocity.X = 0; + velocity.Y = 0; + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 30f); player.UpdateMaxTurrets(); //projectile.ai[1] is attack cooldown. Setting it here prevents immediate attacks } diff --git a/Items/Weapons/Summon/StaffOfNecrosteocytes.cs b/Items/Weapons/Summon/StaffOfNecrosteocytes.cs index f4d3e8afdf..a04faf20a8 100644 --- a/Items/Weapons/Summon/StaffOfNecrosteocytes.cs +++ b/Items/Weapons/Summon/StaffOfNecrosteocytes.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -34,14 +35,14 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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) { Point mouseTileCoords = position.ToTileCoordinates(); if (WorldGen.SolidTile(mouseTileCoords.X, mouseTileCoords.Y)) return false; if (player.altFunctionUse != 2) { - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Summon/StaffoftheMechworm.cs b/Items/Weapons/Summon/StaffoftheMechworm.cs index 7f4d18399e..81457661ac 100644 --- a/Items/Weapons/Summon/StaffoftheMechworm.cs +++ b/Items/Weapons/Summon/StaffoftheMechworm.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using System.Linq; @@ -56,41 +57,41 @@ namespace CalamityMod.Items.Weapons.Summon return true; } - public static void SummonBaseMechworm(int damage, float knockBack, Player owner, out int tailIndex) + public static void SummonBaseMechworm(IEntitySource source, int damage, float knockback, Player owner, out int tailIndex) { tailIndex = -1; if (Main.myPlayer != owner.whoAmI) return; - int curr = Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockBack, owner.whoAmI, 0f, 0f); - curr = Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockBack, owner.whoAmI, Main.projectile[curr].identity, 0f); + int curr = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, 0f, 0f); + curr = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, Main.projectile[curr].identity, 0f); int prev = curr; - curr = Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockBack, owner.whoAmI, Main.projectile[curr].identity, 0f); + curr = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, Main.projectile[curr].identity, 0f); Main.projectile[prev].localAI[1] = curr; prev = curr; - curr = Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockBack, owner.whoAmI, Main.projectile[curr].identity, 0f); + curr = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, Main.projectile[curr].identity, 0f); Main.projectile[prev].localAI[1] = curr; tailIndex = curr; } - public static void AddSegmentToMechworm(int tailIndex, int damage, float knockBack, Player owner) + public static void AddSegmentToMechworm(IEntitySource source, int tailIndex, int damage, float knockback, Player owner) { if (Main.myPlayer != owner.whoAmI) return; Vector2 spawnPosition = Main.projectile[tailIndex].Center; Projectile tailAheadSegment = Main.projectile.Take(Main.maxProjectiles).FirstOrDefault(proj => MechwormBody.SameIdentity(proj, owner.whoAmI, (int)Main.projectile[tailIndex].ai[0])); - int body = Projectile.NewProjectile(spawnPosition, Vector2.Zero, ModContent.ProjectileType(), damage, knockBack, owner.whoAmI, tailAheadSegment.identity, 0f); + int body = Projectile.NewProjectile(source, spawnPosition, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, tailAheadSegment.identity, 0f); int body2 = body; - body = Projectile.NewProjectile(spawnPosition, Vector2.Zero, ModContent.ProjectileType(), damage, knockBack, owner.whoAmI, Main.projectile[body].identity, 0f); + body = Projectile.NewProjectile(source, spawnPosition, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, Main.projectile[body].identity, 0f); var m = Main.projectileIdentity; Main.projectile[tailIndex].ai[0] = Main.projectile[body].identity; Main.projectile[tailIndex].netUpdate = 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 head = -1; int tail = -1; @@ -113,9 +114,9 @@ namespace CalamityMod.Items.Weapons.Summon } } if (head == -1 && tail == -1) - SummonBaseMechworm(damage, knockBack, player, out _); + SummonBaseMechworm(source, damage, knockback, player, out _); else if (head != -1 && tail != -1) - AddSegmentToMechworm(tail, damage, knockBack, player); + AddSegmentToMechworm(source, tail, damage, knockback, player); return false; } } diff --git a/Items/Weapons/Summon/StormjawStaff.cs b/Items/Weapons/Summon/StormjawStaff.cs index 8ff375a1cf..7c02f84b7a 100644 --- a/Items/Weapons/Summon/StormjawStaff.cs +++ b/Items/Weapons/Summon/StormjawStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -34,11 +35,11 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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) { - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Summon/SunGodStaff.cs b/Items/Weapons/Summon/SunGodStaff.cs index 4079bf4f07..831cda0d18 100644 --- a/Items/Weapons/Summon/SunGodStaff.cs +++ b/Items/Weapons/Summon/SunGodStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -40,10 +41,10 @@ namespace CalamityMod.Items.Weapons.Summon CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.SoulofMight, 3).AddIngredient(ItemID.SoulofSight, 3).AddIngredient(ItemID.SoulofFright, 3).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) { CalamityUtils.KillShootProjectiles(true, type, player); - Projectile.NewProjectile(position, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Summon/SunSpiritStaff.cs b/Items/Weapons/Summon/SunSpiritStaff.cs index e7c8b3ce08..6ebdc82e22 100644 --- a/Items/Weapons/Summon/SunSpiritStaff.cs +++ b/Items/Weapons/Summon/SunSpiritStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -40,10 +41,10 @@ namespace CalamityMod.Items.Weapons.Summon CreateRecipe(1).AddIngredient(ItemID.SandstoneBrick, 20).AddIngredient(ModContent.ItemType(), 2).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) { CalamityUtils.KillShootProjectiles(true, type, player); - Projectile.NewProjectile(position, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Summon/TacticalPlagueEngine.cs b/Items/Weapons/Summon/TacticalPlagueEngine.cs index 1e493b6ca7..5ad6c69891 100644 --- a/Items/Weapons/Summon/TacticalPlagueEngine.cs +++ b/Items/Weapons/Summon/TacticalPlagueEngine.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -36,10 +37,10 @@ namespace CalamityMod.Items.Weapons.Summon Item.shootSpeed = 16f; } - 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) - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); return false; } diff --git a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs index 678ad2204a..30993778b8 100644 --- a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs +++ b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -35,12 +36,12 @@ namespace CalamityMod.Items.Weapons.Summon public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] < 3; //If you already have all 3, no need to resummon - 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) { CalamityUtils.KillShootProjectiles(false, type, player); for (int i = 0; i < 3; i++) { - Projectile blossom = Projectile.NewProjectileDirect(player.Center, Vector2.Zero, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile blossom = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); blossom.ai[1] = (int)(MathHelper.TwoPi / 3f * i * 32f); blossom.rotation = blossom.ai[1] / 32f; } diff --git a/Items/Weapons/Summon/UniverseSplitter.cs b/Items/Weapons/Summon/UniverseSplitter.cs index 6b95d2988a..16b345bc8f 100644 --- a/Items/Weapons/Summon/UniverseSplitter.cs +++ b/Items/Weapons/Summon/UniverseSplitter.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using Terraria.DataStructures; +using CalamityMod.Items.Materials; using CalamityMod.Items.SummonItems; using CalamityMod.Projectiles.Summon; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -50,14 +51,14 @@ namespace CalamityMod.Items.Weapons.Summon 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) { if (player.altFunctionUse != 2) { if (!player.HasCooldown(Cooldowns.UniverseSplitter.ID)) { player.AddCooldown(Cooldowns.UniverseSplitter.ID, CalamityUtils.SecondsToFrames(45)); - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); for (int i = 0; i < 36; i++) { float angle = MathHelper.TwoPi / 36f * i + Main.rand.NextFloat(MathHelper.TwoPi / 36f); @@ -69,7 +70,7 @@ namespace CalamityMod.Items.Weapons.Summon } else { - Projectile.NewProjectile(position, Vector2.UnitY * 3f, ProjectileID.SaucerScrap, 5, 0f, player.whoAmI); + Projectile.NewProjectile(source, position, Vector2.UnitY * 3f, ProjectileID.SaucerScrap, 5, 0f, player.whoAmI); } } return false; diff --git a/Items/Weapons/Summon/Vigilance.cs b/Items/Weapons/Summon/Vigilance.cs index 1a629d6aba..149cc8cf47 100644 --- a/Items/Weapons/Summon/Vigilance.cs +++ b/Items/Weapons/Summon/Vigilance.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -34,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Summon 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.altFunctionUse != 2) { @@ -48,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Summon totalSeekers++; } - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); for (int i = 0; i < Main.maxProjectiles; i++) { diff --git a/Items/Weapons/Summon/VileFeeder.cs b/Items/Weapons/Summon/VileFeeder.cs index e05defc231..2b9c3e8cef 100644 --- a/Items/Weapons/Summon/VileFeeder.cs +++ b/Items/Weapons/Summon/VileFeeder.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using System; @@ -36,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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) { @@ -69,7 +70,7 @@ namespace CalamityMod.Items.Weapons.Summon vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; Vector2 spinningpoint = new Vector2(num78, num79); spinningpoint = spinningpoint.RotatedBy(MathHelper.PiOver2, default); - Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, type, damage, knockback, i, 0f, 0f); + Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, type, damage, knockback, i, 0f, 0f); } return false; } diff --git a/Items/Weapons/Summon/ViralSprout.cs b/Items/Weapons/Summon/ViralSprout.cs index 60aba68c79..2f9d27fa7a 100644 --- a/Items/Weapons/Summon/ViralSprout.cs +++ b/Items/Weapons/Summon/ViralSprout.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -35,11 +36,11 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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) { - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); int minionCount = 0; for (int i = 0; i < Main.maxProjectiles; i++) diff --git a/Items/Weapons/Summon/ViridVanguard.cs b/Items/Weapons/Summon/ViridVanguard.cs index c06bbcb1ff..c47f8c6efc 100644 --- a/Items/Weapons/Summon/ViridVanguard.cs +++ b/Items/Weapons/Summon/ViridVanguard.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -36,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Summon 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) { float totalMinionSlots = 0f; for (int i = 0; i < Main.maxProjectiles; i++) @@ -66,12 +67,12 @@ namespace CalamityMod.Items.Weapons.Summon } } - Projectile newBlade = Projectile.NewProjectileDirect(position, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile newBlade = Projectile.NewProjectileDirect(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); (newBlade.modProjectile as ViridVanguardBlade).AltTexture = swordCount % 2 == 1; newBlade.netUpdate = true; swordCount++; - newBlade = Projectile.NewProjectileDirect(position, Vector2.Zero, type, damage, knockBack, player.whoAmI); + newBlade = Projectile.NewProjectileDirect(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); (newBlade.modProjectile as ViridVanguardBlade).AltTexture = swordCount % 2 == 1; newBlade.netUpdate = true; swordCount++; diff --git a/Items/Weapons/Summon/VoidConcentrationStaff.cs b/Items/Weapons/Summon/VoidConcentrationStaff.cs index 0b763b30fa..8d223a8464 100644 --- a/Items/Weapons/Summon/VoidConcentrationStaff.cs +++ b/Items/Weapons/Summon/VoidConcentrationStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.Summon; +using Terraria.DataStructures; +using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -45,11 +46,11 @@ namespace CalamityMod.Items.Weapons.Summon return base.CanUseItem(player); } - 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) { - Projectile.NewProjectile(player.Center, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); player.AddBuff(ModContent.BuffType(), 120); } return false; diff --git a/Items/Weapons/Summon/WitherBlossomsStaff.cs b/Items/Weapons/Summon/WitherBlossomsStaff.cs index d94885f590..a03824a19e 100644 --- a/Items/Weapons/Summon/WitherBlossomsStaff.cs +++ b/Items/Weapons/Summon/WitherBlossomsStaff.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -36,12 +37,12 @@ namespace CalamityMod.Items.Weapons.Summon public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] < 4; //If you already have all 4, no need to resummon - 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) { CalamityUtils.KillShootProjectiles(false, type, player); for (int i = 0; i < 4; i++) { - Projectile blossom = Projectile.NewProjectileDirect(player.Center, Vector2.Zero, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile blossom = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); blossom.ai[0] = MathHelper.TwoPi * i / 4f; blossom.rotation = blossom.ai[0]; } diff --git a/Items/Weapons/Summon/WulfrumController.cs b/Items/Weapons/Summon/WulfrumController.cs index 1eabb874a3..2f6ce3c80b 100644 --- a/Items/Weapons/Summon/WulfrumController.cs +++ b/Items/Weapons/Summon/WulfrumController.cs @@ -1,3 +1,4 @@ +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; @@ -34,14 +35,14 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - 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) { position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + velocity.X = 0; + velocity.Y = 0; + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); } return false; } diff --git a/Localization/CalamityLocalization.cs b/Localization/CalamityLocalization.cs index 23bf802fc9..691f6a9266 100644 --- a/Localization/CalamityLocalization.cs +++ b/Localization/CalamityLocalization.cs @@ -1,4 +1,4 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Localization { @@ -201,7 +201,13 @@ namespace CalamityMod.Localization new [] { "AcidRainStart", "A toxic downpour falls over the wasteland seas!" }, new [] { "AcidRainEnd", "The sulphuric skies begin to clear..." }, - new [] { "DefenseDamage", "Defense Damage" } + new [] { "DefenseDamage", "Defense Damage" }, + + new [] { "Tier1ArsenalRecipeCondition", "View an unencrypted schematic from the lab near the Sunken Sea" }, + new [] { "Tier2ArsenalRecipeCondition", "Decrypt a schematic from the lab in the large planetoid in the sky" }, + new [] { "Tier3ArsenalRecipeCondition", "Decrypt a schematic from the lab deep within the jungle" }, + new [] { "Tier4ArsenalRecipeCondition", "Decrypt a schematic from the lab near the edges of the underworld" }, + new [] { "Tier5ArsenalRecipeCondition", "Decrypt a schematic from the lab deep within the frozen caverns" }, }; } diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index caf40f18bd..1735085e1a 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -172,6 +172,7 @@ namespace CalamityMod.NPCs "Habolo", // <@!163028025494077441> (ChristmasGoat#7810) "Ortho", // <@!264984390910738432> (Worcuus#5225) "Chris Tallballs", // <@!770211589076418571> (Bewearium#1111) + "Syethas", // <@!325413275066171393> (CosmicStarIight#4430) }; #endregion diff --git a/Utilities/MiscUtils.cs b/Utilities/MiscUtils.cs index 660735ab08..4b24c42213 100644 --- a/Utilities/MiscUtils.cs +++ b/Utilities/MiscUtils.cs @@ -37,7 +37,7 @@ namespace CalamityMod /// The path to the sound file. public static TerrariaAudio.CustomSoundStyle GetTrackableSound(string path) { - return new TerrariaAudio.CustomSoundStyle(ModContent.Request(path, AssetRequestMode.ImmediateLoad), TerrariaAudio.SoundType.Sound); + return new TerrariaAudio.CustomSoundStyle(ModContent.Request(path, AssetRequestMode.ImmediateLoad).Value, TerrariaAudio.SoundType.Sound); } public static void DisplayLocalizedText(string key, Color? textColor = null)