use of main.system.auxiliary.EnumMaster in project Eidolons by IDemiurge.
the class UpkeepRule method addUpkeep.
public static void addUpkeep(Obj payObj) {
Obj spell = payObj.getRef().getObj(KEYS.ACTIVE);
if (spell == null) {
return;
}
Obj abil = payObj.getRef().getObj(KEYS.ABILITY);
if (abil != null) {
if (abil instanceof PassiveAbilityObj) {
return;
}
}
String property = spell.getProperty(PROPS.UPKEEP_FAIL_ACTION);
if (new EnumMaster<UPKEEP_FAIL_ACTION>().retrieveEnumConst(UPKEEP_FAIL_ACTION.class, property) == null) {
property = UPKEEP_FAIL_ACTION.DEATH + "";
}
payObj.setProperty(PROPS.UPKEEP_FAIL_ACTION, property);
for (PARAMETER p : ValuePages.UPKEEP_PARAMETERS) {
Integer param = spell.getIntParam(p);
if (param > 0) {
payObj.getType().setParam(p, param);
}
}
}
use of main.system.auxiliary.EnumMaster in project Eidolons by IDemiurge.
the class LocationBuilder method constructBlock.
@Refactor
public static // TODO the way it's done, we can't have Structures in non-Location dungeons!!!
MapBlock constructBlock(Node node, int id, MapZone zone, DungeonPlan map, Dungeon dungeon) {
List<Coordinates> coordinates = new ArrayList<>();
Map<Coordinates, ? extends Obj> objectMap = new HashMap<>();
MapBlock b = new MapBlock(id, null, zone, map, coordinates);
// TODO b-data, coordinates, objects
for (Node subNode : XML_Converter.getNodeList(node)) {
if (StringMaster.compareByChar(subNode.getNodeName(), COORDINATES_NODE)) {
coordinates = CoordinatesMaster.getCoordinatesFromString(subNode.getTextContent());
} else if (StringMaster.compareByChar(subNode.getNodeName(), OBJ_NODE)) {
// TODO BETTER IN TYPES?
objectMap = DC_ObjInitializer.initMapBlockObjects(dungeon, b, subNode.getTextContent());
// TODO encounters?
} else {
// BLOCK TYPE
if (StringMaster.compareByChar(subNode.getNodeName(), BLOCK_TYPE_NODE)) {
BLOCK_TYPE type = new EnumMaster<BLOCK_TYPE>().retrieveEnumConst(BLOCK_TYPE.class, subNode.getTextContent());
b.setType(type);
}
if (StringMaster.compareByChar(subNode.getNodeName(), ROOM_TYPE_NODE)) {
ROOM_TYPE type = new EnumMaster<ROOM_TYPE>().retrieveEnumConst(ROOM_TYPE.class, subNode.getTextContent());
b.setRoomType(type);
}
}
}
b.setCoordinates(coordinates);
if (objectMap == null) {
return b;
}
b.getMap().putAll(objectMap);
b.getObjects().addAll(objectMap.values());
return b;
}
use of main.system.auxiliary.EnumMaster in project Eidolons by IDemiurge.
the class ArenaPositioner method getCoordinatesForUnitGroup.
public List<ObjAtCoordinate> getCoordinatesForUnitGroup(List<ObjType> presetGroupTypes, Wave wave, int unitLevel) {
Map<Coordinates, ObjType> map = new LinkedHashMap<>();
boolean custom = false;
Coordinates presetCenterCoordinate = wave.getCoordinates();
if (wave.isPresetCoordinate()) {
if (presetCenterCoordinate != null) {
custom = isAutoOptimalFacing();
}
}
if (wave.getBlock() != null) {
// TODO return
// getCoordinatesForUnitGroupInMapBlock(presetGroupTypes, wave,
// wave.getBlock());
}
if (forcedSide != null) {
side = forcedSide;
// forcedSide = null;
} else {
side = new EnumMaster<FACING_DIRECTION>().retrieveEnumConst(FACING_DIRECTION.class, wave.getProperty(PROPS.SPAWNING_SIDE));
if (side == null) {
nextSide();
}
}
unitGroups.put(side, map);
int maxUnitsPerRow = getMaxUnitsPerRow(side);
List<Coordinates> list = getCoordinatesForUnits(presetGroupTypes, custom, presetCenterCoordinate, maxUnitsPerRow);
List<ObjAtCoordinate> group = new ArrayList<>();
int i = 0;
for (Coordinates c : list) {
ObjType type = new ObjType(presetGroupTypes.get(i));
type.getGame().initType(type);
i++;
if (unitLevel > 0) {
type = new UnitLevelManager().getLeveledType(type, unitLevel, false);
}
ObjAtCoordinate objAtCoordinate = new ObjAtCoordinate(type, c);
group.add(objAtCoordinate);
}
return group;
}
use of main.system.auxiliary.EnumMaster in project Eidolons by IDemiurge.
the class ItemGenerator method generateItemType.
@Override
public ObjType generateItemType(String typeName, OBJ_TYPE type) {
if (type == (DC_TYPE.JEWELRY)) {
if (ItemGenerator.isJewelryOn())
return generateJewelry(typeName);
return null;
}
if (type == (DC_TYPE.ITEMS)) {
// return getOrCreateItem(typeName);
}
// TODO generic C_TYPE for armor?
boolean weapon = type.equals(DC_TYPE.WEAPONS);
// String baseTypeName = typeName;
String name = StringMaster.getFirstItem(typeName, " ");
QUALITY_LEVEL quality = new EnumMaster<QUALITY_LEVEL>().retrieveEnumConst(QUALITY_LEVEL.class, name);
if (quality != null)
typeName = typeName.replace(quality.toString(), "").trim();
else
quality = QUALITY_LEVEL.NORMAL;
name = StringMaster.getFirstItem(typeName, " ");
MATERIAL material = new EnumMaster<MATERIAL>().retrieveEnumConst(MATERIAL.class, name, true, false);
if (material == null) {
name = name + StringMaster.getFirstItem(typeName.replace(name, "").trim(), " ");
material = new EnumMaster<MATERIAL>().retrieveEnumConst(MATERIAL.class, name);
}
if (material == null) {
return null;
}
typeName = typeName.replace(material.toString(), "").trim();
ObjType baseType = DataManager.getType(typeName, type, true);
if (baseType == null)
return null;
return generateItem(weapon, quality, material, baseType);
}
use of main.system.auxiliary.EnumMaster in project Eidolons by IDemiurge.
the class ItemGenerator method generateJewelry.
public ObjType generateJewelry(String typeName) {
String string = StringMaster.getFirstItem(typeName, " ");
MAGICAL_ITEM_LEVEL itemLevel = new EnumMaster<MAGICAL_ITEM_LEVEL>().retrieveEnumConst(MAGICAL_ITEM_LEVEL.class, string);
typeName = typeName.replaceFirst(string + " ", "");
ObjType objType = null;
for (ObjType type : baseJewelryTypes) {
if (typeName.contains(type.getName())) {
objType = type;
typeName = typeName.replaceFirst(type.getName(), "");
break;
}
}
JEWELRY_ITEM_TRAIT trait = new EnumMaster<JEWELRY_ITEM_TRAIT>().retrieveEnumConst(JEWELRY_ITEM_TRAIT.class, typeName);
if (trait == null) {
typeName = VariableManager.removeVarPart(typeName).replaceFirst("of", "").trim();
trait = new EnumMaster<JEWELRY_ITEM_TRAIT>().retrieveEnumConst(JEWELRY_ITEM_TRAIT.class, typeName);
}
return generateJewelryItem(objType, trait, itemLevel);
}
Aggregations