Search in sources :

Example 16 with Entity

use of main.entity.Entity in project Eidolons by IDemiurge.

the class ListMaster method toStringList.

public static List<String> toStringList(boolean wellFormatted, Boolean preferEntityNameOrIfNameKnown, Object... values) {
    List<String> list = new ArrayList<>();
    for (Object v : values) {
        if (v != null) {
            String string;
            if (v instanceof Entity && preferEntityNameOrIfNameKnown != null) {
                Entity entity = (Entity) v;
                string = preferEntityNameOrIfNameKnown ? entity.getName() : entity.getNameIfKnown();
            } else {
                if (v instanceof Object[]) {
                    Object[] objects = (Object[]) v;
                    string = StringMaster.constructContainer(toStringList(objects));
                } else {
                    string = v.toString();
                }
            }
            if (wellFormatted) {
                string = StringMaster.getWellFormattedString(string);
            }
            list.add(string);
        }
    }
    return list;
}
Also used : Entity(main.entity.Entity)

Example 17 with Entity

use of main.entity.Entity in project Eidolons by IDemiurge.

the class LootMaster method generateLoot.

private static List<Entity> generateLoot(int lootValue, Dungeon dungeon) {
    int min = 0;
    // dungeon.getIntParam(PARAMS.MIN_ITEMS_LOOT);
    if (min <= 0) {
        min = DEFAULT_ITEM_MINIMUM;
    }
    int max = min * 3 / 2;
    List<Entity> loot = new ArrayList<>();
    Loop.startLoop(max);
    int total = 0;
    while (!Loop.loopEnded()) {
        if (total >= lootValue) {
            break;
        }
        LOOT_GROUP group = getLootGroup(dungeon);
        int value = lootValue / min;
        ObjType type = generateLootItem(value, group);
        loot.add(type);
        total += getItemValue(type);
    }
    return loot;
}
Also used : Entity(main.entity.Entity) ObjType(main.entity.type.ObjType) LOOT_GROUP(main.content.enums.rules.ArcadeEnums.LOOT_GROUP) ArrayList(java.util.ArrayList)

Example 18 with Entity

use of main.entity.Entity in project Eidolons by IDemiurge.

the class ResourceMaster method writeAndUpdateImage.

public static void writeAndUpdateImage(ObjType type, boolean update, PROPERTY imgProp, Map<String, ObjType> map) {
    String oldPath = type.getProperty(imgProp);
    if (oldPath.contains(StringMaster.FORMULA_REF_OPEN_CHAR))
        // variable value!
        return;
    String path = getNewImagePath(imgProp, type);
    path = checkDuplicate(path, map);
    Entity cached = map.get(oldPath);
    if (cached != null) {
        if (useFirstEntityIfOverlap)
            path = getNewImagePath(imgProp, cached);
    // else  ???
    } else {
        try {
            writeImage(oldPath, path);
            map.put(oldPath, type);
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
            return;
        }
    }
    if (update) {
        type.setProperty(imgProp, path);
    }
}
Also used : Entity(main.entity.Entity) IOException(java.io.IOException)

Example 19 with Entity

use of main.entity.Entity in project Eidolons by IDemiurge.

the class ParamAnalyzer method getMaxParamUnit.

public static Entity getMaxParamUnit(PARAMS p, List<Entity> ArrayList) {
    Entity unit = null;
    int max = Integer.MIN_VALUE;
    for (Entity e : ArrayList) {
        if (e.getIntParam(p) > max) {
            max = e.getIntParam(p);
            unit = e;
        }
    }
    return unit;
}
Also used : Entity(main.entity.Entity)

Example 20 with Entity

use of main.entity.Entity in project Eidolons by IDemiurge.

the class ListChooser method chooseObj.

public static String chooseObj(List list, SELECTION_MODE MODE) {
    OBJ_TYPE T = ((Entity) list.get(0)).getOBJ_TYPE_ENUM();
    sortingDisabled = true;
    return new ListChooser(MODE, ListMaster.toNameList(list), T).getString();
}
Also used : Entity(main.entity.Entity) OBJ_TYPE(main.content.OBJ_TYPE)

Aggregations

Entity (main.entity.Entity)41 ObjType (main.entity.type.ObjType)11 Unit (eidolons.entity.obj.unit.Unit)7 PARAMETER (main.content.values.parameters.PARAMETER)5 Obj (main.entity.obj.Obj)5 OBJ_TYPE (main.content.OBJ_TYPE)4 Ref (main.entity.Ref)4 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)3 DC_PagedInfoPanel (eidolons.swing.components.panels.page.info.DC_PagedInfoPanel)3 ArrayList (java.util.ArrayList)3 DC_TYPE (main.content.DC_TYPE)3 ITEM_SLOT (main.content.enums.entity.ItemEnums.ITEM_SLOT)3 DC_SpellObj (eidolons.entity.active.DC_SpellObj)2 DC_WeaponObj (eidolons.entity.item.DC_WeaponObj)2 LinkedList (java.util.LinkedList)2 ActiveObj (main.entity.obj.ActiveObj)2 ArcaneEntity (main.logic.ArcaneEntity)2 AtlasRegion (com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion)1 Vector2 (com.badlogic.gdx.math.Vector2)1 ActionGenerator (eidolons.ability.ActionGenerator)1