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

49 lines
1.7 KiB
C#

using Terraria.DataStructures;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Ranged
{
public class P90 : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
public override void SetDefaults()
{
Item.damage = 8;
Item.DamageType = DamageClass.Ranged;
Item.width = 60;
Item.height = 28;
Item.useTime = 5;
Item.useAnimation = 5;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.knockBack = 1.5f;
Item.value = CalamityGlobalItem.Rarity4BuyPrice;
Item.rare = ItemRarityID.LightRed;
Item.UseSound = SoundID.Item11;
Item.autoReuse = true;
Item.shoot = ProjectileID.Bullet;
Item.shootSpeed = 7f;
Item.useAmmo = AmmoID.Bullet;
Item.Calamity().canFirePointBlankShots = true;
}
public override Vector2? HoldoutOffset()
{
return new Vector2(-14, -1);
}
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, 0f, 0f);
return false;
}
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() < 0.5f;
}
}