Search in sources :

Example 1 with StringComparison

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);
}
Also used : Entity(main.entity.Entity) ITEM_SLOT(main.content.enums.entity.ItemEnums.ITEM_SLOT) StringComparison(main.elements.conditions.StringComparison) EnumMaster(main.system.auxiliary.EnumMaster) Unit(eidolons.entity.obj.unit.Unit)

Example 2 with StringComparison

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);
}
Also used : NotCondition(main.elements.conditions.NotCondition) StringComparison(main.elements.conditions.StringComparison) ObjType(main.entity.type.ObjType) NumericCondition(main.elements.conditions.NumericCondition)

Example 3 with StringComparison

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;
}
Also used : OrConditions(main.elements.conditions.OrConditions) StringComparison(main.elements.conditions.StringComparison) QUALITY_LEVEL(main.content.enums.entity.ItemEnums.QUALITY_LEVEL) Conditions(main.elements.conditions.Conditions) OrConditions(main.elements.conditions.OrConditions) MATERIAL(main.content.enums.entity.ItemEnums.MATERIAL)

Example 4 with StringComparison

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;
}
Also used : StringComparison(main.elements.conditions.StringComparison) OrConditions(main.elements.conditions.OrConditions) ObjType(main.entity.type.ObjType) Filter(main.elements.Filter) Conditions(main.elements.conditions.Conditions) OrConditions(main.elements.conditions.OrConditions)

Example 5 with StringComparison

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);
}
Also used : Condition(main.elements.conditions.Condition) RefCondition(main.elements.conditions.RefCondition) Formula(main.system.math.Formula) StringComparison(main.elements.conditions.StringComparison) DivinationEffect(eidolons.ability.effects.oneshot.spell.DivinationEffect) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) DivinationEffect(eidolons.ability.effects.oneshot.spell.DivinationEffect) SetCustomModeEffect(eidolons.ability.effects.continuous.SetCustomModeEffect) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) ModifyPropertyEffect(eidolons.ability.effects.common.ModifyPropertyEffect) PeriodicEffect(main.ability.effects.periodic.PeriodicEffect) RemoveBuffEffect(eidolons.ability.effects.oneshot.buff.RemoveBuffEffect) ImmobilizeEffect(eidolons.ability.effects.oneshot.status.ImmobilizeEffect) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) PARAMETER(main.content.values.parameters.PARAMETER)

Aggregations

StringComparison (main.elements.conditions.StringComparison)5 Conditions (main.elements.conditions.Conditions)2 OrConditions (main.elements.conditions.OrConditions)2 ObjType (main.entity.type.ObjType)2 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)1 ModifyPropertyEffect (eidolons.ability.effects.common.ModifyPropertyEffect)1 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)1 SetCustomModeEffect (eidolons.ability.effects.continuous.SetCustomModeEffect)1 RemoveBuffEffect (eidolons.ability.effects.oneshot.buff.RemoveBuffEffect)1 DivinationEffect (eidolons.ability.effects.oneshot.spell.DivinationEffect)1 ImmobilizeEffect (eidolons.ability.effects.oneshot.status.ImmobilizeEffect)1 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)1 Unit (eidolons.entity.obj.unit.Unit)1 PeriodicEffect (main.ability.effects.periodic.PeriodicEffect)1 ITEM_SLOT (main.content.enums.entity.ItemEnums.ITEM_SLOT)1 MATERIAL (main.content.enums.entity.ItemEnums.MATERIAL)1 QUALITY_LEVEL (main.content.enums.entity.ItemEnums.QUALITY_LEVEL)1 PARAMETER (main.content.values.parameters.PARAMETER)1 Filter (main.elements.Filter)1 Condition (main.elements.conditions.Condition)1