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 0000000000..1f97a07996 Binary files /dev/null and b/Cooldowns/SpeedBlasterBoost.png differ diff --git a/Cooldowns/SpeedBlasterBoostOutline.png b/Cooldowns/SpeedBlasterBoostOutline.png new file mode 100644 index 0000000000..245f680cb5 Binary files /dev/null and b/Cooldowns/SpeedBlasterBoostOutline.png differ diff --git a/Cooldowns/SpeedBlasterBoostOverlay.png b/Cooldowns/SpeedBlasterBoostOverlay.png new file mode 100644 index 0000000000..da21d02b34 Binary files /dev/null and b/Cooldowns/SpeedBlasterBoostOverlay.png differ diff --git a/Items/Weapons/Ranged/SpeedBlaster.cs b/Items/Weapons/Ranged/SpeedBlaster.cs index bc75da7eaf..e62e0b1b5c 100644 --- a/Items/Weapons/Ranged/SpeedBlaster.cs +++ b/Items/Weapons/Ranged/SpeedBlaster.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool AltFunctionUse(Player player) => 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