72 lines
2.5 KiB
C#
72 lines
2.5 KiB
C#
using CalamityMod.Items.Materials;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Ranged
|
|
{
|
|
public class Goobow : ModItem
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Goobow");
|
|
Tooltip.SetDefault("Fires two streams of slime");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
item.damage = 40;
|
|
item.ranged = true;
|
|
item.width = 30;
|
|
item.height = 48;
|
|
item.useTime = 20;
|
|
item.useAnimation = 20;
|
|
item.useStyle = 5;
|
|
item.noMelee = true;
|
|
item.knockBack = 3f;
|
|
item.value = Item.buyPrice(0, 12, 0, 0);
|
|
item.rare = 4;
|
|
item.UseSound = SoundID.Item5;
|
|
item.autoReuse = true;
|
|
item.shoot = 10;
|
|
item.shootSpeed = 12f;
|
|
item.useAmmo = 40;
|
|
}
|
|
|
|
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
|
|
{
|
|
Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true);
|
|
float num117 = 0.314159274f;
|
|
int num118 = 2;
|
|
Vector2 vector7 = new Vector2(speedX, speedY);
|
|
vector7.Normalize();
|
|
vector7 *= 20f;
|
|
bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0);
|
|
for (int num119 = 0; num119 < num118; num119++)
|
|
{
|
|
float num120 = (float)num119 - ((float)num118 - 1f) / 2f;
|
|
Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default);
|
|
if (!flag11)
|
|
{
|
|
value9 -= vector7;
|
|
}
|
|
int projectile = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX * 0.6f, speedY * 0.6f, ProjectileID.SlimeGun, damage / 4, 0f, player.whoAmI, 0f, 0f);
|
|
Main.projectile[projectile].Calamity().forceRanged = true;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
ModRecipe recipe = new ModRecipe(mod);
|
|
recipe.AddIngredient(ModContent.ItemType<PurifiedGel>(), 18);
|
|
recipe.AddIngredient(ItemID.Gel, 30);
|
|
recipe.AddIngredient(ItemID.HellstoneBar, 5);
|
|
recipe.AddTile(TileID.Anvils);
|
|
recipe.SetResult(this);
|
|
recipe.AddRecipe();
|
|
}
|
|
}
|
|
}
|