Files
CalamityModPublic/Items/SummonItems/Portabulb.cs
T
Flowaria 3978b26a5f Netcode Fix: Boss Summon Item issue fixes (#55)
* Fixed Netcode Issues on BossSummon Items

* Replaced npc loop to ActiveNPCs iterator
2024-08-25 12:45:52 -04:00

57 lines
1.7 KiB
C#

using CalamityMod.Events;
using CalamityMod.Items.Materials;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.SummonItems
{
[LegacyName("BulbofDoom")]
public class Portabulb : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.SummonItems";
public override void SetStaticDefaults()
{
NPCID.Sets.MPAllowedEnemies[NPCID.Plantera] = true;
ItemID.Sets.SortingPriorityBossSpawns[Type] = 11; // Pirate Map (1 above Mechanical Skull)
}
public override void SetDefaults()
{
Item.width = 28;
Item.height = 18;
Item.useAnimation = 10;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.HoldUp;
Item.rare = ItemRarityID.Lime;
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(NPCID.Plantera) && !BossRushEvent.BossRushActive;
}
public override bool? UseItem(Player player)
{
CalamityUtils.SpawnBossUsingItem(player, NPCID.Plantera, SoundID.Roar);
return true;
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient(ItemID.JungleSpores, 15).
AddIngredient<MurkyPaste>(3).
AddIngredient<TrapperBulb>().
AddTile(TileID.Anvils).
Register();
}
}
}