def game_success_full_attack(game: Game): game.last_action = Action( action_type=Action.ActionType.CALL_FOR_AN_ATTACK, action_data=CaptainCallForAttackData( which_captain=User(username=game.get_jr_caption()), state=State.Success, from_other_ship=False)) return game
def create_new_game(game_id: str, players: List[str], host: str) -> Game: players_info: Dict[str, Player] = {} players_copy = players.copy() random.shuffle(players_copy) if len(players_copy) % 2 != 0: dutch = players_copy[0] players_copy.remove(dutch) dutch = Player(id=dutch, team=Team.DUTCH.value) players_info[dutch.id] = dutch players_game[dutch.id] = game_id for index, player in enumerate(players_copy): if index % 2 != 0: player_team = Team.BRITAIN.value else: player_team = Team.FRANCE.value players_info[player] = Player(id=player, team=player_team) players_game[player] = game_id players_positions = _generate_map(players) chests_position = _generate_chests_positions() players_info = _give_treasure_to_captains(players_info, players_positions) event_cards = setup_event_cards_deck() new_game = Game( id=game_id, players_info=players_info, chests_position=chests_position, players_position=players_positions, event_cards=event_cards, last_action=None, is_over=False, winner=None, host=host, ) _setup_vote_cards(new_game) new_game.turn = new_game.get_jr_caption() game_statuses[game_id] = new_game return new_game