Skip to content

Commit

Permalink
Remove dashcount decrement workaround from older Purple Booster imple…
Browse files Browse the repository at this point in the history
…mentation
  • Loading branch information
catapillie committed Aug 17, 2022
1 parent 49bb59a commit 759ed16
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
1 change: 0 additions & 1 deletion source/Entities/FloorBooster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ private static void Player_NormalBegin(On.Celeste.Player.orig_NormalBegin orig,
DynData<Player> playerData = self.GetData();
playerData.Set("floorBoosterSpeed", 0f);
playerData.Set<FloorBooster>("lastFloorBooster", null);
playerData.Set(PurpleBooster.EARLY_EXIT, false);
}

private static int Player_NormalUpdate(On.Celeste.Player.orig_NormalUpdate orig, Player self) {
Expand Down
15 changes: 1 addition & 14 deletions source/Entities/PurpleBooster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -387,7 +386,6 @@ public static int PurpleDashingUpdate() {
Util.TryGetPlayer(out Player player);
DynData<Player> playerData = player.GetData();

playerData.Set(EARLY_EXIT, true);
player.LiftSpeed += playerData.Get<Vector2>(POSSIBLE_EARLY_DASHSPEED);

return player.StartDash();
Expand All @@ -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<Solid>(vec)) {
Expand Down Expand Up @@ -456,24 +454,13 @@ public static void PurpleBoosterExplodeLaunch(Player player, DynData<Player> 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<Player> playerData = self.GetData();
if (playerData.Get<bool>(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
Expand Down

0 comments on commit 759ed16

Please sign in to comment.