using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Magic { public class GhastlyVisage : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { Item.damage = 120; Item.DamageType = DamageClass.Magic; Item.noUseGraphic = true; Item.channel = true; Item.mana = 20; Item.width = 32; Item.height = 36; Item.useTime = 27; Item.useAnimation = 27; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; Item.shootSpeed = 9f; Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.Rarity13BuyPrice; Item.rare = ModContent.RarityType(); } public override void OnConsumeMana(Player player, int manaConsumed) => player.statMana += manaConsumed; // This weapon uses a holdout projectile. public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Magic/GhastlyVisageGlow").Value); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } } }