use of eidolons.ability.conditions.req.ClassTreeCondition in project Eidolons by IDemiurge.
the class DC_RequirementsManager method generateClassRequirements.
public Requirements generateClassRequirements(Entity type, int mode) {
// multi :
if (mode == RANK_MODE) {
return generateClassRankRequirements(type);
}
Requirements requirements = new Requirements();
for (PARAMS mastery : DC_ContentManager.getMasteryParams()) {
PARAMETER req = ContentManager.getReqParam(mastery);
int param = type.getIntParam(req);
if (param <= 0) {
continue;
}
Condition c = ConditionMaster.getParamCondition(0, mastery, req);
String t = InfoMaster.getParamReasonString(type, mastery, req);
Requirement r = new Requirement(c, t);
requirements.add(r);
}
String cost = HeroManager.getCost(type, getHero());
Requirement xpReq = new Requirement(ConditionMaster.getParamCondition(0, PARAMS.XP, PARAMS.XP_COST), InfoMaster.getParamReasonString(type, PARAMS.XP, cost));
((NumericCondition) xpReq.getCondition()).setComparingValue(new Formula("" + cost));
requirements.add(xpReq);
if (ClassView.isMulticlass(type)) {
// TODO changing to simpler form with baseType?
requirements.add(getBaseTypeRequirement(type, type.getOBJ_TYPE_ENUM()));
requirements.add(new Requirement(new PropCondition(PROPS.CLASSES, type.getProperty(PROPS.BASE_CLASSES_TWO), false), InfoMaster.MULTICLASS_SECOND_CLASS + StringMaster.cropLast(type.getProperty(PROPS.BASE_CLASSES_TWO), 2, ";").replace(";", " or ")));
requirements.add(new Requirement(new MultiClassCondition(type.getName()), InfoMaster.MULTICLASS));
} else {
requirements.add(new Requirement(new ClassTreeCondition(type.getName()), InfoMaster.CLASS_TREE));
Conditions conditions = new OrConditions();
conditions.add(new EmptyStringCondition(StringMaster.getValueRef(KEYS.SOURCE, PROPS.FIRST_CLASS)));
conditions.add(new EmptyStringCondition(StringMaster.getValueRef(KEYS.SOURCE, PROPS.SECOND_CLASS)));
conditions.add(new StringComparison(type.getProperty(G_PROPS.CLASS_GROUP), StringMaster.getValueRef(KEYS.SOURCE, PROPS.FIRST_CLASS), true));
conditions.add(new StringComparison(type.getProperty(G_PROPS.CLASS_GROUP), StringMaster.getValueRef(KEYS.SOURCE, PROPS.SECOND_CLASS), true));
requirements.add(new Requirement(conditions, InfoMaster.MAX_CLASSES));
}
return requirements;
}
Aggregations