Files
CalamityModPublic/Items/SummonItems/DeathWhistle.cs
T

58 lines
1.9 KiB
C#

using CalamityMod.Events;
using CalamityMod.NPCs.Ravager;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.SummonItems
{
[LegacyName("AncientMedallion")]
public class DeathWhistle : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.SummonItems";
public override void SetStaticDefaults()
{
ItemID.Sets.SortingPriorityBossSpawns[Type] = 17; // Solar Tablet (1 above Lihzahrd Power Cell)
}
public override void SetDefaults()
{
Item.width = 20;
Item.height = 20;
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 !NPC.AnyNPCs(ModContent.NPCType<RavagerBody>()) && !BossRushEvent.BossRushActive;
}
public override bool? UseItem(Player player)
{
int posX = (int)(player.position.X + Main.rand.Next(-250, 251));
int posY = (int)(player.position.Y - 500f);
int bossToSpawn = ModContent.NPCType<RavagerBody>();
CalamityUtils.SpawnBossOnPosUsingItem(player, bossToSpawn, posX, posY, CalamityClientConfig.Instance.MisophoniaSupport ? SoundID.Roar : SoundID.ScaryScream);
return true;
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient(ItemID.LunarTabletFragment, 15).
AddIngredient(ItemID.LihzahrdBrick, 25).
AddTile(TileID.DemonAltar).
Register();
}
}
}