* Fixed Netcode Issues on BossSummon Items * Replaced npc loop to ActiveNPCs iterator
59 lines
1.9 KiB
C#
59 lines
1.9 KiB
C#
using CalamityMod.Events;
|
|
using CalamityMod.Items.Materials;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.SummonItems
|
|
{
|
|
public class OldPowerCell : ModItem, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Items.SummonItems";
|
|
public override string Texture => $"Terraria/Images/Item_{ItemID.LihzahrdPowerCell}";
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
NPCID.Sets.MPAllowedEnemies[NPCID.Golem] = true;
|
|
ItemID.Sets.SortingPriorityBossSpawns[Type] = 16; // Lihzahrd Power Cell
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Item.width = 28;
|
|
Item.height = 18;
|
|
Item.rare = ItemRarityID.Lime;
|
|
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.ZoneLihzhardTemple && !NPC.AnyNPCs(NPCID.Golem) && !BossRushEvent.BossRushActive;
|
|
}
|
|
|
|
public override bool? UseItem(Player player)
|
|
{
|
|
int posX = (int)player.Center.X;
|
|
int posY = (int)(player.Center.Y - 150.0f);
|
|
CalamityUtils.SpawnBossOnPosUsingItem(player, NPCID.Golem, posX, posY, SoundID.Roar);
|
|
return true;
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
CreateRecipe().
|
|
AddIngredient(ItemID.LunarTabletFragment, 20).
|
|
AddIngredient<EssenceofSunlight>(10).
|
|
AddTile(TileID.MythrilAnvil).
|
|
Register();
|
|
}
|
|
}
|
|
}
|