Skip to content

Commit 3e5e143

Browse files
committed
Refine Shortcut Logic
This should be more elegant? Especially if we add any other sources of shortcuts. Only faulty aspect, is if we change values later, save files won't be accurate across versions, but whatever, because saves are readable text.
1 parent 796b4f7 commit 3e5e143

5 files changed

Lines changed: 12 additions & 13 deletions

File tree

Globals/SaveSystem.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ public class SaveFile
385385
public int[] NoteIds { get; init; }
386386
public int[] RelicIds { get; init; }
387387
public int PlayerHealth { get; init; }
388-
public int UsedShortcuts { get; init; }
388+
public int Shortcuts { get; init; }
389389

390390
public SaveFile(
391391
ulong rngSeed,
@@ -396,7 +396,7 @@ public SaveFile(
396396
int playerHealth,
397397
int area,
398398
int money,
399-
int usedShortcuts
399+
int shortcuts
400400
)
401401
{
402402
RngSeed = rngSeed;
@@ -407,7 +407,7 @@ int usedShortcuts
407407
PlayerHealth = playerHealth;
408408
Area = area;
409409
Money = money;
410-
UsedShortcuts = usedShortcuts;
410+
Shortcuts = shortcuts;
411411
}
412412
}
413413

@@ -424,7 +424,7 @@ public static void SaveGame()
424424
StageProducer.PlayerStats.CurrentHealth,
425425
StageProducer.CurLevel.Id,
426426
StageProducer.PlayerStats.Money,
427-
StageProducer.PlayerStats.usedShortcuts
427+
StageProducer.PlayerStats.Shortcuts
428428
);
429429
string json = JsonSerializer.Serialize(sv);
430430

Globals/Scribe.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,9 @@ e is BattleDirector.Harbinger.OnDamageInstanceArgs dmgArgs
401401
new RelicEffect(
402402
BattleEffectTrigger.OnPickup,
403403
1,
404-
(e, self, val) => {
405-
// this no longer has an effect, we just check that the player has looted it :)
404+
(e, self, val) =>
405+
{
406+
StageProducer.PlayerStats.Shortcuts += 1;
406407
}
407408
),
408409
}

Globals/StageProducer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ private bool LoadGame()
103103
}
104104
PlayerStats.CurrentHealth = sv.PlayerHealth;
105105
PlayerStats.Money = sv.Money;
106-
PlayerStats.usedShortcuts = sv.UsedShortcuts;
106+
PlayerStats.Shortcuts = sv.Shortcuts;
107107
IsInitialized = true;
108108
return true;
109109
}

Scenes/Maps/Scripts/Cartographer.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,9 @@ private void DrawMapSprite(MapGrid.Room room)
8787
AddChild(newButton);
8888
bool isChild = StageProducer.GetCurRoom().Children.Contains(room.Idx);
8989

90-
// checks if the next room is one below current room, player has shortcut, and player hasn't used all its charges
90+
// checks if the next room is one below current room, player has shortcuts
9191
bool isLaneChangeAllowed =
92-
room.Y == StageProducer.GetCurRoom().Y + 1
93-
&& StageProducer.PlayerStats.usedShortcuts < Scribe.RelicDictionary[13].Effects[0].Value
94-
&& StageProducer.PlayerStats.CurRelics.Any(r => r.Id == Scribe.RelicDictionary[13].Id);
92+
room.Y == StageProducer.GetCurRoom().Y + 1 && StageProducer.PlayerStats.Shortcuts > 0;
9593

9694
//button is disabled if it is not a child of current room.
9795
//unless player has charges of lane changing
@@ -111,7 +109,7 @@ private void DrawMapSprite(MapGrid.Room room)
111109
newButton.Pressed += () =>
112110
{
113111
if (!isChild)
114-
StageProducer.PlayerStats.usedShortcuts++;
112+
StageProducer.PlayerStats.Shortcuts--;
115113

116114
EnterStage(room.Idx, newButton);
117115
};

Scenes/Puppets/Scripts/PlayerStats.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public partial class PlayerStats : Resource
1414
public int NotesToIncreaseCombo = 4;
1515
public int RewardAmountModifier = 0;
1616
public int Rerolls = 0;
17-
public int usedShortcuts = 0;
17+
public int Shortcuts = 0;
1818

1919
//Array in order of descending rarities, Legendary -> ... Common. Int odds out of 100.
2020
public int[] RarityOdds = [1, 5, 10, 20, 100];

0 commit comments

Comments
 (0)