57 lines
2.0 KiB
C#
57 lines
2.0 KiB
C#
using CalamityMod.Rarities;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.DataStructures;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Ranged
|
|
{
|
|
public class StormDragoon : ModItem, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Items.Weapons.Ranged";
|
|
public override void SetDefaults()
|
|
{
|
|
Item.damage = 96;
|
|
Item.DamageType = DamageClass.Ranged;
|
|
Item.width = 74;
|
|
Item.height = 34;
|
|
Item.useTime = 2;
|
|
Item.useAnimation = 20;
|
|
Item.reuseDelay = 10;
|
|
Item.useLimitPerAnimation = 10;
|
|
Item.useStyle = ItemUseStyleID.Shoot;
|
|
Item.noMelee = true;
|
|
Item.knockBack = 3.25f;
|
|
Item.value = CalamityGlobalItem.Rarity12BuyPrice;
|
|
Item.rare = ModContent.RarityType<Turquoise>();
|
|
Item.UseSound = SoundID.Item31;
|
|
Item.autoReuse = true;
|
|
Item.shoot = ProjectileID.PurificationPowder;
|
|
Item.shootSpeed = 18f;
|
|
Item.useAmmo = AmmoID.Bullet;
|
|
Item.Calamity().canFirePointBlankShots = true;
|
|
}
|
|
|
|
public override Vector2? HoldoutOffset()
|
|
{
|
|
return new Vector2(-25, 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 + (float)Main.rand.Next(-40, 41) * 0.05f;
|
|
float SpeedY = velocity.Y + (float)Main.rand.Next(-40, 41) * 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)
|
|
{
|
|
if (Main.rand.Next(0, 100) < 90)
|
|
return false;
|
|
return true;
|
|
}
|
|
}
|
|
}
|