From cf793b05fc8fa6ff9d246b88c98cf044b05820c6 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Mon, 26 May 2025 16:35:09 -0400 Subject: [PATCH] Mass fix batch #1 1 - Fixed Astral Ore oob error 2 - Fixed a grammatical error in Blast Barrel's tooltip 3 - Fixed Blood Boiler stating the wrong chance to consume HP 4 - Fixed brimstone darts having a larger hitbox than intended 4 - Fixed Brimstone Heart artery trails not appearing 5 - Fixed vanilla bug of Gold Chests being able to contain Meteorite Bars 6 - Fixed Jousting Lance damage formula 7 - Fixed Metastasis index oob error 8 - Fixed Obstructed effect not drawing when gravity is flipped 9 - Fixed exploit with Overloaded Blaster damage when piercing 10 - Fixed Statigel armor paladin minion framing 11 - Fixed SCal being able to deal contact damage on the first frame of spawning 12 - Fixed SCal being able to fire brimstone dart spreads during bros spawn animation 13 - Fixed SCal's brimstone flame skulls briefly being able to deal damage after the bullet hell ends 14 - Fixed Ultimus Cleaver being considered true melee 15 - Fixed Wulfrum Screwdriver not being considered true melee --- ILEditing/MechanicILChanges.cs | 2 +- Items/Weapons/Melee/UltimusCleaver.cs | 4 +++- Items/Weapons/Melee/WulfrumScrewdriver.cs | 2 +- .../Mods.CalamityMod.Items.Weapons.Ranged.hjson | 2 +- .../Mods.CalamityMod.Items.Weapons.Rogue.hjson | 2 +- NPCs/SupremeCalamitas/BrimstoneHeart.cs | 14 ++++++++------ NPCs/SupremeCalamitas/SupremeCalamitas.cs | 10 ++++++---- Projectiles/Boss/BrimstoneBarrage.cs | 2 +- Projectiles/Boss/BrimstoneWave.cs | 6 +++--- Projectiles/CalamityGlobalProjectile.cs | 6 +++--- Projectiles/Melee/WulfrumScrewdriverProj.cs | 2 +- Projectiles/Ranged/SlimeBolt.cs | 2 +- Projectiles/Summon/CorruptionSlimeGodMinion.cs | 13 ++++++++++++- Projectiles/Summon/CrimsonSlimeGodMinion.cs | 13 ++++++++++++- Projectiles/Summon/SepulcherMinion.cs | 4 ++-- Systems/WorldgenManagementSystem.cs | 14 ++++++++++++++ Tiles/Ores/AstralOre.cs | 3 +++ 17 files changed, 73 insertions(+), 28 deletions(-) diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index fb4fe1510e..93488e753c 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -728,7 +728,7 @@ namespace CalamityMod.ILEditing private static void AdditiveDrawing(ILContext il) { ILCursor cursor = new(il); - if (!cursor.TryGotoNext(MoveType.After, i => i.MatchCall("DrawWhite"))) + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchCall("Draw"))) return; cursor.EmitDelegate(() => diff --git a/Items/Weapons/Melee/UltimusCleaver.cs b/Items/Weapons/Melee/UltimusCleaver.cs index 655d248f21..3c7b6dd96e 100644 --- a/Items/Weapons/Melee/UltimusCleaver.cs +++ b/Items/Weapons/Melee/UltimusCleaver.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -26,8 +27,9 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.autoReuse = true; Item.UseSound = SoundID.Item1; + Item.shoot = ModContent.ProjectileType(); // Dummy argument to ensure it doesn't get set to true melee } - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) => false; public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.OnFire3, 360); diff --git a/Items/Weapons/Melee/WulfrumScrewdriver.cs b/Items/Weapons/Melee/WulfrumScrewdriver.cs index ad663b26d5..94b7ff804c 100644 --- a/Items/Weapons/Melee/WulfrumScrewdriver.cs +++ b/Items/Weapons/Melee/WulfrumScrewdriver.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 14; Item.height = 50; Item.damage = 12; - Item.DamageType = DamageClass.Melee; + Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = DefaultTime + WulfrumScrewdriverProj.MaxTime; Item.useStyle = ItemUseStyleID.Shoot; Item.useTime = DefaultTime + WulfrumScrewdriverProj.MaxTime; diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index d15cb408ad..2b819b79be 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -183,7 +183,7 @@ BloodBoiler: { ''' Fires twin streams of life stealing bloodfire that returns to you Uses your health as ammo - 40% chance to save health + 60% chance to save health ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 69ed27ce98..13b9b83d4a 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -64,7 +64,7 @@ BlastBarrel: { Tooltip: ''' Throws a rolling barrel that explodes on wall collision - Stealth strikes makes the barrel bounce twice before disappearing with varied effects after each bounce + Stealth strikes make the barrel bounce twice before disappearing with varied effects after each bounce 'Some people used to jump over these' ''' } diff --git a/NPCs/SupremeCalamitas/BrimstoneHeart.cs b/NPCs/SupremeCalamitas/BrimstoneHeart.cs index fd529f0e33..46a94b1db7 100644 --- a/NPCs/SupremeCalamitas/BrimstoneHeart.cs +++ b/NPCs/SupremeCalamitas/BrimstoneHeart.cs @@ -115,16 +115,18 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.IsABestiaryIconDummy) return true; + spriteBatch.ExitShaderRegion(); + for (int i = 0; i < ChainEndpoints.Count; i++) { - List points = new List() - { - NPC.Center, - ChainEndpoints[i] + NPC.DirectionTo(ChainEndpoints[i]) * 25f - }; + float dist = NPC.Distance(ChainEndpoints[i]); + List points = new List(); + for (int j = 0; j < 4; j++) + points.Add(NPC.Center + NPC.DirectionTo(ChainEndpoints[i]) * dist * 0.25f * j); + points.Add(ChainEndpoints[i] + NPC.DirectionTo(ChainEndpoints[i]) * 18f); + PrimitiveRenderer.RenderTrail(points, new(PrimitiveWidthFunction, PrimitiveColorFunction), 40); } - return true; } diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 42f996b630..9904de5f8d 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -2271,7 +2271,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas GeneralParticleHandler.SpawnParticle(spark2); } - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != NetmodeID.MultiplayerClient && attackPause == 0) { Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, randomShot, gigablastDamage, 0f, Main.myPlayer, 0f, 2f); NPC.netUpdate = true; @@ -2290,7 +2290,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas GeneralParticleHandler.SpawnParticle(spark2); } - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != NetmodeID.MultiplayerClient && attackPause == 0) { Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, randomShot, fireblastDamage, 0f, Main.myPlayer, 0f, 2f); NPC.netUpdate = true; @@ -2312,7 +2312,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas GeneralParticleHandler.SpawnParticle(orb); } - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != NetmodeID.MultiplayerClient && attackPause == 0) { float projectileVelocityToPass = projectileVelocity.Length() * 1.3f; Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (float)(numProj - 1))); @@ -3556,7 +3556,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas float _ = 0f; bool collidingWithShield = Collision.CheckAABBvLineCollision(target.TopLeft, target.Size, shieldTop, shieldBottom, 64f, ref _) && shieldOpacity > 0.55f; - return collidingWithShield || NPC.Hitbox.Intersects(target.Hitbox); + // CIT 16MAY2025: SCal must have contact damage set on the first frame to preserve difficulty mode stat scaling, sometimes leading to people getting hit if on top of her. + // Thus, also check if the arena has spawned, since that will not be true on the first frame. + return (collidingWithShield || NPC.Hitbox.Intersects(target.Hitbox)) && spawnArena; } public override void FindFrame(int frameHeight) diff --git a/Projectiles/Boss/BrimstoneBarrage.cs b/Projectiles/Boss/BrimstoneBarrage.cs index 5c4f0f70eb..344dee7f5e 100644 --- a/Projectiles/Boss/BrimstoneBarrage.cs +++ b/Projectiles/Boss/BrimstoneBarrage.cs @@ -161,6 +161,6 @@ namespace CalamityMod.Projectiles.Boss CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 18 * Projectile.scale, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 10 * Projectile.scale, targetHitbox); } } diff --git a/Projectiles/Boss/BrimstoneWave.cs b/Projectiles/Boss/BrimstoneWave.cs index abb32499e3..063a83b776 100644 --- a/Projectiles/Boss/BrimstoneWave.cs +++ b/Projectiles/Boss/BrimstoneWave.cs @@ -62,10 +62,10 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame > 3) Projectile.frame = 0; - if (Projectile.timeLeft < 30) - Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 30f, 0f, 1f); + if (Projectile.timeLeft < 60) + Projectile.Opacity = MathHelper.Clamp(Projectile.timeLeft / 60f, 0f, 1f); else - Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 1170) / 30f), 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 1140) / 60f), 0f, 1f); Lighting.AddLight(Projectile.Center, 0.5f * Projectile.Opacity, 0f, 0f); diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index b80b8e3805..5478122efc 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -4190,13 +4190,13 @@ namespace CalamityMod.Projectiles } } - // The vanilla damage Jousting Lance multiplier is as follows. Calamity overrides this with a new formula. - // damageScale = 0.1f + player.velocity.Length() / 7f * 0.9f if (projectile.type == ProjectileID.JoustingLance || projectile.type == ProjectileID.HallowJoustingLance || projectile.type == ProjectileID.ShadowJoustingLance) { + // The vanilla damage Jousting Lance multiplier is as follows. Calamity overrides this with a new formula. + float vanillaVelocityDamageMultiplier = 0.1f + player.velocity.Length() / 7f * 0.9f; float baseVelocityDamageMultiplier = 0.01f + player.velocity.Length() * 0.002f; float calamityVelocityDamageMultiplier = 100f * (1f - (1f / (1f + baseVelocityDamageMultiplier))); - modifiers.SourceDamage *= calamityVelocityDamageMultiplier; + modifiers.SourceDamage *= calamityVelocityDamageMultiplier / vanillaVelocityDamageMultiplier; } // If applicable, use ricoshot bonus damage. diff --git a/Projectiles/Melee/WulfrumScrewdriverProj.cs b/Projectiles/Melee/WulfrumScrewdriverProj.cs index e5b86eea6a..1f76e30360 100644 --- a/Projectiles/Melee/WulfrumScrewdriverProj.cs +++ b/Projectiles/Melee/WulfrumScrewdriverProj.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = TrueMeleeDamageClass.Instance; Projectile.width = 14; Projectile.height = 50; Projectile.tileCollide = false; diff --git a/Projectiles/Ranged/SlimeBolt.cs b/Projectiles/Ranged/SlimeBolt.cs index efe0d6612b..480bb7d7d8 100644 --- a/Projectiles/Ranged/SlimeBolt.cs +++ b/Projectiles/Ranged/SlimeBolt.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Ranged if (Time == EmpowerTime) { Projectile.penetrate = 1; - Projectile.damage = (int)((Projectile.damage / Math.Pow(DamageFalloff, Projectile.numHits)) * 1.6f); // 7/4 + Projectile.damage = (int)(Projectile.originalDamage * 1.6f); Projectile.velocity *= 0f; Projectile.rotation = Main.rand.NextFloat(0f, MathHelper.TwoPi); diff --git a/Projectiles/Summon/CorruptionSlimeGodMinion.cs b/Projectiles/Summon/CorruptionSlimeGodMinion.cs index 7127930079..6a2fd85620 100644 --- a/Projectiles/Summon/CorruptionSlimeGodMinion.cs +++ b/Projectiles/Summon/CorruptionSlimeGodMinion.cs @@ -1,7 +1,9 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon @@ -9,11 +11,12 @@ namespace CalamityMod.Projectiles.Summon public class CorruptionSlimeGodMinion : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; + public override string Texture => "CalamityMod/Projectiles/Summon/CorroslimeMinion"; public float dust = 0f; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 2; + Main.projFrames[Projectile.type] = 6; ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } @@ -84,5 +87,13 @@ namespace CalamityMod.Projectiles.Summon } public override bool OnTileCollide(Vector2 oldVelocity) => false; + + public override bool PreDraw(ref Color lightColor) + { + Texture2D slom = TextureAssets.Projectile[Type].Value; + Rectangle frame = slom.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Main.EntitySpriteDraw(slom, Projectile.Center - Main.screenPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, frame.Size() / 2f, Projectile.scale, SpriteEffects.None); + return false; + } } } diff --git a/Projectiles/Summon/CrimsonSlimeGodMinion.cs b/Projectiles/Summon/CrimsonSlimeGodMinion.cs index de7c9f436c..bf2cc01e45 100644 --- a/Projectiles/Summon/CrimsonSlimeGodMinion.cs +++ b/Projectiles/Summon/CrimsonSlimeGodMinion.cs @@ -1,7 +1,9 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon @@ -9,11 +11,12 @@ namespace CalamityMod.Projectiles.Summon public class CrimsonSlimeGodMinion : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; + public override string Texture => "CalamityMod/Projectiles/Summon/CrimslimeMinion"; public float dust = 0f; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 2; + Main.projFrames[Projectile.type] = 6; ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } @@ -84,5 +87,13 @@ namespace CalamityMod.Projectiles.Summon } public override bool OnTileCollide(Vector2 oldVelocity) => false; + + public override bool PreDraw(ref Color lightColor) + { + Texture2D slom = TextureAssets.Projectile[Type].Value; + Rectangle frame = slom.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Main.EntitySpriteDraw(slom, Projectile.Center - Main.screenPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, frame.Size() / 2f, Projectile.scale, SpriteEffects.None); + return false; + } } } diff --git a/Projectiles/Summon/SepulcherMinion.cs b/Projectiles/Summon/SepulcherMinion.cs index 93860c3ce5..e915f17f82 100644 --- a/Projectiles/Summon/SepulcherMinion.cs +++ b/Projectiles/Summon/SepulcherMinion.cs @@ -134,7 +134,7 @@ namespace CalamityMod.Projectiles.Summon #region Syncing public override void SendExtraAI(BinaryWriter writer) { - if (Arms is null || Arms[0] is null) + if (Arms is null || Arms.Count == 0 || Arms[0] is null) Initialize(); writer.Write(IdleTimer); @@ -154,7 +154,7 @@ namespace CalamityMod.Projectiles.Summon public override void ReceiveExtraAI(BinaryReader reader) { - if (Arms is null || Arms[0] is null) + if (Arms is null || Arms.Count == 0 || Arms[0] is null) Initialize(); IdleTimer = reader.ReadInt32(); diff --git a/Systems/WorldgenManagementSystem.cs b/Systems/WorldgenManagementSystem.cs index 49ad227e92..2886021901 100644 --- a/Systems/WorldgenManagementSystem.cs +++ b/Systems/WorldgenManagementSystem.cs @@ -408,6 +408,20 @@ namespace CalamityMod.Systems } } + // Fix vanilla's stupidity with Gold Chests being able to have Meteorite Bars in them near the Underworld + if (isGoldChest) + { + for (int inventoryIndex = 0; inventoryIndex < 40; inventoryIndex++) + { + if (chest.item[inventoryIndex].type == ItemID.MeteoriteBar) + { + int oldStack = chest.item[inventoryIndex].stack; + chest.item[inventoryIndex].SetDefaults(WorldGen.genRand.NextBool() ? ItemID.PlatinumBar : ItemID.GoldBar); + chest.item[inventoryIndex].stack = oldStack; + } + } + } + // Give Dead Man's Chests better loot. if (isDeadManChest) { diff --git a/Tiles/Ores/AstralOre.cs b/Tiles/Ores/AstralOre.cs index 2b9da5ece9..b3d8ab14d2 100644 --- a/Tiles/Ores/AstralOre.cs +++ b/Tiles/Ores/AstralOre.cs @@ -42,6 +42,9 @@ namespace CalamityMod.Tiles.Ores } public override void NearbyEffects(int i, int j, bool closer) { + if (j < 2) + return; + Tile tile = Main.tile[i, j]; Tile up = Main.tile[i, j - 1]; Tile up2 = Main.tile[i, j - 2];