def _save_game_setup_state(self): picked_nations = [] for i in range(6): empire_name = self.game_board.player_setups[i].empire_picker.get() if empire_name != '': current_empire = Empires.get_by_name(empire_name) picked_nations.append(current_empire) else: picked_nations.append('') return picked_nations
def load_game(self, game_state): self._reset_for_game_start() for data in game_state.player_data: empire_literal = game_state.player_data[data].empire game_state.player_data[data].empire = Empires.get_by_adjective( empire_literal) self.players[data] = Player(self.game_board, game_state.player_data[data]) self._prepare_new_ui() while self.player_order[0] != game_state.next_player: self.player_order.append(self.player_order.pop(0)) self.engine = Vezerlo(self, game_state.taverns) self.game_board.update_wind_direction(game_state.wind_index) if game_state.is_lieutenant_found: self.engine.set_hadnagyElokerult() if game_state.is_grog_lord_defeated: self.engine.set_grogbaroLegyozve() self.menu.update_developer_tab() self.engine.set_paklik(game_state.card_decks) self.status_bar.log(s.language.loading_done) self.engine.szakasz_0()
def test_get_empire_by_name(self): for empire in Empires: empire.value.name = empire.value.adjective self.assertEqual(Empires.PIRATE.value, Empires.get_by_name("Pirate"))
def test_get_names(self): self.assertEqual(['British', 'French', 'Dutch', 'Spanish', 'Pirate'], Empires.get_names())
def test_get_empire_by_adjective_fail(self): with self.assertRaises(RuntimeError, msg="Invalid empire name: 'Portugal'"): self.assertEqual(Empires.PIRATE.value, Empires.get_by_adjective("Portugal"))
def test_get_empire_by_adjective(self): self.assertEqual(Empires.PIRATE.value, Empires.get_by_adjective("Pirate"))