switch (options.getDeckType()) { case "Variant Magic - Commander": case "Variant Magic - Duel Commander": case "Commander Two Player Duel": case "Commander Free For All": if (!options.getDeckType().equals("Variant Magic - Commander") && !options.getDeckType().equals("Variant Magic - Duel Commander") && !options.getDeckType().equals("Variant Magic - MTGO 1v1 Commander")) { JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Deck type Commander needs also a Commander game type", "Error", JOptionPane.ERROR_MESSAGE); return false; case "Brawl Two Player Duel": case "Brawl Free For All": if (!options.getDeckType().equals("Variant Magic - Brawl") && !options.getDeckType().equals("Variant Magic - Duel Brawl")) { JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Deck type Brawl needs also a Brawl game type", "Error", JOptionPane.ERROR_MESSAGE); return false; if (!options.getDeckType().equals("Variant Magic - Tiny Leaders")) { JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Deck type Tiny Leaders needs also a Tiny Leaders game type", "Error", JOptionPane.ERROR_MESSAGE); return false;
@Override public void startGame() throws GameException { int startLife = 40; boolean alsoHand = true; // Don't like it to compare but seems like it's complicated to do it in another way boolean checkCommanderDamage = true; if (options.getDeckType().equals("Variant Magic - Duel Commander")) { startLife = 20; // Starting with the Commander 2016 update (on November 11th, 2016), Duel Commander will be played with 20 life points instead of 30. alsoHand = true; // commander going to hand allowed to go to command zone effective July 17, 2015 checkCommanderDamage = false; // since nov 16 duel commander uses no longer commander damage rule } if (options.getDeckType().equals("Variant Magic - MTGO 1v1 Commander")) { startLife = 30; alsoHand = true; // commander going to hand allowed to go to command zone effective July 17, 2015 } CommanderDuel game = new CommanderDuel(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife); game.setCheckCommanderDamage(checkCommanderDamage); game.setStartMessage(this.createGameStartMessage()); game.setAlsoHand(alsoHand); game.setAlsoLibrary(true); initGame(game); games.add(game); }
public TableController(UUID roomId, UUID userId, TournamentOptions options) { this.userId = userId; tournament = TournamentFactory.instance.createTournament(options.getTournamentType(), options); if (userId != null) { Optional<User> user = UserManager.instance.getUser(userId); if (!user.isPresent()) { logger.fatal(new StringBuilder("User for userId ").append(userId).append(" could not be retrieved from UserManager").toString()); controllerName = "[unknown]"; } else { controllerName = user.get().getName(); } } else { controllerName = "System"; } table = new Table(roomId, options.getTournamentType(), options.getName(), controllerName, DeckValidatorFactory.instance.createDeckValidator(options.getMatchOptions().getDeckType()), options.getPlayerTypes(), TableRecorderImpl.instance, tournament, options.getMatchOptions().getBannedUsers(), options.isPlaneChase()); chatId = ChatManager.instance.createChatSession("Tourn. table " + table.getId()); }
@Override public void startGame() throws GameException { int startLife = 40; boolean alsoHand = true; if (options.getDeckType().equals("Variant Magic - Duel Penny Dreadful Commander")) { startLife = 30; alsoHand = true; // commander going to hand allowed to go to command zone effective July 17, 2015 } PennyDreadfulCommanderFreeForAll game = new PennyDreadfulCommanderFreeForAll(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife); game.setStartMessage(this.createGameStartMessage()); game.setAlsoHand(alsoHand); game.setAlsoLibrary(true); initGame(game); games.add(game); }
@Override public void startGame() throws GameException { int startLife = 40; boolean alsoHand = true; if (options.getDeckType().equals("Variant Magic - Duel Commander")) { startLife = 30; alsoHand = true; // commander going to hand allowed to go to command zone effective July 17, 2015 } CommanderFreeForAll game = new CommanderFreeForAll(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife); game.setStartMessage(this.createGameStartMessage()); game.setAlsoHand(alsoHand); game.setAlsoLibrary(true); initGame(game); games.add(game); }
this.deckType = match.getOptions().getDeckType() + " [" + table.getName() + ']'; } else { this.deckType = match.getOptions().getDeckType();
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(); } } }
public TournamentView(Tournament tournament) { tournamentName = tournament.getOptions().getName(); StringBuilder typeText = new StringBuilder(tournament.getOptions().getTournamentType()); if (!tournament.getTournamentType().isLimited()) { typeText.append(" / ").append(tournament.getOptions().getMatchOptions().getDeckType()); } if (tournament.getNumberRounds() > 0) { typeText.append(' ').append(tournament.getNumberRounds()).append(" rounds"); } tournamentType = typeText.toString(); startTime = tournament.getStartTime(); endTime = tournament.getEndTime(); stepStartTime = tournament.getStepStartTime(); constructionTime = tournament.getOptions().getLimitedOptions().getConstructionTime(); watchingAllowed = tournament.getOptions().isWatchingAllowed(); serverTime = new Date(); tournamentState = tournament.getTournamentState(); if (tournament.getTournamentState().equals("Drafting") && tournament.getDraft() != null) { runningInfo = "booster/card: " + tournament.getDraft().getBoosterNum() + '/' + (tournament.getDraft().getCardNum() -1); } else { runningInfo = ""; } for (TournamentPlayer player: tournament.getPlayers()) { players.add(new TournamentPlayerView(player)); } Collections.sort(players); for (Round round: tournament.getRounds()) { rounds.add(new RoundView(round)); } }
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(); }
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());
@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(); }
.setName(match.getName()) .setGameType(match.getOptions().getGameType()) .setDeckType(match.getOptions().getDeckType()) .setGames(match.getNumGames()) .setDraws(match.getDraws())