Files
CalamityModPublic/Items/SummonItems/Abombination.cs
T
2023-08-10 21:12:50 +07:00

64 lines
2.1 KiB
C#

using CalamityMod.Events;
using CalamityMod.Items.Materials;
using CalamityMod.NPCs.PlaguebringerGoliath;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Items.SummonItems
{
[LegacyName("Abomination")]
public class Abombination : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.SummonItems";
public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/PBGSummon");
public override void SetStaticDefaults()
{
ItemID.Sets.SortingPriorityBossSpawns[Type] = 17; // Solar Tablet (1 above Lihzahrd Power Cell)
}
public override void SetDefaults()
{
Item.width = 28;
Item.height = 18;
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 player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType<PlaguebringerGoliath>()) && !BossRushEvent.BossRushActive;
}
public override bool? UseItem(Player player)
{
SoundEngine.PlaySound(UseSound, player.Center);
if (Main.netMode != NetmodeID.MultiplayerClient)
NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType<PlaguebringerGoliath>());
else
NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, player.whoAmI, ModContent.NPCType<PlaguebringerGoliath>());
return true;
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<PlagueCellCanister>(20).
AddRecipeGroup("IronBar", 8).
AddIngredient(ItemID.Obsidian, 3).
AddTile(TileID.MythrilAnvil).
Register();
}
}
}