diff --git a/Localization/en-US/Mods.CalamityMod.Prefixes.hjson b/Localization/en-US/Mods.CalamityMod.Prefixes.hjson index 636579790f..0542742e9d 100644 --- a/Localization/en-US/Mods.CalamityMod.Prefixes.hjson +++ b/Localization/en-US/Mods.CalamityMod.Prefixes.hjson @@ -1,8 +1,12 @@ Accessory: { Cloaked.DisplayName: Cloaked Silent.DisplayName: Silent + Invigorating.DisplayName: Invigorating + Dauntless.DisplayName: Dauntless // New modifier effects (this is only positive) StealthGenTooltip: +{0}% stealth generation + LifeRegenTooltip: +{0} HP/s life regen + MaxLifeBoostTooltip: +{0} max life } Weapon: { diff --git a/Prefixes/AccessoryPrefix.cs b/Prefixes/AccessoryPrefix.cs new file mode 100644 index 0000000000..c68a382f5d --- /dev/null +++ b/Prefixes/AccessoryPrefix.cs @@ -0,0 +1,62 @@ +using System.Collections.Generic; +using Terraria; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Prefixes +{ + public class Invigorating : ModPrefix, ILocalizedModType + { + public new string LocalizationCategory => "Prefixes.Accessory"; + public override PrefixCategory Category => PrefixCategory.Accessory; + + public override void ApplyAccessoryEffects(Player player) + { + player.lifeRegen += GetLifeRegenAmount(); + } + + public LocalizedText LifeRegenTooltip => CalamityUtils.GetText($"{LocalizationCategory}.LifeRegenTooltip"); + public override IEnumerable GetTooltipLines(Item item) + { + var perSecHP = (GetLifeRegenAmount() / 2.0f).ToString("0.#"); + yield return new TooltipLine(Mod, "CalamityMod:PrefixLifeRegenBoost", LifeRegenTooltip.Format(perSecHP)) + { + IsModifier = true + }; + } + + public static int GetLifeRegenAmount() + { + return 2; + } + } + + public class Dauntless : ModPrefix, ILocalizedModType + { + public new string LocalizationCategory => "Prefixes.Accessory"; + public override PrefixCategory Category => PrefixCategory.Accessory; + + public override void ApplyAccessoryEffects(Player player) + { + player.statLifeMax2 += GetHealthBoostAmount(); + } + + public LocalizedText LifeBoostTooltip => CalamityUtils.GetText($"{LocalizationCategory}.MaxLifeBoostTooltip"); + public override IEnumerable GetTooltipLines(Item item) + { + yield return new TooltipLine(Mod, "CalamityMod:PrefixMaxLifeBoost", LifeBoostTooltip.Format(GetHealthBoostAmount())) + { + IsModifier = true + }; + } + + public static int GetHealthBoostAmount() + { + if (DownedBossSystem.downedDoG) return 30; + if (NPC.downedMoonlord) return 25; + if (NPC.downedPlantBoss) return 20; + if (Main.hardMode) return 15; + return 10; + } + } +}