53 lines
2.1 KiB
C#
53 lines
2.1 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 RealmRavager : ModItem, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Items.Weapons.Ranged";
|
|
public override void SetDefaults()
|
|
{
|
|
Item.damage = 50;
|
|
Item.DamageType = DamageClass.Ranged;
|
|
Item.width = 76;
|
|
Item.height = 32;
|
|
Item.useTime = 22;
|
|
Item.useAnimation = 22;
|
|
Item.useStyle = ItemUseStyleID.Shoot;
|
|
Item.noMelee = true;
|
|
Item.knockBack = 4f;
|
|
Item.value = CalamityGlobalItem.Rarity8BuyPrice;
|
|
Item.rare = ItemRarityID.Yellow;
|
|
Item.UseSound = SoundID.Item38;
|
|
Item.autoReuse = true;
|
|
Item.shootSpeed = 30f;
|
|
Item.shoot = ModContent.ProjectileType<RealmRavagerBullet>();
|
|
Item.useAmmo = AmmoID.Bullet;
|
|
Item.Calamity().canFirePointBlankShots = true;
|
|
}
|
|
|
|
public override Vector2? HoldoutOffset() => new Vector2(-10, 0);
|
|
|
|
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
|
{
|
|
int numBullets = Main.rand.NextBool() ? 4 : 3;
|
|
for (int index = 0; index < numBullets; ++index)
|
|
{
|
|
float SpeedX = velocity.X + Main.rand.Next(-75, 76) * 0.05f;
|
|
float SpeedY = velocity.Y + Main.rand.Next(-75, 76) * 0.05f;
|
|
|
|
if (type == ProjectileID.Bullet)
|
|
Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType<RealmRavagerBullet>(), damage, knockback, player.whoAmI);
|
|
else
|
|
Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI);
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
}
|