Skip to content

Commit fc2333c

Browse files
cornerloanLifeHckr
authored andcommitted
Game now saves MaxComboBar, added field medic event
We never actually needed to save MaxComboBar since energy drink was an onPickup effect. With this event, we now need to save the MaxComboBar value between sessions. Also adjusted event 2's translations and healing effect since I messed up both of those.
1 parent ffb119b commit fc2333c

4 files changed

Lines changed: 58 additions & 19 deletions

File tree

Classes/Events/EventDatabase.cs

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,40 +47,40 @@ public partial class EventDatabase
4747
1,
4848
"EVENT_EVENT2_DESC",
4949
["EVENT_EVENT2_OPTION1", "EVENT_EVENT2_OPTION2"],
50-
["", "EVENT_EVENT1_OUTCOME1"],
50+
["", "EVENT_EVENT2_OUTCOME1"],
5151
[
5252
(self) =>
5353
{
5454
StageProducer.PlayerStats.Money -= 20;
5555
// [do nothing, get money back, win money, get note, get relic, heal]
5656
int spinOutcome = (int)
57-
StageProducer.GlobalRng.RandWeighted([13, 8, 5, 5, 3, 3]);
57+
StageProducer.GlobalRng.RandWeighted([13, 8, 5, 5, 3, 3]); //TODO: adjust odds
5858
switch (spinOutcome)
5959
{
6060
case 0: //do nothing AKA lose
6161
GD.Print("owned lol");
62-
self.OutcomeDescriptions[0] = "EVENT_EVENT1_OUTCOME2";
62+
self.OutcomeDescriptions[0] = "EVENT_EVENT2_OUTCOME2";
6363
break;
6464
case 1: // get money back
6565
GD.Print("refund");
66-
self.OutcomeDescriptions[0] = "EVENT_EVENT1_OUTCOME3";
66+
self.OutcomeDescriptions[0] = "EVENT_EVENT2_OUTCOME3";
6767
StageProducer.PlayerStats.Money += 20;
6868
break;
6969
case 2: // get triple money
7070
GD.Print("triple money");
71-
self.OutcomeDescriptions[0] = "EVENT_EVENT1_OUTCOME4";
71+
self.OutcomeDescriptions[0] = "EVENT_EVENT2_OUTCOME4";
7272
StageProducer.PlayerStats.Money += 60;
7373
break;
7474
case 3: // get random note
7575
GD.Print("random note");
76-
self.OutcomeDescriptions[0] = "EVENT_EVENT1_OUTCOME5";
76+
self.OutcomeDescriptions[0] = "EVENT_EVENT2_OUTCOME5";
7777
StageProducer.PlayerStats.AddNote(
7878
Scribe.GetRandomRewardNotes(1, StageProducer.CurRoom + 10)[0]
7979
);
8080
break;
8181
case 4: // get random relic
8282
GD.Print("random relic");
83-
self.OutcomeDescriptions[0] = "EVENT_EVENT1_OUTCOME6";
83+
self.OutcomeDescriptions[0] = "EVENT_EVENT2_OUTCOME6";
8484
StageProducer.PlayerStats.AddRelic(
8585
Scribe.GetRandomRelics(
8686
1,
@@ -91,8 +91,8 @@ public partial class EventDatabase
9191
break;
9292
case 5:
9393
GD.Print("heal");
94-
self.OutcomeDescriptions[0] = "EVENT_EVENT1_OUTCOME7";
95-
StageProducer.PlayerStats.CurrentHealth = Math.Max(
94+
self.OutcomeDescriptions[0] = "EVENT_EVENT2_OUTCOME7";
95+
StageProducer.PlayerStats.CurrentHealth = Math.Min(
9696
StageProducer.PlayerStats.CurrentHealth + 20,
9797
StageProducer.PlayerStats.MaxHealth
9898
);
@@ -104,7 +104,34 @@ public partial class EventDatabase
104104
},
105105
],
106106
GD.Load<Texture2D>("res://Classes/Events/Assets/TEMP.png"),
107-
[() => StageProducer.PlayerStats.Money > 20, () => true]
107+
[() => StageProducer.PlayerStats.Money >= 20, () => true]
108+
),
109+
new EventTemplate(
110+
2,
111+
"EVENT_EVENT3_DESC",
112+
["EVENT_EVENT3_OPTION1", "EVENT_EVENT3_OPTION2", "EVENT_EVENT3_OPTION3"],
113+
["EVENT_EVENT3_OUTCOME1", "EVENT_EVENT3_OUTCOME2", "EVENT_EVENT3_OUTCOME3"],
114+
[
115+
(self) =>
116+
{
117+
StageProducer.PlayerStats.CurrentHealth = Math.Min(
118+
StageProducer.PlayerStats.CurrentHealth + 10,
119+
StageProducer.PlayerStats.MaxHealth
120+
);
121+
},
122+
(self) =>
123+
{
124+
StageProducer.PlayerStats.MaxComboBar -= 5;
125+
},
126+
(self) =>
127+
{
128+
StageProducer.PlayerStats.Money -= 30;
129+
StageProducer.PlayerStats.AddNote(Scribe.NoteDictionary[3]);
130+
StageProducer.PlayerStats.AddNote(Scribe.NoteDictionary[3]);
131+
},
132+
],
133+
GD.Load<Texture2D>("res://Classes/Events/Assets/TEMP.png"),
134+
[() => true, () => true, () => StageProducer.PlayerStats.Money >= 30]
108135
),
109136
};
110137
}

Globals/SaveSystem.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ public class SaveFile
386386
public int[] RelicIds { get; init; }
387387
public int PlayerHealth { get; init; }
388388
public int Shortcuts { get; init; }
389+
public int PlayerMaxCombo { get; init; }
389390

390391
public SaveFile(
391392
ulong rngSeed,
@@ -396,7 +397,8 @@ public SaveFile(
396397
int playerHealth,
397398
int area,
398399
int money,
399-
int shortcuts
400+
int shortcuts,
401+
int playerMaxCombo
400402
)
401403
{
402404
RngSeed = rngSeed;
@@ -408,6 +410,7 @@ int shortcuts
408410
Area = area;
409411
Money = money;
410412
Shortcuts = shortcuts;
413+
PlayerMaxCombo = playerMaxCombo;
411414
}
412415
}
413416

@@ -424,7 +427,8 @@ public static void SaveGame()
424427
StageProducer.PlayerStats.CurrentHealth,
425428
StageProducer.CurLevel.Id,
426429
StageProducer.PlayerStats.Money,
427-
StageProducer.PlayerStats.Shortcuts
430+
StageProducer.PlayerStats.Shortcuts,
431+
StageProducer.PlayerStats.MaxComboBar
428432
);
429433
string json = JsonSerializer.Serialize(sv);
430434

