From 5d2f3c4ec74a5d5183f07d23e64d54d23157bee2 Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Sun, 2 Jul 2023 16:55:44 -0500 Subject: [PATCH] Tried to fix weird Ghastly Visage and Grand Staff bug. --- Projectiles/Magic/GhastlyVisageProj.cs | 10 ++++++++-- .../Magic/GrandStaffoftheNebulaMage_Held.cs | 16 ++++++++++++---- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Projectiles/Magic/GhastlyVisageProj.cs b/Projectiles/Magic/GhastlyVisageProj.cs index ffb2f5b640..e83e0c2664 100644 --- a/Projectiles/Magic/GhastlyVisageProj.cs +++ b/Projectiles/Magic/GhastlyVisageProj.cs @@ -87,11 +87,13 @@ namespace CalamityMod.Projectiles.Magic else { Projectile.Kill(); + flag15 = false; } } else { Projectile.Kill(); + flag15 = false; } } else @@ -104,7 +106,9 @@ namespace CalamityMod.Projectiles.Magic } Projectile.localAI[1] += 1f; Projectile.soundDelay = num40 - num41 * num39; - SoundEngine.PlaySound(SoundID.Item117, Projectile.position); + + if (flag15) + SoundEngine.PlaySound(SoundID.Item117, Projectile.position); } else if (Projectile.soundDelay <= 0 && flag16) { @@ -121,11 +125,13 @@ namespace CalamityMod.Projectiles.Magic else { Projectile.Kill(); + flag15 = false; } } else { Projectile.Kill(); + flag15 = false; } } else @@ -137,7 +143,7 @@ namespace CalamityMod.Projectiles.Magic } } Projectile.soundDelay = num40 - num41 * num39; - if (Projectile.ai[0] != 1f) + if (Projectile.ai[0] != 1f && flag15) { SoundEngine.PlaySound(SoundID.Item117, Projectile.position); } diff --git a/Projectiles/Magic/GrandStaffoftheNebulaMage_Held.cs b/Projectiles/Magic/GrandStaffoftheNebulaMage_Held.cs index b434c0bfd5..bd7f706ec9 100644 --- a/Projectiles/Magic/GrandStaffoftheNebulaMage_Held.cs +++ b/Projectiles/Magic/GrandStaffoftheNebulaMage_Held.cs @@ -58,6 +58,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.ai[0] = 0f; bool shoot = CurrentFrame == ShootFrame && Projectile.ai[0] == 0f; + bool ableToShoot = true; bool weaponInUse = Owner.channel && !Owner.noItems && !Owner.CCed; int manaCost = (int)(30f * Owner.manaCost); Vector2 halvedSize = Projectile.Size / 2f; @@ -74,30 +75,37 @@ namespace CalamityMod.Projectiles.Magic if (Owner.manaFlower) { Owner.QuickMana(); - if (Owner.statMana >= (int)(float)manaCost) + if (Owner.statMana >= manaCost) { Owner.manaRegenDelay = (int)Owner.maxRegenDelay; Owner.statMana -= manaCost; } else + { Projectile.Kill(); + ableToShoot = false; + } } else + { Projectile.Kill(); + ableToShoot = false; + } } else { - if (Owner.statMana >= (int)(float)manaCost) + if (Owner.statMana >= manaCost) { Owner.statMana -= manaCost; Owner.manaRegenDelay = (int)Owner.maxRegenDelay; } } - SoundEngine.PlaySound(SoundID.Item117, Projectile.position); + if (ableToShoot) + SoundEngine.PlaySound(SoundID.Item117, Projectile.position); } - if (Main.myPlayer == Projectile.owner) + if (Main.myPlayer == Projectile.owner && ableToShoot) { int projectileType = ModContent.ProjectileType(); float coreVelocity = 8f;