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;
}
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;
}
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);
}
}
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;
}
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();
}
Aggregations