Files
CalamityModPublic/Buffs/StatBuffs/ProfanedCrystalBuff.cs
T

62 lines
2.2 KiB
C#

using CalamityMod.CalPlayer;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.StatBuffs
{
public class ProfanedCrystalBuff : ModBuff
{
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
Main.buffNoSave[Type] = true;
Main.buffNoTimeDisplay[Type] = true;
BuffID.Sets.NurseCannotRemoveDebuff[Type] = true;
}
public override void Update(Player player, ref int buffIndex)
{
CalamityPlayer modPlayer = player.Calamity();
if (!modPlayer.profanedCrystal)
{
player.DelBuff(buffIndex);
buffIndex--;
}
}
public override void ModifyBuffText(ref string buffName, ref string tip, ref int rare)
{
Player player = Main.player[Main.myPlayer];
if (player.Calamity().profanedCrystalBuffs)
{
if (player.Calamity().endoCooper)
{
tip = this.GetLocalizedValue("NerfedEndo");
}
else if (player.Calamity().magicHat)
{
tip = this.GetLocalizedValue("NerfedHat");
}
else
{
bool offense = (Main.dayTime && !player.wet) || player.lavaWet;
tip += "\n" + (offense ? this.GetLocalization("Offense").Format(this.GetLocalizedValue(player.lavaWet ? "Lava" : "Day"))
: this.GetLocalization("Defense").Format(this.GetLocalizedValue(player.honeyWet ? "Honey" : (player.wet ? "Water" : "Night"))));
if (player.statLife <= (int)(player.statLifeMax2 * 0.5))
tip += "\n" + this.GetLocalizedValue("Enrage");
}
}
else if (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs)
{
tip = this.GetLocalizedValue("LockedSlots");
}
else
{
tip = this.GetLocalizedValue(!DownedBossSystem.downedExoMechs ? "LockedExos" : "LockedSCal");
}
}
}
}