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