101 lines
3.8 KiB
C#
101 lines
3.8 KiB
C#
using CalamityMod.NPCs.SlimeGod;
|
|
using CalamityMod.World;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.DataStructures;
|
|
using Terraria.ID;
|
|
using Terraria.Localization;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.Items.DifficultyItems
|
|
{
|
|
public class Death : ModItem
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Death");
|
|
Tooltip.SetDefault("Makes bosses even more EXTREME.\n" +
|
|
"Allows certain bosses to spawn naturally.\n" +
|
|
"Increases enemy damage by 15% and spawn rates by 25%.\n" +
|
|
"Nerfs the effectiveness of life steal.\n" +
|
|
"Greatly increases the effectiveness of Rage and Adrenaline.\n" +
|
|
"Effect can be toggled on and off.\n" +
|
|
"Effect will only work if Revengeance Mode is active.\n" +
|
|
"Using this while a boss is alive will instantly kill you and despawn the boss.");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
item.rare = 11;
|
|
item.width = 28;
|
|
item.height = 28;
|
|
item.useAnimation = 45;
|
|
item.useTime = 45;
|
|
item.useStyle = 4;
|
|
item.UseSound = SoundID.Item119;
|
|
item.consumable = false;
|
|
}
|
|
|
|
public override bool CanUseItem(Player player)
|
|
{
|
|
if (!CalamityWorld.revenge || CalamityWorld.bossRushActive)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public override bool UseItem(Player player)
|
|
{
|
|
for (int doom = 0; doom < 200; doom++)
|
|
{
|
|
if ((Main.npc[doom].active && (Main.npc[doom].boss || Main.npc[doom].type == NPCID.EaterofWorldsHead || Main.npc[doom].type == NPCID.EaterofWorldsTail || Main.npc[doom].type == ModContent.NPCType<SlimeGodRun>() ||
|
|
Main.npc[doom].type == ModContent.NPCType<SlimeGodRunSplit>() || Main.npc[doom].type == ModContent.NPCType<SlimeGod>() || Main.npc[doom].type == ModContent.NPCType<SlimeGodSplit>())) || CalamityWorld.DoGSecondStageCountdown > 0)
|
|
{
|
|
player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " tried to change the rules."), 1000.0, 0, false);
|
|
Main.npc[doom].active = false;
|
|
Main.npc[doom].netUpdate = true;
|
|
}
|
|
}
|
|
if (!CalamityWorld.death)
|
|
{
|
|
CalamityWorld.death = true;
|
|
string key = "Mods.CalamityMod.DeathText";
|
|
Color messageColor = Color.Crimson;
|
|
if (Main.netMode == NetmodeID.SinglePlayer)
|
|
{
|
|
Main.NewText(Language.GetTextValue(key), messageColor);
|
|
}
|
|
else if (Main.netMode == NetmodeID.Server)
|
|
{
|
|
NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
CalamityWorld.death = false;
|
|
string key = "Mods.CalamityMod.DeathText2";
|
|
Color messageColor = Color.Crimson;
|
|
if (Main.netMode == NetmodeID.SinglePlayer)
|
|
{
|
|
Main.NewText(Language.GetTextValue(key), messageColor);
|
|
}
|
|
else if (Main.netMode == NetmodeID.Server)
|
|
{
|
|
NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor);
|
|
}
|
|
}
|
|
|
|
CalamityMod.UpdateServerBoolean();
|
|
return true;
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
ModRecipe recipe = new ModRecipe(mod);
|
|
recipe.AddTile(TileID.DemonAltar);
|
|
recipe.SetResult(this);
|
|
recipe.AddRecipe();
|
|
}
|
|
}
|
|
}
|