From 99b996e8deefcf6756c3f60463111ce370fdc16f Mon Sep 17 00:00:00 2001 From: Dreitone Date: Wed, 28 Jan 2026 14:44:49 -0600 Subject: [PATCH 1/3] bloodstone heal orb optimization attempt --- Projectiles/Healing/BloodstoneHealOrb.cs | 34 +++++++++++++----------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/Projectiles/Healing/BloodstoneHealOrb.cs b/Projectiles/Healing/BloodstoneHealOrb.cs index e2cb0587b6..df057b3c2e 100644 --- a/Projectiles/Healing/BloodstoneHealOrb.cs +++ b/Projectiles/Healing/BloodstoneHealOrb.cs @@ -1,4 +1,5 @@ -using CalamityMod.Graphics.Metaballs; +using System.Runtime.CompilerServices; +using CalamityMod.Graphics.Metaballs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; @@ -26,20 +27,22 @@ namespace CalamityMod.Projectiles.Healing Projectile.alpha = 255; Projectile.penetrate = 1; Projectile.tileCollide = false; - Projectile.extraUpdates = 3; + Projectile.extraUpdates = 1; Projectile.timeLeft = 60 * 5 * Projectile.MaxUpdates; spawnCooldown *= Projectile.MaxUpdates; } public override void AI() { + bool finalUpdate = Projectile.FinalExtraUpdate(); + if (finalUpdate) + { + var p = BloodMetaball.SpawnParticle(Projectile.Center + Projectile.velocity, Main.rand.NextVector2Circular(-0.5f, -0.5f), Projectile.width); + p.SizeScaling = 0.75f; + p.ShrinkDelay = 1; + } - var p = BloodMetaball.SpawnParticle(Projectile.Center + Projectile.velocity, Main.rand.NextVector2Circular(-0.5f, -0.5f), Projectile.width); - p.SizeScaling = 0.75f; - p.ShrinkDelay = 1; - - Projectile.scale = MathHelper.Lerp(1, 1, 0.65f); - float maxDistance = 200f; + float maxDistanceSq = 200f * 200f; if (spawnCooldown > 0) { PassiveBehavior(); @@ -49,15 +52,14 @@ namespace CalamityMod.Projectiles.Healing if (target < 0) { PassiveBehavior(); - if (Projectile.FinalExtraUpdate()) for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + if (finalUpdate) for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) { Player player = Main.player[playerIndex]; - if (player.lifeMagnet) - maxDistance *= 1.5f; //Heartreach gives 50% more range - float targetDist = Vector2.Distance(player.Center, Projectile.Center); - if (targetDist < maxDistance) + float perPlayerMaxDistanceSq = player.lifeMagnet ? maxDistanceSq * 2.25f : maxDistanceSq; //Heartreach gives 50% more range + float targetDistSq = Vector2.DistanceSquared(player.Center, Projectile.Center); + if (targetDistSq < perPlayerMaxDistanceSq) { - maxDistance = targetDist; + maxDistanceSq = targetDistSq; target = playerIndex; } } @@ -69,7 +71,7 @@ namespace CalamityMod.Projectiles.Healing { Projectile.velocity *= 0.99f; } - + public void HealHome() { Player player = Main.player[target]; @@ -81,7 +83,7 @@ namespace CalamityMod.Projectiles.Healing Projectile.Kill(); } - Projectile.velocity = (Projectile.velocity * 5 + (playerVector.SafeNormalize(Vector2.Zero) * 5)) / 6f; //Move towards player. Range is determined in the AI(); + Projectile.velocity = (Projectile.velocity * 5 + (playerVector.SafeNormalize(Vector2.Zero) * 10)) / 6f; //Move towards player. Range is determined in the AI(); } public static void Heal(Player player, int PotionTime) From 319f6db9d44c08454cd8e08efbeb223cf04bd5d7 Mon Sep 17 00:00:00 2001 From: Dreitone Date: Wed, 28 Jan 2026 15:25:39 -0600 Subject: [PATCH 2/3] preserve some facet of previous visuals --- Projectiles/Healing/BloodstoneHealOrb.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Projectiles/Healing/BloodstoneHealOrb.cs b/Projectiles/Healing/BloodstoneHealOrb.cs index df057b3c2e..2d6019baa8 100644 --- a/Projectiles/Healing/BloodstoneHealOrb.cs +++ b/Projectiles/Healing/BloodstoneHealOrb.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Healing if (finalUpdate) { var p = BloodMetaball.SpawnParticle(Projectile.Center + Projectile.velocity, Main.rand.NextVector2Circular(-0.5f, -0.5f), Projectile.width); - p.SizeScaling = 0.75f; + p.SizeScaling = 0.85f; p.ShrinkDelay = 1; } @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Healing Projectile.Kill(); } - Projectile.velocity = (Projectile.velocity * 5 + (playerVector.SafeNormalize(Vector2.Zero) * 10)) / 6f; //Move towards player. Range is determined in the AI(); + Projectile.velocity = (Projectile.velocity * 5 + (playerVector.SafeNormalize(Vector2.Zero) * 15)) / 6f; //Move towards player. Range is determined in the AI(); } public static void Heal(Player player, int PotionTime) From 632c97b48149861098892d799586e23477eef38a Mon Sep 17 00:00:00 2001 From: doze-zoze Date: Wed, 28 Jan 2026 16:39:58 -0600 Subject: [PATCH 3/3] returned extraupdates, removed rogue bloodorbs --- CalPlayer/CalamityPlayerOnHit.cs | 2 +- ...CalamityMod.Items.Armor.PostMoonLord.hjson | 3 +- Projectiles/Healing/BloodstoneHealOrb.cs | 40 +++++++++---------- 3 files changed, 20 insertions(+), 25 deletions(-) diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 60fe2b408a..bd2d31e66c 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -1340,7 +1340,7 @@ namespace CalamityMod.CalPlayer Player.SpawnLifeStealProjectile(target, proj, ProjectileID.VampireHeal, electricianGlove ? 10 : 5, 2f); if (bloodflareThrowing && proj.CountsAsClass() && crit) - Projectile.NewProjectile(proj.GetSource_OnHit(target), proj.Center, proj.velocity.SafeNormalize(Vector2.Zero) * Math.Min(((proj.velocity.Length() * proj.MaxUpdates) / 4f), 4f) * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), 4, 0f, proj.owner); + Player.SpawnLifeStealProjectile(target, proj, ProjectileID.VampireHeal, 2, 1.5f); if (proj.CountsAsClass() && Player.HeldItem.CountsAsClass()) { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson index dea3ded2a9..10cdedab20 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson @@ -252,8 +252,7 @@ BloodflareHeadRogue: { SetBonusEffect: ''' Grants {0} defense when above {1}% life - Rogue critical strikes burst into blood orbs - Picking up these blood orbs reduces the duration of [cbuff:PotionSickness] + Rogue critical strikes have lifesteal {$BloodflareBodyArmor.CommonSetBonus} ''' } diff --git a/Projectiles/Healing/BloodstoneHealOrb.cs b/Projectiles/Healing/BloodstoneHealOrb.cs index 2d6019baa8..c0073ab719 100644 --- a/Projectiles/Healing/BloodstoneHealOrb.cs +++ b/Projectiles/Healing/BloodstoneHealOrb.cs @@ -1,5 +1,4 @@ -using System.Runtime.CompilerServices; -using CalamityMod.Graphics.Metaballs; +using CalamityMod.Graphics.Metaballs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; @@ -27,20 +26,17 @@ namespace CalamityMod.Projectiles.Healing Projectile.alpha = 255; Projectile.penetrate = 1; Projectile.tileCollide = false; - Projectile.extraUpdates = 1; + Projectile.extraUpdates = 3; Projectile.timeLeft = 60 * 5 * Projectile.MaxUpdates; spawnCooldown *= Projectile.MaxUpdates; } - public override void AI() { bool finalUpdate = Projectile.FinalExtraUpdate(); - if (finalUpdate) - { - var p = BloodMetaball.SpawnParticle(Projectile.Center + Projectile.velocity, Main.rand.NextVector2Circular(-0.5f, -0.5f), Projectile.width); - p.SizeScaling = 0.85f; - p.ShrinkDelay = 1; - } + + var p = BloodMetaball.SpawnParticle(Projectile.Center + Projectile.velocity, Main.rand.NextVector2Circular(-0.5f, -0.5f), Projectile.width); + p.SizeScaling = 0.75f; + p.ShrinkDelay = 1; float maxDistanceSq = 200f * 200f; if (spawnCooldown > 0) @@ -53,16 +49,16 @@ namespace CalamityMod.Projectiles.Healing { PassiveBehavior(); if (finalUpdate) for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) - { - Player player = Main.player[playerIndex]; - float perPlayerMaxDistanceSq = player.lifeMagnet ? maxDistanceSq * 2.25f : maxDistanceSq; //Heartreach gives 50% more range - float targetDistSq = Vector2.DistanceSquared(player.Center, Projectile.Center); - if (targetDistSq < perPlayerMaxDistanceSq) { - maxDistanceSq = targetDistSq; - target = playerIndex; + Player player = Main.player[playerIndex]; + float perPlayerMaxDistanceSq = player.lifeMagnet ? maxDistanceSq * 2.25f : maxDistanceSq; //Heartreach gives 50% more range + float targetDistSq = Vector2.DistanceSquared(player.Center, Projectile.Center); + if (targetDistSq < perPlayerMaxDistanceSq) + { + maxDistanceSq = targetDistSq; + target = playerIndex; + } } - } } else HealHome(); } @@ -71,7 +67,7 @@ namespace CalamityMod.Projectiles.Healing { Projectile.velocity *= 0.99f; } - + public void HealHome() { Player player = Main.player[target]; @@ -83,7 +79,7 @@ namespace CalamityMod.Projectiles.Healing Projectile.Kill(); } - Projectile.velocity = (Projectile.velocity * 5 + (playerVector.SafeNormalize(Vector2.Zero) * 15)) / 6f; //Move towards player. Range is determined in the AI(); + Projectile.velocity = (Projectile.velocity * 5 + (playerVector.SafeNormalize(Vector2.Zero) * 5)) / 6f; //Move towards player. Range is determined in the AI(); } public static void Heal(Player player, int PotionTime) @@ -109,9 +105,9 @@ namespace CalamityMod.Projectiles.Healing { player.lifeRegenTime += 3*PotionTime; //if Potion Sickness is full, each orb speeds up natural regen } - + Particle ring = new CustomPulse(player.Center, Vector2.Zero, new Color(255, 32, 32)*0.75f, "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, 0, 0.01f, 0.05f, 20); - GeneralParticleHandler.SpawnParticle(ring); + GeneralParticleHandler.SpawnParticle(ring); } public override bool PreDraw(ref Color lightColor)