From e4206e067b4ef8f08097dca75bfe27975def8177 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Fri, 16 Feb 2024 17:24:22 -0500 Subject: [PATCH] Speed Blaster Boost cooldown --- CalPlayer/CalamityPlayer.cs | 4 ++-- CalPlayer/CalamityPlayerMiscEffects.cs | 2 -- Cooldowns/SpeedBlasterBoost.cs | 19 +++++++++++++++++++ Cooldowns/SpeedBlasterBoost.png | Bin 0 -> 359 bytes Cooldowns/SpeedBlasterBoostOutline.png | Bin 0 -> 213 bytes Cooldowns/SpeedBlasterBoostOverlay.png | Bin 0 -> 175 bytes Items/Weapons/Ranged/SpeedBlaster.cs | 12 ++++++------ Localization/en-US/Mods.CalamityMod.UI.hjson | 1 + 8 files changed, 28 insertions(+), 10 deletions(-) create mode 100644 Cooldowns/SpeedBlasterBoost.cs create mode 100644 Cooldowns/SpeedBlasterBoost.png create mode 100644 Cooldowns/SpeedBlasterBoostOutline.png create mode 100644 Cooldowns/SpeedBlasterBoostOverlay.png diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index e1f0f73072..691d32f226 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -79,7 +79,6 @@ namespace CalamityMod.CalPlayer public bool killSpikyBalls = false; public float KameiTrailXScale = 0.1f; public int KameiBladeUseDelay = 0; - public int SpeedBlasterDashDelayCooldown = 0; public Vector2[] OldPositions = new Vector2[4]; public double contactDamageReduction = 0D; public double projectileDamageReduction = 0D; @@ -3033,10 +3032,11 @@ namespace CalamityMod.CalPlayer //Right click dash on Speed Blaster if (sBlasterDashActivated == true) { - if ((Player.controlUp || Player.controlDown || Player.controlLeft || Player.controlRight) && !Player.pulley && Player.grappling[0] == -1 && !Player.tongued && !Player.mount.Active && SpeedBlasterDashDelayCooldown == SpeedBlaster.DashCooldown && Player.dashDelay == 0) + if ((Player.controlUp || Player.controlDown || Player.controlLeft || Player.controlRight) && !Player.pulley && Player.grappling[0] == -1 && !Player.tongued && !Player.mount.Active && Player.HasCooldown(Cooldowns.SpeedBlasterBoost.ID) && Player.dashDelay == 0) { SpeedBlasterDashStarted = true; } + sBlasterDashActivated = false; } if (Player.Calamity().SpeedBlasterDashStarted || (Player.dashDelay != 0 && Player.Calamity().LastUsedDashID == SpeedBlasterDash.ID)) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index cc08f712ec..6910c86ca8 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -1361,8 +1361,6 @@ namespace CalamityMod.CalPlayer phantomicBulwarkCooldown--; if (KameiBladeUseDelay > 0) KameiBladeUseDelay--; - if (SpeedBlasterDashDelayCooldown > 0) - SpeedBlasterDashDelayCooldown--; if (galileoCooldown > 0) galileoCooldown--; if (dragonRageCooldown > 0) diff --git a/Cooldowns/SpeedBlasterBoost.cs b/Cooldowns/SpeedBlasterBoost.cs new file mode 100644 index 0000000000..b12f4dd065 --- /dev/null +++ b/Cooldowns/SpeedBlasterBoost.cs @@ -0,0 +1,19 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.Localization; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Cooldowns +{ + public class SpeedBlasterBoost : CooldownHandler + { + public static new string ID => "SpeedBlasterBoost"; + public override bool ShouldDisplay => true; + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + public override string Texture => "CalamityMod/Cooldowns/SpeedBlasterBoost"; + public override Color OutlineColor => new Color(207, 207, 207); + public override Color CooldownStartColor => new Color(235, 33, 130); + public override Color CooldownEndColor => new Color(39, 227, 208); + } +} diff --git a/Cooldowns/SpeedBlasterBoost.png b/Cooldowns/SpeedBlasterBoost.png new file mode 100644 index 0000000000000000000000000000000000000000..1f97a07996db88f4ffe8df825a53afb6be57be46 GIT binary patch literal 359 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VV{wqX6T`Z5GB1H_c25__5R2aA z6bEL%oWlPXk4gZ+x4%(GJbJ9ua+;&yw{4|%3OqBC zoVb|>1RiOh25FM$ySXks0SE%pew;o41RH{bSzRB$?EVjy{pMuL$(_7v_XNRbhkOr4 zDEB7*Eix6EKI>I-dGqhD);wDZ6?+;_FMV@8L=vRlN^jAvz4PCSg)wJ}w{3`M*}25& zzkHWd#F|CS5x*8k>KrcSI$ZBj5cVRmKR4pdp_&J0KCrL0x^>)0r~i>xzJd6mB+0!Z zixMRkHBRuB5BQP&g#~D+z{dUmt;%Y@a63!9Ncq!psC}mhTSDcGw3h-5)y!cpPSq}b j4-6l^)CkWsUtb0-Ae#e-LEuvGWDw=)>gTe~DWM4fdc%jE literal 0 HcmV?d00001 diff --git a/Cooldowns/SpeedBlasterBoostOutline.png b/Cooldowns/SpeedBlasterBoostOutline.png new file mode 100644 index 0000000000000000000000000000000000000000..245f680cb533cfc362f84fe449a111c000e6dc01 GIT binary patch literal 213 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjjKx9jP7LeL$-D$|N)O;`^^B#TGfW`|B=`7cQUFBWvcqxb~}r^>x0$HP?T< zTCW$)ZaT65;2MX6i~>aw47W6I1ppnumm1-j=IhI#1!QvoF$i1=o(!TqUHx3vIVCg! E03;eu2><{9 literal 0 HcmV?d00001 diff --git a/Cooldowns/SpeedBlasterBoostOverlay.png b/Cooldowns/SpeedBlasterBoostOverlay.png new file mode 100644 index 0000000000000000000000000000000000000000..da21d02b349ab032cd0b504d6ad21c0e08c882ab GIT binary patch literal 175 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VV{wqX6T`Z5GB1G~e@_?35R2aA z6bI)2K+vyu>;Mp)IB~+G$4V`yX$r%RwL5ZDL<8=(UMZ5)>0w{botR)UP1B$wY@^K& z-X#{(E_yFK`2OiZ@wS5IjH!H#b+c6jH?Fv-1vHv3HNrE^*Ovjr<^W<4xD-4YM0vXU KxvX true; public override bool CanUseItem(Player player) { - if (player.Calamity().SpeedBlasterDashDelayCooldown > 0 && player.altFunctionUse == 2) + if (player.HasCooldown(Cooldowns.SpeedBlasterBoost.ID) && player.altFunctionUse == 2) { SoundEngine.PlaySound(Empty, player.Center); return false; @@ -67,14 +67,14 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-1, -6); // Increased fire rate after dashing - public override float UseSpeedMultiplier(Player player) => player.Calamity().SpeedBlasterDashDelayCooldown > 0 ? FireRatePowerup : 1f; + public override float UseSpeedMultiplier(Player player) => player.HasCooldown(Cooldowns.SpeedBlasterBoost.ID) ? FireRatePowerup : 1f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { // Reposition all shots to the gun's tip Vector2 newPos = position + new Vector2(38f, player.direction * (Math.Abs(velocity.SafeNormalize(Vector2.Zero).X) < 0.02f ? -2f : -8f)).RotatedBy(velocity.ToRotation()); // Big dashing shot - if (player.altFunctionUse == 2 && player.Calamity().SpeedBlasterDashDelayCooldown == 0) + if (player.altFunctionUse == 2 && !(player.HasCooldown(Cooldowns.SpeedBlasterBoost.ID))) { // Switches the color of the next shots, including this one if (ColorValue >= 4f) @@ -85,7 +85,7 @@ namespace CalamityMod.Items.Weapons.Ranged Projectile.NewProjectile(source, newPos, velocity, type, (int)(damage * DashShotDamageMult), knockback, player.whoAmI, ColorValue, 3f); // Activate the dash and cooldown - player.Calamity().SpeedBlasterDashDelayCooldown = DashCooldown; + player.AddCooldown(Cooldowns.SpeedBlasterBoost.ID, DashCooldown); player.Calamity().sBlasterDashActivated = true; // If moving, emit particles to signal the dash @@ -102,8 +102,8 @@ namespace CalamityMod.Items.Weapons.Ranged } // Add inaccuracy to regular shots; powered up shots are more accurate - Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(player.Calamity().SpeedBlasterDashDelayCooldown > 0 ? 3f : 15f)); - float ShotMode = player.Calamity().SpeedBlasterDashDelayCooldown > 0 ? 2f : 0f; + Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(player.HasCooldown(Cooldowns.SpeedBlasterBoost.ID) ? 3f : 15f)); + float ShotMode = player.HasCooldown(Cooldowns.SpeedBlasterBoost.ID) ? 2f : 0f; Projectile.NewProjectile(source, newPos, newVel, type, damage, knockback, player.whoAmI, ColorValue, ShotMode); return false; } diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index 63c871d76e..ed549ccdf1 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -110,6 +110,7 @@ Cooldowns: { SandsmokeBombActive: Sandsmoke Bomb Duration SandsmokeBombCooldown: Sandsmoke Bomb Cooldown SilvaRevive: Silva Revive Cooldown + SpeedBlasterBoost: Speed Blaster Boost SpongeDurability: Sponge Barrier Durability SpongeRecharge: Sponge Barrier Recharge TarragonCloak: Tarragon Cloak Cooldown