From 759ed16a6b6c4827c3c90ab0b52541c4d2a2a1a3 Mon Sep 17 00:00:00 2001 From: catapillie Date: Wed, 17 Aug 2022 21:53:59 +0200 Subject: [PATCH] Remove dashcount decrement workaround from older Purple Booster implementation --- source/Entities/FloorBooster.cs | 1 - source/Entities/PurpleBooster.cs | 15 +-------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/source/Entities/FloorBooster.cs b/source/Entities/FloorBooster.cs index 4a5dd2e..a38e3ed 100644 --- a/source/Entities/FloorBooster.cs +++ b/source/Entities/FloorBooster.cs @@ -247,7 +247,6 @@ private static void Player_NormalBegin(On.Celeste.Player.orig_NormalBegin orig, DynData playerData = self.GetData(); playerData.Set("floorBoosterSpeed", 0f); playerData.Set("lastFloorBooster", null); - playerData.Set(PurpleBooster.EARLY_EXIT, false); } private static int Player_NormalUpdate(On.Celeste.Player.orig_NormalUpdate orig, Player self) { diff --git a/source/Entities/PurpleBooster.cs b/source/Entities/PurpleBooster.cs index 8c026a3..d52a692 100644 --- a/source/Entities/PurpleBooster.cs +++ b/source/Entities/PurpleBooster.cs @@ -13,7 +13,6 @@ namespace Celeste.Mod.VortexHelper.Entities { [Tracked] public class PurpleBooster : Entity { internal const string POSSIBLE_EARLY_DASHSPEED = "purpleBoostPossibleEarlyDashSpeed"; - internal const string EARLY_EXIT = "purpleBoosterEarlyExit"; private Sprite sprite; private Wiggler wiggler; @@ -387,7 +386,6 @@ public static int PurpleDashingUpdate() { Util.TryGetPlayer(out Player player); DynData playerData = player.GetData(); - playerData.Set(EARLY_EXIT, true); player.LiftSpeed += playerData.Get(POSSIBLE_EARLY_DASHSPEED); return player.StartDash(); @@ -406,7 +404,7 @@ public static IEnumerator PurpleDashingCoroutine() { while (t < 1f) { t = Calc.Approach(t, 1.0f, Engine.DeltaTime * 1.5f); Vector2 vec = origin + (Vector2.UnitY * 6f) + (player.DashDir * 60f * (float)Math.Sin(t * Math.PI)); - + playerData.Set(POSSIBLE_EARLY_DASHSPEED, earlyExitBoost = (t > .6f) ? (t - .5f) * 200f * -player.DashDir : Vector2.Zero); if (player.CollideCheck(vec)) { @@ -456,24 +454,13 @@ public static void PurpleBoosterExplodeLaunch(Player player, DynData pla internal static class Hooks { public static void Hook() { - On.Celeste.Player.DashBegin += Player_DashBegin; On.Celeste.Player.ctor += Player_ctor; } public static void Unhook() { - On.Celeste.Player.DashBegin -= Player_DashBegin; On.Celeste.Player.ctor -= Player_ctor; } - private static void Player_DashBegin(On.Celeste.Player.orig_DashBegin orig, Player self) { - orig(self); - DynData playerData = self.GetData(); - if (playerData.Get(EARLY_EXIT)) { - --self.Dashes; - playerData.Set(EARLY_EXIT, false); - } - } - private static void Player_ctor(On.Celeste.Player.orig_ctor orig, Player self, Vector2 position, PlayerSpriteMode spriteMode) { orig(self, position, spriteMode); // Custom Purple Booster State