Search in sources :

Example 1 with Initialization

use of net.warvale.core.game.start.Initialization 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)

Example 2 with Initialization

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

the class Game method start.

public static void start(GameMap last, GameMap next) {
    GameMap map = next == null ? getMap(last) : next;
    running = true;
    Integer tp = Main.getTeams().getBlueTeam().getSize() + Main.getTeams().getRedTeam().getSize();
    new Initialization(map, new MatchInfo(tp, Main.getTeams().getRedTeam().getSize(), Main.getTeams().getBlueTeam().getSize())).startGame();
}
Also used : Initialization(net.warvale.core.game.start.Initialization) GameMap(net.warvale.core.map.GameMap)

Aggregations

Initialization (net.warvale.core.game.start.Initialization)2 MatchInfo (net.warvale.core.game.MatchInfo)1 GameMap (net.warvale.core.map.GameMap)1