diff --git a/stone_age/game_phase_controller/game_phase_controller.py b/stone_age/game_phase_controller/game_phase_controller.py index b3cc099..09b6490 100644 --- a/stone_age/game_phase_controller/game_phase_controller.py +++ b/stone_age/game_phase_controller/game_phase_controller.py @@ -123,7 +123,8 @@ def _try_to_do_further_actions(self) -> None: first_unsuccesful_player = None self._progress_state_after_succesfull_action() case HasAction.NO_ACTION_POSSIBLE: - if first_unsuccesful_player is None: + game_phase_match: bool = unsuccesful_game_phase == self._game_phase + if first_unsuccesful_player is None or not game_phase_match: first_unsuccesful_player = player unsuccesful_game_phase = self._game_phase self._progress_state_after_no_action_possible() diff --git a/test/game_phase_controller/test_game_phase_contoller.py b/test/game_phase_controller/test_game_phase_contoller.py index 9c66c78..b5c6754 100644 --- a/test/game_phase_controller/test_game_phase_contoller.py +++ b/test/game_phase_controller/test_game_phase_contoller.py @@ -301,6 +301,24 @@ def test_all_players_take_a_reward(self) -> None: self.assertTrue(self.make_all_players_take_a_reward_choice(1)) self.check_state_string("GamePhase.MAKE_ACTION,0/1/None") + def test_no_tools_last_action(self) -> None: + self.mock_setup("pDNN mW") + self.assertTrue(self.place_figures(0)) + self.check_state_string("GamePhase.MAKE_ACTION,0/0/None") + + self.mock_setup("mT wN mNN fW") + self.assertTrue(self.make_action(0)) + self.check_state_string("GamePhase.FEED_TRIBE,0/0/None") + + def test_all_players_take_a_reward_last_action(self) -> None: + self.mock_setup("pDNN mW") + self.assertTrue(self.place_figures(0)) + self.check_state_string("GamePhase.MAKE_ACTION,0/0/None") + + self.mock_setup("mR aN mNN fW") + self.assertTrue(self.make_action(0)) + self.check_state_string("GamePhase.FEED_TRIBE,0/0/None") + if __name__ == "__main__": unittest.main()