use of main.system.auxiliary.StringMaster in project Eidolons by IDemiurge.
the class AutoTestFactory method createTest.
public AutoTest createTest(ObjType type) {
List<String> list = new ArrayList<>();
list.add(TEST_ARGS.NAME + ":" + type.getName());
initArgList(list, type);
String args = new StringMaster().constructContainer(list);
AUTO_TEST_TYPE t = new EnumMaster<AUTO_TEST_TYPE>().retrieveEnumConst(AUTO_TEST_TYPE.class, type.getProperty(PROPS.AUTO_TEST_TYPE));
if (t == null) {
t = getType(type);
}
AutoTest test = new AutoTest(type, args, t, master);
return test;
}
use of main.system.auxiliary.StringMaster in project Eidolons by IDemiurge.
the class DC_ActionManager method resetActions.
@Override
public void resetActions(Entity entity) {
if (!(entity instanceof Unit)) {
return;
}
Unit unit = (Unit) entity;
DequeImpl<ActiveObj> actives;
// #1: reset prop with ids if nothing is changed
// if (ListMaster.isNotEmpty(actives) && entity.isActivesReady()) {
// entity.setProperty(ACTIVES, StringMaster
// .constructContainer(StringMaster.convertToIdList(actives)));
// return;
// }
actives = new DequeImpl<>();
// #2: reset the list if prop has been modified (via Add/Remove effects
// ++ items). They should set ActivesReady to false for that.
// or upon init
unit.setActionMap(new HashMap<>());
// if (!unit.isStandardActionsAdded())
if (!unit.isBfObj()) {
actives.addAll(getStandardActions(unit));
}
String activesProp = entity.getProperty(ACTIVES);
for (String typeName : StringMaster.open(activesProp)) {
ObjType type = DataManager.getType(typeName, DC_TYPE.ACTIONS);
DC_UnitAction action;
if (type == null) {
try {
action = (DC_UnitAction) game.getObjectById(Integer.valueOf(typeName));
} catch (Exception e) {
continue;
}
} else {
action = getOrCreateAction(typeName, entity);
}
// idList.add(action.getId() + "");
actives.add(action);
}
// list = new DequeImpl<>(items);
actives.removeIf(activeObj -> !isActionAvailable(activeObj, ExplorationMaster.isExplorationOn()));
try {
addSpecialActions(unit, actives);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
if (ExplorationMaster.isExplorationOn())
try {
actives.removeIf(activeObj -> unit.getGame().getDungeonMaster().getExplorationMaster().getActionHandler().isActivationDisabledByExploration((DC_ActiveObj) activeObj));
List<DC_ActiveObj> actions = unit.getGame().getDungeonMaster().getExplorationMaster().getActionHandler().getExplorationActions(unit);
actives.addAll(actions);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
unit.setActives(new ArrayList<>(actives));
if (!unit.isBfObj()) {
addHiddenActions(unit, unit.getActives());
}
try {
constructActionMaps(unit);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
// entity.setProperty(ACTIVES, StringMaster
// .constructContainer(StringMaster.convertToIdList(actives)));
entity.setActivesReady(true);
for (ActiveObj a : actives) {
if (activesProp.contains(a.getName())) {
activesProp += a.getName() + ";";
}
}
entity.setProperty(ACTIVES, activesProp);
}
Aggregations