2626*/
2727float (float condition, string message) Test_Assert;
2828void (string message) Test_Skip;
29+ void (entity object) Test_SimulateUse;
30+
31+ // MARK: Quick Revive
2932
3033//
3134// Test_Perks_QuickRevive_ValidatePrice()
@@ -48,6 +51,48 @@ void() Test_Perks_QuickRevive_ValidateFields =
4851 remove(machine);
4952};
5053
54+ //
55+ // Test_Perks_QuickRevive_NoCostChangeOnRestart()
56+ // Validates that on a Soft_Restart the price of Quick
57+ // Revive does not change.
58+ // (https://github.com/nzp-team/nzportable/issues/1116)
59+ //
60+ void () Test_Perks_QuickRevive_NoCostChangeOnRestart =
61+ {
62+ entity perk_revive = find(world, classname, "perk_revive" );
63+
64+ // We need to simulate buying the perk to see the cost reduction,
65+ // so give us points.
66+ self. points = 10000 ;
67+ float start_score = self. points;
68+
69+ // Simulate purchase
70+ Test_SimulateUse(perk_revive);
71+
72+ float score_diff_before = start_score - self. points;
73+
74+ Test_Assert((score_diff_before != 0 ), "Could not buy Quick Revive before restart!" );
75+
76+ Soft_Restart();
77+
78+ // Do everything again and then assert
79+ // the diffs are the same.
80+ self. points = 10000 ;
81+ start_score = self. points;
82+
83+ Test_SimulateUse(perk_revive);
84+
85+ float score_diff_after = start_score - self. points;
86+
87+ Test_Assert((score_diff_before != 0 ), "Could not buy Quick Revive after restart!" );
88+ Test_Assert((score_diff_before == score_diff_after), sprintf("Quick Revive price changed after Soft_Restart, expected [%d] but got [%d]!" , score_diff_before, score_diff_after));
89+
90+ // Restart at end of test to not cause conflicts with tests ran afterwards.
91+ Soft_Restart();
92+ };
93+
94+ // MARK: Jugger-Nog
95+
5196//
5297// Test_Perks_JuggerNog_ValidatePrice()
5398// Spawns a Jugger-Nog machine and validates its
@@ -69,6 +114,8 @@ void() Test_Perks_JuggerNog_ValidateFields =
69114 remove(machine);
70115};
71116
117+ // MARK: Speed Cola
118+
72119//
73120// Test_Perks_SpeedCola_ValidatePrice()
74121// Spawns a Speed Cola machine and validates its
@@ -90,6 +137,8 @@ void() Test_Perks_SpeedCola_ValidateFields =
90137 remove(machine);
91138};
92139
140+ // MARK: Double Tap
141+
93142//
94143// Test_Perks_DoubleTap_ValidateFields()
95144// Spawns a Double Tap machine and validates its
@@ -111,6 +160,8 @@ void() Test_Perks_DoubleTap_ValidateFields =
111160 remove(machine);
112161};
113162
163+ // MARK: Stamin-Up
164+
114165//
115166// Test_Perks_StaminUp_ValidateFields()
116167// Spawns a Stamin-Up machine and validates its
@@ -132,6 +183,8 @@ void() Test_Perks_StaminUp_ValidateFields =
132183 remove(machine);
133184};
134185
186+ // MARK: PhD Flopper
187+
135188//
136189// Test_Perks_PhDFlopper_ValidateFields()
137190// Spawns a PhD Flopper machine and validates its
@@ -153,6 +206,8 @@ void() Test_Perks_PhDFlopper_ValidateFields =
153206 remove(machine);
154207};
155208
209+ // MARK: Deadshot Daiquiri
210+
156211//
157212// Test_Perks_DeadshotDaiquiri_ValidateFields()
158213// Spawns a Deadshot Daiquiri machine and validates its
@@ -174,6 +229,8 @@ void() Test_Perks_DeadshotDaiquiri_ValidateFields =
174229 remove(machine);
175230};
176231
232+ // MARK: Mule Kick
233+
177234//
178235// Test_Perks_MuleKick_ValidateFields()
179236// Spawns a Deadshot Daiquiri machine and validates its
@@ -195,6 +252,8 @@ void() Test_Perks_MuleKick_ValidateFields =
195252 remove(machine);
196253};
197254
255+ // MARK: Random Perk
256+
198257//
199258// Test_Perks_Random_LegacyFields()
200259// Attempts to spawn a random Perk-A-Cola
@@ -212,4 +271,20 @@ void() Test_Perks_Random_LegacyFields =
212271 self = old_self;
213272
214273 remove(random);
274+ };
275+
276+ // MARK: Misc.
277+
278+ //
279+ // Test_Perks_Drink_WorkOnReset()
280+ // Verifies that drinking a Perk and then
281+ // triggering a Soft_Restart does not
282+ // prevent purchase of additional Perks.
283+ // (https://github.com/nzp-team/nzportable/issues/1126)
284+ //
285+ void () Test_Perks_Drink_WorkOnReset =
286+ {
287+ self. isBuying = true;
288+ Soft_Restart();
289+ Test_Assert((self. isBuying == false), "isBuying state not reset!" );
215290};
0 commit comments