57 lines
1.9 KiB
C#
57 lines
1.9 KiB
C#
using Terraria.DataStructures;
|
|
using CalamityMod.Projectiles.Ranged;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Ranged
|
|
{
|
|
public class OverloadedBlaster : ModItem, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Items.Weapons.Ranged";
|
|
public override void SetDefaults()
|
|
{
|
|
Item.damage = 16;
|
|
Item.DamageType = DamageClass.Ranged;
|
|
Item.width = 42;
|
|
Item.height = 34;
|
|
Item.useTime = 16;
|
|
Item.useAnimation = 16;
|
|
Item.useStyle = ItemUseStyleID.Shoot;
|
|
Item.noMelee = true;
|
|
Item.knockBack = 1.5f;
|
|
Item.value = CalamityGlobalItem.Rarity4BuyPrice;
|
|
Item.rare = ItemRarityID.LightRed;
|
|
Item.UseSound = SoundID.Item9;
|
|
Item.autoReuse = true;
|
|
Item.shootSpeed = 6.5f;
|
|
Item.shoot = ModContent.ProjectileType<SlimeBolt>();
|
|
Item.useAmmo = AmmoID.Gel;
|
|
}
|
|
|
|
public override Vector2? HoldoutOffset()
|
|
{
|
|
return new Vector2(-4, -5);
|
|
}
|
|
|
|
public override bool CanConsumeAmmo(Item ammo, Player player)
|
|
{
|
|
if (Main.rand.Next(0, 100) < 33)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
|
{
|
|
for (int index = 0; index < 5; ++index)
|
|
{
|
|
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;
|
|
}
|
|
}
|
|
}
|