74 lines
2.4 KiB
C#
74 lines
2.4 KiB
C#
using CalamityMod.Items.Materials;
|
|
using CalamityMod.Projectiles.Ranged;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Ranged
|
|
{
|
|
public class OverloadedBlaster : ModItem
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Overloaded Blaster");
|
|
Tooltip.SetDefault("33% chance to not consume gel\n" +
|
|
"Fires a large spread of bouncing slime");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
item.damage = 16;
|
|
item.ranged = true;
|
|
item.width = 42;
|
|
item.height = 20;
|
|
item.useTime = 17;
|
|
item.useAnimation = 17;
|
|
item.useStyle = 5;
|
|
item.noMelee = true;
|
|
item.knockBack = 1.5f;
|
|
item.value = Item.buyPrice(0, 12, 0, 0);
|
|
item.rare = 4;
|
|
item.UseSound = SoundID.Item9;
|
|
item.autoReuse = true;
|
|
item.shootSpeed = 6.5f;
|
|
item.shoot = ModContent.ProjectileType<SlimeBolt>();
|
|
item.useAmmo = 23;
|
|
}
|
|
|
|
public override Vector2? HoldoutOffset()
|
|
{
|
|
return new Vector2(-4, 0);
|
|
}
|
|
|
|
public override bool ConsumeAmmo(Player player)
|
|
{
|
|
if (Main.rand.Next(0, 100) < 33)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
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 index = 0; index < 5; ++index)
|
|
{
|
|
float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f;
|
|
float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f;
|
|
Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
ModRecipe recipe = new ModRecipe(mod);
|
|
recipe.AddIngredient(ModContent.ItemType<PurifiedGel>(), 15);
|
|
recipe.AddIngredient(ItemID.Gel, 30);
|
|
recipe.AddIngredient(ItemID.HellstoneBar, 5);
|
|
recipe.AddTile(TileID.Anvils);
|
|
recipe.SetResult(this);
|
|
recipe.AddRecipe();
|
|
}
|
|
}
|
|
}
|