63 lines
2.3 KiB
C#
63 lines
2.3 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using CalamityMod.Rarities;
|
|
using CalamityMod.World;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.Audio;
|
|
using Terraria.DataStructures;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.Weapons.Ranged
|
|
{
|
|
public class HalibutCannon : ModItem, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Items.Weapons.Ranged";
|
|
public override void SetDefaults()
|
|
{
|
|
Item.damage = 50;
|
|
Item.DamageType = DamageClass.Ranged;
|
|
Item.width = 118;
|
|
Item.height = 56;
|
|
Item.useTime = 10;
|
|
Item.useAnimation = 20;
|
|
Item.useStyle = ItemUseStyleID.Shoot;
|
|
Item.rare = ModContent.RarityType<HotPink>();
|
|
Item.noMelee = true;
|
|
Item.knockBack = 1f;
|
|
Item.value = CalamityGlobalItem.Rarity16BuyPrice;
|
|
Item.UseSound = null;
|
|
Item.autoReuse = true;
|
|
Item.shoot = ProjectileID.Bullet;
|
|
Item.shootSpeed = 12f;
|
|
Item.useAmmo = AmmoID.Bullet;
|
|
Item.Calamity().canFirePointBlankShots = true;
|
|
}
|
|
|
|
public override Vector2? HoldoutOffset() => new Vector2(-15, 0);
|
|
|
|
public override void ModifyTooltips(List<TooltipLine> list) => list.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal"));
|
|
|
|
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
|
{
|
|
SoundEngine.PlaySound(SoundID.Item38, player.Center);
|
|
|
|
// Really jammed in GFB
|
|
if (Main.zenithWorld)
|
|
return Main.rand.NextBool(5);
|
|
|
|
int bulletAmt = Main.rand.Next(25, 36);
|
|
for (int index = 0; index < bulletAmt; ++index)
|
|
{
|
|
float SpeedX = velocity.X + Main.rand.Next(-10, 11) * 0.05f;
|
|
float SpeedY = velocity.Y + Main.rand.Next(-10, 11) * 0.05f;
|
|
int shot = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI);
|
|
Main.projectile[shot].timeLeft = 120;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|