From 3d871eebe5b348717682f74bde5c0b76b3281f2e Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Sat, 19 Jul 2025 12:08:11 +0700 Subject: [PATCH 1/2] similarly efficient comb chest search --- CalPlayer/DrawLayers/CombHairSparkleLayer.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CalPlayer/DrawLayers/CombHairSparkleLayer.cs b/CalPlayer/DrawLayers/CombHairSparkleLayer.cs index 18ca428d85..e2525ac081 100644 --- a/CalPlayer/DrawLayers/CombHairSparkleLayer.cs +++ b/CalPlayer/DrawLayers/CombHairSparkleLayer.cs @@ -60,10 +60,14 @@ namespace CalamityMod.CalPlayer.DrawLayers { for (int j = TopRange; j <= BottomRange; j++) { + Tile tile = Main.tile[i, j]; + if (!tile.HasTile || !TileID.Sets.IsAContainer[tile.TileType] || TileID.Sets.BasicDresser[tile.TileType]) + continue; + int PotentialChest = Chest.FindChestByGuessing(i, j); - if (PotentialChest != -1 && !TileID.Sets.BasicDresser[Main.tile[i, j].TileType]) + if (PotentialChest != -1) { - // Adjust position ot the center of the chest + // Adjust position to the center of the chest Chest chest = Main.chest[PotentialChest]; Vector2 chestCenter = new Vector2(chest.x + 1, chest.y + 1) * 16f; float distance = Vector2.Distance(chestCenter, drawPlayer.MountedCenter); From 08994f5c77635b1cb9465e9278c24c6dd7998e39 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Sat, 19 Jul 2025 20:39:08 -0400 Subject: [PATCH 2/2] 1 - Biome Blade balance 2 - Cal Clone no longer fires hellfireballs during brothers phase 3 - Fixed Plantera always being enraged --- Items/Weapons/Melee/TrueBiomeBlade.cs | 18 +++---- NPCs/CalClone/CalamitasClone.cs | 51 ++++++++----------- .../Bosses/PlanteraAI.cs | 2 +- .../MendedBiomeBlade_DecaysRetortDash.cs | 4 +- .../Melee/MendedBiomeBlade_HeavensMight.cs | 6 ++- .../Melee/MendedBiomeBlade_HeavensMonolith.cs | 2 +- 6 files changed, 38 insertions(+), 45 deletions(-) diff --git a/Items/Weapons/Melee/TrueBiomeBlade.cs b/Items/Weapons/Melee/TrueBiomeBlade.cs index 2dbd3efbd9..36b0850ef5 100644 --- a/Items/Weapons/Melee/TrueBiomeBlade.cs +++ b/Items/Weapons/Melee/TrueBiomeBlade.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Melee #region stats public static int BaseDamage = 115; - public static int DefaultAttunement_BaseDamage = 100; + public static int DefaultAttunement_BaseDamage = 90; public static int DefaultAttunement_SigilTime = 900; public static int DefaultAttunement_BeamTime = 90; public static float DefaultAttunement_LungeDamageMult = 2f; @@ -48,27 +48,27 @@ namespace CalamityMod.Items.Weapons.Melee public static float EvilAttunement_SlashDamageBoost = 3f; public static int EvilAttunement_SlashIFrames = 60; - public static int ColdAttunement_BaseDamage = 150; + public static int ColdAttunement_BaseDamage = 140; public static float ColdAttunement_ThirdSwingBoost = 1.25f; public static float ColdAttunement_MistDamageReduction = 0.11f; - public static int HotAttunement_BaseDamage = 135; + public static int HotAttunement_BaseDamage = 126; public static int HotAttunement_PlayerShredIFrames = 8; public static float HotAttunement_ShotDamageBoost = 4.5f; public static int HotAttunement_LocalIFrames = 24; //Be warned its got one extra update so all the iframes should be divided in 2 public static float HotAttunement_ShredDecayRate = 0.65f; //How much charge is lost per frame. - public static int TropicalAttunement_BaseDamage = 150; + public static int TropicalAttunement_BaseDamage = 132; public static float TropicalAttunement_ChainDamageReduction = 0.6f; public static float TropicalAttunement_VineDamageReduction = 0.3f; public static float TropicalAttunement_SweetSpotDamageMultiplier = 1.5f; //It also crits, so be mindful of that public static int TropicalAttunement_LocalIFrames = 60; //Be warned its got 2 extra updates so all the iframes should be divided in 3 - public static int HolyAttunement_BaseDamage = 66; - public static float HolyAttunement_BaseSwingDamageMult = 0.75f; - public static float HolyAttunement_FullSwingDamageMult = 1.5f; - public static float HolyAttunement_ThrowDamageBoost = 3.8f; - public static int HolyAttunement_LocalIFrames = 16; //Be warned its got 1 extra update yadda yadda + public static int HolyAttunement_BaseDamage = 84; + public static float HolyAttunement_BaseSwingDamageMult = 0.5f; + public static float HolyAttunement_FullSwingDamageMult = 1f; + public static float HolyAttunement_ThrowDamageBoost = 3f; + public static int HolyAttunement_LocalIFrames = 20; //Be warned its got 1 extra update yadda yadda public static float HolyAttunement_MonolithDamage = 0.5f; #endregion diff --git a/NPCs/CalClone/CalamitasClone.cs b/NPCs/CalClone/CalamitasClone.cs index 83f55e1c3e..7f4eff2654 100644 --- a/NPCs/CalClone/CalamitasClone.cs +++ b/NPCs/CalClone/CalamitasClone.cs @@ -645,10 +645,9 @@ namespace CalamityMod.NPCs.CalClone float phaseTimer = 400f - (death ? 120f * (1f - lifeRatio) : 0f); if (NPC.ai[2] >= phaseTimer || phase4) { - if (death && !phase4 && Main.rand.NextBool() && !brotherAlive) - NPC.ai[1] = 4f; - else - NPC.ai[1] = 1f; + // Prevent going to other positions during brothers phase + if (!brotherAlive) + NPC.ai[1] = death && !phase4 && Main.rand.NextBool() ? 4f : 1f; NPC.ai[2] = 0f; if (death) @@ -657,18 +656,15 @@ namespace CalamityMod.NPCs.CalClone NPC.netUpdate = true; } - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != NetmodeID.MultiplayerClient && !brotherAlive) { NPC.localAI[1] += 1f; - if (!brotherAlive) - { - if (expertMode) - NPC.localAI[1] += death ? 2f * (1f - lifeRatio) : 1f - lifeRatio; - if (revenge) - NPC.localAI[1] += 0.5f; - } + if (expertMode) + NPC.localAI[1] += death ? 2f * (1f - lifeRatio) : 1f - lifeRatio; + if (revenge) + NPC.localAI[1] += 0.5f; - if (NPC.localAI[1] >= (brotherAlive ? 180f : 120f)) + if (NPC.localAI[1] >= 120f) { NPC.localAI[1] = 0f; SoundEngine.PlaySound(BrimstoneElemental.BrimstoneElemental.HellfireballSound, NPC.Center); @@ -693,24 +689,21 @@ namespace CalamityMod.NPCs.CalClone // Avoid cheap bullshit NPC.damage = 0; - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != NetmodeID.MultiplayerClient && !brotherAlive) { NPC.localAI[1] += 1f; - if (!brotherAlive) - { - if (revenge) - NPC.localAI[1] += 0.5f; - if (expertMode) - NPC.localAI[1] += 0.5f; - } + if (revenge) + NPC.localAI[1] += 0.5f; + if (expertMode) + NPC.localAI[1] += 0.5f; - if (NPC.localAI[1] >= (brotherAlive ? 75f : 50f) && Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) + if (NPC.localAI[1] >= 50f && Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { NPC.localAI[1] = 0f; float projectileVelocity = expertMode ? 12.5f : 11f; projectileVelocity += 3f * enrageScale; - int type = brotherAlive ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); Vector2 fireballVelocity = Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity; Vector2 offset = Vector2.Normalize(fireballVelocity) * 40f; @@ -723,9 +716,7 @@ namespace CalamityMod.NPCs.CalClone } else { - float ai0 = type == ModContent.ProjectileType() ? 1f : player.position.X; - float ai1 = type == ModContent.ProjectileType() ? 0f : player.position.Y; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, fireballVelocity, type, damage, 0f, Main.myPlayer, ai0, ai1); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, fireballVelocity, type, damage, 0f, Main.myPlayer, 1f); } } } @@ -734,10 +725,12 @@ namespace CalamityMod.NPCs.CalClone float phaseTimer = 240f - (death ? 60f * (1f - lifeRatio) : 0f); if (NPC.ai[2] >= phaseTimer || phase4) { - if (death && !phase4 && Main.rand.NextBool() && !brotherAlive) + if (brotherAlive) + NPC.ai[1] = 0f; + else if (death && !phase4 && Main.rand.NextBool()) NPC.ai[1] = 0f; else - NPC.ai[1] = !brotherAlive && phase2 && revenge ? 4f : 0f; + NPC.ai[1] = phase2 && revenge ? 4f : 0f; NPC.ai[2] = 0f; if (death) @@ -750,7 +743,7 @@ namespace CalamityMod.NPCs.CalClone { // Set damage NPC.damage = NPC.defDamage; - SoundEngine.PlaySound(CalamitasClone.ChargeSound, NPC.Center); + SoundEngine.PlaySound(ChargeSound, NPC.Center); NPC.rotation = rotation; float chargeVelocity = phase4 ? 30f : death ? 28f : 25f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs index 2fc7601040..e8f96d99da 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int reducedSetDamage = (int)Math.Round(setDamage * 0.5); // Variables and target - bool enrage = !BossRushEvent.BossRushActive; + bool enrage = false; bool despawn = false; // Check for Jungle diff --git a/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs b/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs index fb19dc0660..cc6e39ef9c 100644 --- a/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs +++ b/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs @@ -24,15 +24,13 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; - Projectile.width = Projectile.height = 8; + Projectile.width = Projectile.height = 80; Projectile.tileCollide = false; Projectile.friendly = true; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 60; Projectile.timeLeft = 20; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs b/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs index 7a7fc8cb16..68bc6ca463 100644 --- a/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs +++ b/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLength = 100 * Projectile.scale; + float bladeLength = 105 * Projectile.scale; float bladeWidth = 20 * Projectile.scale; return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (direction * bladeLength), bladeWidth, ref collisionPoint); } @@ -171,7 +171,7 @@ namespace CalamityMod.Projectiles.Melee //Manage position and rotation - Projectile.scale = 1 + Empowerment / maxEmpowerment * 1.5f; + Projectile.scale = 1 + Empowerment / maxEmpowerment * 1.85f; oldDirection = direction; direction = direction.RotatedBy(MathHelper.Clamp(Empowerment * 1.1f / maxEmpowerment, 0.45f, 1f) * MathHelper.PiOver4 * 0.20f); @@ -222,6 +222,8 @@ namespace CalamityMod.Projectiles.Melee modifiers.SourceDamage *= MathHelper.Lerp(1f, TrueBiomeBlade.HolyAttunement_ThrowDamageBoost, Empowerment / maxEmpowerment); else modifiers.SourceDamage *= MathHelper.Lerp(TrueBiomeBlade.HolyAttunement_BaseSwingDamageMult, TrueBiomeBlade.HolyAttunement_FullSwingDamageMult, Empowerment / maxEmpowerment); + + modifiers.HitDirectionOverride = (Owner.Center.X > target.Center.X).ToDirectionInt(); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith.cs b/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith.cs index d2ada56839..a9e9b8c3b8 100644 --- a/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith.cs +++ b/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 102; Projectile.scale = Scale; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + Projectile.idStaticNPCHitCooldown = 20; Projectile.hide = true; }