use of main.elements.conditions.StringComparison in project Eidolons by IDemiurge.
the class ItemCondition method check.
@Override
public boolean check(Ref ref) {
if (ref.getGame().isSimulation()) {
return true;
}
if (slot == null) {
slot = (weapon) ? ItemEnums.ITEM_SLOT.MAIN_HAND.toString() : ItemEnums.ITEM_SLOT.ARMOR.toString();
}
Entity item;
Unit unit = (Unit) ref.getObj(obj_ref);
if (unit == null) {
return false;
}
if (slot.equalsIgnoreCase(KEYS.RANGED.toString())) {
item = unit.getRef().getObj(KEYS.RANGED);
} else {
if (slot.equalsIgnoreCase("weapon"))
item = unit.getItem(!ref.getActive().isOffhand() ? ITEM_SLOT.MAIN_HAND : ITEM_SLOT.OFF_HAND);
else
item = unit.getItem(new EnumMaster<ITEM_SLOT>().retrieveEnumConst(ITEM_SLOT.class, slot, true));
}
if (item == null) {
return false;
}
if (// any item in the slot
prop == null) {
return true;
}
String string = item.getProp(prop);
return new StringComparison(string, val, strict).preCheck(ref);
// String prop2 = ref.getObj(obj_string).getProp(slot);
// if (StringMaster.isEmpty(prop2)) {
// try {
// prop2 = "" + ref.getObj(obj_string).getRef().getObj(slot).getId();
// } catch (Exception e) {
// return false;
// }
// }
// item = DataManager.getType(prop2, C_OBJ_TYPE.ITEMS);
// return StringMaster.compare(string, val, true);
}
use of main.elements.conditions.StringComparison in project Eidolons by IDemiurge.
the class UnitGroupMaster method createGroupLeader.
public static ObjType createGroupLeader(boolean me, Entity faction, int unitGroupLevel) {
// type =
List<ObjType> list = DataManager.getTypesSubGroup(DC_TYPE.CHARS, StringMaster.PRESET);
String backgrounds = faction.getProperty(PROPS.HERO_BACKGROUNDS);
FilterMaster.filterOut(list, new NotCondition(new StringComparison(backgrounds, StringMaster.getValueRef(KEYS.MATCH, G_PROPS.BACKGROUND), false)));
FilterMaster.filterOut(list, new NotCondition(new NumericCondition("2", "abs(" + StringMaster.getValueRef(KEYS.MATCH, PARAMS.LEVEL) + "-" + unitGroupLevel + ")", false)));
String name = ListChooser.chooseType(DataManager.toStringList(list), DC_TYPE.CHARS);
if (name == null) {
return null;
}
if (me) {
myHero = name;
} else {
enemyHero = name;
}
return DataManager.getType(name, DC_TYPE.CHARS);
}
use of main.elements.conditions.StringComparison in project Eidolons by IDemiurge.
the class ArcadeManager method generateMaterialQualityForRegion.
public Condition generateMaterialQualityForRegion(ARCADE_REGION region) {
Conditions c = new Conditions();
MATERIAL[] materials = new MATERIAL[0];
QUALITY_LEVEL[] qualities = new QUALITY_LEVEL[0];
// TODO and what about jewelry?
switch(region) {
case DUSK_DALE:
break;
case GREYLEAF_WOODS:
break;
case WRAITH_MARSHES:
break;
case MISTY_SHORES:
break;
case BLIGHTSTONE_DESERT:
qualities = new QUALITY_LEVEL[] { ItemEnums.QUALITY_LEVEL.ANCIENT, ItemEnums.QUALITY_LEVEL.OLD, ItemEnums.QUALITY_LEVEL.MASTERPIECE };
materials = new MATERIAL[] { ItemEnums.MATERIAL.ADAMANTIUM };
break;
}
OrConditions mC = new OrConditions();
OrConditions qC = new OrConditions();
for (MATERIAL m : materials) {
mC.add(new StringComparison(StringMaster.getValueRef(KEYS.MATCH, G_PROPS.MATERIAL), m.getName(), true));
}
for (QUALITY_LEVEL q : qualities) {
mC.add(new StringComparison(StringMaster.getValueRef(KEYS.MATCH, G_PROPS.QUALITY_LEVEL), q.getName(), true));
}
c.add(mC);
c.add(qC);
return c;
}
use of main.elements.conditions.StringComparison in project Eidolons by IDemiurge.
the class ClassView method getAdditionalTypesData.
@Override
protected List<ObjType> getAdditionalTypesData() {
String group = vendorPanel.getSelectedTabName();
List<ObjType> list = getAdditionalTypesMap().get(group);
if (list != null) {
return list;
}
String types = StringMaster.joinStringList(DataManager.getTypeNamesGroup(getTYPE(), group), ";");
Filter<ObjType> filter = new Filter<>(hero.getRef(), new Conditions(new StringComparison("{Match_}" + G_PROPS.CLASS_GROUP, MULTICLASS, true), new OrConditions(new Conditions(// ,
new StringComparison(group, "{Match_}" + G_PROPS.BASE_TYPE, false)), new StringComparison("{Match_}" + PROPS.BASE_CLASSES_ONE, types, false), new StringComparison("{Match_}" + PROPS.BASE_CLASSES_TWO, types, false))), DC_TYPE.CLASSES);
list = new ArrayList<>(filter.getTypes());
getAdditionalTypesMap().put(vendorPanel.getSelectedTabName(), list);
return list;
}
use of main.elements.conditions.StringComparison in project Eidolons by IDemiurge.
the class ModeEffect method addEndTurnEffect.
private void addEndTurnEffect() {
Condition condition = new StringComparison(prop, mode.toString(), true);
if (mode == STD_MODES.DIVINATION) {
Effect effect = new DivinationEffect();
addBuffEffect.addEffect(new DelayedEffect(effect, condition));
return;
}
String formula = mode.getFormula();
if (ref.getActive() instanceof DC_ActiveObj) {
DC_ActiveObj activeObj = (DC_ActiveObj) ref.getActive();
if (activeObj.getParam(PARAMS.FORMULA).contains(StringMaster.MOD)) {
formula = StringMaster.wrapInParenthesis(formula) + "*" + activeObj.getParam(PARAMS.FORMULA) + "/100";
} else if (activeObj.getIntParam(PARAMS.FORMULA) != 0) {
formula += "+" + activeObj.getIntParam(PARAMS.FORMULA);
}
}
ModifyValueEffect effect = new ModifyValueEffect(mode.getParameter(), MOD.MODIFY_BY_CONST, new Formula("min(0, " + formula + ")"));
PARAMETER param = ContentManager.getPARAM(mode.getParameter());
effect.setParam(param);
effect.setMaxParam(ContentManager.getBaseParameterFromCurrent(param));
Formula appendedByModifier = new Formula(formula).getAppendedByModifier(timeModifier);
effect.setFormula(appendedByModifier);
addBuffEffect.addEffect(new DelayedEffect(effect, condition));
// new DelayedEffect(effect, condition).apply(ref);
}
Aggregations