Cleaned up code for melee weapons.
This commit is contained in:
@@ -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<Wakizashi>());
|
||||
recipe1.AddRecipeGroup("FabusMod:OrichalcumBar", 6);
|
||||
recipe1.AddIngredient(ItemID.Sapphire, 2);
|
||||
recipe1.AddTile(TileID.MythrilAnvil);
|
||||
recipe1.Register();
|
||||
CreateRecipe()
|
||||
.AddIngredient(ModContent.ItemType<Wakizashi>())
|
||||
.AddRecipeGroup("FabusMod:OrichalcumBar", 6)
|
||||
.AddIngredient(ItemID.Sapphire, 2)
|
||||
.AddTile(TileID.MythrilAnvil)
|
||||
.Register();
|
||||
|
||||
Recipe recipe2 = CreateRecipe();
|
||||
recipe2.AddIngredient(ModContent.ItemType<CarbonDaggerNihon>());
|
||||
recipe2.AddIngredient(ItemID.BlueDye, 1);
|
||||
recipe2.AddTile(TileID.DyeVat);
|
||||
recipe2.Register();
|
||||
CreateRecipe()
|
||||
.AddIngredient(ModContent.ItemType<CarbonDaggerNihon>())
|
||||
.AddIngredient(ItemID.BlueDye)
|
||||
.AddTile(TileID.DyeVat)
|
||||
.Register();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<CarbonDagger>());
|
||||
recipe.AddIngredient(ItemID.BlueDye, 1);
|
||||
recipe.AddTile(TileID.DyeVat);
|
||||
recipe.Register();
|
||||
CreateRecipe()
|
||||
.AddIngredient(ModContent.ItemType<CarbonDagger>())
|
||||
.AddIngredient(ItemID.BlueDye)
|
||||
.AddTile(TileID.DyeVat)
|
||||
.Register();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<GoldenKnife>();
|
||||
Item.shoot = ModContent.ProjectileType<Projectiles.Shortsword.GoldenKnife>();
|
||||
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<OniDagger>());
|
||||
recipe.AddIngredient(ModContent.ItemType<Items.CraftingIngredients.GoddessGold>(), 6);
|
||||
recipe.AddIngredient(ModContent.ItemType<Items.CraftingIngredients.SoulofWisdom>(), 4);
|
||||
recipe.AddTile(TileID.AdamantiteForge);
|
||||
recipe.Register();
|
||||
CreateRecipe()
|
||||
.AddIngredient(ModContent.ItemType<OniDagger>())
|
||||
.AddIngredient(ModContent.ItemType<Items.CraftingIngredients.GoddessGold>(), 6)
|
||||
.AddIngredient(ModContent.ItemType<Items.CraftingIngredients.SoulofWisdom>(), 4)
|
||||
.AddTile(TileID.AdamantiteForge)
|
||||
.Register();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<Items.CraftingIngredients.SoulofWisdom>(), 2);
|
||||
recipe.AddTile(TileID.MythrilAnvil);
|
||||
recipe.Register();
|
||||
CreateRecipe()
|
||||
.AddRecipeGroup("FabusMod:CarbonDagger")
|
||||
.AddRecipeGroup("FabusMod:AdamantiteBar", 6)
|
||||
.AddIngredient(ItemID.SoulofNight, 4)
|
||||
.AddIngredient(ModContent.ItemType<Items.CraftingIngredients.SoulofWisdom>(), 2)
|
||||
.AddTile(TileID.MythrilAnvil)
|
||||
.Register();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,10 +29,10 @@ public class StonePlatedShortsword : ModItem
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
Recipe recipe = CreateRecipe();
|
||||
recipe.AddIngredient(ModContent.ItemType<Items.WeaponParts.UntreatedShortswordPart>());
|
||||
recipe.AddIngredient(ItemID.StoneBlock, 6);
|
||||
recipe.AddTile(ModContent.TileType<global::FabusMod.Tiles.ReinforcedWorkBench>());
|
||||
recipe.Register();
|
||||
CreateRecipe()
|
||||
.AddIngredient(ModContent.ItemType<Items.WeaponParts.UntreatedShortswordPart>())
|
||||
.AddIngredient(ItemID.StoneBlock, 6)
|
||||
.AddTile(ModContent.TileType<global::FabusMod.Tiles.ReinforcedWorkBench>())
|
||||
.Register();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<GoldenDagger>());
|
||||
recipe.AddIngredient(ModContent.ItemType<Bars.RainbowChunk>(), 6);
|
||||
recipe.AddTile(ModContent.TileType<global::FabusMod.Tiles.RainbowStation>());
|
||||
recipe.Register();
|
||||
CreateRecipe()
|
||||
.AddIngredient(ModContent.ItemType<GoldenDagger>())
|
||||
.AddIngredient(ModContent.ItemType<Bars.RainbowChunk>(), 6)
|
||||
.AddTile(ModContent.TileType<global::FabusMod.Tiles.RainbowStation>())
|
||||
.Register();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<StonePlatedShortsword>());
|
||||
recipe.AddRecipeGroup("IronBar", 6);
|
||||
recipe.AddIngredient(ItemID.Emerald, 2);
|
||||
recipe.AddTile(TileID.Anvils);
|
||||
recipe.Register();
|
||||
CreateRecipe()
|
||||
.AddIngredient(ModContent.ItemType<StonePlatedShortsword>())
|
||||
.AddRecipeGroup("IronBar", 6)
|
||||
.AddIngredient(ItemID.Emerald, 2)
|
||||
.AddTile(TileID.Anvils)
|
||||
.Register();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user