Globals/StageProducer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ private bool LoadGame()
104104
PlayerStats.CurrentHealth = sv.PlayerHealth;
105105
PlayerStats.Money = sv.Money;
106106
PlayerStats.Shortcuts = sv.Shortcuts;
107+
PlayerStats.MaxComboBar = sv.PlayerMaxCombo;
107108
IsInitialized = true;
108109
return true;
109110
}

Globals/Translations/Translations.csv

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,17 @@ EVENT_EVENT1_OUTCOME3,"You got robbed of half your gold.",(TODO)
138138
EVENT_EVENT2_DESC,"There is a slot machine.",(TODO)
139139
EVENT_EVENT2_OPTION1,"Pay 20g to spin",(TODO)
140140
EVENT_EVENT2_OPTION2,"Ignore the machine",(TODO)
141-
EVENT_EVENT1_OUTCOME1,"You saved your money and moved on.",(TODO)
142-
EVENT_EVENT1_OUTCOME2,"You lost your money.",(TODO)
143-
EVENT_EVENT1_OUTCOME3,"You refunded your money.",(TODO)
144-
EVENT_EVENT1_OUTCOME4,"You tripled your money.",(TODO)
145-
EVENT_EVENT1_OUTCOME5,"You gained a random note.",(TODO)
146-
EVENT_EVENT1_OUTCOME6,"You gained a random relic.",(TODO)
147-
EVENT_EVENT1_OUTCOME7,"You gained some health.",(TODO)
141+
EVENT_EVENT2_OUTCOME1,"You saved your money and moved on.",(TODO)
142+
EVENT_EVENT2_OUTCOME2,"You lost your money.",(TODO)
143+
EVENT_EVENT2_OUTCOME3,"You refunded your money.",(TODO)
144+
EVENT_EVENT2_OUTCOME4,"You tripled your money.",(TODO)
145+
EVENT_EVENT2_OUTCOME5,"You gained a random note.",(TODO)
146+
EVENT_EVENT2_OUTCOME6,"You gained a random relic.",(TODO)
147+
EVENT_EVENT2_OUTCOME7,"You gained some health.",(TODO)
148+
EVENT_EVENT3_DESC,"There is a field medic on the side of the road.",(TODO)
149+
EVENT_EVENT3_OPTION1,"Receive a bit of healing",(TODO)
150+
EVENT_EVENT3_OPTION2,"Decrease max energy",(TODO)
151+
EVENT_EVENT3_OPTION3,"Purchase 2 heal notes (30g)",(TODO)
152+
EVENT_EVENT3_OUTCOME1,"The medic patched you up.\nYou restored 10 Health.",(TODO)
153+
EVENT_EVENT3_OUTCOME2,"The medic gave you a shot of adrenaline.\nMax Energy reduced by 5.",(TODO)
154+
EVENT_EVENT3_OUTCOME3,"The medic sold you some healing supplies.\nAdded 2 heal notes to your inventory.",(TODO)

0 commit comments

Comments
 (0)