Files
CalamityModPublic/Items/SummonItems/DesertMedallion.cs
T

77 lines
2.8 KiB
C#

using CalamityMod.Events;
using CalamityMod.Items.Materials;
using CalamityMod.NPCs.DesertScourge;
using CalamityMod.World;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.SummonItems
{
[LegacyName("DriedSeafood")]
public class DesertMedallion : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.SummonItems";
public override void SetStaticDefaults()
{
ItemID.Sets.SortingPriorityBossSpawns[Type] = 1; // Suspicious Looking Eye
}
public override void SetDefaults()
{
Item.width = 28;
Item.height = 28;
Item.rare = ItemRarityID.Green;
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 player.ZoneDesert && !NPC.AnyNPCs(ModContent.NPCType<DesertScourgeHead>()) && !BossRushEvent.BossRushActive;
}
public override bool? UseItem(Player player)
{
SoundEngine.PlaySound(SoundID.Roar, player.Center);
if (Main.netMode != NetmodeID.MultiplayerClient)
NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType<DesertScourgeHead>());
else
NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType<DesertScourgeHead>());
if (CalamityWorld.revenge)
{
if (Main.netMode != NetmodeID.MultiplayerClient)
NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType<DesertNuisanceHead>());
else
NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType<DesertNuisanceHead>());
if (Main.netMode != NetmodeID.MultiplayerClient)
NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType<DesertNuisanceHead>());
else
NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType<DesertNuisanceHead>());
}
return true;
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient(ItemID.SandBlock, 40).
AddIngredient(ItemID.AntlionMandible, 4).
AddIngredient<StormlionMandible>(2).
AddTile(TileID.DemonAltar).
Register();
}
}
}