From d679e0291f4df541952a9bc2ca57d0697dfce85f Mon Sep 17 00:00:00 2001 From: Xyk Date: Sun, 5 Oct 2025 16:08:33 -0700 Subject: [PATCH] Bugfixes Fixed NOU breaking various holdouts Fixed being able to fire these weapons without having stars Fixed super deep pitch shift if M2ing after losing combo on Starmada Fixed frame perfect dual wielding Properly organized the Starmada projectile names --- CalPlayer/CalamityPlayer.cs | 7 +++ CalPlayer/CalamityPlayerMiscEffects.cs | 7 +-- .../Mods.CalamityMod.Projectiles.Ranged.hjson | 4 +- Projectiles/Ranged/StarfleetHoldout.cs | 12 ++++- Projectiles/Ranged/StarmadaHoldout.cs | 53 +++++++++---------- 5 files changed, 45 insertions(+), 38 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 0875689261..599c9a33ce 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -5216,6 +5216,13 @@ namespace CalamityMod.CalPlayer private void NOULOL() { Player.ResetEffects(); + for (int j = 0; j < 1000; j++) + { + if (!Main.projectile[j].active || Main.projectile[j].owner != Player.whoAmI) + continue; + + Player.ownedProjectileCounts[Main.projectile[j].type]++; + } Player.head = -1; Player.body = -1; Player.legs = -1; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index f8b6f4177a..09bbb8966c 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -201,15 +201,12 @@ namespace CalamityMod.CalPlayer if (Player.ActiveItem().type != ModContent.ItemType()) saharaSlicersBolts = 0; - // CIT 03OCT2025: - // NO U debuff was causing these weapons to spawn a holdout on every frame due to shenanigans with resetting owned projectile counts. - // This means the weapon now doesn't spawn at all with NO U, but I consider that preferable. - if (Player.whoAmI == Main.myPlayer && Player.HeldItem.type == ModContent.ItemType() && (Player.ownedProjectileCounts[ModContent.ProjectileType()] == 0 && !NOU) && !Player.dead) + if (Player.whoAmI == Main.myPlayer && Player.HeldItem.type == ModContent.ItemType() && (Player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) && !Player.dead) { int damage = (int)Player.GetTotalDamage().ApplyTo(Player.HeldItem.damage); Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Player.Center.DirectionTo(Player.Calamity().mouseWorld), ModContent.ProjectileType(), damage, Player.HeldItem.knockBack, Player.whoAmI); } - if (Player.whoAmI == Main.myPlayer && Player.HeldItem.type == ModContent.ItemType() && (Player.ownedProjectileCounts[ModContent.ProjectileType()] == 0 && !NOU) && !Player.dead) + if (Player.whoAmI == Main.myPlayer && Player.HeldItem.type == ModContent.ItemType() && (Player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) && !Player.dead) { int damage = (int)Player.GetTotalDamage().ApplyTo(Player.HeldItem.damage); Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Player.Center.DirectionTo(Player.Calamity().mouseWorld), ModContent.ProjectileType(), damage, Player.HeldItem.knockBack, Player.whoAmI); diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 3f473f3192..0efa140c93 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -212,6 +212,8 @@ SputterComet.DisplayName: Sputter Comet SputterCometBig.DisplayName: Sputter Comet SpykerProj.DisplayName: Spyker StarfleetStar.DisplayName: Starfleet Star +StarmadaHitProj.DisplayName: Starmada +StarmadaStar.DisplayName: Starmada Star StarmageddonBinaryStarCenter.DisplayName: Starmageddon Binary Star Center StarmageddonStar.DisplayName: Starmageddon Star StarmageddonStar2.DisplayName: Starmageddon Star @@ -263,5 +265,3 @@ AcidRocket.DisplayName: Acid Rocket M1GarandBulletCasing.DisplayName: M1 Garand Bullet Casing M1GarandEmptyClip.DisplayName: M1 Garand Empty Clip M1GarandShot.DisplayName: .30-06 Round -StarmadaHitProj.DisplayName: Starmada -StarmadaStar.DisplayName: Starmada Star diff --git a/Projectiles/Ranged/StarfleetHoldout.cs b/Projectiles/Ranged/StarfleetHoldout.cs index d71f92ba94..a71a81866c 100644 --- a/Projectiles/Ranged/StarfleetHoldout.cs +++ b/Projectiles/Ranged/StarfleetHoldout.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Ranged if (lastUseTime == 0 || doingNothing) lastUseTime = Owner.HeldItem.useAnimation; if (!doingNothing) - Owner.itemTime = Owner.itemAnimation = 2; + Owner.itemTime = Owner.itemAnimation = 5; glowIntensity = MathHelper.Lerp(glowIntensity, (float)Math.Pow(Utils.GetLerpValue(recoilTimerMax, 0, shootingCooldown, true), 5), 0.2f); @@ -83,8 +83,16 @@ namespace CalamityMod.Projectiles.Ranged Projectile.Kill(); return; } - bool leftShootChecks = Main.mouseLeft && !Main.mapFullscreen && !Owner.mouseInterface && shootingCooldown == 0; + bool hasAmmo = Owner.PickAmmo(HeldItem, out _, out _, out _, out _, out _, true); + bool leftShootChecks = (Main.mouseLeft && !Main.mapFullscreen && !Owner.mouseInterface && shootingCooldown == 0) && hasAmmo; bool rightShootChecks = Owner.Calamity().mouseRight && !Main.mapFullscreen && !Owner.mouseInterface && starburstCooldown == 0 && starburstTimer == 0; + + if (Main.mouseLeft && !hasAmmo && OffsetLengthFromArm >= 24.5f) + { + OffsetLengthFromArm -= 8; + SoundStyle click = new("CalamityMod/Sounds/Item/DudFire"); + SoundEngine.PlaySound(click with { Volume = .6f, Pitch = -.2f }, Projectile.Center); + } if (leftShootChecks) FireShotgun(); if (rightShootChecks) diff --git a/Projectiles/Ranged/StarmadaHoldout.cs b/Projectiles/Ranged/StarmadaHoldout.cs index 37bd53c9ee..c1ad5ad3c4 100644 --- a/Projectiles/Ranged/StarmadaHoldout.cs +++ b/Projectiles/Ranged/StarmadaHoldout.cs @@ -4,16 +4,13 @@ using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; -using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Typeless; -using log4net.Appender; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Utilities; using Terraria; using Terraria.Audio; using Terraria.ModLoader; -using static System.Net.Mime.MediaTypeNames; using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Ranged @@ -87,7 +84,7 @@ namespace CalamityMod.Projectiles.Ranged if (lastUseTime == 0 || doingNothing) lastUseTime = Owner.HeldItem.useAnimation; if (!doingNothing) - Owner.itemTime = Owner.itemAnimation = 2; + Owner.itemTime = Owner.itemAnimation = 5; glowIntensity = MathHelper.Lerp(glowIntensity, (float)Math.Pow(Utils.GetLerpValue(recoilTimerMax, 0, shootingCooldown, true), 5), 0.2f); attackVisualMult = MathHelper.Lerp(attackVisualMult, (float)Math.Pow(Math.Min(Utils.GetLerpValue(0, starburstPerfectTime - 1, starburstTimer, true), 2) + (gunPower - 1) * 0.25f, 1) * glowIntensity, 0.2f); @@ -99,16 +96,25 @@ namespace CalamityMod.Projectiles.Ranged Projectile.Kill(); return; } - bool leftShootChecks = Main.mouseLeft && !Main.mapFullscreen && !Owner.mouseInterface && shootingCooldown == 0; + bool hasAmmo = Owner.PickAmmo(HeldItem, out _, out _, out _, out _, out _, true); + bool leftShootChecks = (Main.mouseLeft && !Main.mapFullscreen && !Owner.mouseInterface && shootingCooldown == 0) && hasAmmo; bool rightShootChecks = Owner.Calamity().mouseRight && !Main.mapFullscreen && !Owner.mouseInterface && starburstCooldown == 0 && starburstTimer == 0; + + if (Main.mouseLeft && !hasAmmo && shake < 0.1f) + { + shake = 0.8f; + SoundStyle click = new("CalamityMod/Sounds/Item/DudFire"); + SoundEngine.PlaySound(click with { Volume = .6f, Pitch = -.2f}, Projectile.Center); + } + if (leftShootChecks) FireShotgun(); if (rightShootChecks) { SoundStyle blast1 = new("CalamityMod/Sounds/Item/StarfleetStarburst"); - AudSlot1 = SoundEngine.PlaySound(blast1 with { Volume = 0.8f, Pitch = 0f, MaxInstances = 8 }, Projectile.Center); + AudSlot1 = SoundEngine.PlaySound(blast1 with { Volume = 0.7f + gunPower * 0.1f, Pitch = 0f, MaxInstances = 8 }, Projectile.Center); SoundStyle blast2 = new("CalamityMod/Sounds/Item/StarfleetStarburst"); - AudSlot2 = SoundEngine.PlaySound(blast2 with { Volume = 0.6f, Pitch = -0.2f + gunPower * 0.2f, MaxInstances = 8 }, Projectile.Center); + AudSlot2 = SoundEngine.PlaySound(blast2 with { Volume = 0.5f + gunPower * 0.1f, Pitch = -0.2f + gunPower * 0.2f, MaxInstances = 8 }, Projectile.Center); lastGunPower = gunPower; starburstTimer++; } @@ -137,15 +143,18 @@ namespace CalamityMod.Projectiles.Ranged } if (shootingCooldown > 0) { - if (SoundEngine.TryGetActiveSound(AudSlot1, out var s1) && s1.IsPlaying && failedChain) + if (lastGunPower != gunPower) { - s1.Pitch = MathHelper.Lerp(s1.Pitch, -0.7f, 0.05f); - s1.Volume = MathHelper.Lerp(s1.Volume, 0.2f, 0.05f); - } - if (SoundEngine.TryGetActiveSound(AudSlot2, out var s2) && s2.IsPlaying && failedChain) - { - s2.Pitch = MathHelper.Lerp(s2.Pitch, -0.7f, 0.05f); - s2.Volume = MathHelper.Lerp(s2.Volume, 0.2f, 0.05f); + if (SoundEngine.TryGetActiveSound(AudSlot1, out var s1) && s1.IsPlaying && failedChain) + { + s1.Pitch = MathHelper.Lerp(s1.Pitch, -0.7f, 0.07f); + s1.Volume = MathHelper.Lerp(s1.Volume, 0.2f, 0.07f); + } + if (SoundEngine.TryGetActiveSound(AudSlot2, out var s2) && s2.IsPlaying && failedChain) + { + s2.Pitch = MathHelper.Lerp(s2.Pitch, -0.7f, 0.07f); + s2.Volume = MathHelper.Lerp(s2.Volume, 0.2f, 0.07f); + } } shootingCooldown--; } @@ -293,20 +302,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile blast = Projectile.NewProjectileDirect(Owner.GetSource_FromThis(), blastCenter, Vector2.Zero, ModContent.ProjectileType(), damage, -45, Owner.whoAmI, blastSize, minMultiplier, hitsToMinMult); blast.timeLeft = 15; - /*for (int x = 0; x < Main.maxProjectiles; x++) - { - Projectile projectile = Main.projectile[x]; - if (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.localAI[2] == 1 && GunTipPosition.Distance(projectile.Center) <= 200) - { - projectile.localAI[2] = 5; - float dist = Utils.GetLerpValue(160, 60, projectile.Center.Distance(GunTipPosition), true); - Vector2 vel = Vector2.Lerp(projectile.Center.DirectionFrom(Owner.Center), Projectile.velocity, dist); - projectile.velocity = vel * 12; - projectile.timeLeft = 300; - } - }*/ - - float gunPowerMult = MathHelper.Lerp(lastGunPower, 1, 0.7f); for (int i = 0; i < 20; i++) {