public synchronized void startMatch() { if (table.getState() == TableState.STARTING) { try { if (table.isTournamentSubTable()) { logger.info("Tourn. match started id:" + match.getId() + " tournId: " + table.getTournament().getId()); } else { UserManager.instance.getUser(userId).ifPresent(user -> { logger.info("MATCH started [" + match.getName() + "] " + match.getId() + '(' + user.getName() + ')'); logger.debug("- " + match.getOptions().getGameType() + " - " + match.getOptions().getDeckType()); }); } match.startMatch(); startGame(null); } catch (GameException ex) { logger.fatal("Error starting match ", ex); match.endGame(); } } }
this.matchId = match.getId(); this.matchName = match.getName(); this.gameType = match.getOptions().getGameType(); this.deckType = match.getOptions().getDeckType() + " [" + table.getName() + ']'; } else { this.deckType = match.getOptions().getDeckType(); this.endTime = match.getEndTime(); this.replayAvailable = match.isReplayAvailable(); this.rated = match.getOptions().isRated();
winsNeeded = match.getOptions().getWinsNeeded(); StringBuilder additonalText = new StringBuilder(); for (MatchPlayer matchPlayer : match.getPlayers()) {
if (!table.getMatch().getOptions().getPassword().isEmpty() && playerType == PlayerType.HUMAN) { if (!table.getMatch().getOptions().getPassword().equals(password)) { user.showUserMessage("Join Table", "Wrong password."); return false; int quitRatio = table.getMatch().getOptions().getQuitRatio(); if (quitRatio < user.getMatchQuitRatio()) { String message = new StringBuilder("Your quit ratio ").append(user.getMatchQuitRatio()) int minimumRating = table.getMatch().getOptions().getMinimumRating(); int userRating; if (table.getMatch().getOptions().isLimited()) { userRating = user.getUserData().getLimitedRating(); } else { int edhPowerLevel = table.getMatch().getOptions().getEdhPowerLevel(); if (edhPowerLevel > 0 && table.getValidator().getName().toLowerCase(Locale.ENGLISH).equals("commander")) { int deckEdhPowerLevel = table.getValidator().getEdhPowerLevel(deck);
table.initGame(); GameOptions gameOptions = new GameOptions(); gameOptions.rollbackTurnsAllowed = match.getOptions().isRollbackTurnsAllowed(); gameOptions.bannedUsers = match.getOptions().getBannedUsers(); gameOptions.planeChase = match.getOptions().isPlaneChase(); match.getGame().setGameOptions(gameOptions); GameManager.instance.createGameSession(match.getGame(), userPlayerMap, table.getId(), choosingPlayerId, gameOptions);
if (table.getMatch().getGames().isEmpty()) { addInfo.append("Wins:").append(table.getMatch().getWinsNeeded()); addInfo.append(" Time: ").append(table.getMatch().getOptions().getMatchTimeLimit().toString()); if (table.getMatch().getFreeMulligans() > 0) { addInfo.append(" Free Mul.: ").append(table.getMatch().getFreeMulligans()); addInfo.append(" Rng: ").append(table.getMatch().getOptions().getRange().toString()); this.skillLevel = table.getMatch().getOptions().getSkillLevel(); this.quitRatio = Integer.toString(table.getMatch().getOptions().getQuitRatio()); this.minimumRating = Integer.toString(table.getMatch().getOptions().getMinimumRating()); this.limited = table.getMatch().getOptions().isLimited(); this.rated = table.getMatch().getOptions().isRated(); this.passworded = !table.getMatch().getOptions().getPassword().isEmpty(); this.spectatorsAllowed = table.getMatch().getOptions().isSpectatorsAllowed(); } else {
MatchProto.Builder matchBuilder = roundBuilder.addMatchesBuilder() .setName(match.getName()) .setGameType(match.getOptions().getGameType()) .setDeckType(match.getOptions().getDeckType()) .setGames(match.getNumGames()) .setDraws(match.getDraws()) .addPlayers(matchToProto(match, pair.getPlayer1())) .addPlayers(matchToProto(match, pair.getPlayer2())) .setMatchOptions(match.getOptions().toProto()) .setEndTimeMs((match.getEndTime() != null ? match.getEndTime() : new Date()).getTime());