Package mage.game.match

Examples of mage.game.match.Match


            player.setPoints(0);
            player.setStateInfo("");
        }
        for (Round round: rounds) {
            for (TournamentPairing pair: round.getPairs()) {
                Match match = pair.getMatch();
                if (match != null && match.hasEnded()) {
                    TournamentPlayer tp1 = pair.getPlayer1();
                    TournamentPlayer tp2 = pair.getPlayer2();
                    MatchPlayer mp1 = match.getPlayer(pair.getPlayer1().getPlayer().getId());
                    MatchPlayer mp2 = match.getPlayer(pair.getPlayer2().getPlayer().getId());
                    // set player state if he finished the round
                    if (round.getRoundNumber() == rounds.size()) { // for elimination getRoundNumber = 0 so never true here
                        match.setTournamentRound(round.getRoundNumber());
                        if (tp1.getState().equals(TournamentPlayerState.DUELING)) {
                            if (round.getRoundNumber() == getNumberRounds()) {
                                tp1.setState(TournamentPlayerState.FINISHED);
                            } else {
                                tp1.setState(TournamentPlayerState.WAITING);
View Full Code Here


    private GameFactory() {}

    public Match createMatch(String gameType, MatchOptions options) {

        Match match;
        Constructor<Match> con;
        try {
            con = games.get(gameType).getConstructor(new Class[]{MatchOptions.class});
            match = con.newInstance(new Object[] {options});
        } catch (Exception ex) {
View Full Code Here

            controllers.remove(tableId);
            tableController.cleanUp()// deletes the table chat and references to users          
           
            Table table = tables.get(tableId);
            tables.remove(tableId);
            Match match = table.getMatch();
            Game game = null;
            if (match != null) {
                game = match.getGame();
                if (game != null && !game.hasEnded()) {
                    game.end();
                }               
            }
                       
View Full Code Here

                gameInfo = new StringBuilder("Game is a draw on Turn ").append(game.getTurnNum()).append(".").toString();
            }
        }
        matchView = new MatchView(table);

        Match match = table.getMatch();
        MatchPlayer matchWinner = null;
        winsNeeded = match.getOptions().getWinsNeeded();
        StringBuilder additonalText = new StringBuilder();
        for (MatchPlayer matchPlayer: match.getPlayers()) {
            if (matchPlayer.getPlayer().equals(you)) {
                wins = matchPlayer.getWins();
            }
            if (matchPlayer.isMatchWinner()) {
                matchWinner = matchPlayer;
View Full Code Here

        }
    }

    // used for matches
    private void initMatchTable(Table table) {
        Match match = table.getMatch();
        this.matchId = match.getId();
        this.matchName = match.getName();
        this.gameType = match.getOptions().getGameType();

        if (table.getName() != null && !table.getName().isEmpty()) {
            this.deckType = match.getOptions().getDeckType() + " [" +  table.getName() + "]";
        else {
            this.deckType = match.getOptions().getDeckType();
        }
       
        for (Game game: match.getGames()) {
            games.add(game.getId());
        }
        StringBuilder sb1 = new StringBuilder();
        StringBuilder sb2 = new StringBuilder();
        for (MatchPlayer matchPlayer: match.getPlayers()) {
            sb1.append(matchPlayer.getName());
            if(matchPlayer.hasQuit()) {
                if (matchPlayer.getPlayer().hasTimerTimeout()) {
                    sb1.append(" [timer] ");
                } else if (matchPlayer.getPlayer().hasIdleTimeout()) {
                    sb1.append(" [idle] ");
                } else {
                    sb1.append(" [quit] ");
                }
            }
            int lostGames = match.getNumGames() - (matchPlayer.getWins() + match.getDraws());
            sb1.append(", ");
            sb2.append(matchPlayer.getName()).append(" [");
            sb2.append(matchPlayer.getWins()).append("-");
            if (match.getDraws() > 0) {
                sb2.append(match.getDraws()).append("-");
            }
            sb2.append(lostGames).append("], ");
        }
        if (sb1.length() > 2) {
            players = sb1.substring(0, sb1.length() - 2);
            result = sb2.substring(0, sb2.length() - 2);
        } else {
            players = "[no players]";
            result = "";
        }
        this.startTime = match.getStartTime();
        this.endTime = match.getEndTime();
        this.replayAvailable = match.isReplayAvailable();

    }
View Full Code Here

            TournamentPlayer player2 = pair.getPlayer2();
            tableManager.addPlayer(getPlayerUserId(player1.getPlayer().getId()), table.getId(), player1.getPlayer(), player1.getPlayerType(), player1.getDeck());
            tableManager.addPlayer(getPlayerUserId(player2.getPlayer().getId()), table.getId(), player2.getPlayer(), player2.getPlayerType(), player2.getDeck());
            table.setState(TableState.STARTING);
            tableManager.startTournamentSubMatch(null, table.getId());
            Match match = tableManager.getMatch(table.getId());
            match.setTableId(tableId);
            pair.setMatch(match);
            pair.setTableId(table.getId());
            player1.setState(TournamentPlayerState.DUELING);
            player2.setState(TournamentPlayerState.DUELING);
        } catch (GameException ex) {
View Full Code Here

TOP

Related Classes of mage.game.match.Match

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.