Search in sources :

Example 26 with EnumMaster

use of main.system.auxiliary.EnumMaster in project Eidolons by IDemiurge.

the class UnitShop method chooseMaterialType.

public static MATERIAL chooseMaterialType(int costLimit, Unit unit, ObjType baseType, boolean canExceed) {
    if (baseType == null)
        return null;
    if (baseType.getOBJ_TYPE_ENUM() == DC_TYPE.JEWELRY)
        return null;
    if (baseType.getOBJ_TYPE_ENUM() == DC_TYPE.ITEMS)
        return null;
    QUALITY_LEVEL qualityLevel = QUALITY_LEVEL.DAMAGED;
    String property = unit.getProperty(PROPS.ALLOWED_MATERIAL);
    List<MATERIAL> list = property.isEmpty() ? getMaterialsForUnit(unit, baseType, costLimit, canExceed) : new EnumMaster<MATERIAL>().getEnumList(MATERIAL.class, property);
    list.removeIf(material -> !ItemMaster.checkMaterial(baseType, material));
    Collections.shuffle(list);
    List<MATERIAL> materials = new ArrayList<>();
    for (MATERIAL sub : list) {
        // map .get(sub).get(baseType);
        ObjType type = DataManager.getItem(qualityLevel, sub, baseType);
        if (type.getIntParam(PARAMS.GOLD_COST) <= costLimit)
            return sub;
        else if (canExceed)
            materials.add(sub);
    }
    if (!canExceed)
        return null;
    SortMaster.sortByExpression(materials, (type) -> -((MATERIAL) type).getCost());
    return materials.get(0);
}
Also used : EnumMaster(main.system.auxiliary.EnumMaster) ObjType(main.entity.type.ObjType) QUALITY_LEVEL(main.content.enums.entity.ItemEnums.QUALITY_LEVEL) ArrayList(java.util.ArrayList) MATERIAL(main.content.enums.entity.ItemEnums.MATERIAL)

Example 27 with EnumMaster

use of main.system.auxiliary.EnumMaster in project Eidolons by IDemiurge.

the class UnitInitializer method initMode.

public void initMode() {
    String name = getProperty(G_PROPS.MODE);
    MODE mode = (new EnumMaster<STD_MODES>().retrieveEnumConst(STD_MODES.class, name));
    if (mode == null) {
        BEHAVIOR_MODE behavior = new EnumMaster<BEHAVIOR_MODE>().retrieveEnumConst(BEHAVIOR_MODE.class, name);
        if (behavior != null) {
            mode = new ModeImpl(behavior);
        }
    }
    if (mode == null) {
        mode = (STD_MODES.NORMAL);
    }
    getEntity().setMode(mode);
    LogMaster.log(LogMaster.CORE_DEBUG, getName() + " has mode: " + mode);
}
Also used : EnumMaster(main.system.auxiliary.EnumMaster) BEHAVIOR_MODE(main.content.enums.system.AiEnums.BEHAVIOR_MODE) MODE(main.content.mode.MODE) ModeImpl(main.content.mode.ModeImpl) STD_MODES(main.content.mode.STD_MODES) BEHAVIOR_MODE(main.content.enums.system.AiEnums.BEHAVIOR_MODE)

Example 28 with EnumMaster

use of main.system.auxiliary.EnumMaster in project Eidolons by IDemiurge.

the class ShadeLightCell method initTeamColor.

public Color initTeamColor() {
    // for each coordinate?
    // default per dungeon
    // Eidolons.getGame().getMaster().getObjCache()
    // IlluminationRule.
    COLOR_THEME colorTheme = null;
    if (type == SHADE_LIGHT.LIGHT_EMITTER) {
        for (Structure sub : Eidolons.game.getStructures()) {
            if (sub.isLightEmitter()) {
                // if (sub.getCoordinates().equals(new Coordinates(x,y)))
                colorTheme = new EnumMaster<COLOR_THEME>().retrieveEnumConst(COLOR_THEME.class, sub.getProperty(PROPS.COLOR_THEME, true));
                if (colorTheme != null)
                    break;
            }
        }
    }
    if (colorTheme == null) {
        Dungeon obj = Eidolons.game.getDungeon();
        colorTheme = obj.getColorTheme();
    }
    Color c = null;
    if (colorTheme != null)
        c = GdxColorMaster.getColorForTheme(colorTheme);
    if (c != null)
        return c;
    return DEFAULT_COLOR;
}
Also used : COLOR_THEME(main.content.CONTENT_CONSTS.COLOR_THEME) EnumMaster(main.system.auxiliary.EnumMaster) Dungeon(eidolons.game.battlecraft.logic.dungeon.universal.Dungeon) Color(com.badlogic.gdx.graphics.Color) Structure(eidolons.entity.obj.Structure)

Aggregations

EnumMaster (main.system.auxiliary.EnumMaster)28 ObjType (main.entity.type.ObjType)10 Unit (eidolons.entity.obj.unit.Unit)4 LINK_VARIANT (eidolons.client.cc.gui.neo.tree.logic.TreeMap.LINK_VARIANT)3 ArrayList (java.util.ArrayList)3 PROPERTY (main.content.values.properties.PROPERTY)3 ListChooser (main.swing.generic.components.editors.lists.ListChooser)3 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)2 RULE_SCOPE (eidolons.game.battlecraft.rules.RuleMaster.RULE_SCOPE)2 GAMEPLAY_OPTION (eidolons.system.options.GameplayOptions.GAMEPLAY_OPTION)2 MATERIAL (main.content.enums.entity.ItemEnums.MATERIAL)2 QUALITY_LEVEL (main.content.enums.entity.ItemEnums.QUALITY_LEVEL)2 Coordinates (main.game.bf.Coordinates)2 Color (com.badlogic.gdx.graphics.Color)1 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)1 Align (com.badlogic.gdx.utils.Align)1 DC_Effect (eidolons.ability.effects.DC_Effect)1 ModifyPropertyEffect (eidolons.ability.effects.common.ModifyPropertyEffect)1 AbilityEffect (eidolons.ability.effects.containers.AbilityEffect)1 RayEffect (eidolons.ability.effects.containers.customtarget.RayEffect)1