def setUp(self): super().setUp() self.player1 = c.DmClient("player1", 0, tu.PlayerHandler()) self.player2 = c.DmClient("player2", 1, tu.PlayerHandler()) self.player3 = c.DmClient("player3", 2, tu.PlayerHandler()) self.game = g.DmGame([self.player1, self.player2, self.player3], [], [], test=True) self.game.players = [self.player1, self.player2, self.player3] for i in self.game.players: i.game = self.game self.game.start_game() self.player1.take_turn()
def setUp(self): super().setUp() self.player1 = c.DmClient("player1", 0, tu.PlayerHandler()) self.player2 = c.DmClient("player2", 1, tu.PlayerHandler()) self.player3 = c.DmClient("player3", 2, tu.PlayerHandler()) self.game = g.DmGame([self.player1, self.player2, self.player3], [], [], test=True) #hard code order of players so that random turn order doesn't interfere with tests self.game.players = [self.player1, self.player2, self.player3] for i in self.game.players: i.game = self.game self.game.start_game() self.player1.take_turn()
def setUp(self): super().setUp() waitHandler.WaitHandler.time_until_afk = 1 self.player1 = c.DmClient("player1", 0, tu.PlayerHandler()) self.player2 = c.DmClient("player2", 1, tu.PlayerHandler()) self.player3 = c.DmClient("player3", 2, tu.PlayerHandler()) self.game = g.DmGame([self.player1, self.player2, self.player3], [], [], test=True) self.game.players = [self.player1, self.player2, self.player3] for i in self.game.players: i.game = self.game self.game.start_game()
def start_game(self, table): game = g.DmGame(table.players, table.required, table.excluded, table.req_supply) for i in table.players: i.write_json(command="resume") i.game = game self.application.games.append(game) for x in table.players: try: del self.application.unattachedClients[x.name] except ValueError: print("Error tried removing " + x.name + " from unattachedClients list") x.handler.table = None try: del self.application.game_tables[table.host.name] except ValueError: print("Error tried removing " + table.host.name + "'s table from game_tables list") self.update_lobby() self.announce_lobby( " and ".join(list(map(lambda x: x.name, table.players))) + " started a game.")