Search in sources :

Example 86 with ObjType

use of main.entity.type.ObjType in project Eidolons by IDemiurge.

the class UnitGroupMaster method createGroupLeader.

public static ObjType createGroupLeader(boolean me, Entity faction, int unitGroupLevel) {
    // type =
    List<ObjType> list = DataManager.getTypesSubGroup(DC_TYPE.CHARS, StringMaster.PRESET);
    String backgrounds = faction.getProperty(PROPS.HERO_BACKGROUNDS);
    FilterMaster.filterOut(list, new NotCondition(new StringComparison(backgrounds, StringMaster.getValueRef(KEYS.MATCH, G_PROPS.BACKGROUND), false)));
    FilterMaster.filterOut(list, new NotCondition(new NumericCondition("2", "abs(" + StringMaster.getValueRef(KEYS.MATCH, PARAMS.LEVEL) + "-" + unitGroupLevel + ")", false)));
    String name = ListChooser.chooseType(DataManager.toStringList(list), DC_TYPE.CHARS);
    if (name == null) {
        return null;
    }
    if (me) {
        myHero = name;
    } else {
        enemyHero = name;
    }
    return DataManager.getType(name, DC_TYPE.CHARS);
}
Also used : NotCondition(main.elements.conditions.NotCondition) StringComparison(main.elements.conditions.StringComparison) ObjType(main.entity.type.ObjType) NumericCondition(main.elements.conditions.NumericCondition)

Example 87 with ObjType

use of main.entity.type.ObjType in project Eidolons by IDemiurge.

the class UnitGroupMaster method modifyFactions.

public static void modifyFactions() {
    for (FACTION f : FACTION.values()) {
        DEITY deity = f.getDeity();
        ObjType faction = DataManager.getType(f.toString(), MACRO_OBJ_TYPES.FACTIONS);
        if (faction == null) {
            continue;
        }
        if (deity != null) {
            ObjType deityType = DataManager.getType(deity.name(), DC_TYPE.DEITIES);
            for (ObjType unit : DataManager.getTypes(DC_TYPE.UNITS)) {
                if (unit.getProperty(G_PROPS.DEITY).equals(deityType.getName())) {
                    faction.addProperty(PROPS.UNIT_POOL, unit.getName(), true);
                }
            }
        }
    // List<String> list =
    // StringMaster.openContainer(faction.getProperty(PROPS.UNIT_POOL));
    // SortMaster.sortByValue(list, PARAMS.POWER, OBJ_TYPES.FACTIONS,
    // false);
    }
}
Also used : DEITY(main.content.CONTENT_CONSTS.DEITY) ObjType(main.entity.type.ObjType) FACTION(main.content.CONTENT_CONSTS2.FACTION)

Example 88 with ObjType

use of main.entity.type.ObjType in project Eidolons by IDemiurge.

the class UnitGroupMaster method chooseGroup.

public static String chooseGroup(boolean me) {
    if (factionMode) {
        List<ObjType> available = new ArrayList<>(DataManager.getTypes(MACRO_OBJ_TYPES.FACTIONS));
        // DC_HeroObj
        FilterMaster.filterByProp(available, G_PROPS.WORKSPACE_GROUP.getName(), "" + MetaEnums.WORKSPACE_GROUP.COMPLETE);
        ObjType faction = ListChooser.chooseType_(available, MACRO_OBJ_TYPES.FACTIONS);
        if (factionLeaderRequired) {
            hero = UnitGroupMaster.createGroupLeader(me, faction, powerLevel);
            if (hero == null) {
                return null;
            }
        }
        return chooseGroup(faction, powerLevel);
    }
    File groupFile = ListChooser.chooseFile(PathFinder.getUnitGroupPath());
    if (groupFile != null) {
        return groupFile.getPath();
    }
    return null;
}
Also used : ObjType(main.entity.type.ObjType) ArrayList(java.util.ArrayList) File(java.io.File)

Example 89 with ObjType

use of main.entity.type.ObjType in project Eidolons by IDemiurge.

the class UnitGroupMaster method chooseUnit.

