Files
CalamityModPublic/Items/Weapons/Ranged/Minigun.cs
T

62 lines
2.2 KiB
C#

using CalamityMod.Items.Materials;
using CalamityMod.Rarities;
using CalamityMod.Tiles.Furniture.CraftingStations;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Ranged
{
public class Minigun : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
public override void SetDefaults()
{
Item.damage = 275;
Item.DamageType = DamageClass.Ranged;
Item.width = 92;
Item.height = 44;
Item.useTime = 3;
Item.useAnimation = 3;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.knockBack = 2.5f;
Item.value = CalamityGlobalItem.Rarity15BuyPrice;
Item.UseSound = SoundID.Item41;
Item.autoReuse = true;
Item.shoot = ProjectileID.PurificationPowder;
Item.shootSpeed = 22f;
Item.useAmmo = AmmoID.Bullet;
Item.rare = ModContent.RarityType<Violet>();
Item.Calamity().canFirePointBlankShots = true;
}
public override Vector2? HoldoutOffset()
{
return new Vector2(-10, 0);
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
float SpeedX = velocity.X + Main.rand.Next(-15, 16) * 0.05f;
float SpeedY = velocity.Y + Main.rand.Next(-15, 16) * 0.05f;
Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI);
return false;
}
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() > 0.8f;
public override void AddRecipes()
{
CreateRecipe().
AddIngredient(ItemID.ChainGun).
AddIngredient<ClockGatlignum>().
AddIngredient<AuricBar>(5).
AddTile<CosmicAnvil>().
Register();
}
}
}