private Optional<Player> createPlayer(String name, PlayerType playerType, int skill) { Optional<Player> playerOpt; if (options == null) { playerOpt = PlayerFactory.instance.createPlayer(playerType, name, RangeOfInfluence.ALL, skill); } else { playerOpt = PlayerFactory.instance.createPlayer(playerType, name, options.getRange(), skill); } if (playerOpt.isPresent()) { Player player = playerOpt.get(); logger.trace("Player " + player.getName() + " created id: " + player.getId()); } return playerOpt; }
protected String createGameStartMessage() { StringBuilder sb = new StringBuilder(); sb.append("<br/><b>Match score:</b><br/>"); for (MatchPlayer mp : this.getPlayers()) { sb.append(" ").append(mp.getPlayer().getLogName()); sb.append(" - ").append(mp.getWins()).append(mp.getWins() == 1 ? " win" : " wins"); if (mp.hasQuit()) { sb.append(" QUITTED"); } sb.append("<br/>"); if (mp.getDeck() != null) { sb.append("DeckHash: ").append(mp.getDeck().getDeckHashCode()).append("<br/>"); } } if (getDraws() > 0) { sb.append(" Draws: ").append(getDraws()).append("<br/>"); } if (options.getRange() != null) { sb.append(" Range: ").append(options.getRange().toString()).append("<br/>"); } sb.append("<br/>").append("Match is ").append(this.getOptions().isRated() ? "" : "not ").append("rated<br/>"); sb.append("You have to win ").append(this.getWinsNeeded()).append(this.getWinsNeeded() == 1 ? " game" : " games").append(" to win the complete match<br/>"); sb.append("<br/>Game has started<br/><br/>"); return sb.toString(); }
@Override public void startGame() throws GameException { // Momir Vig, Simic Visionary gives +4 starting life int startLife = 24; MomirGame game = new MomirGame(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife); game.setStartMessage(this.createGameStartMessage()); this.initGame(game); games.add(game); }
@Override public void startGame() throws GameException { FreeForAll game = new FreeForAll(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), 20); game.setStartMessage(this.createGameStartMessage()); initGame(game); games.add(game); }
@Override public void startGame() throws GameException { // Momir Vig, Simic Visionary gives +4 starting life int startLife = 24; MomirDuel game = new MomirDuel(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife); game.setStartMessage(this.createGameStartMessage()); this.initGame(game); games.add(game); }
@Override public void startGame() throws GameException { TwoPlayerDuel game = new TwoPlayerDuel(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), 20); // Sets a start message about the match score game.setStartMessage(this.createGameStartMessage()); initGame(game); games.add(game); }
@Override public void startGame() throws GameException { int startLife = 20; CanadianHighlanderDuel game = new CanadianHighlanderDuel(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife); game.setStartMessage(this.createGameStartMessage()); initGame(game); games.add(game); }
@Override public void startGame() throws GameException { int startLife = 40; boolean alsoHand = true; FreeformCommanderFreeForAll game = new FreeformCommanderFreeForAll(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 { //Tiny Leaders Play Rule 13: Players begin the game with 25 life. int startLife = 25; TinyLeadersDuel game = new TinyLeadersDuel(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife); game.setStartMessage(this.createGameStartMessage()); //Tucking a Tiny Leader is legal game.setAlsoHand(false); game.setAlsoLibrary(false); this.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); }
@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 = 30; boolean alsoHand = true; BrawlFreeForAll game = new BrawlFreeForAll(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife); game.setStartMessage(this.createGameStartMessage()); game.setAlsoHand(alsoHand); game.setCheckCommanderDamage(false); game.setAlsoLibrary(true); initGame(game); games.add(game); }
@Override public void startGame() throws GameException { int startLife = 25; boolean alsoHand = true; BrawlDuel game = new BrawlDuel(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife); game.setCheckCommanderDamage(false); game.setStartMessage(this.createGameStartMessage()); game.setAlsoHand(true); game.setAlsoLibrary(true); initGame(game); games.add(game); } }
@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); }
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_DECK_FILE + versionStr, deckFile); PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_PLAYERS + versionStr, spnNumPlayers.getValue().toString()); PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_RANGE + versionStr, Integer.toString(options.getRange().getRange())); PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_ATTACK_OPTION + versionStr, options.getAttackOption().toString()); PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_SKILL_LEVEL + versionStr, options.getSkillLevel().toString());
addInfo.append(" Rng: ").append(table.getMatch().getOptions().getRange().toString());