use of eidolons.entity.obj.attach.DC_FeatObj in project Eidolons by IDemiurge.
the class Unit method saveRanks.
public void saveRanks(DequeImpl<DC_FeatObj> container, PROPERTY property) {
String value = "";
for (DC_FeatObj featObj : container) {
value += featObj.getName();
if (featObj.getIntParam(PARAMS.RANK) > 0) {
value += StringMaster.wrapInParenthesis(featObj.getParam(PARAMS.RANK));
}
value += ";";
}
setProperty(property, value, true);
}
use of eidolons.entity.obj.attach.DC_FeatObj in project Eidolons by IDemiurge.
the class UnitInitializer method initFeatContainer.
// TODO reqs: save() ; modify() ; resetSkillRanks() for (s s : skills)
public void initFeatContainer(PROPERTY PROP, DC_TYPE TYPE, DequeImpl<DC_FeatObj> list) {
// TODO make it dynamic and clean!
List<String> feats = StringMaster.openContainer(getProperty(PROP));
for (String feat : feats) {
DC_FeatObj featObj = null;
int rank = 0;
// or special separator!
if (StringMaster.isInteger(StringMaster.cropParenthesises(VariableManager.getVarPart(feat)))) {
rank = StringMaster.getInteger(StringMaster.cropParenthesises(VariableManager.getVarPart(feat)));
feat = VariableManager.removeVarPart(feat);
}
ObjType featType = DataManager.getType(feat, TYPE);
if (game.isSimulation()) {
featObj = (DC_FeatObj) getGame().getSimulationObj(getEntity(), featType, PROP);
}
if (featObj == null) {
try {
featObj = new DC_FeatObj(featType, getEntity().getOriginalOwner(), getGame(), getRef());
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
continue;
}
if (game.isSimulation()) {
getGame().addSimulationObj(getEntity(), featType, featObj, PROP);
}
}
if (rank != 0) {
featObj.setParam(PARAMS.RANK, rank);
}
list.add(featObj);
}
}
use of eidolons.entity.obj.attach.DC_FeatObj in project Eidolons by IDemiurge.
the class UnitResetter method resetRanks.
public void resetRanks(DequeImpl<DC_FeatObj> container, PROPERTY property) {
List<DC_FeatObj> list = new ArrayList<>(container);
for (String feat : StringMaster.open(getProperty(property))) {
Integer rank = StringMaster.getInteger(VariableManager.getVarPart(feat));
if (rank == 0) {
continue;
}
feat = (VariableManager.removeVarPart(feat));
for (DC_FeatObj featObj : container) {
if (!featObj.getName().equals(feat)) {
continue;
}
featObj.setParam(PARAMS.RANK, rank);
list.remove(featObj);
}
}
for (DC_FeatObj featObj : list) {
featObj.setParam(PARAMS.RANK, 0);
}
}
use of eidolons.entity.obj.attach.DC_FeatObj in project Eidolons by IDemiurge.
the class ClassTreeCondition method check.
@Override
public boolean check(Ref ref) {
ObjType type = DataManager.getType(className, DC_TYPE.CLASSES);
if (type == null) {
return true;
}
Unit hero = (Unit) ref.getSourceObj();
for (DC_FeatObj c : hero.getClasses()) {
if (c.getType().equals(type)) {
return true;
}
if (c.getProperty(G_PROPS.CLASS_GROUP).equalsIgnoreCase(type.getProperty(G_PROPS.CLASS_GROUP))) {
if (c.getIntParam(PARAMS.CIRCLE) >= type.getIntParam(PARAMS.CIRCLE)) {
return false;
}
}
}
return true;
}
use of eidolons.entity.obj.attach.DC_FeatObj in project Eidolons by IDemiurge.
the class DC_ActionManager method checkSetFeatRef.
private void checkSetFeatRef(DC_UnitAction action) {
DequeImpl<DC_FeatObj> skills = new DequeImpl<>(action.getOwnerObj().getSkills());
skills.addAll(action.getOwnerObj().getClasses());
for (DC_FeatObj s : skills) {
if (StringMaster.contains(s.getProperty(G_PROPS.ACTIVES), action.getName())) {
action.getRef().setID(KEYS.SKILL, s.getId());
return;
}
}
}
Aggregations