67 lines
2.3 KiB
C#
67 lines
2.3 KiB
C#
using CalamityMod.Items.Materials;
|
|
using CalamityMod.Tiles.Furniture.CraftingStations;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Ranged
|
|
{
|
|
public class Minigun : ModItem
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Minigun");
|
|
Tooltip.SetDefault("80% chance to not consume ammo");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
item.damage = 275;
|
|
item.ranged = true;
|
|
item.width = 72;
|
|
item.height = 34;
|
|
item.useTime = 3;
|
|
item.useAnimation = 3;
|
|
item.useStyle = ItemUseStyleID.HoldingOut;
|
|
item.noMelee = true;
|
|
item.knockBack = 2.5f;
|
|
item.value = CalamityGlobalItem.Rarity15BuyPrice;
|
|
item.rare = ItemRarityID.Purple;
|
|
item.UseSound = SoundID.Item41;
|
|
item.autoReuse = true;
|
|
item.shoot = ProjectileID.PurificationPowder;
|
|
item.shootSpeed = 22f;
|
|
item.useAmmo = AmmoID.Bullet;
|
|
item.Calamity().customRarity = CalamityRarity.Violet;
|
|
item.Calamity().canFirePointBlankShots = true;
|
|
}
|
|
|
|
public override Vector2? HoldoutOffset()
|
|
{
|
|
return new Vector2(-10, 0);
|
|
}
|
|
|
|
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
|
|
{
|
|
float SpeedX = speedX + Main.rand.Next(-15, 16) * 0.05f;
|
|
float SpeedY = speedY + Main.rand.Next(-15, 16) * 0.05f;
|
|
Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI);
|
|
return false;
|
|
}
|
|
|
|
public override bool ConsumeAmmo(Player player) => Main.rand.NextFloat() > 0.8f;
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
ModRecipe recipe = new ModRecipe(mod);
|
|
recipe.AddIngredient(ItemID.ChainGun);
|
|
recipe.AddIngredient(ModContent.ItemType<ClockGatlignum>());
|
|
recipe.AddIngredient(ModContent.ItemType<AuricBar>(), 5);
|
|
recipe.AddTile(ModContent.TileType<CosmicAnvil>());
|
|
recipe.SetResult(this);
|
|
recipe.AddRecipe();
|
|
}
|
|
}
|
|
}
|