using CalamityMod.Events; using CalamityMod.NPCs.Ravager; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; using Terraria.DataStructures; namespace CalamityMod.Items.SummonItems { [LegacyName("AncientMedallion")] public class DeathWhistle : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.SummonItems"; public override void SetStaticDefaults() { ItemID.Sets.SortingPriorityBossSpawns[Type] = 17; // Solar Tablet (1 above Lihzahrd Power Cell) } public override void SetDefaults() { Item.width = 20; Item.height = 20; Item.rare = ItemRarityID.Yellow; Item.useAnimation = 10; Item.useTime = 10; Item.useStyle = ItemUseStyleID.HoldUp; Item.consumable = false; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) { itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; } public override bool CanUseItem(Player player) { return !NPC.AnyNPCs(ModContent.NPCType()) && player.ZoneOverworldHeight && !BossRushEvent.BossRushActive; } public override bool? UseItem(Player player) { SoundEngine.PlaySound(SoundID.ScaryScream, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { int npc = NPC.NewNPC(new EntitySource_BossSpawn(player), (int)(player.position.X + Main.rand.Next(-250, 251)), (int)(player.position.Y - 500f), ModContent.NPCType(), 1); Main.npc[npc].timeLeft *= 20; CalamityUtils.BossAwakenMessage(npc); } else NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType()); return true; } public override void AddRecipes() { CreateRecipe(). AddIngredient(ItemID.LunarTabletFragment, 15). AddIngredient(ItemID.LihzahrdBrick, 25). AddTile(TileID.MythrilAnvil). Register(); } } }