-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new placeholder mode and test qualification
- Loading branch information
Showing
14 changed files
with
136 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
modes: | ||
- base | ||
- green_flag | ||
- grooveline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
#config_version=6 | ||
|
||
# mode: | ||
# code: attract.Attract | ||
|
||
slide_player: | ||
mode_attract_started: | ||
attract_slide: | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from mpf.core.mode import Mode | ||
|
||
class Base(Mode): | ||
|
||
def mode_start(self, **kwargs): | ||
player = self.machine.game.player | ||
if player.is_player_var('grooveline_counter_count'): | ||
self.machine.counters['grooveline_counter'].reset() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#config_version=6 | ||
|
||
mode: | ||
start_events: | ||
- logicblock_grooveline_counter_complete | ||
restart_on_next_ball: false | ||
priority: 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
from tests.death_save_game_testing import DeathSaveGameTesting | ||
|
||
class TestGroovelineMode(DeathSaveGameTesting): | ||
|
||
def test_qualification(self): | ||
self._start_green_flag() | ||
|
||
self.hit_and_release_switch("s_spinner") | ||
self.hit_and_release_switch("s_grooveline") | ||
self.assertEqual( | ||
1, self.machine.game.player.grooveline_counter_count) | ||
|
||
self.machine.events.post("degrade_oil") | ||
self.machine.events.post("degrade_oil") | ||
self.advance_time_and_run(1) | ||
|
||
self.assertModeNotRunning("green_flag") | ||
|
||
# Count doesn't increase outside of green_flag mode | ||
self.hit_and_release_switch("s_spinner") | ||
self.hit_and_release_switch("s_grooveline") | ||
self.assertEqual( | ||
1, self.machine.game.player.grooveline_counter_count) | ||
|
||
# Player tops up the oil, reactivating green_flag mode | ||
self.hit_and_release_switch("s_qualifier2") | ||
self.advance_time_and_run(1) | ||
self.assertModeRunning("green_flag") | ||
# Grooveline counter still at 1 as its value is | ||
# persisted for a single ball | ||
self.assertEqual( | ||
1, self.machine.game.player.grooveline_counter_count) | ||
self.assertEqual(1, self.machine.game.player.ball) | ||
|
||
# ball drains and ball 2 begins | ||
for i in range(2): | ||
self.hit_switch_and_run("s_trough1", 4) | ||
self.hit_and_release_switch("s_shooter_lane") | ||
|
||
self.assertModeRunning("base") | ||
|
||
# Green flag mode resumes | ||
self.assertModeRunning("green_flag") | ||
self.assertEqual(2, self.machine.game.player.ball) | ||
# Grooveline counter is reset to 0 | ||
self.assertEqual( | ||
0, self.machine.game.player.grooveline_counter_count) | ||
|
||
# Players hits the grooveline 10 times (10 laps) | ||
for i in range(10): | ||
# mock the event, so we avoid the random events | ||
self.machine.events. \ | ||
post("logicblock_seq_lap_complete") | ||
self.advance_time_and_run(1) | ||
|
||
# Counter resets | ||
self.assertEqual( | ||
0, self.machine.game.player.grooveline_counter_count) | ||
# And grooveline mode begins (multiball) | ||
self.assertModeRunning("grooveline") |