Search in sources :

Example 1 with MatchInfo

use of net.warvale.core.game.MatchInfo in project GameCore by Warvale.

the class GameStart method voteTally.

public static void voteTally() {
    votingActive = false;
    int rf = votes.get("redwood_forest");
    int vi = votes.get("volcano_island");
    int pe = votes.get("pagoda_everglade");
    int et = votes.get("extraterrestrial");
    int n = NumberUtils.random(4, 1);
    switch(n) {
        case 1:
            if (rf >= vi && rf >= pe && rf >= et) {
                map = GameMap.getMaps().get(mapNumbers.get(1));
            } else if (vi >= rf && vi >= pe && vi >= et) {
                map = GameMap.getMaps().get(mapNumbers.get(2));
            } else if (pe >= rf && pe >= vi && pe >= et) {
                map = GameMap.getMaps().get(mapNumbers.get(3));
            } else if (et >= rf && et >= vi && et >= pe) {
                map = GameMap.getMaps().get(mapNumbers.get(4));
            } else {
                map = GameMap.getMaps().get(mapNumbers.get(NumberUtils.random(4, 1)));
            }
            break;
        case 2:
            if (vi >= rf && vi >= pe && vi >= et) {
                map = GameMap.getMaps().get(mapNumbers.get(2));
            } else if (pe >= rf && pe >= vi && pe >= et) {
                map = GameMap.getMaps().get(mapNumbers.get(3));
            } else if (et >= rf && et >= vi && et >= pe) {
                map = GameMap.getMaps().get(mapNumbers.get(4));
            } else if (rf >= vi && rf >= pe && rf >= et) {
                map = GameMap.getMaps().get(mapNumbers.get(1));
            } else {
                map = GameMap.getMaps().get(mapNumbers.get(NumberUtils.random(4, 1)));
            }
            break;
        case 3:
            if (pe >= rf && pe >= vi && pe >= et) {
                map = GameMap.getMaps().get(mapNumbers.get(3));
            } else if (et >= rf && et >= vi && et >= pe) {
                map = GameMap.getMaps().get(mapNumbers.get(4));
            } else if (rf >= vi && rf >= pe && rf >= et) {
                map = GameMap.getMaps().get(mapNumbers.get(1));
            } else if (vi >= rf && vi >= pe && vi >= et) {
                map = GameMap.getMaps().get(mapNumbers.get(2));
            } else {
                map = GameMap.getMaps().get(mapNumbers.get(NumberUtils.random(4, 1)));
            }
            break;
        case 4:
            if (et >= rf && et >= vi && et >= pe) {
                map = GameMap.getMaps().get(mapNumbers.get(4));
            } else if (rf >= vi && rf >= pe && rf >= et) {
                map = GameMap.getMaps().get(mapNumbers.get(1));
            } else if (vi >= rf && vi >= pe && vi >= et) {
                map = GameMap.getMaps().get(mapNumbers.get(2));
            } else if (pe >= rf && pe >= vi && pe >= et) {
                map = GameMap.getMaps().get(mapNumbers.get(3));
            } else {
                map = GameMap.getMaps().get(mapNumbers.get(NumberUtils.random(4, 1)));
            }
            break;
    }
    MatchInfo info = new MatchInfo(teamBlue.size() + teamRed.size(), teamRed.size(), teamBlue.size());
    new Initialization(map, info).startGame();
    MessageManager.broadcast(PrefixType.MAIN, ChatColor.GRAY + "Voting is now closed!");
    MessageManager.broadcast(PrefixType.MAIN, ChatColor.GRAY + "The game has begun on " + ChatColor.RED + map.getName());
}
Also used : Initialization(net.warvale.core.game.start.Initialization) MatchInfo(net.warvale.core.game.MatchInfo)

Aggregations

MatchInfo (net.warvale.core.game.MatchInfo)1 Initialization (net.warvale.core.game.start.Initialization)1