public GameTypeView(MatchType gameType) { this.name = gameType.getName(); this.minPlayers = gameType.getMinPlayers(); this.maxPlayers = gameType.getMaxPlayers(); this.numTeams = gameType.getNumTeams(); this.playersPerTeam = gameType.getPlayersPerTeam(); this.useAttackOption = gameType.isUseAttackOption(); this.useRange = gameType.isUseRange(); }
@Override public void sideboard(Match match, Deck deck) { //TODO: improve this match.submitDeck(playerId, deck); }
public boolean isRoundOver() { boolean roundIsOver = true; if (this.match != null) { if (!this.match.hasEnded()) { roundIsOver = false; } } return roundIsOver; } }
@Override public int getFreeMulligans() { return options.getFreeMulligans(); }
private void autoSideboard() { for (MatchPlayer player : match.getPlayers()) { if (!player.isDoneSideboarding()) { match.submitDeck(player.getPlayer().getId(), player.generateDeck()); } } }
@Override public void submitDeck(UUID playerId, Deck deck) { MatchPlayer player = getPlayer(playerId); if (player != null) { // make sure the deck name (needed for Tiny Leaders) won't get lost by sideboarding deck.setName(player.getDeck().getName()); deck.setDeckHashCode(player.getDeck().getDeckHashCode()); player.submitDeck(deck); } synchronized (this) { this.notifyAll(); } }
@Override public boolean isDoneSideboarding() { for (MatchPlayer player : this.players) { if (!player.hasQuit() && !player.isDoneSideboarding()) { return false; } } return true; }
@Override public String getName() { return options.getName(); }
@Override public int getWinsNeeded() { return options.getWinsNeeded(); }
@Override public void cleanUpOnMatchEnd(boolean isSaveGameActivated, boolean isTournament) { for (MatchPlayer matchPlayer : players) { matchPlayer.cleanUpOnMatchEnd(); } if ((!isSaveGameActivated && !isTournament) || this.getGame().isSimulation()) { this.getGames().clear(); } }
/** * Complete remove of the table, release all objects */ public void cleanUp() { if (match != null) { match.cleanUpOnMatchEnd(false, false); } }
public void setPlaneChase(boolean planeChase) { this.planeChase = planeChase; this.matchOptions.setPlaneChase(planeChase); }
public TournamentOptions(String name, String matchType, int numSeats) { this.name = name; this.matchOptions = new MatchOptions("", matchType, numSeats > 2, numSeats); }
@Override public void cleanUp() { for (MatchPlayer matchPlayer : players) { matchPlayer.cleanUpOnMatchEnd(); } this.getGames().clear(); }
public MatchPlayer(Player player, Deck deck, Match match) { this.player = player; this.deck = deck; this.wins = 0; this.winsNeeded = match.getWinsNeeded(); this.doneSideboarding = true; this.quit = false; //this.timerTimeout = false; this.name = player.getName(); this.matchWinner = false; }
public Date getStartTime() { if (isTournament) { return tournament.getStartTime(); } else { return match.getStartTime(); } }
@Override public void sideboard(Match match, Deck deck) { match.fireSideboardEvent(playerId, deck); }
@Override public void fireSideboardEvent(UUID playerId, Deck deck) { MatchPlayer player = getPlayer(playerId); if (player != null) { tableEventSource.fireTableEvent(EventType.SIDEBOARD, playerId, deck, SIDEBOARD_TIME); } }
public boolean areAllDoneSideboarding() { int count = 0; for (MatchPlayer player : this.players) { if (!player.hasQuit() && player.isDoneSideboarding()) { return true; } if (player.hasQuit()) { count++; } } return count < this.players.size(); }