def kick_player(self, playerId): try: p = self.by_id(playerId) except: print "cant not find player:%d" % playerId return if self.turn == playerId: self.set_turn(1) p.dispose() self.players.remove(p) BaseClass.exeEvt(self, 'kick', playerId) if len(self.players) == 1: #win BaseClass.exeEvt(self, 'won', self.players[0].playerId)
def play(self, playerId, msg): if not self.playing: raise NotPlaying() if self.turn != playerId: raise NotTurn(playerId) p = self.by_id(playerId) p.play(msg) self.game.com_bc_play(p.playerId, msg) self.game.com_s_go(self.turn, self.current_card.toString()) if p.is_won(): self.game.com_bc_gg(playerId) BaseClass.exeEvt(self, 'won', playerId) if p.is_uno(): self.game.com_bc_uno(playerId) self.played_time = time.time()