case "Variant Magic - Duel Commander": case "Variant Magic - MTGO 1v1 Commander": if (!options.getGameType().startsWith("Commander")) { JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Deck type Commander needs also a Commander game type", "Error", JOptionPane.ERROR_MESSAGE); return false; case "Variant Magic - Brawl": case "Variant Magic - Duel Brawl": if (!options.getGameType().startsWith("Brawl")) { JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Deck type Brawl needs also a Brawl game type", "Error", JOptionPane.ERROR_MESSAGE); return false; if (!options.getGameType().startsWith("Tiny Leaders")) { JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Deck type Tiny Leaders needs also a Tiny Leaders game type", "Error", JOptionPane.ERROR_MESSAGE); return false; if (!options.getGameType().startsWith("Momir Basic")) { JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Deck type Momir Basic needs also a Momir Basic game type", "Error", JOptionPane.ERROR_MESSAGE); return false; switch (options.getGameType()) { case "Commander Two Player Duel": case "Commander Free For All":
public TableController(UUID roomId, UUID userId, MatchOptions options) { this.userId = userId; this.options = options; match = GameFactory.instance.createMatch(options.getGameType(), options); if (userId != null) { Optional<User> user = UserManager.instance.getUser(userId); // TODO: Handle if user == null controllerName = user.map(User::getName).orElse("undefined"); } else { controllerName = "System"; } table = new Table(roomId, options.getGameType(), options.getName(), controllerName, DeckValidatorFactory.instance.createDeckValidator(options.getDeckType()), options.getPlayerTypes(), TableRecorderImpl.instance, match, options.getBannedUsers(), options.isPlaneChase()); chatId = ChatManager.instance.createChatSession("Match Table " + table.getId()); init(); }
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();
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_DECK_TYPE + versionStr, options.getDeckType()); PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_TIME_LIMIT + versionStr, Integer.toString(options.getPriorityTime())); PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_GAME_TYPE + versionStr, options.getGameType()); PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_WINS + versionStr, Integer.toString(options.getWinsNeeded())); PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_ROLLBACK_TURNS_ALLOWED + versionStr, options.isRollbackTurnsAllowed() ? "Yes" : "No");
@Override public MatchProto toProto() { MatchProto.Builder builder = MatchProto.newBuilder() .setName(this.getName()) .setGameType(this.getOptions().getGameType()) .setDeckType(this.getOptions().getDeckType()) .setGames(this.getNumGames()) .setDraws(this.getDraws()) .setMatchOptions(this.getOptions().toProto()) .setEndTimeMs((this.getEndTime() != null ? this.getEndTime() : new Date()).getTime()); for (MatchPlayer matchPlayer : this.getPlayers()) { MatchQuitStatus status = !matchPlayer.hasQuit() ? MatchQuitStatus.NO_MATCH_QUIT : matchPlayer.getPlayer().hasTimerTimeout() ? MatchQuitStatus.TIMER_TIMEOUT : matchPlayer.getPlayer().hasIdleTimeout() ? MatchQuitStatus.IDLE_TIMEOUT : MatchQuitStatus.QUIT; builder.addPlayersBuilder() .setName(matchPlayer.getName()) .setHuman(matchPlayer.getPlayer().isHuman()) .setQuit(status) .setWins(matchPlayer.getWins()); } return builder.build(); }
MatchProto.Builder matchBuilder = roundBuilder.addMatchesBuilder() .setName(match.getName()) .setGameType(match.getOptions().getGameType()) .setDeckType(match.getOptions().getDeckType()) .setGames(match.getNumGames())