using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Magic { [LegacyName("Genisis")] public class Genesis : ModItem, ILocalizedModType { public static float FireRate = 15f; public static float StarterWindup = 60f; public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() { Item.width = 108; Item.height = 46; Item.damage = 65; Item.DamageType = DamageClass.Magic; Item.mana = 20; Item.useAnimation = Item.useTime = 5; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.UseSound = null; Item.autoReuse = true; Item.shootSpeed = 6f; Item.channel = true; Item.noUseGraphic = true; Item.shoot = ModContent.ProjectileType(); } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] == 0; // Makes the rotation of the mouse around the player sync in multiplayer. public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); holdout.velocity = player.Calamity().mouseWorld - player.RotatedRelativePoint(player.MountedCenter); return false; } public override void AddRecipes() { CreateRecipe(). AddIngredient(ItemID.LaserRifle). AddIngredient(ItemID.LunarBar, 5). AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } } }