From 148d1fc72884349a94e8215baf1a0ce2d73bd148 Mon Sep 17 00:00:00 2001 From: Big Duckie Date: Tue, 5 Jul 2022 19:43:21 -0600 Subject: [PATCH] Cleaned up code for melee weapons. --- .../Weapons/Melee/Shortswords/CarbonDagger.cs | 29 ++++++++-------- .../Melee/Shortswords/CarbonDaggerNihon.cs | 16 ++++----- .../Weapons/Melee/Shortswords/GoldenDagger.cs | 23 ++++++------- Items/Weapons/Melee/Shortswords/OniDagger.cs | 16 ++++----- .../Shortswords/StonePlatedShortsword.cs | 10 +++--- .../Melee/Shortswords/TheRainbowsCurse.cs | 18 +++++----- Items/Weapons/Melee/Shortswords/Wakizashi.cs | 13 ++++--- Items/Weapons/Melee/Swords/GoldenSlasher.cs | 25 +++++++------- Items/Weapons/Melee/Swords/RainbowClaymore.cs | 26 +++++++------- .../Melee/Swords/ShimadaSwords/CarbonSword.cs | 32 ++++++++---------- .../Swords/ShimadaSwords/CarbonSwordNihon.cs | 21 ++++++------ .../Melee/Swords/ShimadaSwords/DemonsFury.cs | 21 ++++++------ .../{TheRainbowsHonor.cs => DreamCatcher.cs} | 19 +++++------ ...{TheRainbowsHonor.png => DreamCatcher.png} | Bin .../Melee/Swords/ShimadaSwords/GoldenFury.cs | 30 ++++++++-------- .../Swords/ShimadaSwords/ShimadaSword.cs | 13 ++++--- .../Swords/ShimadaSwords/StonePlatedKatana.cs | 10 +++--- .../{RainbowAxe.cs => SpectralShredder.cs} | 28 +++++++-------- .../{RainbowAxe.png => SpectralShredder.png} | Bin 19 files changed, 168 insertions(+), 182 deletions(-) rename Items/Weapons/Melee/Swords/ShimadaSwords/{TheRainbowsHonor.cs => DreamCatcher.cs} (88%) rename Items/Weapons/Melee/Swords/ShimadaSwords/{TheRainbowsHonor.png => DreamCatcher.png} (100%) rename Items/Weapons/Melee/Waraxes/{RainbowAxe.cs => SpectralShredder.cs} (69%) rename Items/Weapons/Melee/Waraxes/{RainbowAxe.png => SpectralShredder.png} (100%) diff --git a/Items/Weapons/Melee/Shortswords/CarbonDagger.cs b/Items/Weapons/Melee/Shortswords/CarbonDagger.cs index 2de748a..c569993 100644 --- a/Items/Weapons/Melee/Shortswords/CarbonDagger.cs +++ b/Items/Weapons/Melee/Shortswords/CarbonDagger.cs @@ -11,7 +11,6 @@ public class CarbonDagger : ModItem { public override void SetStaticDefaults() { - DisplayName.SetDefault("Carbon Dagger"); Tooltip.SetDefault("[c/B6FF00:Autoswings, dyeable]\nThrows a medium-ranged Carbon Knife that deals more damage the closer you are to the target \nShortsword hits inflict [c/007700:Poison] debuff for 8 seconds\n[c/FF0000:Shortsword hits steal a small amount of life] \nShortsword hits grant the [c/FC3A3A:Rage] buff for 8 seconds"); } @@ -50,13 +49,13 @@ public class CarbonDagger : ModItem int healingAmount = damage / 18; player.statLife += healingAmount; player.HealEffect(healingAmount, true); - target.AddBuff(20, 480, false); - player.AddBuff(115, 480, true); + target.AddBuff(BuffID.Poisoned, 480, false); + player.AddBuff(BuffID.Rage, 480, true); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Vector2 muzzleOffset = Vector2.Normalize(new Vector2(velocity.X, velocity.Y)) * 45f; + Vector2 muzzleOffset = Vector2.Normalize(velocity) * 45f; if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0)) { position += muzzleOffset; @@ -66,17 +65,17 @@ public class CarbonDagger : ModItem public override void AddRecipes() { - Recipe recipe1 = CreateRecipe(); - recipe1.AddIngredient(ModContent.ItemType()); - recipe1.AddRecipeGroup("FabusMod:OrichalcumBar", 6); - recipe1.AddIngredient(ItemID.Sapphire, 2); - recipe1.AddTile(TileID.MythrilAnvil); - recipe1.Register(); + CreateRecipe() + .AddIngredient(ModContent.ItemType()) + .AddRecipeGroup("FabusMod:OrichalcumBar", 6) + .AddIngredient(ItemID.Sapphire, 2) + .AddTile(TileID.MythrilAnvil) + .Register(); - Recipe recipe2 = CreateRecipe(); - recipe2.AddIngredient(ModContent.ItemType()); - recipe2.AddIngredient(ItemID.BlueDye, 1); - recipe2.AddTile(TileID.DyeVat); - recipe2.Register(); + CreateRecipe() + .AddIngredient(ModContent.ItemType()) + .AddIngredient(ItemID.BlueDye) + .AddTile(TileID.DyeVat) + .Register(); } } diff --git a/Items/Weapons/Melee/Shortswords/CarbonDaggerNihon.cs b/Items/Weapons/Melee/Shortswords/CarbonDaggerNihon.cs index cbd5c3e..19d8d10 100644 --- a/Items/Weapons/Melee/Shortswords/CarbonDaggerNihon.cs +++ b/Items/Weapons/Melee/Shortswords/CarbonDaggerNihon.cs @@ -49,13 +49,13 @@ public class CarbonDaggerNihon : ModItem int healingAmount = damage / 16; player.statLife += healingAmount; player.HealEffect(healingAmount, true); - target.AddBuff(20, 480, false); - player.AddBuff(115, 480, true); + target.AddBuff(BuffID.Poisoned, 480, false); + player.AddBuff(BuffID.Rage, 480, true); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Vector2 muzzleOffset = Vector2.Normalize(new Vector2(velocity.X, velocity.Y)) * 45f; + Vector2 muzzleOffset = Vector2.Normalize(velocity) * 45f; if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0)) { position += muzzleOffset; } @@ -64,10 +64,10 @@ public class CarbonDaggerNihon : ModItem public override void AddRecipes() { - Recipe recipe = Recipe.Create(Type); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.BlueDye, 1); - recipe.AddTile(TileID.DyeVat); - recipe.Register(); + CreateRecipe() + .AddIngredient(ModContent.ItemType()) + .AddIngredient(ItemID.BlueDye) + .AddTile(TileID.DyeVat) + .Register(); } } diff --git a/Items/Weapons/Melee/Shortswords/GoldenDagger.cs b/Items/Weapons/Melee/Shortswords/GoldenDagger.cs index 972a157..38f870b 100644 --- a/Items/Weapons/Melee/Shortswords/GoldenDagger.cs +++ b/Items/Weapons/Melee/Shortswords/GoldenDagger.cs @@ -1,4 +1,3 @@ -using FabusMod.Projectiles.Shortsword; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -27,7 +26,7 @@ public class GoldenDagger : ModItem Item.knockBack = 6f; Item.value = Item.sellPrice(0, 54, 96, 0); Item.rare = ItemRarityID.Yellow; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 50f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -49,12 +48,12 @@ public class GoldenDagger : ModItem { float numberProjectiles = 2f; float rotation = MathHelper.ToRadians(4f); - position += Vector2.Normalize(new Vector2(velocity.X, velocity.Y)) * 6f; + position += Vector2.Normalize(velocity) * 6f; for (int i = 0; i < numberProjectiles; i++) { - Vector2 perturbedSpeed = Utils.RotatedBy(new Vector2(velocity.X, velocity.Y), (double)MathHelper.Lerp(0f - rotation, rotation, i / (numberProjectiles - 1f)), default) * 0.2f; - Projectile.NewProjectile(source, position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, knockback, player.whoAmI, 0f, 0f); - Vector2 muzzleOffset = Vector2.Normalize(new Vector2(velocity.X, velocity.Y)) * 55f; + Vector2 perturbedSpeed = Utils.RotatedBy(velocity, (double)MathHelper.Lerp(0f - rotation, rotation, i / (numberProjectiles - 1f)), default) * 0.2f; + Projectile.NewProjectile(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI); + Vector2 muzzleOffset = Vector2.Normalize(velocity) * 55f; if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0)) { position += muzzleOffset; @@ -75,11 +74,11 @@ public class GoldenDagger : ModItem public override void AddRecipes() { - Recipe recipe = CreateRecipe(); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.AdamantiteForge); - recipe.Register(); + CreateRecipe() + .AddIngredient(ModContent.ItemType()) + .AddIngredient(ModContent.ItemType(), 6) + .AddIngredient(ModContent.ItemType(), 4) + .AddTile(TileID.AdamantiteForge) + .Register(); } } diff --git a/Items/Weapons/Melee/Shortswords/OniDagger.cs b/Items/Weapons/Melee/Shortswords/OniDagger.cs index d7e644a..4ae08ed 100644 --- a/Items/Weapons/Melee/Shortswords/OniDagger.cs +++ b/Items/Weapons/Melee/Shortswords/OniDagger.cs @@ -56,7 +56,7 @@ public class OniDagger : ModItem public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Vector2 muzzleOffset = Vector2.Normalize(new Vector2(velocity.X, velocity.Y)) * 55f; + Vector2 muzzleOffset = Vector2.Normalize(velocity) * 55f; if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0)) { position += muzzleOffset; @@ -66,12 +66,12 @@ public class OniDagger : ModItem public override void AddRecipes() { - Recipe recipe = CreateRecipe(); - recipe.AddRecipeGroup("FabusMod:CarbonDagger", 1); - recipe.AddRecipeGroup("FabusMod:AdamantiteBar", 6); - recipe.AddIngredient(ItemID.SoulofNight, 4); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.MythrilAnvil); - recipe.Register(); + CreateRecipe() + .AddRecipeGroup("FabusMod:CarbonDagger") + .AddRecipeGroup("FabusMod:AdamantiteBar", 6) + .AddIngredient(ItemID.SoulofNight, 4) + .AddIngredient(ModContent.ItemType(), 2) + .AddTile(TileID.MythrilAnvil) + .Register(); } } diff --git a/Items/Weapons/Melee/Shortswords/StonePlatedShortsword.cs b/Items/Weapons/Melee/Shortswords/StonePlatedShortsword.cs index fd0dc2c..04a0154 100644 --- a/Items/Weapons/Melee/Shortswords/StonePlatedShortsword.cs +++ b/Items/Weapons/Melee/Shortswords/StonePlatedShortsword.cs @@ -29,10 +29,10 @@ public class StonePlatedShortsword : ModItem public override void AddRecipes() { - Recipe recipe = CreateRecipe(); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.StoneBlock, 6); - recipe.AddTile(ModContent.TileType()); - recipe.Register(); + CreateRecipe() + .AddIngredient(ModContent.ItemType()) + .AddIngredient(ItemID.StoneBlock, 6) + .AddTile(ModContent.TileType()) + .Register(); } } diff --git a/Items/Weapons/Melee/Shortswords/TheRainbowsCurse.cs b/Items/Weapons/Melee/Shortswords/TheRainbowsCurse.cs index f12fc1f..b131d00 100644 --- a/Items/Weapons/Melee/Shortswords/TheRainbowsCurse.cs +++ b/Items/Weapons/Melee/Shortswords/TheRainbowsCurse.cs @@ -60,12 +60,12 @@ public class TheRainbowsCurse : ModItem { float numberProjectiles = 3f; float rotation = MathHelper.ToRadians(6f); - position += Vector2.Normalize(new Vector2(velocity.X, velocity.Y)) * 6f; + position += Vector2.Normalize(velocity) * 6f; for (int i = 0; i < numberProjectiles; i++) { - Vector2 perturbedSpeed = Utils.RotatedBy(new Vector2(velocity.X, velocity.Y), (double)MathHelper.Lerp(0f - rotation, rotation, i / (numberProjectiles - 1f)), default) * 0.2f; - Projectile.NewProjectile(source, position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, knockback, player.whoAmI, 0f, 0f); - Vector2 muzzleOffset = Vector2.Normalize(new Vector2(velocity.X, velocity.Y)) * 60f; + Vector2 perturbedSpeed = Utils.RotatedBy(velocity, (double)MathHelper.Lerp(0f - rotation, rotation, i / (numberProjectiles - 1f)), default) * 0.2f; + Projectile.NewProjectile(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI); + Vector2 muzzleOffset = Vector2.Normalize(velocity) * 60f; if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0)) { position += muzzleOffset; @@ -86,10 +86,10 @@ public class TheRainbowsCurse : ModItem public override void AddRecipes() { - Recipe recipe = CreateRecipe(); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(ModContent.TileType()); - recipe.Register(); + CreateRecipe() + .AddIngredient(ModContent.ItemType()) + .AddIngredient(ModContent.ItemType(), 6) + .AddTile(ModContent.TileType()) + .Register(); } } diff --git a/Items/Weapons/Melee/Shortswords/Wakizashi.cs b/Items/Weapons/Melee/Shortswords/Wakizashi.cs index 7404ba8..a66739e 100644 --- a/Items/Weapons/Melee/Shortswords/Wakizashi.cs +++ b/Items/Weapons/Melee/Shortswords/Wakizashi.cs @@ -9,7 +9,6 @@ public class Wakizashi : ModItem { public override void SetStaticDefaults() { - DisplayName.SetDefault("Wakizashi"); Tooltip.SetDefault("Inflicts [c/007700:Poison] debuff for 5 seconds on hit"); } @@ -48,11 +47,11 @@ public class Wakizashi : ModItem public override void AddRecipes() { - Recipe recipe = CreateRecipe(); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddRecipeGroup("IronBar", 6); - recipe.AddIngredient(ItemID.Emerald, 2); - recipe.AddTile(TileID.Anvils); - recipe.Register(); + CreateRecipe() + .AddIngredient(ModContent.ItemType()) + .AddRecipeGroup("IronBar", 6) + .AddIngredient(ItemID.Emerald, 2) + .AddTile(TileID.Anvils) + .Register(); } } diff --git a/Items/Weapons/Melee/Swords/GoldenSlasher.cs b/Items/Weapons/Melee/Swords/GoldenSlasher.cs index 52dfebb..262268b 100644 --- a/Items/Weapons/Melee/Swords/GoldenSlasher.cs +++ b/Items/Weapons/Melee/Swords/GoldenSlasher.cs @@ -11,7 +11,6 @@ public class GoldenSlasher : ModItem { public override void SetStaticDefaults() { - DisplayName.SetDefault("Golden Slasher"); Tooltip.SetDefault("[c/B6FF00:Autoswings] \nShoots two homing golden orbs in a medium-sized spread on swing"); } @@ -40,24 +39,24 @@ public class GoldenSlasher : ModItem } } - public override void AddRecipes() + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Recipe val = CreateRecipe(); - val.AddIngredient(ModContent.ItemType(), 14); - val.AddTile(TileID.AdamantiteForge); - val.Register(); - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { float numberProjectiles = 2f; float rotation = MathHelper.ToRadians(25f); - position += Vector2.Normalize(new Vector2(velocity.X, velocity.Y)) * 45f; + position += Vector2.Normalize(velocity) * 45f; for (int i = 0; i < numberProjectiles; i++) { - Vector2 perturbedSpeed = Utils.RotatedBy(new Vector2(velocity.X, velocity.Y), (double)MathHelper.Lerp(0f - rotation, rotation, i / (numberProjectiles - 1f)), default) * 0.2f; - Projectile.NewProjectile(source, position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, knockback, player.whoAmI); + Vector2 perturbedSpeed = Utils.RotatedBy(velocity, (double)MathHelper.Lerp(0f - rotation, rotation, i / (numberProjectiles - 1f)), default) * 0.2f; + Projectile.NewProjectile(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI); } return false; } + + public override void AddRecipes() + { + CreateRecipe() + .AddIngredient(ModContent.ItemType(), 14) + .AddTile(TileID.AdamantiteForge) + .Register(); + } } diff --git a/Items/Weapons/Melee/Swords/RainbowClaymore.cs b/Items/Weapons/Melee/Swords/RainbowClaymore.cs index 1c93d27..629a199 100644 --- a/Items/Weapons/Melee/Swords/RainbowClaymore.cs +++ b/Items/Weapons/Melee/Swords/RainbowClaymore.cs @@ -41,25 +41,25 @@ public class RainbowClaymore : ModItem } } - public override void AddRecipes() + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Recipe val = CreateRecipe(); - val.AddIngredient(ModContent.ItemType()); - val.AddIngredient(ModContent.ItemType(), 14); - val.AddTile(ModContent.TileType()); - val.Register(); - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { float numberProjectiles = 3f; float rotation = MathHelper.ToRadians(45f); - position += Vector2.Normalize(new Vector2(velocity.X, velocity.Y)) * 45f; + position += Vector2.Normalize(velocity) * 45f; for (int i = 0; i < numberProjectiles; i++) { - Vector2 perturbedSpeed = Utils.RotatedBy(new Vector2(velocity.X, velocity.Y), (double)MathHelper.Lerp(0f - rotation, rotation, i / (numberProjectiles - 1f)), default) * 0.2f; - Projectile.NewProjectile(source, position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, knockback, player.whoAmI, 0f, 0f); + Vector2 perturbedSpeed = Utils.RotatedBy(velocity, (double)MathHelper.Lerp(0f - rotation, rotation, i / (numberProjectiles - 1f)), default) * 0.2f; + Projectile.NewProjectile(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI); } return false; } + + public override void AddRecipes() + { + CreateRecipe() + .AddIngredient(ModContent.ItemType()) + .AddIngredient(ModContent.ItemType(), 14) + .AddTile(ModContent.TileType()) + .Register(); + } } diff --git a/Items/Weapons/Melee/Swords/ShimadaSwords/CarbonSword.cs b/Items/Weapons/Melee/Swords/ShimadaSwords/CarbonSword.cs index 2422e29..9bc992a 100644 --- a/Items/Weapons/Melee/Swords/ShimadaSwords/CarbonSword.cs +++ b/Items/Weapons/Melee/Swords/ShimadaSwords/CarbonSword.cs @@ -1,4 +1,3 @@ -using FabusMod.Projectiles.Shimada; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,7 +10,6 @@ public class CarbonSword : ModItem { public override void SetStaticDefaults() { - DisplayName.SetDefault("Carbon Sword"); Tooltip.SetDefault("[c/B6FF00:Autoswings, dyeable]\nFires a stream of particles that deals damage three times\nInflicts [c/7B2D2F:Advanced Blood Loss] for 10 seconds when hit with the blade, dealing damage over time"); } @@ -28,19 +26,19 @@ public class CarbonSword : ModItem Item.knockBack = 2f; Item.value = Item.sellPrice(0, 6, 0, 0); Item.rare = ItemRarityID.LightRed; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { int numberProjectiles = 3; for (int i = 0; i < numberProjectiles; i++) { - Vector2 perturbedSpeed = Utils.RotatedByRandom(new Vector2(velocity.X, velocity.Y), (double)MathHelper.ToRadians(0f)); - Projectile.NewProjectile(source, position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, knockback, player.whoAmI, 0f, 0f); + Vector2 perturbedSpeed = Utils.RotatedByRandom(velocity, (double)MathHelper.ToRadians(0f)); + Projectile.NewProjectile(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI); } return false; } @@ -64,16 +62,16 @@ public class CarbonSword : ModItem public override void AddRecipes() { - Recipe recipe1 = CreateRecipe(); - recipe1.AddIngredient(ModContent.ItemType()); - recipe1.AddRecipeGroup("FabusMod:OrichalcumBar", 10); - recipe1.AddTile(TileID.DemonAltar); - recipe1.Register(); + CreateRecipe() + .AddIngredient(ModContent.ItemType()) + .AddRecipeGroup("FabusMod:OrichalcumBar", 10) + .AddTile(TileID.DemonAltar) + .Register(); - Recipe recipe2 = CreateRecipe(); - recipe2.AddIngredient(ModContent.ItemType()); - recipe2.AddIngredient(ItemID.BlueDye, 1); - recipe2.AddTile(TileID.DyeVat); - recipe2.Register(); + CreateRecipe() + .AddIngredient(ModContent.ItemType()) + .AddIngredient(ItemID.BlueDye, 1) + .AddTile(TileID.DyeVat) + .Register(); } } diff --git a/Items/Weapons/Melee/Swords/ShimadaSwords/CarbonSwordNihon.cs b/Items/Weapons/Melee/Swords/ShimadaSwords/CarbonSwordNihon.cs index e967bbf..4ab3e0d 100644 --- a/Items/Weapons/Melee/Swords/ShimadaSwords/CarbonSwordNihon.cs +++ b/Items/Weapons/Melee/Swords/ShimadaSwords/CarbonSwordNihon.cs @@ -1,4 +1,3 @@ -using FabusMod.Projectiles.Shimada; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -28,19 +27,19 @@ public class CarbonSwordNihon : ModItem Item.knockBack = 2f; Item.value = Item.sellPrice(0, 6, 0, 0); Item.rare = ItemRarityID.LightRed; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { int numberProjectiles = 3; for (int i = 0; i < numberProjectiles; i++) { - Vector2 perturbedSpeed = Utils.RotatedByRandom(new Vector2(velocity.X, velocity.Y), (double)MathHelper.ToRadians(0f)); - Projectile.NewProjectile(source, position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, knockback, player.whoAmI, 0f, 0f); + Vector2 perturbedSpeed = Utils.RotatedByRandom(velocity, (double)MathHelper.ToRadians(0f)); + Projectile.NewProjectile(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI); } return false; } @@ -64,10 +63,10 @@ public class CarbonSwordNihon : ModItem public override void AddRecipes() { - Recipe recipe = CreateRecipe(); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.SilverDye, 1); - recipe.AddTile(TileID.DyeVat); - recipe.Register(); + CreateRecipe() + .AddIngredient(ModContent.ItemType()) + .AddIngredient(ItemID.SilverDye, 1) + .AddTile(TileID.DyeVat) + .Register(); } } diff --git a/Items/Weapons/Melee/Swords/ShimadaSwords/DemonsFury.cs b/Items/Weapons/Melee/Swords/ShimadaSwords/DemonsFury.cs index 8e4777b..021a22d 100644 --- a/Items/Weapons/Melee/Swords/ShimadaSwords/DemonsFury.cs +++ b/Items/Weapons/Melee/Swords/ShimadaSwords/DemonsFury.cs @@ -1,4 +1,3 @@ -using FabusMod.Projectiles.Shimada; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -64,7 +63,7 @@ public class DemonsFury : ModItem Item.useAnimation = 60; Item.shootSpeed = 0f; Item.mana = 40; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.UseSound = SoundID.Item88; } else @@ -76,11 +75,11 @@ public class DemonsFury : ModItem Item.mana = 0; if (Utils.NextFloat(Main.rand) < 0.08f) { - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); } else { - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); } Item.UseSound = SoundID.Item1; } @@ -89,12 +88,12 @@ public class DemonsFury : ModItem public override void AddRecipes() { - Recipe recipe = CreateRecipe(); - recipe.AddRecipeGroup("FabusMod:CarbonSword", 1); - recipe.AddRecipeGroup("FabusMod:AdamantiteBar", 10); - recipe.AddIngredient(ItemID.SoulofNight, 8); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.DemonAltar); - recipe.Register(); + CreateRecipe() + .AddRecipeGroup("FabusMod:CarbonSword") + .AddRecipeGroup("FabusMod:AdamantiteBar", 10) + .AddIngredient(ItemID.SoulofNight, 8) + .AddIngredient(ModContent.ItemType(), 4) + .AddTile(TileID.DemonAltar) + .Register(); } } diff --git a/Items/Weapons/Melee/Swords/ShimadaSwords/TheRainbowsHonor.cs b/Items/Weapons/Melee/Swords/ShimadaSwords/DreamCatcher.cs similarity index 88% rename from Items/Weapons/Melee/Swords/ShimadaSwords/TheRainbowsHonor.cs rename to Items/Weapons/Melee/Swords/ShimadaSwords/DreamCatcher.cs index 9f43aaf..c05808c 100644 --- a/Items/Weapons/Melee/Swords/ShimadaSwords/TheRainbowsHonor.cs +++ b/Items/Weapons/Melee/Swords/ShimadaSwords/DreamCatcher.cs @@ -6,11 +6,10 @@ using Terraria.ModLoader; namespace FabusMod.Items.Weapons.Melee.Swords.ShimadaSwords; -public class TheRainbowsHonor : ModItem +public class DreamCatcher : ModItem { public override void SetStaticDefaults() { - DisplayName.SetDefault("Dream Catcher"); Tooltip.SetDefault("[c/B6FF00:Autoswings]\nFires a beam of particles that ignores immunity frames, pierces 8 times, and regenerates 1 Mana with every hit\nInflicts [c/806580:Bad Dream] for 16 seconds when hit with the blade, dealing damage over time\n uses 40 Mana to bring up [c/C4AB37:Midas]-inducing spikes from the ground, dealing damage with a 2% chance of granting a [c/FF52DC:Dream] stack\nHas a 10% chance to fire homing, soul-absorbing shards, healing for 20 HP and granting a stack of [c/FF52DC:Dream] when hit\nHaving 6 stacks of [c/FF52DC:Dream] restores 85 HP and Mana and puts you into an enraged state for 8 seconds, increasing melee damage dealt"); } @@ -42,19 +41,19 @@ public class TheRainbowsHonor : ModItem { if (Main.rand.NextBool(3)) { - int dust1 = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, ModContent.DustType(), 0f, 0f, 0, default(Color), 1f); + int dust1 = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, ModContent.DustType()); Main.dust[dust1].scale = 1f; Main.dust[dust1].velocity.Y = 0f; Main.dust[dust1].velocity.X = 0.5f; Main.dust[dust1].noGravity = true; - int dust2 = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, ModContent.DustType(), 0f, 0f, 0, default(Color), 1f); + int dust2 = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, ModContent.DustType()); Main.dust[dust2].scale = 1f; Main.dust[dust2].velocity.Y = 0f; Main.dust[dust2].velocity.X = 0.5f; Main.dust[dust2].noGravity = true; - int dust3 = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, ModContent.DustType(), 0f, 0f, 0, default(Color), 1f); + int dust3 = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, ModContent.DustType()); Main.dust[dust3].scale = 1f; Main.dust[dust3].velocity.Y = 0f; Main.dust[dust3].velocity.X = 0.5f; @@ -101,10 +100,10 @@ public class TheRainbowsHonor : ModItem public override void AddRecipes() { - Recipe recipe = CreateRecipe(); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(null, "RainbowStation"); - recipe.Register(); + CreateRecipe() + .AddIngredient(ModContent.ItemType()) + .AddIngredient(ModContent.ItemType(), 10) + .AddTile(null, "RainbowStation") + .Register(); } } diff --git a/Items/Weapons/Melee/Swords/ShimadaSwords/TheRainbowsHonor.png b/Items/Weapons/Melee/Swords/ShimadaSwords/DreamCatcher.png similarity index 100% rename from Items/Weapons/Melee/Swords/ShimadaSwords/TheRainbowsHonor.png rename to Items/Weapons/Melee/Swords/ShimadaSwords/DreamCatcher.png diff --git a/Items/Weapons/Melee/Swords/ShimadaSwords/GoldenFury.cs b/Items/Weapons/Melee/Swords/ShimadaSwords/GoldenFury.cs index a9c5d56..3199152 100644 --- a/Items/Weapons/Melee/Swords/ShimadaSwords/GoldenFury.cs +++ b/Items/Weapons/Melee/Swords/ShimadaSwords/GoldenFury.cs @@ -1,4 +1,3 @@ -using FabusMod.Projectiles.Shimada; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -10,7 +9,6 @@ public class GoldenFury : ModItem { public override void SetStaticDefaults() { - DisplayName.SetDefault("Golden Fury"); Tooltip.SetDefault("[c/B6FF00:Autoswings]\nFires a beam of particles that ignores immunity frames, pierces 6 times, and regenerates 1 Mana with every hit\nInflicts [c/7B2D2F:Advanced Blood Loss] for 14 seconds when hit with the blade, dealing damage over time\n uses 40 Mana to bring up [c/C4AB37:Midas]-inducing spikes from the ground, dealing damage with a 2% chance of granting an [c/D2D25A:Enrichment] stack\nHas a 10% chance to fire soul-absorbing shards, granting a stack of [c/D2D25A:Enrichment] when hit\nHaving 6 stacks of [c/D2D25A:Enrichment] restores 75 HP and Mana"); } @@ -42,11 +40,11 @@ public class GoldenFury : ModItem { if (Main.rand.NextBool(3)) { - int num1 = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, ModContent.DustType(), 0f, 0f, 0, default(Color), 1f); - Main.dust[num1].scale = 1f; - Main.dust[num1].velocity.Y = 0f; - Main.dust[num1].velocity.X = 0.5f; - Main.dust[num1].noGravity = true; + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, ModContent.DustType(), 0f, 0f, 0, default(Color), 1f); + Main.dust[dust].scale = 1f; + Main.dust[dust].velocity.Y = 0f; + Main.dust[dust].velocity.X = 0.5f; + Main.dust[dust].noGravity = true; } } @@ -64,7 +62,7 @@ public class GoldenFury : ModItem Item.useAnimation = 60; Item.shootSpeed = 0f; Item.mana = 40; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.UseSound = SoundID.Item88; } else @@ -76,11 +74,11 @@ public class GoldenFury : ModItem Item.mana = 0; if (Utils.NextFloat(Main.rand) < 0.1f) { - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); } else { - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); } Item.UseSound = SoundID.Item1; } @@ -89,11 +87,11 @@ public class GoldenFury : ModItem public override void AddRecipes() { - Recipe recipe = CreateRecipe(); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(TileID.DemonAltar); - recipe.Register(); + CreateRecipe() + .AddIngredient(ModContent.ItemType()) + .AddIngredient(ModContent.ItemType(), 10) + .AddIngredient(ModContent.ItemType(), 4) + .AddTile(TileID.DemonAltar) + .Register(); } } diff --git a/Items/Weapons/Melee/Swords/ShimadaSwords/ShimadaSword.cs b/Items/Weapons/Melee/Swords/ShimadaSwords/ShimadaSword.cs index f8ed83d..ab10a40 100644 --- a/Items/Weapons/Melee/Swords/ShimadaSwords/ShimadaSword.cs +++ b/Items/Weapons/Melee/Swords/ShimadaSwords/ShimadaSword.cs @@ -9,7 +9,6 @@ public class ShimadaSword : ModItem { public override void SetStaticDefaults() { - DisplayName.SetDefault("Shimada Sword"); Tooltip.SetDefault("Inflicts [c/7B2D2F:Blood Loss] for 3 seconds on hit, dealing damage over time"); } @@ -49,11 +48,11 @@ public class ShimadaSword : ModItem public override void AddRecipes() { - Recipe recipe = CreateRecipe(); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddRecipeGroup("FabusMod:LightsBane"); - recipe.AddIngredient(ItemID.Emerald, 10); - recipe.AddTile(TileID.Anvils); - recipe.Register(); + CreateRecipe() + .AddIngredient(ModContent.ItemType()) + .AddRecipeGroup("FabusMod:LightsBane") + .AddIngredient(ItemID.Emerald, 10) + .AddTile(TileID.Anvils) + .Register(); } } diff --git a/Items/Weapons/Melee/Swords/ShimadaSwords/StonePlatedKatana.cs b/Items/Weapons/Melee/Swords/ShimadaSwords/StonePlatedKatana.cs index e395794..094996f 100644 --- a/Items/Weapons/Melee/Swords/ShimadaSwords/StonePlatedKatana.cs +++ b/Items/Weapons/Melee/Swords/ShimadaSwords/StonePlatedKatana.cs @@ -30,10 +30,10 @@ public class StonePlatedKatana : ModItem public override void AddRecipes() { - Recipe recipe = CreateRecipe(); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.StoneBlock, 12); - recipe.AddTile(ModContent.TileType()); - recipe.Register(); + CreateRecipe() + .AddIngredient(ModContent.ItemType()) + .AddIngredient(ItemID.StoneBlock, 12) + .AddTile(ModContent.TileType()) + .Register(); } } diff --git a/Items/Weapons/Melee/Waraxes/RainbowAxe.cs b/Items/Weapons/Melee/Waraxes/SpectralShredder.cs similarity index 69% rename from Items/Weapons/Melee/Waraxes/RainbowAxe.cs rename to Items/Weapons/Melee/Waraxes/SpectralShredder.cs index eafba09..e0ba9cd 100644 --- a/Items/Weapons/Melee/Waraxes/RainbowAxe.cs +++ b/Items/Weapons/Melee/Waraxes/SpectralShredder.cs @@ -1,4 +1,3 @@ -using FabusMod.Projectiles; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -7,11 +6,10 @@ using Terraria.ModLoader; namespace FabusMod.Items.Weapons.Melee.Waraxes; -public class RainbowAxe : ModItem +public class SpectralShredder : ModItem { public override void SetStaticDefaults() { - DisplayName.SetDefault("Spectral Shredder"); Tooltip.SetDefault("[c/B6FF00:Autoswings] \nPressing fires a long-ranged Rainbow-Axe wall"); } @@ -59,7 +57,7 @@ public class RainbowAxe : ModItem Item.damage = 280; Item.axe = 38; Item.tileBoost = 6; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); } else { @@ -78,24 +76,24 @@ public class RainbowAxe : ModItem { float numberProjectiles = 16f; float rotation = MathHelper.ToRadians(35f); - position += Vector2.Normalize(new Vector2(velocity.X, velocity.Y)) * 80f; + position += Vector2.Normalize(velocity) * 80f; for (int i = 0; i < numberProjectiles; i++) { - Vector2 perturbedSpeed = Utils.RotatedBy(new Vector2(velocity.X, velocity.Y), (double)MathHelper.Lerp(0f - rotation, rotation, i / (numberProjectiles - 1f)), default) * 0.2f; - Projectile.NewProjectile(source, position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, knockback, player.whoAmI); + Vector2 perturbedSpeed = Utils.RotatedBy(velocity, (double)MathHelper.Lerp(0f - rotation, rotation, i / (numberProjectiles - 1f)), default) * 0.2f; + Projectile.NewProjectile(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI); } return false; } public override void AddRecipes() { - Recipe recipe = CreateRecipe(); - recipe.AddIngredient(ItemID.LunarHamaxeSolar); - recipe.AddIngredient(ItemID.LunarHamaxeVortex); - recipe.AddIngredient(ItemID.LunarHamaxeNebula); - recipe.AddIngredient(ItemID.LunarHamaxeStardust); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.AddTile(ModContent.TileType()); - recipe.Register(); + CreateRecipe() + .AddIngredient(ItemID.LunarHamaxeSolar) + .AddIngredient(ItemID.LunarHamaxeVortex) + .AddIngredient(ItemID.LunarHamaxeNebula) + .AddIngredient(ItemID.LunarHamaxeStardust) + .AddIngredient(ModContent.ItemType(), 14) + .AddTile(ModContent.TileType()) + .Register(); } } diff --git a/Items/Weapons/Melee/Waraxes/RainbowAxe.png b/Items/Weapons/Melee/Waraxes/SpectralShredder.png similarity index 100% rename from Items/Weapons/Melee/Waraxes/RainbowAxe.png rename to Items/Weapons/Melee/Waraxes/SpectralShredder.png