/** * Returns a list of all active players of the game, setting the playerId to the current player of * the list. * * @param playerId * @return playerList */ public PlayerList getPlayerList(UUID playerId) { PlayerList newPlayerList = new PlayerList(); for (Player player : players.values()) { if (!player.hasLeft() && !player.hasLost()) { newPlayerList.add(player.getId()); } } newPlayerList.setCurrent(playerId); return newPlayerList; }
/* 20130711 *903.14a A player that’s been dealt 21 or more combat damage by the same commander * over the course of the game loses the game. (This is a state-based action. See rule 704.) * */ @Override protected boolean checkStateBasedActions() { for (Player player : getPlayers().values()) { CommanderInfoWatcher damageWatcher = (CommanderInfoWatcher) getState().getWatchers().get("CommanderCombatDamageWatcher", player.getCommanderId()); if (damageWatcher == null) { continue; } for (Map.Entry<UUID, Integer> entrySet : damageWatcher.getDamageToPlayer().entrySet()) { if (entrySet.getValue() > 20) { Player opponent = getPlayer(entrySet.getKey()); if (opponent != null && !opponent.hasLost() && player.isInGame()) { opponent.lost(this); } } } } return super.checkStateBasedActions(); }