Files
CalamityModPublic/Items/Weapons/Magic/PlagueStaff.cs
T

50 lines
1.7 KiB
C#

using CalamityMod.Projectiles.Magic;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Magic
{
public class PlagueStaff : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Magic";
public override void SetStaticDefaults()
{
Item.staff[Item.type] = true;
}
public override void SetDefaults()
{
Item.damage = 78;
Item.DamageType = DamageClass.Magic;
Item.mana = 22;
Item.width = 46;
Item.height = 46;
Item.useTime = 21;
Item.useAnimation = 21;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.knockBack = 8f;
Item.value = CalamityGlobalItem.Rarity8BuyPrice;
Item.rare = ItemRarityID.Yellow;
Item.UseSound = SoundID.Item43;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<PlagueFang>();
Item.shootSpeed = 16f;
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
for (int i = 0; i < 3; i++)
{
Vector2 spreadVelocity = velocity.RotatedByRandom(MathHelper.ToRadians(5f)) * Main.rand.NextFloat(0.8f, 1.2f);
Projectile.NewProjectile(source, position, spreadVelocity, type, damage, knockback, Main.myPlayer);
}
return true; // Fires one directly with no randomness, totaling 4 projectiles
}
}
}