Cleaned up code for melee weapons.

This commit is contained in:
Big Duckie
2022-07-05 19:43:21 -06:00
parent 1871f6cfe8
commit 148d1fc728
19 changed files with 168 additions and 182 deletions
+12 -13
View File
@@ -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<Items.CraftingIngredients.GoddessGold>(), 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<Items.CraftingIngredients.GoddessGold>(), 14)
.AddTile(TileID.AdamantiteForge)
.Register();
}
}
+13 -13
View File
@@ -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<GoldenSlasher>());
val.AddIngredient(ModContent.ItemType<Bars.RainbowChunk>(), 14);
val.AddTile(ModContent.TileType<global::FabusMod.Tiles.RainbowStation>());
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<GoldenSlasher>())
.AddIngredient(ModContent.ItemType<Bars.RainbowChunk>(), 14)
.AddTile(ModContent.TileType<global::FabusMod.Tiles.RainbowStation>())
.Register();
}
}
@@ -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<ShimadaWave>();
Item.shoot = ModContent.ProjectileType<Projectiles.Shimada.ShimadaWave>();
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<ShimadaSword>());
recipe1.AddRecipeGroup("FabusMod:OrichalcumBar", 10);
recipe1.AddTile(TileID.DemonAltar);
recipe1.Register();
CreateRecipe()
.AddIngredient(ModContent.ItemType<ShimadaSword>())
.AddRecipeGroup("FabusMod:OrichalcumBar", 10)
.AddTile(TileID.DemonAltar)
.Register();
Recipe recipe2 = CreateRecipe();
recipe2.AddIngredient(ModContent.ItemType<CarbonSwordNihon>());
recipe2.AddIngredient(ItemID.BlueDye, 1);
recipe2.AddTile(TileID.DyeVat);
recipe2.Register();
CreateRecipe()
.AddIngredient(ModContent.ItemType<CarbonSwordNihon>())
.AddIngredient(ItemID.BlueDye, 1)
.AddTile(TileID.DyeVat)
.Register();
}
}
@@ -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<ShimadaWaveNihon>();
Item.shoot = ModContent.ProjectileType<Projectiles.Shimada.ShimadaWaveNihon>();
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<CarbonSword>());
recipe.AddIngredient(ItemID.SilverDye, 1);
recipe.AddTile(TileID.DyeVat);
recipe.Register();
CreateRecipe()
.AddIngredient(ModContent.ItemType<CarbonSword>())
.AddIngredient(ItemID.SilverDye, 1)
.AddTile(TileID.DyeVat)
.Register();
}
}
@@ -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<DemonProjRMB>();
Item.shoot = ModContent.ProjectileType<Projectiles.Shimada.DemonProjRMB>();
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<DemonProjTwo>();
Item.shoot = ModContent.ProjectileType<Projectiles.Shimada.DemonProjTwo>();
}
else
{
Item.shoot = ModContent.ProjectileType<DemonWave>();
Item.shoot = ModContent.ProjectileType<Projectiles.Shimada.DemonWave>();
}
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<Items.CraftingIngredients.SoulofWisdom>(), 4);
recipe.AddTile(TileID.DemonAltar);
recipe.Register();
CreateRecipe()
.AddRecipeGroup("FabusMod:CarbonSword")
.AddRecipeGroup("FabusMod:AdamantiteBar", 10)
.AddIngredient(ItemID.SoulofNight, 8)
.AddIngredient(ModContent.ItemType<Items.CraftingIngredients.SoulofWisdom>(), 4)
.AddTile(TileID.DemonAltar)
.Register();
}
}
@@ -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<right> 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<Dusts.RainbowDust>(), 0f, 0f, 0, default(Color), 1f);
int dust1 = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, ModContent.DustType<Dusts.RainbowDust>());
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<Dusts.RainbowDust2>(), 0f, 0f, 0, default(Color), 1f);
int dust2 = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, ModContent.DustType<Dusts.RainbowDust2>());
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<Dusts.RainbowDust3>(), 0f, 0f, 0, default(Color), 1f);
int dust3 = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, ModContent.DustType<Dusts.RainbowDust3>());
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<GoldenFury>());
recipe.AddIngredient(ModContent.ItemType<Bars.RainbowChunk>(), 10);
recipe.AddTile(null, "RainbowStation");
recipe.Register();
CreateRecipe()
.AddIngredient(ModContent.ItemType<GoldenFury>())
.AddIngredient(ModContent.ItemType<Bars.RainbowChunk>(), 10)
.AddTile(null, "RainbowStation")
.Register();
}
}

Before

Width:  |  Height:  |  Size: 1009 B

After

Width:  |  Height:  |  Size: 1009 B

@@ -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<right> 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<Dusts.MeatDust>(), 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<Dusts.MeatDust>(), 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<GoldenFuryProjRMB>();
Item.shoot = ModContent.ProjectileType<Projectiles.Shimada.GoldenFuryProjRMB>();
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<GoldenFuryProjTwo>();
Item.shoot = ModContent.ProjectileType<Projectiles.Shimada.GoldenFuryProjTwo>();
}
else
{
Item.shoot = ModContent.ProjectileType<GoldenFuryWave>();
Item.shoot = ModContent.ProjectileType<Projectiles.Shimada.GoldenFuryWave>();
}
Item.UseSound = SoundID.Item1;
}
@@ -89,11 +87,11 @@ public class GoldenFury : ModItem
public override void AddRecipes()
{
Recipe recipe = CreateRecipe();
recipe.AddIngredient(ModContent.ItemType<DemonsFury>());
recipe.AddIngredient(ModContent.ItemType<Items.CraftingIngredients.GoddessGold>(), 10);
recipe.AddIngredient(ModContent.ItemType<Items.CraftingIngredients.SoulofWisdom>(), 4);
recipe.AddTile(TileID.DemonAltar);
recipe.Register();
CreateRecipe()
.AddIngredient(ModContent.ItemType<DemonsFury>())
.AddIngredient(ModContent.ItemType<Items.CraftingIngredients.GoddessGold>(), 10)
.AddIngredient(ModContent.ItemType<Items.CraftingIngredients.SoulofWisdom>(), 4)
.AddTile(TileID.DemonAltar)
.Register();
}
}
@@ -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<StonePlatedKatana>());
recipe.AddRecipeGroup("FabusMod:LightsBane");
recipe.AddIngredient(ItemID.Emerald, 10);
recipe.AddTile(TileID.Anvils);
recipe.Register();
CreateRecipe()
.AddIngredient(ModContent.ItemType<StonePlatedKatana>())
.AddRecipeGroup("FabusMod:LightsBane")
.AddIngredient(ItemID.Emerald, 10)
.AddTile(TileID.Anvils)
.Register();
}
}
@@ -30,10 +30,10 @@ public class StonePlatedKatana : ModItem
public override void AddRecipes()
{
Recipe recipe = CreateRecipe();
recipe.AddIngredient(ModContent.ItemType<Items.WeaponParts.UntreatedSwordParts>());
recipe.AddIngredient(ItemID.StoneBlock, 12);
recipe.AddTile(ModContent.TileType<global::FabusMod.Tiles.ReinforcedWorkBench>());
recipe.Register();
CreateRecipe()
.AddIngredient(ModContent.ItemType<Items.WeaponParts.UntreatedSwordParts>())
.AddIngredient(ItemID.StoneBlock, 12)
.AddTile(ModContent.TileType<global::FabusMod.Tiles.ReinforcedWorkBench>())
.Register();
}
}