Search in sources :

Example 1 with FLAG_COLOR

use of main.system.graphics.ColorManager.FLAG_COLOR in project Eidolons by IDemiurge.

the class PlayerManager method initializePlayers.

public void initializePlayers() {
    players = new ArrayList<>();
    if (getMaster().getGame().getDataKeeper().getPlayerData() != null) {
    // TODO init data from preset
    }
    if (data == null) {
        data = generateDefaultPlayerData();
    }
    unusedPlayerColorsList = new ListMaster<FLAG_COLOR>().getList(playerColors);
    int i = 0;
    for (String substring : StringMaster.open(data)) {
        DC_Player player = initPlayerFromString(substring);
        if (player.getAllegiance() == ALLEGIENCE.NEUTRAL)
            Player.NEUTRAL = player;
        // else
        players.add(player);
        if (player.isEnemy())
            player.setAi(true);
        initUnitData(player, i);
        FLAG_COLOR color = getRandomColorFlag(player.isEnemy());
        player.setFlagColor(color);
        i++;
    }
    if (Player.NEUTRAL == null) {
        Player.NEUTRAL = new DC_Player("Neutral", FLAG_COLOR.BROWN, "", "", ALLEGIENCE.NEUTRAL);
        DC_Player.NEUTRAL = (DC_Player) Player.NEUTRAL;
        players.add(DC_Player.NEUTRAL);
    }
}
Also used : ListMaster(main.system.auxiliary.data.ListMaster) FLAG_COLOR(main.system.graphics.ColorManager.FLAG_COLOR)

Example 2 with FLAG_COLOR

use of main.system.graphics.ColorManager.FLAG_COLOR in project Eidolons by IDemiurge.

the class WorldGenerator method generateFactions.

private static void generateFactions() {
    for (String sub : StringMaster.openContainer(world.getProperty(MACRO_PROPS.FACTIONS))) {
        boolean me = world.checkProperty(MACRO_PROPS.PLAYER_FACTION, sub);
        ObjType type = DataManager.getType(sub, MACRO_OBJ_TYPES.FACTIONS);
        FLAG_COLOR color = new EnumMaster<FLAG_COLOR>().retrieveEnumConst(FLAG_COLOR.class, type.getProperty(PROPS.FLAG_COLOR));
        if (color == null)
            color = FLAG_COLOR.BROWN;
        DC_Player player = new DC_Player(sub, color, type.getProperty(G_PROPS.EMBLEM), type.getProperty(G_PROPS.IMAGE), me ? ALLEGIENCE.ALLY : ALLEGIENCE.ENEMY);
        Faction faction = new Faction(type, player);
        game.addFaction(faction);
        if (me)
            game.setPlayerFaction(faction);
    }
}
Also used : ObjType(main.entity.type.ObjType) FLAG_COLOR(main.system.graphics.ColorManager.FLAG_COLOR) DC_Player(eidolons.game.battlecraft.logic.battle.universal.DC_Player) Faction(eidolons.game.module.adventure.faction.Faction)

Example 3 with FLAG_COLOR

use of main.system.graphics.ColorManager.FLAG_COLOR in project Eidolons by IDemiurge.

the class PlayerManager method initPlayerFromString.

public DC_Player initPlayerFromString(String data) {
    PlayerData dataUnit = new PlayerData(data);
    ALLEGIENCE allegience = new EnumMaster<ALLEGIENCE>().retrieveEnumConst(ALLEGIENCE.class, dataUnit.getValue(PLAYER_VALUE.ALLEGIENCE));
    if (allegience == null) {
        allegience = ALLEGIENCE.NEUTRAL;
    }
    FLAG_COLOR color = new EnumMaster<FLAG_COLOR>().retrieveEnumConst(FLAG_COLOR.class, dataUnit.getValue(PLAYER_VALUE.COLOR));
    if (color == null) {
        color = getRandomColorFlag();
    }
    DC_Player player = new DC_Player(dataUnit.getValue(PLAYER_VALUE.NAME), color, dataUnit.getValue(PLAYER_VALUE.EMBLEM), dataUnit.getValue(PLAYER_VALUE.PORTRAIT), allegience);
    player.setMainHeroName(dataUnit.getValue(PLAYER_VALUE.MAIN_HERO));
    return player;
}
Also used : ALLEGIENCE(main.system.data.PlayerData.ALLEGIENCE) PlayerData(main.system.data.PlayerData) FLAG_COLOR(main.system.graphics.ColorManager.FLAG_COLOR)

Aggregations

FLAG_COLOR (main.system.graphics.ColorManager.FLAG_COLOR)3 DC_Player (eidolons.game.battlecraft.logic.battle.universal.DC_Player)1 Faction (eidolons.game.module.adventure.faction.Faction)1 ObjType (main.entity.type.ObjType)1 ListMaster (main.system.auxiliary.data.ListMaster)1 PlayerData (main.system.data.PlayerData)1 ALLEGIENCE (main.system.data.PlayerData.ALLEGIENCE)1