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

48 lines
1.7 KiB
C#

using Terraria.DataStructures;
using CalamityMod.Projectiles.Ranged;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Sounds;
namespace CalamityMod.Items.Weapons.Ranged
{
public class ClamorRifle : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
public override void SetDefaults()
{
Item.damage = 36;
Item.DamageType = DamageClass.Ranged;
Item.width = 64;
Item.height = 30;
Item.useTime = 15;
Item.useAnimation = 15;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.knockBack = 2.5f;
Item.value = CalamityGlobalItem.Rarity5BuyPrice;
Item.UseSound = CommonCalamitySounds.PlasmaBoltSound;
Item.autoReuse = true;
Item.rare = ItemRarityID.Pink;
Item.shoot = ModContent.ProjectileType<ClamorRifleProj>();
Item.shootSpeed = 15f;
Item.useAmmo = AmmoID.Bullet;
Item.Calamity().canFirePointBlankShots = true;
}
public override Vector2? HoldoutOffset() => new Vector2(-5, 0);
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
if (type == ProjectileID.Bullet)
Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType<ClamorRifleProj>(), damage, knockback, player.whoAmI);
else
Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI);
return false;
}
}
}