private static ObjType chooseUnit(ObjType factionType, int power, int max_power) {
    Map<ObjType, Integer> pool = initPool(factionType);
    List<ObjType> available = new ArrayList<>();
    for (ObjType l : pool.keySet()) {
        if (getUnitCost(l, factionType) > power) {
            continue;
        }
        if (l.getIntParam(PARAMS.POWER) > max_power) {
            continue;
        }
        available.add(l);
    }
    if (available.isEmpty()) {
        return null;
    }
    // chooseUnit();
    Map<String, String> map = new HashMap<>();
    for (ObjType type : pool.keySet()) {
        map.put(type.getName(), "Cost: " + pool.get(type) + "; Power: " + type.getIntParam(PARAMS.POWER));
    }
    ListChooser.setDecorator(new Decorator() {

        @Override
        public void addComponents(G_Panel panel) {
            G_ListPanel<ObjType> list = // new CustomList<>(getUnitList());
            new G_ListPanel<ObjType>(getUnitList()) {

                @Override
                public void setInts() {
                    wrap = 1;
                    minItems = max;
                    rowsVisible = 1;
                    layoutOrientation = JList.HORIZONTAL_WRAP;
                }

                @Override
                public boolean isVertical() {
                    return false;
                }
            };
            list.setPanelSize(new Dimension(300, 120));
            panel.add(list, "pos tp.x decor_info.y2");
            WrappedTextComp textComp = new WrappedTextComp(null) {

                @Override
                protected Color getColor() {
                    return Color.black;
                }

                @Override
                public synchronized List<String> getTextLines() {
                    List<String> list = new ArrayList<>();
                    list.add(UnitGroupMaster.getRemainingPower() + " points remaining");
                    list.add("Size contraints: between " + min + " and " + max);
                    return list;
                }
            };
            textComp.setDefaultSize(new Dimension(300, 120));
            panel.add(textComp, "id decor_info, pos tp.x tp.y2");
        }
    });
    ListChooser.setTooltipMapForComponent(map);
    ListChooser.setSortingDisabled(true);
    return ListChooser.chooseType_(available, DC_TYPE.UNITS);
// gui - a list per ally
}
Also used : G_ListPanel(main.swing.generic.components.panels.G_ListPanel) HashMap(java.util.HashMap) G_Panel(main.swing.generic.components.G_Panel) ArrayList(java.util.ArrayList) Decorator(main.swing.generic.Decorator) ObjType(main.entity.type.ObjType) WrappedTextComp(eidolons.swing.components.panels.page.log.WrappedTextComp) List(java.util.List) ArrayList(java.util.ArrayList)

Example 90 with ObjType

use of main.entity.type.ObjType in project Eidolons by IDemiurge.

the class UnitGroupMaster method addUnits.

private static void addUnits(ObjType factionType, Map<ObjType, Integer> map, ObjType allyFactionType) {
    for (String unit : StringMaster.open(allyFactionType.getProperty(PROPS.UNIT_POOL))) {
        ObjType type = DataManager.getType(unit, DC_TYPE.UNITS);
        map.put(type, getUnitCost(type, factionType));
    }
}
Also used : ObjType(main.entity.type.ObjType)

Aggregations

ObjType (main.entity.type.ObjType)354 ArrayList (java.util.ArrayList)42 Coordinates (main.game.bf.Coordinates)30 Ref (main.entity.Ref)25 Unit (eidolons.entity.obj.unit.Unit)24 OBJ_TYPE (main.content.OBJ_TYPE)18 PROPERTY (main.content.values.properties.PROPERTY)18 DC_TYPE (main.content.DC_TYPE)16 PARAMETER (main.content.values.parameters.PARAMETER)16 File (java.io.File)15 Entity (main.entity.Entity)12 XLinkedMap (main.data.XLinkedMap)11 EnumMaster (main.system.auxiliary.EnumMaster)11 DC_SpellObj (eidolons.entity.active.DC_SpellObj)9 MATERIAL (main.content.enums.entity.ItemEnums.MATERIAL)9 Obj (main.entity.obj.Obj)9 QUALITY_LEVEL (main.content.enums.entity.ItemEnums.QUALITY_LEVEL)8 MusicList (main.music.entity.MusicList)8 Wave (eidolons.game.battlecraft.logic.battle.arena.Wave)6 C_OBJ_TYPE (main.content.C_OBJ_TYPE)6