Files
CalamityModPublic/Items/SummonItems/ProfanedCore.cs
T
mountaindrew10 741c2263df 1 - Guardian edits.
2 - A LOT more sounds play at Center instead of at position.
2023-01-27 04:06:27 -06:00

63 lines
2.3 KiB
C#

using CalamityMod.Events;
using CalamityMod.NPCs.Providence;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
using Terraria.DataStructures;
namespace CalamityMod.Items.SummonItems
{
[LegacyName("ProfanedCoreUnlimited")]
public class ProfanedCore : ModItem
{
public override void SetStaticDefaults()
{
SacrificeTotal = 1;
DisplayName.SetDefault("Profaned Core");
Tooltip.SetDefault("The core of the unholy flame\n" +
"Summons Providence when used in the Hallow or Underworld\n" +
"Unique drop changes depending on the biome fought in\n" +
"Enrages when fought during nighttime or when outside the Hallow or Underworld\n" +
"Not consumable");
ItemID.Sets.SortingPriorityBossSpawns[Type] = 17; // Celestial Sigil
}
public override void SetDefaults()
{
Item.width = 20;
Item.height = 20;
Item.useAnimation = 10;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.HoldUp;
Item.consumable = false;
Item.rare = ItemRarityID.Purple;
}
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<Providence>()) && (player.ZoneHallow || player.ZoneUnderworldHeight) && !BossRushEvent.BossRushActive;
}
public override bool? UseItem(Player player)
{
SoundEngine.PlaySound(Providence.SpawnSound, player.Center);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int npc = NPC.NewNPC(new EntitySource_BossSpawn(player), (int)(player.position.X + Main.rand.Next(-500, 501)), (int)(player.position.Y - 250f), ModContent.NPCType<Providence>(), 1);
Main.npc[npc].timeLeft *= 20;
CalamityUtils.BossAwakenMessage(npc);
}
else
NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType<Providence>());
return true;
}
}
}