60 lines
1.9 KiB
C#
60 lines
1.9 KiB
C#
using CalamityMod.Events;
|
|
using CalamityMod.NPCs.Ravager;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.Items.SummonItems
|
|
{
|
|
public class AncientMedallion : ModItem
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Death Whistle");
|
|
Tooltip.SetDefault("A very old temple whistle\n" +
|
|
"Summons the Ravager\n" +
|
|
"Not consumable");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
item.width = 20;
|
|
item.height = 20;
|
|
item.rare = ItemRarityID.Yellow;
|
|
item.useAnimation = 45;
|
|
item.useTime = 45;
|
|
item.useStyle = ItemUseStyleID.HoldingUp;
|
|
item.consumable = false;
|
|
}
|
|
|
|
public override bool CanUseItem(Player player)
|
|
{
|
|
return !NPC.AnyNPCs(ModContent.NPCType<RavagerBody>()) && player.ZoneOverworldHeight && !BossRushEvent.BossRushActive;
|
|
}
|
|
|
|
public override bool UseItem(Player player)
|
|
{
|
|
Main.PlaySound(SoundID.Roar, player.position, 2);
|
|
if (Main.netMode != NetmodeID.MultiplayerClient)
|
|
{
|
|
int npc = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-250, 251)), (int)(player.position.Y - 500f), ModContent.NPCType<RavagerBody>(), 1);
|
|
Main.npc[npc].timeLeft *= 20;
|
|
CalamityUtils.BossAwakenMessage(npc);
|
|
}
|
|
else
|
|
NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType<RavagerBody>());
|
|
|
|
return true;
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
ModRecipe recipe = new ModRecipe(mod);
|
|
recipe.AddIngredient(ItemID.LunarTabletFragment, 15);
|
|
recipe.AddIngredient(ItemID.LihzahrdBrick, 25);
|
|
recipe.AddTile(TileID.MythrilAnvil);
|
|
recipe.SetResult(this);
|
|
recipe.AddRecipe();
|
|
}
|
|
}
|
|
}
|