79 lines
2.9 KiB
C#
79 lines
2.9 KiB
C#
using CalamityMod.Items.Materials;
|
|
using CalamityMod.Items.Placeables;
|
|
using CalamityMod.Projectiles.Ranged;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Melee
|
|
{
|
|
public class Floodtide : ModItem
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Floodtide");
|
|
Tooltip.SetDefault("Launches sharks, because sharks are awesome!");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
item.damage = 89;
|
|
item.melee = true;
|
|
item.width = 80;
|
|
item.height = 92;
|
|
item.useTime = 21;
|
|
item.useAnimation = 21;
|
|
item.useTurn = true;
|
|
item.useStyle = ItemUseStyleID.SwingThrow;
|
|
item.knockBack = 6f;
|
|
item.value = Item.buyPrice(0, 60, 0, 0);
|
|
item.rare = ItemRarityID.Lime;
|
|
item.UseSound = SoundID.Item1;
|
|
item.autoReuse = true;
|
|
item.shoot = ModContent.ProjectileType<MiniSharkron>();
|
|
item.shootSpeed = 18f;
|
|
}
|
|
|
|
public override void UseStyle(Player player)
|
|
{
|
|
player.itemLocation += new Vector2(-4f * player.direction, 2f * player.gravDir).RotatedBy(player.itemRotation);
|
|
}
|
|
|
|
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
|
|
{
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f;
|
|
float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f;
|
|
int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f);
|
|
if (proj.WithinBounds(Main.maxProjectiles))
|
|
Main.projectile[proj].Calamity().forceMelee = true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public override void MeleeEffects(Player player, Rectangle hitbox)
|
|
{
|
|
if (Main.rand.NextBool(5))
|
|
{
|
|
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 217);
|
|
}
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
ModRecipe recipe = new ModRecipe(mod);
|
|
recipe.AddIngredient(ModContent.ItemType<VictideBar>(), 5);
|
|
recipe.AddIngredient(ItemID.SharkFin, 2);
|
|
recipe.AddRecipeGroup("AnyAdamantiteBar", 5);
|
|
recipe.AddIngredient(ModContent.ItemType<DepthCells>(), 10);
|
|
recipe.AddIngredient(ModContent.ItemType<Lumenite>(), 10);
|
|
recipe.AddIngredient(ModContent.ItemType<Tenebris>(), 5);
|
|
recipe.AddTile(TileID.MythrilAnvil);
|
|
recipe.SetResult(this);
|
|
recipe.AddRecipe();
|
|
}
|
|
}
|
|
}
|