59 lines
1.9 KiB
C#
59 lines
1.9 KiB
C#
using CalamityMod.Events;
|
|
using CalamityMod.Items.Materials;
|
|
using CalamityMod.NPCs.Yharon;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Items.SummonItems
|
|
{
|
|
public class ChickenEgg : ModItem
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Jungle Dragon Egg");
|
|
Tooltip.SetDefault("An imitation of the egg that bore the loyal guardian of the tyrant king\n" +
|
|
"Summons Jungle Dragon, Yharon when used in the jungle\n" +
|
|
"Not consumable");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
item.width = 28;
|
|
item.height = 18;
|
|
item.useAnimation = 45;
|
|
item.useTime = 45;
|
|
item.useStyle = ItemUseStyleID.HoldingUp;
|
|
item.consumable = false;
|
|
item.rare = ItemRarityID.Purple;
|
|
item.Calamity().customRarity = CalamityRarity.DarkBlue;
|
|
}
|
|
|
|
public override bool CanUseItem(Player player)
|
|
{
|
|
return player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType<Yharon>()) && !BossRushEvent.BossRushActive;
|
|
}
|
|
|
|
public override bool UseItem(Player player)
|
|
{
|
|
Main.PlaySound(SoundID.Roar, player.position, 0);
|
|
if (Main.netMode != NetmodeID.MultiplayerClient)
|
|
NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType<Yharon>());
|
|
else
|
|
NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType<Yharon>());
|
|
|
|
return true;
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
ModRecipe recipe = new ModRecipe(mod);
|
|
recipe.AddIngredient(ModContent.ItemType<EffulgentFeather>(), 15);
|
|
recipe.AddIngredient(ModContent.ItemType<BarofLife>(), 15);
|
|
recipe.AddTile(TileID.LunarCraftingStation);
|
|
recipe.SetResult(this);
|
|
recipe.AddRecipe();
|
|
}
|
|
}
|
|
}
|