if (forceVictory) { return true; }
    public boolean victory() {        if (game.isForceVictory()) {            int victoryPlayerId = game.getVictoryPlayerId();            int victoryTeam = game.getVictoryTeam();            Vector players = game.getPlayersVector();            boolean forceVictory = true;            // Individual victory.            if (victoryPlayerId != Player.PLAYER_NONE) {                for (int i = 0; i < players.size(); i++) {                    Player player = (Player) players.elementAt(i);                    if (player.getId() != victoryPlayerId && !player.isObserver()) {                        if (!player.admitsDefeat()) {                            forceVictory = false;                            break;                        }                    }                }            }            // Team victory.            if (victoryTeam != Player.TEAM_NONE) {                for (int i = 0; i < players.size(); i++) {                    Player player = (Player) players.elementAt(i);                    if (player.getTeam() != victoryTeam && !player.isObserver()) {                        if (!player.admitsDefeat()) {                            forceVictory = false;                            break;                        }                    }                }            }            for (int i = 0; i < players.size(); i++) {                Player player = (Player) players.elementAt(i);                player.setAdmitsDefeat(false);            }            if (forceVictory) {                return true;            }            cancelVictory();        }        if (!game.getOptions().booleanOption("check_victory")) {            return false;        }        // check all players/teams for aliveness        int playersAlive = 0;        Player lastPlayer = null;        boolean oneTeamAlive = false;        int lastTeam = Player.TEAM_NONE;        boolean unteamedAlive = false;        for (Enumeration e = game.getPlayers(); e.hasMoreElements();) {            Player player = (Player)e.nextElement();            int team = player.getTeam();            if (game.getLiveDeployedEntitiesOwnedBy(player) <= 0) {                continue;            }            // we found a live one!            playersAlive++;            lastPlayer = player;            // check team            if (team == Player.TEAM_NONE) {                unteamedAlive = true;            } else if (lastTeam == Player.TEAM_NONE) {                // possibly only one team alive                oneTeamAlive = true;                lastTeam = team;            } else if (team != lastTeam) {                // more than one team alive                oneTeamAlive = false;                lastTeam = team;            }        }        // check if there's one player alive        if (playersAlive < 1) {            game.setVictoryPlayerId( Player.PLAYER_NONE );            game.setVictoryTeam( Player.TEAM_NONE );            return true;        }        else if ( playersAlive == 1 ) {            if (lastPlayer.getTeam() == Player.TEAM_NONE) {                // individual victory                game.setVictoryPlayerId(lastPlayer.getId());                game.setVictoryTeam(Player.TEAM_NONE);                return true;            }        }        // did we only find one live team?        if (oneTeamAlive && !unteamedAlive) {            // team victory            game.setVictoryPlayerId(Player.PLAYER_NONE);            game.setVictoryTeam(lastTeam);            return true;        }                //now check for detailed victory conditions...        Hashtable<Integer,Integer> winPlayers = new Hashtable<Integer,Integer>();        Hashtable<Integer,Integer> winTeams = new Hashtable<Integer,Integer>();                //BV related victory conditions        if(game.getOptions().booleanOption("use_bv_destroyed")                || game.getOptions().booleanOption("use_bv_ratio")) {            HashSet<Integer> doneTeams = new HashSet<Integer>();            for(Enumeration e = game.getPlayers();e.hasMoreElements();) {                Player player = (Player)e.nextElement();                int fbv = 0;                int ebv = 0;                int eibv = 0;                int team = player.getTeam();                if(team != Player.TEAM_NONE) {                    if(doneTeams.contains(team))                        continue; //skip if already                    doneTeams.add(team);                }                                for(Enumeration f = game.getPlayers();f.hasMoreElements();) {                    Player other = (Player)f.nextElement();                    if(other.isEnemyOf(player)) {                        ebv += other.getBV();                        eibv += other.getInitialBV();                    } else {                        fbv += other.getBV();                    }                }                                if(game.getOptions().booleanOption("use_bv_ratio")) {                    if(ebv == 0 || (100*fbv)/ebv >= game.getOptions().intOption("bv_ratio_percent")) {                        Report r = new Report(7100);                        if(team == Player.TEAM_NONE) {                            r.add(player.getName());                            Integer vc=winPlayers.get(player.getId());                            if(vc==null)vc = new Integer(0);                            winPlayers.put(player.getId(),vc + 1);                        } else {                            r.add("Team "+team);                            Integer vc=winTeams.get(team);                            if(vc==null)vc = new Integer(0);                            winTeams.put(team,vc + 1);                        }                        r.add(ebv==0?9999:(100*fbv)/ebv);                        addReport(r);                    }                }                if(game.getOptions().booleanOption("use_bv_destroyed")) {                    if((ebv * 100) / eibv <=                        100 - game.getOptions().intOption("bv_destroyed_percent")) {                        Report r = new Report(7105);                        if(team == Player.TEAM_NONE) {                            r.add(player.getName());                            Integer vc=winPlayers.get(player.getId());                            if(vc==null)vc = new Integer(0);                            winPlayers.put(player.getId(),vc + 1);                        } else {                            r.add("Team "+team);                            Integer vc=winTeams.get(team);                            if(vc==null)vc = new Integer(0);                            winTeams.put(team,vc + 1);                        }                        r.add(100-((ebv*100)/eibv));                        addReport(r);                    }                }            }        }                //Any winners?        int wonPlayer = Player.PLAYER_NONE;        int wonTeam = Player.TEAM_NONE;        boolean draw = false;        for(Map.Entry<Integer,Integer> e : winPlayers.entrySet()) {            if(e.getValue() >= game.getOptions().intOption("achieve_conditions")) {                if(wonPlayer != Player.PLAYER_NONE)                    draw = true;                wonPlayer = e.getKey();                Report r = new Report(7200);                r.add(game.getPlayer(wonPlayer).getName());                addReport(r);            }        }        for(Map.Entry<Integer,Integer> e : winTeams.entrySet()) {            if(e.getValue() >= game.getOptions().intOption("achieve_conditions")) {                if(wonTeam != Player.TEAM_NONE || wonPlayer != Player.PLAYER_NONE)                    draw = true;                wonTeam = e.getKey();                Report r = new Report(7200);                r.add("Team "+wonTeam);                addReport(r);            }        }        if(draw) {            game.setVictoryPlayerId(Player.PLAYER_NONE);            game.setVictoryTeam(Player.TEAM_NONE);            return true;        }        if(wonPlayer != Player.PLAYER_NONE) {            //individual victory            game.setVictoryPlayerId(winPlayers.keys().nextElement());            game.setVictoryTeam(Player.TEAM_NONE);            return true;        }        if(wonTeam != Player.TEAM_NONE) {            //team victory            game.setVictoryPlayerId(Player.PLAYER_NONE);            game.setVictoryTeam(wonTeam);            return true;        }        return false;    }