diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 32c6f92045..f979990cc6 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -903,6 +903,10 @@ namespace CalamityMod.CalPlayer public bool lAmbergrisVisual = false; public bool tortShell = false; public bool absorber = false; + /// + /// Used for detetcing life regen hindering debuffs + /// + bool _hasNoNaturalRegen = false; public bool hadLifeRegenHinderingDebuff = false; public bool alwaysHoneyRegen = false; public float alwaysHoneyRegenAmount = 0; @@ -922,8 +926,6 @@ namespace CalamityMod.CalPlayer public float pulseRate = 1; public bool aAmpoule = false; public bool rOoze = false; - public float radiantOozeRegen = 0; - public float purityRegen = 0; public bool fBarrier = false; public bool aBrain = false; public bool amalgam = false; @@ -2390,8 +2392,6 @@ namespace CalamityMod.CalPlayer livingDew = false; aAmpoule = false; rOoze = false; - radiantOozeRegen = 0; - purityRegen = 0; fBarrier = false; aBrain = false; amalgam = false; @@ -5013,6 +5013,9 @@ namespace CalamityMod.CalPlayer if (gSabaton && Player.whoAmI == Main.myPlayer) Player.jumpSpeedBoost += 2f; } + + //Update life regen that needs to happen before calculating debuffs + GeneralLifeRegen(); } #endregion diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index f3ac99db4d..e6b70c8528 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -48,22 +48,22 @@ namespace CalamityMod.CalPlayer { int totalVanillaDoT = 0; - if (Player.poisoned && !purity) + if (Player.poisoned) totalVanillaDoT += 4; - if (Player.onFire && !purity) + if (Player.onFire) totalVanillaDoT += 8; if (Player.tongued) totalVanillaDoT += 100; - if (Player.venom && !purity) + if (Player.venom) totalVanillaDoT += 12; - if (Player.onFrostBurn && !purity) + if (Player.onFrostBurn) totalVanillaDoT += 12; - if (Player.onFire2 && !purity) + if (Player.onFire2) totalVanillaDoT += 12; if (Player.burned) @@ -72,7 +72,7 @@ namespace CalamityMod.CalPlayer if (Player.suffocating) totalVanillaDoT += 40; - if (Player.electrified && !purity) + if (Player.electrified) { totalVanillaDoT += eleResist ? 4 : 8; if (Player.controlLeft || Player.controlRight) @@ -101,38 +101,38 @@ namespace CalamityMod.CalPlayer // Whispering Death sets positive regen to zero but doesn't actually deal any damage ApplyDoTDebuff(whisperingDeath, 0, laudanum); - ApplyDoTDebuff(irradiated, 4, purity); + ApplyDoTDebuff(irradiated, 4); int sulphurDoT = 6 - (sulphurSet ? 2 : 0) - (sulphurskin ? 2 : 0) - (corrosiveSpine ? 2 : 0); - ApplyDoTDebuff(sulphurPoison, sulphurDoT, purity); - ApplyDoTDebuff(riptide, 6, purity); + ApplyDoTDebuff(sulphurPoison, sulphurDoT); + ApplyDoTDebuff(riptide, 6); ApplyDoTDebuff(weakBrimstoneFlames, 7); - ApplyDoTDebuff(burningBlood, 8, purity); - ApplyDoTDebuff(brainRot, 8, purity); - ApplyDoTDebuff(vaporfied, 8, purity); + ApplyDoTDebuff(burningBlood, 8); + ApplyDoTDebuff(brainRot, 8); + ApplyDoTDebuff(vaporfied, 8); int staticDoT = ((Player.controlLeft || Player.controlRight) ? 12 : 3) / (eleResist ? 2 : 1); - ApplyDoTDebuff(staticDischarge, staticDoT, purity); - ApplyDoTDebuff(heavybleeding, 16, purity); - ApplyDoTDebuff(crushDepth, 18, purity); - ApplyDoTDebuff(astralInfection, 24, infectedJewel || hideOfDeus || purity); - ApplyDoTDebuff(shadowflame, 30, purity); - ApplyDoTDebuff(brimstoneFlames, 30, purity); - ApplyDoTDebuff(plague, (int)MathF.Round(30 * (alchFlask ? (1f - AlchemicalDecanter.PlagueReduction) : 1f)), purity); + ApplyDoTDebuff(staticDischarge, staticDoT); + ApplyDoTDebuff(heavybleeding, 16); + ApplyDoTDebuff(crushDepth, 18); + ApplyDoTDebuff(astralInfection, 24, hideOfDeus); + ApplyDoTDebuff(shadowflame, 30); + ApplyDoTDebuff(brimstoneFlames, 30); + ApplyDoTDebuff(plague, (int)MathF.Round(30 * (alchFlask ? (1f - AlchemicalDecanter.PlagueReduction) : 1f))); ApplyDoTDebuff(vHex, 30); // Has other effects ApplyDoTDebuff(searingLava, 30); - ApplyDoTDebuff(demonicFlames, 33, purity); // Never inflicted on the player - ApplyDoTDebuff(laceration, 36, purity); - ApplyDoTDebuff(daybroken, 40, purity); - ApplyDoTDebuff(bane, 40, purity); - ApplyDoTDebuff(nightwither, 40, purity); - ApplyDoTDebuff(holyFlames, 40, purity); - ApplyDoTDebuff(voidfrost, 40, purity); - ApplyDoTDebuff(hadopelagicPressure, 40, purity); + ApplyDoTDebuff(demonicFlames, 33); // Never inflicted on the player + ApplyDoTDebuff(laceration, 36); + ApplyDoTDebuff(daybroken, 40); + ApplyDoTDebuff(bane, 40); + ApplyDoTDebuff(nightwither, 40); + ApplyDoTDebuff(holyFlames, 40); + ApplyDoTDebuff(voidfrost, 40); + ApplyDoTDebuff(hadopelagicPressure, 40); // Profaned Soul Crystal turns you into Providence, a God, and you take more damage from God Slayer Inferno ApplyDoTDebuff(godSlayerInferno, profanedCrystalBuffs ? 50 : 40); int fluxDoT = ((Player.controlLeft || Player.controlRight) ? 50 : 10) / (eleResist ? 2 : 1); ApplyDoTDebuff(vermillionFlux, fluxDoT); - ApplyDoTDebuff(elementalMix, 50, purity); // Never inflicted on the player + ApplyDoTDebuff(elementalMix, 50); // Never inflicted on the player ApplyDoTDebuff(trueVHex, 50); int dragonfireDoT = ((Player.name == "JFL" || Player.name == "MrJFL") ? 200 : 50) / (dynamoStemCells ? 2 : 1); ApplyDoTDebuff(dragonFire, dragonfireDoT); @@ -276,7 +276,25 @@ namespace CalamityMod.CalPlayer bool hasLifeRegenHinderingDebuff = Player.lifeRegenTime == 0; + #region Life Regen That Works Even During DoT Debuffs + + //Negation of debuffs. These all will not take life regen above 0 + if (Player.lifeRegen < 0) + { + if (crownJewel) + Player.lifeRegen += CrownJewel.ReducedDoTAmount; + + if (infectedJewel) + Player.lifeRegen += InfectedJewel.ReducedDoTAmount; + + if (purity) + Player.lifeRegen += Radiance.ReducedDoTAmount; + + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; + } + if (divineBless) { if (Player.whoAmI == Main.myPlayer && Player.miscCounter % AngelicAlliance.DivineBlessFramesPerHeal == 0) // Flat 4 health per second @@ -318,75 +336,19 @@ namespace CalamityMod.CalPlayer else if (grandDadHealTimer > 0) grandDadHealTimer--; - if (purity) + //Raising natural regen post-damaging-debuff + if (hadLifeRegenHinderingDebuff && !hasLifeRegenHinderingDebuff) { - int intendedPurityDefense = 0; - int currentDebuffs = Player.buffType.Count(i => CalamityBuffSets.IsDebuff[i]); - if (currentDebuffs > 0) - { - Player.lifeRegen += Radiance.DebuffedRegenBoost; + if (infectedJewel) + Player.lifeRegenTime += InfectedJewel.PostDebuffRegenTimeBoost; - intendedPurityDefense = Radiance.DebuffedDefenseBoost + (currentDebuffs - 1) * Radiance.ExtraDebuffDefenseBoost; - if (jewelBonusDefense < intendedPurityDefense) - jewelBonusDefense = intendedPurityDefense; + if (purity) + Player.lifeRegenTime += Radiance.PostDebuffRegenTimeBoost; - // Update tooltip - purityRegen += Radiance.DebuffedRegenBoost / 2f; - } - - // If the defense should be ticking down to some lower value, do that. - if (Player.miscCounter % Radiance.FramesToDecayDefense == 0 && jewelBonusDefense > intendedPurityDefense) - --jewelBonusDefense; - - // Actually apply defense bonus - Player.statDefense += jewelBonusDefense; - } - - // Infected Jewel does not stack with Purity - else if (infectedJewel) - { - Player.lifeRegen += InfectedJewel.RegenBoost; - - // If the player has any debuffs, give the extra life regen and defense - // More defense is given for each additional debuff - int intendedJewelDefense = 0; - int currentDebuffs = Player.buffType.Count(i => CalamityBuffSets.IsDebuff[i]); - if (currentDebuffs > 0) - { - Player.lifeRegen += InfectedJewel.DebuffedRegenBoost; - - intendedJewelDefense = InfectedJewel.DebuffedDefenseBoost + (currentDebuffs - 1) * InfectedJewel.ExtraDebuffDefenseBoost; - if (jewelBonusDefense < intendedJewelDefense) - jewelBonusDefense = intendedJewelDefense; - } - - // If the defense should be ticking down to some lower value, do that. - if (Player.miscCounter % InfectedJewel.FramesToDecayDefense == 0 && jewelBonusDefense > intendedJewelDefense) - --jewelBonusDefense; - - // Actually apply defense bonus - Player.statDefense += jewelBonusDefense; - } - - // Crown Jewel does not stack with Purity or Infected Jewel - else if (crownJewel) - { - Player.lifeRegen += CrownJewel.RegenBoost; - - // If any debuff is detected, provide even more life regen - if (Player.buffType.Any(i => CalamityBuffSets.IsDebuff[i])) - Player.lifeRegen += CrownJewel.DebuffedRegenBoost; - } - - //If a player had a life regen hindering debuff, add 30 seconds to their regen time when under Tequila Sunrise - //This stacks with all other post-debuff boosts due to Tequila Sunrise increasing DoT damage taken - if (tequilaSunrise) - { - if (hadLifeRegenHinderingDebuff && !hasLifeRegenHinderingDebuff) - { + if (tequilaSunrise) Player.lifeRegenTime += 1800; - } } + #endregion // During Silva revive or God Slayer dash, all negative life regen is canceled @@ -461,24 +423,29 @@ namespace CalamityMod.CalPlayer // The bleedout is applied by directly reducing the player's health. It is not canceled by anything. ChaliceOfTheBloodGod.HandleBleedout(Player); - //Finally, update the state of hadLifeRegenHinderingDebuff for next frame. - hadLifeRegenHinderingDebuff = hasLifeRegenHinderingDebuff; + //Finally, update the state of hadLifeRegenHinderingDebuff for next frame. Needs to check for 2 frames of 0 regen time to be sure they had a debuff + hadLifeRegenHinderingDebuff = hasLifeRegenHinderingDebuff && _hasNoNaturalRegen; + _hasNoNaturalRegen = hasLifeRegenHinderingDebuff; } #endregion #region Update Life Regen - public override void UpdateLifeRegen() + //This method runs BEFORE UpdateBadLifeRegen. Put most effects here. Ran at the end of PostUpdateEquips + public void GeneralLifeRegen() { + + float lifeRatio = (Player.statLife) / (float)Player.statLifeMax2; + if (mushy) Player.lifeRegen += Mushy.RegenBoost; if (permafrostsConcoction) { - if (Player.statLife < actualMaxLife / 2) + if (lifeRatio <= 0.5f) Player.lifeRegen++; - if (Player.statLife < actualMaxLife / 4) + if (lifeRatio <= 0.25f) Player.lifeRegen++; - if (Player.statLife < actualMaxLife / 10) + if (lifeRatio <= 0.1f) Player.lifeRegen += 2; } @@ -494,21 +461,25 @@ namespace CalamityMod.CalPlayer if (PinkJellyRegen) Player.lifeRegen += LifeJelly.AuraRegenBoost; - // Grant life regen based on missing health for Radiant Ooze, Ambrosial Ampule, and Radiance - if (rOoze || aAmpoule || purity) - { - float missingLifeRatio = (Player.statLifeMax2 - Player.statLife) / (float)Player.statLifeMax2; - // Rounding is needed to prevent flooring and making the max unreachable - int lifeRegenToGive = (int)Math.Round(MathHelper.Lerp(RadiantOoze.MinRegenBoost, RadiantOoze.MaxRegenBoost, missingLifeRatio)); - Player.lifeRegen += lifeRegenToGive; - // Update tooltips - radiantOozeRegen += lifeRegenToGive / 2f; - purityRegen += lifeRegenToGive / 2f; - } + if (rOoze) + Player.lifeRegen += (int)Math.Round(MathHelper.Lerp(RadiantOoze.MaxRegenBoost, RadiantOoze.MinRegenBoost, lifeRatio)); if (livingDew) Player.lifeRegenTime += LivingDew.RegenTimeBoost; + if (aAmpoule) + { + Player.lifeRegen += (int)Math.Round(MathHelper.Lerp(AmbrosialAmpoule.MaxRegenBoost, AmbrosialAmpoule.MinRegenBoost, lifeRatio)); + Player.lifeRegenTime += AmbrosialAmpoule.RegenTimeBoost; + } + + if (purity) + { + Player.lifeRegen += (int)Math.Round(MathHelper.Lerp(Radiance.MaxRegenBoost, Radiance.MinRegenBoost, lifeRatio)); + Player.lifeRegenTime += Radiance.RegenTimeBoost; + } + + if (GreenJellyRegen) Player.lifeRegen += Items.Accessories.GrandGelatin.AuraRegenBoost; @@ -554,6 +525,27 @@ namespace CalamityMod.CalPlayer regen.position = Player.Center - velocity; } } + if (fearmongerSet && fearmongerRegenFrames > 0) + { + if (Player.lifeRegenTime < FearmongerGreathelm.MinionRegenTimeFloor) + Player.lifeRegenTime = FearmongerGreathelm.MinionRegenTimeFloor; + + Player.lifeRegen += FearmongerGreathelm.MinionRegenBoost; + Player.lifeRegenTime += FearmongerGreathelm.MinionRegenTimeBoost; + } + if (handWarmer && eskimoSet) + { + Player.lifeRegen += 2; + } + } + + //This method runs AFTER UpdateBadLifeRegen. Only put effects that should bypass debuff DoT canceling here. + public override void UpdateLifeRegen() + { + if (avertorBonus) + { + Player.lifeRegen += 4; + } if (community) { @@ -568,22 +560,10 @@ namespace CalamityMod.CalPlayer Player.lifeRegen += lesserEffect ? 1 : regenBoost; } - if (handWarmer && eskimoSet) + if (manaOverloader) { - Player.lifeRegen += 2; - } - if (avertorBonus) - { - Player.lifeRegen += 4; - } - - if (fearmongerSet && fearmongerRegenFrames > 0) - { - if (Player.lifeRegenTime < FearmongerGreathelm.MinionRegenTimeFloor) - Player.lifeRegenTime = FearmongerGreathelm.MinionRegenTimeFloor; - - Player.lifeRegen += FearmongerGreathelm.MinionRegenBoost; - Player.lifeRegenTime += FearmongerGreathelm.MinionRegenTimeBoost; + float manaRatio = Player.statMana / (float)Player.statManaMax2; + Player.lifeRegen += (int)(MathF.Round(MathHelper.Lerp(4f, -4f, manaRatio)) * (Player.HasBuff(BuffID.ManaSickness) ? 0.5f : 1f)); } if (pinkCandle && !noLifeRegen) @@ -600,12 +580,6 @@ namespace CalamityMod.CalPlayer else pinkCandleHealFraction = 0D; - if (manaOverloader) - { - float manaRatio = Player.statMana / (float)Player.statManaMax2; - Player.lifeRegen += (int)(MathF.Round(MathHelper.Lerp(4f, -4f, manaRatio)) * (Player.HasBuff(BuffID.ManaSickness) ? 0.5f : 1f)); - } - #region Standing Still Life Regen // Standing still healing bonuses (all are exclusive with vanilla Shiny Stone, but all function similarly) if (!Player.shinyStone && Player.StandingStill() && Player.velocity.Y == 0 && Player.itemAnimation == 0 && (shadeRegen || cFreeze)) @@ -692,7 +666,13 @@ namespace CalamityMod.CalPlayer public override void NaturalLifeRegen(ref float regen) { // Honey Dew and its upgrades make natural regen more powerful - if (honeyDew) + if (purity) + regen *= Radiance.NaturalRegenPower; + else if (aAmpoule) + regen *= AmbrosialAmpoule.NaturalRegenPower; + else if (livingDew) + regen *= LivingDew.NaturalRegenPower; + else if (honeyDew) regen *= HoneyDew.NaturalRegenPower; // The Camper counteracts the regen loss while moving horizontally diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 496bd372f8..0e2be84687 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3637,24 +3637,24 @@ namespace CalamityMod.CalPlayer if (tarraSet) Player.lifeMagnet = true; - if (whisperingDeath && !laudanum && !purity) + if (whisperingDeath && !laudanum) Player.GetDamage() -= 0.2f; - if (armorCrunch && !laudanum && !purity) + if (armorCrunch && !laudanum) { Player.statDefense -= ArmorCrunch.DefenseReduction; Player.endurance *= ArmorCrunch.MultiplicativeDamageReductionPlayer; } - if (wither && !purity) + if (wither) { Player.statDefense -= RemsRevenge.WitherDefenseReduction; } - if (eutrophication && !purity) + if (eutrophication) Player.velocity = Vector2.Zero; - if ((vaporfied && !purity) || galvanicCorrosion) + if ((vaporfied) || galvanicCorrosion) Player.velocity *= 0.98f; if (molluskHelmet) diff --git a/Items/Accessories/AmbrosialAmpoule.cs b/Items/Accessories/AmbrosialAmpoule.cs index ee9f62221b..0011d11d15 100644 --- a/Items/Accessories/AmbrosialAmpoule.cs +++ b/Items/Accessories/AmbrosialAmpoule.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; @@ -13,8 +14,11 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; - public static int MaxLifeBoost = 50; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxLifeBoost, LivingDew.RegenTimeBoost.ToPercent(), (HoneyDew.NaturalRegenPower - 1f).ToPercent(), RadiantOoze.MinRegenBoost.ToRegenPerSecond(), RadiantOoze.MaxRegenBoost.ToRegenPerSecond()); + public static int MinRegenBoost => 2; + public static int MaxRegenBoost => 6; + public static float RegenTimeBoost => 1; + public static float NaturalRegenPower => 1.5f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinRegenBoost.ToRegenPerSecond(), MaxRegenBoost.ToRegenPerSecond(), (NaturalRegenPower - 1f).ToPercent(), RegenTimeBoost.ToPercent()); public override void SetDefaults() { @@ -28,19 +32,8 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - player.statLifeMax2 += MaxLifeBoost; - if (!player.HasBuff(BuffID.Honey)) - player.AddBuff(BuffID.Honey, 2); - - // bool left in for abyss light purposes and life regen effects modPlayer.aAmpoule = true; - - // Inherits all effects of Honey Dew and Living Dew - modPlayer.honeyDew = true; - modPlayer.livingDew = true; - - // Add light if the other accessories aren't equipped and visibility is turned on - if (!(modPlayer.rOoze || modPlayer.purity) && !hideVisual) + if (!(modPlayer.purity) && !hideVisual) Lighting.AddLight(player.Center, new Vector3(1.2f, 1.2f, 0.72f)); } @@ -49,7 +42,7 @@ namespace CalamityMod.Items.Accessories var player = Main.LocalPlayer; if (player != null) { - list.FindAndReplace("[REGEN]", player.Calamity().radiantOozeRegen.ToString("0.##")); + list.FindAndReplace("[REGEN]", ((int)MathF.Round(MathHelper.Lerp(MaxRegenBoost, MinRegenBoost, (player.statLife / (float)player.statLifeMax2)))).ToRegenPerSecond()); } } diff --git a/Items/Accessories/CrownJewel.cs b/Items/Accessories/CrownJewel.cs index 26871c87ef..6eebae181d 100644 --- a/Items/Accessories/CrownJewel.cs +++ b/Items/Accessories/CrownJewel.cs @@ -11,13 +11,12 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public static int RegenBoost = 1; - public static int DebuffedRegenBoost = 3; // Added on top of the baseline regen boost - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RegenBoost.ToRegenPerSecond(), DebuffedRegenBoost.ToRegenPerSecond()); + public static int ReducedDoTAmount = 4; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RegenBoost.ToRegenPerSecond(), ReducedDoTAmount.ToRegenPerSecond()); public override void SetDefaults() { Item.width = 26; Item.height = 26; - Item.defense = 1; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.accessory = true; @@ -27,6 +26,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.crownJewel = true; + player.lifeRegen += RegenBoost; } } } diff --git a/Items/Accessories/HoneyDew.cs b/Items/Accessories/HoneyDew.cs index ee517c2349..854d5f27b0 100644 --- a/Items/Accessories/HoneyDew.cs +++ b/Items/Accessories/HoneyDew.cs @@ -10,9 +10,8 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; - public static int MaxLifeBoost = 10; - public static float NaturalRegenPower = 1.5f; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxLifeBoost, (NaturalRegenPower - 1f).ToPercent()); + public static float NaturalRegenPower => 1.5f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((NaturalRegenPower - 1f).ToPercent()); public override void SetDefaults() { Item.width = 20; @@ -24,7 +23,6 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.statLifeMax2 += MaxLifeBoost; CalamityPlayer modPlayer = player.Calamity(); modPlayer.honeyDew = true; } diff --git a/Items/Accessories/InfectedJewel.cs b/Items/Accessories/InfectedJewel.cs index fbd7f2306e..c88977e5ba 100644 --- a/Items/Accessories/InfectedJewel.cs +++ b/Items/Accessories/InfectedJewel.cs @@ -14,16 +14,13 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public static int RegenBoost = 2; - public static int DebuffedRegenBoost = 3; // Added on top of the baseline regen boost - public static int DebuffedDefenseBoost = 8; - public static int ExtraDebuffDefenseBoost = 3; // Per additional debuff - public static int FramesToDecayDefense = 15; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RegenBoost.ToRegenPerSecond(), DebuffedDefenseBoost, DebuffedRegenBoost.ToRegenPerSecond(), ExtraDebuffDefenseBoost); + public static int ReducedDoTAmount = 8; + public static int PostDebuffRegenTimeBoost = CalamityUtils.SecondsToFrames(10); + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RegenBoost.ToRegenPerSecond(), ReducedDoTAmount.ToRegenPerSecond(), PostDebuffRegenTimeBoost.FramesToSeconds()); public override void SetDefaults() { Item.width = 26; Item.height = 26; - Item.defense = 2; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.accessory = true; @@ -33,6 +30,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.infectedJewel = true; + player.lifeRegen += RegenBoost; } public override void AddRecipes() diff --git a/Items/Accessories/LivingDew.cs b/Items/Accessories/LivingDew.cs index 938341e256..2ab98916c6 100644 --- a/Items/Accessories/LivingDew.cs +++ b/Items/Accessories/LivingDew.cs @@ -11,9 +11,9 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; - public static int MaxLifeBoost = 25; - public static int RegenTimeBoost = 1; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxLifeBoost, RegenTimeBoost.ToPercent(), (HoneyDew.NaturalRegenPower - 1f).ToPercent()); + public static int RegenTimeBoost => 1; + public static float NaturalRegenPower => 1.5f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((NaturalRegenPower - 1f).ToPercent(), RegenTimeBoost.ToPercent()); public override void SetDefaults() { Item.width = 34; @@ -25,11 +25,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.statLifeMax2 += MaxLifeBoost; - - // Inherits all effects of Honey Dew CalamityPlayer modPlayer = player.Calamity(); - modPlayer.honeyDew = true; modPlayer.livingDew = true; } diff --git a/Items/Accessories/Radiance.cs b/Items/Accessories/Radiance.cs index dcf0f695a2..46823c36ed 100644 --- a/Items/Accessories/Radiance.cs +++ b/Items/Accessories/Radiance.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Rarities; @@ -13,18 +14,17 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { [LegacyName("AstralArcanum", "Purity")] - public class Radiance : ModItem, ILocalizedModType, IHoldShiftTooltipItem + public class Radiance : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public static int MaxLifeBoost = 70; - public static int DebuffedRegenBoost = 4; // Added on top of the baseline regen boost - public static int DebuffedDefenseBoost = 9; - public static int ExtraDebuffDefenseBoost = 4; // Per additional debuff - public static int FramesToDecayDefense = 15; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxLifeBoost); - public LocalizedText TooltipExtensionText => this.GetLocalization("HoldShiftTooltip").WithFormatArgs(LivingDew.RegenTimeBoost.ToPercent(), (HoneyDew.NaturalRegenPower - 1f).ToPercent(), - RadiantOoze.MinRegenBoost.ToRegenPerSecond(), RadiantOoze.MaxRegenBoost.ToRegenPerSecond(), DebuffedDefenseBoost, DebuffedRegenBoost.ToRegenPerSecond(), ExtraDebuffDefenseBoost); + public static int MinRegenBoost => 2; + public static int MaxRegenBoost => 8; + public static int ReducedDoTAmount => 20; + public static int PostDebuffRegenTimeBoost => CalamityUtils.SecondsToFrames(10); + public static float RegenTimeBoost => 1; + public static float NaturalRegenPower => 1.5f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinRegenBoost.ToRegenPerSecond(),MaxRegenBoost.ToRegenPerSecond(),ReducedDoTAmount.ToRegenPerSecond(), (NaturalRegenPower - 1f).ToPercent(),RegenTimeBoost.ToPercent()); public override void SetStaticDefaults() { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 7)); @@ -35,7 +35,6 @@ namespace CalamityMod.Items.Accessories { Item.width = 18; Item.height = 44; - Item.defense = 3; Item.accessory = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); @@ -44,17 +43,8 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - player.statLifeMax2 += MaxLifeBoost; - - // Abyss light, debuff near-immunity, and life regen effects modPlayer.purity = true; - - // Inherits effects from Honey Dew and Living Dew - modPlayer.honeyDew = true; - modPlayer.livingDew = true; - - // Add light if the other accessories aren't equipped and visibility is turned on - if (!(modPlayer.rOoze || modPlayer.aAmpoule) && !hideVisual) + if (!hideVisual) Lighting.AddLight(player.Center, new Vector3(1.32f, 1.32f, 1.82f)); } @@ -64,8 +54,7 @@ namespace CalamityMod.Items.Accessories var player = Main.LocalPlayer; if (player != null) { - list.FindAndReplace("[REGEN]", player.Calamity().purityRegen.ToString("0.##")); - list.FindAndReplace("[DEFENSE]", player.Calamity().jewelBonusDefense.ToString()); + list.FindAndReplace("[REGEN]", ((int)MathF.Round(MathHelper.Lerp(MaxRegenBoost, MinRegenBoost, (player.statLife / (float)player.statLifeMax2)))).ToRegenPerSecond()); } } diff --git a/Items/Accessories/RadiantOoze.cs b/Items/Accessories/RadiantOoze.cs index 0164304a0d..e4f31b3ee8 100644 --- a/Items/Accessories/RadiantOoze.cs +++ b/Items/Accessories/RadiantOoze.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; @@ -13,8 +14,8 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; - public static int MinRegenBoost = 1; - public static int MaxRegenBoost = 5; + public static int MinRegenBoost => 1; + public static int MaxRegenBoost => 5; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinRegenBoost.ToRegenPerSecond(), MaxRegenBoost.ToRegenPerSecond()); public override void SetDefaults() @@ -29,11 +30,8 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - - // bool left in for abyss light purposes and life regen effects modPlayer.rOoze = true; - // Add light if the other accessories aren't equipped and visibility is turned on if (!(modPlayer.aAmpoule || modPlayer.purity) && !hideVisual) Lighting.AddLight(player.Center, new Vector3(1f, 1f, 0.6f)); } @@ -43,7 +41,7 @@ namespace CalamityMod.Items.Accessories var player = Main.LocalPlayer; if (player != null) { - list.FindAndReplace("[REGEN]", (player.Calamity().radiantOozeRegen).ToString("0.##")); + list.FindAndReplace("[REGEN]", ((int)MathF.Round(MathHelper.Lerp(MaxRegenBoost, MinRegenBoost, (player.statLife / (float)player.statLifeMax2)))).ToRegenPerSecond()); } } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 605100e9e8..b019cbc856 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -98,11 +98,8 @@ AmbrosialAmpoule: { DisplayName: Ambrosial Ampoule Tooltip: ''' - +{0} max life - Natural life regen is {1}% faster and {2}% more potent - Grants +{2} to +{3} HP/s life regen based on missing health - Current boost: +[REGEN] HP/s - Fire and sickness debuff durations are halved + +{0} to +{1} HP/s life regen based on missing health [c/999999:(Current: +[REGEN] HP/s)] + Natural life regen is {2}% more potent and returns {3}% faster You emit yellow light if visibility is enabled ''' } @@ -468,7 +465,7 @@ CrownJewel: { Tooltip: ''' +{0} HP/s life regen - You gain an additional +{1} HP/s life regen while afflicted with any debuff + Reduces damage over time taken by {1} HP/s ''' } @@ -946,11 +943,7 @@ HideofAstrumDeus: { HoneyDew: { DisplayName: Honey Dew - Tooltip: - ''' - +{0} max life - Natural life regen is {1}% more potent - ''' + Tooltip: Natural life regen is {0}% more potent } HowlsHeart: { @@ -976,11 +969,9 @@ InfectedJewel: { DisplayName: Infected Jewel Tooltip: ''' - Passively grants +{0} HP/s life regen - Grants {1} defense and +{2} HP/s life regen while afflicted with any debuff - Granted defense fades away when not afflicted with any debuffs - Each debuff beyond the first grants {3} additional defense - Nullifies the [cbuffplr:CalamityMod/AstralInfectionDebuff] + +{0} HP/s life regen + Reduces damage over time taken by {1} HP/s + Jump-starts regeneration after a damaging debuff ends 'A beautiful gemstone tarnished by spaceborne rot' ''' } @@ -1077,11 +1068,7 @@ LifeJelly: { LivingDew: { DisplayName: Living Dew - Tooltip: - ''' - +{0} max life - Natural life regen is {1}% faster and {2}% more potent - ''' + Tooltip: Natural life regen is {0}% more potent and returns {1}% faster } LuxorsGift: { @@ -1390,30 +1377,21 @@ Radiance: { DisplayName: Radiance Tooltip: ''' - +{0} max life - Provides greatly improved life regen, increasing with lost health - Gain increased defense from debuffs inflicted on you, and greatly reduces their effectiveness - Current boosts: +[REGEN] HP/s and [DEFENSE] defense. + +{0} to +{1} HP/s life regen based on missing health [c/999999:(Current: +[REGEN] HP/s)] + Reduces damage over time taken by {2} HP/s and jump-starts regeneration after a damaging debuff ends + Natural life regen is {3}% more potent and returns {4}% faster You emit shining blue light if visibility is enabled 'A once putrid crystal, now glimmering with immaculate purity' ''' - HoldShiftTooltip: - ''' - [c/CDF69C:Natural life regen is {0}% faster and {1}% more potent] - [c/CDF69C:Grants +{2} to +{3} HP/s life regen based on missing health] - [c/CDF69C:Grants {4} defense and +{5} HP/s life regen while afflicted with any debuff] - [c/CDF69C:Each additional debuff grants {6} defense, which decays while not debuffed] - [c/CDF69C:Causes weak damaging debuffs to be harmless] - ''' } RadiantOoze: { DisplayName: Radiant Ooze Tooltip: ''' - Grants +{0} to +{1} HP/s life regen based on missing health - Current boost: +[REGEN] HP/s + +{0} to +{1} HP/s life regen based on missing health You emit yellow light if visibility is enabled + [c/999999:(Current regen: +[REGEN] HP/s)] ''' }