From 8e37d6f092c9ef2fc912e2e06e10671e8db158f1 Mon Sep 17 00:00:00 2001 From: Xyk Date: Fri, 4 Apr 2025 14:42:13 -0700 Subject: [PATCH] Anticheese for the sashes No it doesn't PREVENT cheese, but it does make it not so easy to do and shouldn't effect normal use much --- Balancing/BalancingConstants.cs | 2 +- CalPlayer/CalamityPlayer.cs | 8 +++-- CalPlayer/CalamityPlayerMiscEffects.cs | 9 +++-- CalPlayer/Dashes/StatisNinjaBeltDash.cs | 17 +++++++++- CalPlayer/Dashes/StatisVoidSashDash.cs | 33 ++++++++----------- .../Mods.CalamityMod.Items.Accessories.hjson | 2 ++ 6 files changed, 44 insertions(+), 27 deletions(-) diff --git a/Balancing/BalancingConstants.cs b/Balancing/BalancingConstants.cs index 4a0c2f914f..8ebeea298b 100644 --- a/Balancing/BalancingConstants.cs +++ b/Balancing/BalancingConstants.cs @@ -50,7 +50,7 @@ #region Dashes and Dodges // Dash cooldowns (in frames) internal const int UniversalDashCooldown = 30; - internal const int UniversalSashDashCooldown = 23; + internal const int UniversalSashDashCooldown = 30; internal const int UniversalShieldSlamCooldown = 30; internal const int UniversalShieldBonkCooldown = 30; internal const int OnShieldBonkCooldown = 30; diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index a634f65b31..789c740bbc 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -783,9 +783,11 @@ namespace CalamityMod.CalPlayer public int gloveLevel = 0; public bool alreadyHasFrogLeg = false; // Unused, intended to prevent Frog Leg tinker stacking public bool eTalisman = false; - /// Counter variable used for spawning Statis' Void Sash's scythes when dashing. - public int statisTimer = 0; public bool statisNinjaBelt = false; + /// Used to keep track of how many dashes in the same direction you make to prevent dashing away from bosses forever at max efficency. + public int statisPenaltyTimer = 0; + public int statisAnticheese = 0; + public int statisTimerMax => (int)(Utils.Remap(statisAnticheese, 1, 6, 120, 50, true)); public bool voidSashVisuals = true; public bool statisVoidSash = false; public bool nucleogenesis = false; @@ -2877,7 +2879,7 @@ namespace CalamityMod.CalPlayer scuttlerCooldown = 0; rogueCrownCooldown = 0; wingProjectileCooldown = 0; - statisTimer = 0; + statisPenaltyTimer = -1; hallowedRuneCooldown = 0; sulphurBubbleCooldown = 0; ladHearts = 0; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 31a063dafc..79d688f161 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -1963,8 +1963,13 @@ namespace CalamityMod.CalPlayer if (vortexBoosterStealthDelay == 1) Player.vortexStealthActive = true; } - if (statisTimer > 0 && Player.dashDelay >= 0) - statisTimer = 0; + if (statisPenaltyTimer > 0) + statisPenaltyTimer--; + if (statisPenaltyTimer == 0 && statisAnticheese > 0) + { + statisAnticheese--; + statisPenaltyTimer = statisTimerMax; + } if (hallowedRuneCooldown > 0) hallowedRuneCooldown--; if (sulphurBubbleCooldown > 0) diff --git a/CalPlayer/Dashes/StatisNinjaBeltDash.cs b/CalPlayer/Dashes/StatisNinjaBeltDash.cs index ee1a612583..9c0196c584 100644 --- a/CalPlayer/Dashes/StatisNinjaBeltDash.cs +++ b/CalPlayer/Dashes/StatisNinjaBeltDash.cs @@ -1,4 +1,5 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Dusts; using CalamityMod.Enums; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -14,11 +15,25 @@ namespace CalamityMod.CalPlayer.Dashes public override DashCollisionType CollisionType => DashCollisionType.NoCollision; public override bool IsOmnidirectional => false; public int Time = 0; + public int lastDashDir = 0; public override float CalculateDashSpeed(Player player) => (50f * player.moveSpeed); public override void OnDashEffects(Player player) { + if (Math.Sign(player.velocity.X) == lastDashDir && lastDashDir != 0) + { + player.Calamity().statisPenaltyTimer = player.Calamity().statisTimerMax; + if (player.Calamity().statisAnticheese < 6) + player.Calamity().statisAnticheese++; + } + else + player.Calamity().statisAnticheese = 0; + if (player.Calamity().statisAnticheese > 1) + player.velocity.X *= Utils.Remap(player.Calamity().statisAnticheese, 1, 6, 0.9f, 0.3f, true); + lastDashDir = Math.Sign(player.velocity.X); + lastDashDir = Math.Sign(player.velocity.X); + Time = 0; for (int i = 0; i < 15; i++) { diff --git a/CalPlayer/Dashes/StatisVoidSashDash.cs b/CalPlayer/Dashes/StatisVoidSashDash.cs index f9d18cc35d..2d03a45fbe 100644 --- a/CalPlayer/Dashes/StatisVoidSashDash.cs +++ b/CalPlayer/Dashes/StatisVoidSashDash.cs @@ -21,14 +21,26 @@ namespace CalamityMod.CalPlayer.Dashes public override bool IsOmnidirectional => false; public int Time = 0; - public bool AngleSwap = true; public Vector2 aimVel; public bool strongVisuals = true; + public int lastDashDir = 0; public override float CalculateDashSpeed(Player player) => (75f * player.moveSpeed); public override void OnDashEffects(Player player) { + if (Math.Sign(player.velocity.X) == lastDashDir && lastDashDir != 0) + { + player.Calamity().statisPenaltyTimer = player.Calamity().statisTimerMax; + if (player.Calamity().statisAnticheese < 6) + player.Calamity().statisAnticheese++; + } + else + player.Calamity().statisAnticheese = 0; + if (player.Calamity().statisAnticheese > 1) + player.velocity.X *= Utils.Remap(player.Calamity().statisAnticheese, 1, 6, 0.9f, 0.3f, true); + lastDashDir = Math.Sign(player.velocity.X); + strongVisuals = player.Calamity().voidSashVisuals; Time = 0; aimVel = player.velocity; @@ -96,25 +108,6 @@ namespace CalamityMod.CalPlayer.Dashes SignusMetaball.SpawnParticle(fxPlace, fxVelocity * Main.rand.NextFloat(5, 8), 50f * Main.rand.NextFloat(0.7f, 1f), 8, new Vector2(0.8f, 1.2f), 0.18f, 0); } } - - // Periodically release scythes. - player.Calamity().statisTimer++; - if (Main.myPlayer == player.whoAmI && player.Calamity().statisTimer % 2 == 0 && false) - { - int scytheDamage = (int)player.GetBestClassDamage().ApplyTo(250); - - int scythe = Projectile.NewProjectile(player.GetSource_FromAI(), player.Center, player.velocity.RotatedBy(player.direction * (AngleSwap ? 30 : -30), default) * 0.1f - player.velocity / 2f, ModContent.ProjectileType(), scytheDamage, 5f, player.whoAmI); ; - if (scythe.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[scythe].DamageType = DamageClass.Generic; - Main.projectile[scythe].usesIDStaticNPCImmunity = true; - Main.projectile[scythe].idStaticNPCHitCooldown = 10; - } - - AngleSwap = !AngleSwap; - - } - player.velocity.X *= 0.912f; } } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index d915b05b1b..06971c0bfb 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -1697,6 +1697,7 @@ StatisNinjaBelt: { 10% increased movement speed, 32% increased jump speed, allows auto-jump, and negates fall damage Increases movement acceleration and deceleration by 1.6x Grants the ability to swim, climb walls, and dodge attacks +Consecutive dashes in the same direction reduce dash speed ''' HoldShiftTooltip: "{$Common.DodgeInformation}" } @@ -1710,6 +1711,7 @@ StatisVoidSash: { Increases movement acceleration and deceleration by 1.85x Grants the ability to swim, climb walls, and dodge attacks Visual effects are reduced if visibility is disabled +Consecutive dashes in the same direction reduce dash speed ''' HoldShiftTooltip: "{$Common.DodgeInformation}" }