diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 7d4745af4e..af8fc09184 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -2251,15 +2251,13 @@ namespace CalamityMod.CalPlayer if (daedalusAbsorb && Main.rand.NextBool(10)) { int healAmt = (int)(hurtInfo.Damage / 2D); - Player.statLife += healAmt; - Player.HealEffect(healAmt); + Player.HealPlayer(healAmt); } if (absorber) { int healAmt = (int)(hurtInfo.Damage / 20D); - Player.statLife += healAmt; - Player.HealEffect(healAmt); + Player.HealPlayer(healAmt); } if (witheringDamageDone > 0) @@ -2268,8 +2266,7 @@ namespace CalamityMod.CalPlayer if (healCompenstationRatio > 1D) healCompenstationRatio = 1D; int healCompensation = (int)(healCompenstationRatio * hurtInfo.Damage); - Player.statLife += (int)(healCompenstationRatio * hurtInfo.Damage); - Player.HealEffect(healCompensation); + Player.HealPlayer((int)(healCompenstationRatio * hurtInfo.Damage)); Player.AddBuff(ModContent.BuffType(), 1080); witheringDamageDone = 0; } diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 395f9c1d71..c143bb4e06 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -396,7 +396,7 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI == Main.myPlayer && Player.miscCounter % 15 == 0) // Flat 4 health per second { if (!noLifeRegen) - Player.statLife += 1; + Player.HealPlayer(1, HealTextType.None); } } @@ -423,7 +423,7 @@ namespace CalamityMod.CalPlayer bloodfinTimer = 30; if (Player.statLife < (int)(Player.statLifeMax2 * 0.75) && !noLifeRegen) - Player.statLife += 1; + Player.HealPlayer(1, HealTextType.None); } } @@ -752,7 +752,7 @@ namespace CalamityMod.CalPlayer reaverRegenCooldown = 0; if (Player.statLife != Player.statLifeMax2 && !noLifeRegen) - Player.statLife += 1; + Player.HealPlayer(1, HealTextType.None); } if (BloomStoneRegen) diff --git a/DataStructures/Attunement.cs b/DataStructures/Attunement.cs index 11a9f82344..10d2bf28a6 100644 --- a/DataStructures/Attunement.cs +++ b/DataStructures/Attunement.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Enums; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; @@ -563,8 +564,7 @@ namespace CalamityMod.DataStructures { if (!player.moonLeech) { - player.statLife += OmegaBiomeBlade.SuperPogoAttunement_PassiveLifeSteal; - player.HealEffect(OmegaBiomeBlade.SuperPogoAttunement_PassiveLifeSteal); + player.HealPlayer(OmegaBiomeBlade.SuperPogoAttunement_PassiveLifeSteal); } Procced = false; diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 01c99c9c0e..a7487c8cb8 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -616,9 +616,7 @@ namespace CalamityMod.Items bool boostedHeart = player.Calamity().photosynthesis; if (boostedHeart) { - player.statLife += 5; - if (Main.myPlayer == player.whoAmI) - player.HealEffect(5, true); + player.HealPlayer(5); } } return true; diff --git a/Projectiles/Boss/HealOrbProv.cs b/Projectiles/Boss/HealOrbProv.cs index 6a19d3dcc6..71c67e33d8 100644 --- a/Projectiles/Boss/HealOrbProv.cs +++ b/Projectiles/Boss/HealOrbProv.cs @@ -35,12 +35,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.owner == Main.myPlayer) { int healAmount = (int)Projectile.ai[1]; - Main.player[playerTracker].HealEffect(healAmount, false); - Main.player[playerTracker].statLife += healAmount; - if (Main.player[playerTracker].statLife > Main.player[playerTracker].statLifeMax2) - { - Main.player[playerTracker].statLife = Main.player[playerTracker].statLifeMax2; - } + Main.player[playerTracker].HealPlayer(healAmount); NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, playerTracker, (float)healAmount, 0f, 0f, 0, 0, 0); } Projectile.Kill(); diff --git a/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs b/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs index 805df34b78..eeaef1dec2 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs @@ -104,8 +104,7 @@ namespace CalamityMod.Projectiles.Melee if (!cannotLifesteal) //trolled { - Owner.statLife += BrokenBiomeBlade.EvilAttunement_Lifesteal; - Owner.HealEffect(BrokenBiomeBlade.EvilAttunement_Lifesteal); //Idk if its too much or what but at the same time its close range as fuck + Owner.HealPlayer(BrokenBiomeBlade.EvilAttunement_Lifesteal); //Idk if its too much or what but at the same time its close range as fuck } // Bounce off diff --git a/Projectiles/Melee/EarthHoldout.cs b/Projectiles/Melee/EarthHoldout.cs index 9f2c31452e..6e352bc5dc 100644 --- a/Projectiles/Melee/EarthHoldout.cs +++ b/Projectiles/Melee/EarthHoldout.cs @@ -264,10 +264,7 @@ namespace CalamityMod.Projectiles.Melee int heal = (int)(MathHelper.Clamp(80 - Projectile.numHits * 40, 1, 80)); if (Projectile.numHits < 30) { - Owner.statLife += heal; - Owner.HealEffect(heal); - if (Owner.statLife > Owner.statLifeMax2) - Owner.statLife = Owner.statLifeMax2; + Owner.HealPlayer(heal); } if (Projectile.numHits <= 2) diff --git a/Projectiles/Melee/GalaxiaTropicRing.cs b/Projectiles/Melee/GalaxiaTropicRing.cs index c0fb8cc795..96a336a693 100644 --- a/Projectiles/Melee/GalaxiaTropicRing.cs +++ b/Projectiles/Melee/GalaxiaTropicRing.cs @@ -31,8 +31,7 @@ namespace CalamityMod.Projectiles.Melee { if (Mode == 0f && Main.rand.NextFloat() < FourSeasonsGalaxia.CancerPassiveLifeStealProc) { - Owner.statLife += FourSeasonsGalaxia.CancerPassiveLifeSteal; - Owner.HealEffect(FourSeasonsGalaxia.CancerPassiveLifeSteal); + Owner.HealPlayer(FourSeasonsGalaxia.CancerPassiveLifeSteal); } else { diff --git a/Projectiles/Melee/GrandDadHoldout.cs b/Projectiles/Melee/GrandDadHoldout.cs index 869acbd228..be4ff0a9bb 100644 --- a/Projectiles/Melee/GrandDadHoldout.cs +++ b/Projectiles/Melee/GrandDadHoldout.cs @@ -219,10 +219,7 @@ namespace CalamityMod.Projectiles.Melee int heal = (int)(MathHelper.Clamp(20 - Projectile.numHits * 5, 1, 20)); if (Projectile.numHits < 20) { - Owner.statLife += heal; - Owner.HealEffect(heal); - if (Owner.statLife > Owner.statLifeMax2) - Owner.statLife = Owner.statLifeMax2; + Owner.HealPlayer(heal); } if (target.CanBeMoved(true) || Main.zenithWorld || target.type == ModContent.NPCType() || (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs)) diff --git a/Projectiles/Melee/GrandGuardianHoldout.cs b/Projectiles/Melee/GrandGuardianHoldout.cs index d26ded3fa7..9a09685e78 100644 --- a/Projectiles/Melee/GrandGuardianHoldout.cs +++ b/Projectiles/Melee/GrandGuardianHoldout.cs @@ -208,10 +208,7 @@ namespace CalamityMod.Projectiles.Melee int heal = (int)(MathHelper.Clamp(3 - Projectile.numHits, 1, 3)); if (Projectile.numHits < 3) { - Owner.statLife += heal; - Owner.HealEffect(heal); - if (Owner.statLife > Owner.statLifeMax2) - Owner.statLife = Owner.statLifeMax2; + Owner.HealPlayer(heal); } int points = 4; diff --git a/Projectiles/Melee/MajesticGuardHoldout.cs b/Projectiles/Melee/MajesticGuardHoldout.cs index 36024f29ad..ccfb619712 100644 --- a/Projectiles/Melee/MajesticGuardHoldout.cs +++ b/Projectiles/Melee/MajesticGuardHoldout.cs @@ -183,10 +183,7 @@ namespace CalamityMod.Projectiles.Melee int heal = (int)(MathHelper.Clamp(5 - Projectile.numHits * 3, 1, 5)); if (Projectile.numHits < 5) { - Owner.statLife += heal; - Owner.HealEffect(heal); - if (Owner.statLife > Owner.statLifeMax2) - Owner.statLife = Owner.statLifeMax2; + Owner.HealPlayer(heal); } if (target.CanBeMoved(true)) diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs b/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs index 43accf8d45..1ae95e7c7e 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs @@ -154,8 +154,7 @@ namespace CalamityMod.Projectiles.Melee if (!cannotLifesteal) //trolled { - Owner.statLife += TrueBiomeBlade.EvilAttunement_Lifesteal; - Owner.HealEffect(TrueBiomeBlade.EvilAttunement_Lifesteal); //Idk if its too much or what but at the same time its close range as fuck + Owner.HealPlayer(TrueBiomeBlade.EvilAttunement_Lifesteal); //Idk if its too much or what but at the same time its close range as fuck } // Bounce off diff --git a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs index 0d2290995c..6c0cc309ec 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs @@ -59,8 +59,7 @@ namespace CalamityMod.Projectiles.Melee if (Owner.moonLeech) return; - Owner.statLife += OmegaBiomeBlade.SuperPogoAttunementSlashLifesteal; - Owner.HealEffect(OmegaBiomeBlade.SuperPogoAttunementSlashLifesteal); + Owner.HealPlayer(OmegaBiomeBlade.SuperPogoAttunementSlashLifesteal); } public override bool PreDraw(ref Color lightColor) //OMw to reuse way too much code from the entangling vines diff --git a/Projectiles/Pets/Sparks.cs b/Projectiles/Pets/Sparks.cs index 036204101e..6cde17f7d5 100644 --- a/Projectiles/Pets/Sparks.cs +++ b/Projectiles/Pets/Sparks.cs @@ -76,15 +76,7 @@ namespace CalamityMod.Projectiles.Pets { continue; //Main.PlaySound(7, (int)player.position.X, (int)player.position.Y, 1); - //player.statLife += 20; - //if (Main.myPlayer == player.whoAmI) - //{ - // player.HealEffect(20, true); - //} - //if (player.statLife > player.statLifeMax2) - //{ - // player.statLife = player.statLifeMax2; - //} + //player.HealPlayer(20); //Main.item[itemIndex] = new Item(); //if (Main.netMode == 1) //{ diff --git a/Projectiles/Ranged/BloodBoilerFire.cs b/Projectiles/Ranged/BloodBoilerFire.cs index ea27971022..ecabaf11f9 100644 --- a/Projectiles/Ranged/BloodBoilerFire.cs +++ b/Projectiles/Ranged/BloodBoilerFire.cs @@ -207,10 +207,7 @@ namespace CalamityMod.Projectiles.Ranged } Main.player[Main.myPlayer].lifeSteal -= heal; - player.statLife += heal; - player.HealEffect(heal); - if (Main.player[Projectile.owner].statLife > Main.player[Projectile.owner].statLifeMax2) - Main.player[Projectile.owner].statLife = Main.player[Projectile.owner].statLifeMax2; + player.HealPlayer(heal); } Projectile.Kill(); diff --git a/Projectiles/Ranged/SepticSkewerHarpoon.cs b/Projectiles/Ranged/SepticSkewerHarpoon.cs index 79b307a048..d53a9969ce 100644 --- a/Projectiles/Ranged/SepticSkewerHarpoon.cs +++ b/Projectiles/Ranged/SepticSkewerHarpoon.cs @@ -268,10 +268,7 @@ namespace CalamityMod.Projectiles.Ranged } int heal = 25; - Owner.statLife += heal; - Owner.HealEffect(heal); - if (Owner.statLife > Owner.statLifeMax2) - Owner.statLife = Owner.statLifeMax2; + Owner.HealPlayer(heal); spawnPullBlood = false; } diff --git a/Projectiles/Rogue/SacrificeProjectile.cs b/Projectiles/Rogue/SacrificeProjectile.cs index 2c946b43b3..fd2c11b97d 100644 --- a/Projectiles/Rogue/SacrificeProjectile.cs +++ b/Projectiles/Rogue/SacrificeProjectile.cs @@ -64,10 +64,7 @@ namespace CalamityMod.Projectiles.Rogue } Main.player[Main.myPlayer].lifeSteal -= heal; - Owner.HealEffect(heal); - Owner.statLife += heal; - if (Owner.statLife > Owner.statLifeMax2) - Owner.statLife = Owner.statLifeMax2; + Owner.HealPlayer(heal); } Projectile.Kill(); diff --git a/Projectiles/Rogue/WhitewaterAura.cs b/Projectiles/Rogue/WhitewaterAura.cs index 4d19d49999..4b56d28857 100644 --- a/Projectiles/Rogue/WhitewaterAura.cs +++ b/Projectiles/Rogue/WhitewaterAura.cs @@ -40,10 +40,7 @@ namespace CalamityMod.Projectiles.Rogue if (targetDist < 200f * areaScale && time % 6 == 0) { - player.statLife += 1; - player.HealEffect(1); - if (player.statLife > player.statLifeMax2) - player.statLife = player.statLifeMax2; + player.HealPlayer(1); } } diff --git a/Projectiles/Typeless/ChlorophyteLifePulse.cs b/Projectiles/Typeless/ChlorophyteLifePulse.cs index c76a6f1bc5..32d4f715df 100644 --- a/Projectiles/Typeless/ChlorophyteLifePulse.cs +++ b/Projectiles/Typeless/ChlorophyteLifePulse.cs @@ -57,8 +57,7 @@ namespace CalamityMod.Projectiles.Typeless continue; int healQuantity = (int)owner.GetBestClassDamage().ApplyTo(ChlorophyteArmorSetChange.AmountToHealPerPulse); - player.statLife += healQuantity; - player.HealEffect(healQuantity); + player.HealPlayer(healQuantity); player.Calamity().ChlorophyteHealDelay = ChlorophyteArmorSetChange.DelayBetweenHeals; } } diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index 56ab1087a7..db1a3c7a32 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -652,7 +652,7 @@ namespace CalamityMod healAmt = 0; } - player.statLife += healAmt; + player.HealPlayer(healAmt, healAmt > 0 ? Enums.HealTextType.Broadcast : Enums.HealTextType.None); player.statMana += item.healMana; if (player.statMana > player.statManaMax2) { @@ -666,8 +666,6 @@ namespace CalamityMod player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); if (Main.myPlayer == player.whoAmI) { - if (healAmt > 0) - player.HealEffect(healAmt, true); if (item.healMana > 0) player.ManaEffect(item.healMana); }