Search in sources :

Example 21 with Conditions

use of main.elements.conditions.Conditions 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 22 with Conditions

use of main.elements.conditions.Conditions in project Eidolons by IDemiurge.

the class ReasonMaster method getReasonsCannotTarget.

public static List<FILTER_REASON> getReasonsCannotTarget(Action action, boolean useConditionResultCache, Boolean checkMiscOrOnly, FILTER_REASON searchedReason) {
    Ref REF = action.getRef().getCopy();
    REF.setMatch(action.getRef().getTarget());
    Targeting targeting = action.getActive().getTargeting();
    if (targeting == null) {
        targeting = TargetingMaster.findTargeting(action.getActive());
    }
    if (targeting == null) {
        return new ArrayList<>();
    }
    Conditions conditions = targeting.getFilter().getConditions();
    // conditions.preCheck(REF);
    List<FILTER_REASON> reasons = new ArrayList<>();
    for (Condition c : conditions) {
        FILTER_REASON reason = getReason(c);
        if (searchedReason != null) {
            if (reason != searchedReason) {
                continue;
            }
        }
        if (checkMiscOrOnly == null) {
            if (reason != FILTER_REASON.OTHER) {
                continue;
            }
        } else if (!checkMiscOrOnly) {
            if (reason == FILTER_REASON.OTHER) {
                continue;
            }
        }
        boolean result = c.isTrue();
        if (!useConditionResultCache) {
            result = c.preCheck(REF);
        } else {
        // LogMaster.log(0, c + " uses cached result " + result);
        }
        if (!result) {
            if (reason != null) {
                reasons.add(reason);
            }
        }
    }
    return reasons;
}
Also used : DistanceCondition(main.elements.conditions.DistanceCondition) VisibilityCondition(eidolons.ability.conditions.VisibilityCondition) FacingCondition(eidolons.ability.conditions.FacingCondition) Condition(main.elements.conditions.Condition) Ref(main.entity.Ref) Targeting(main.elements.targeting.Targeting) ArrayList(java.util.ArrayList) Conditions(main.elements.conditions.Conditions)

Example 23 with Conditions

use of main.elements.conditions.Conditions in project Eidolons by IDemiurge.

the class ArenaBattleConstructor method constructWaveSequence.

public Map<Wave, Integer> constructWaveSequence(ENCOUNTER_TYPE[] encounter_sequence) {
    Integer round = getRoundNumber();
    if (SkirmishMaster.isSkirmish()) {
        return SkirmishMaster.constructWaveSequences(round);
    }
    Map<Wave, Integer> map = new XLinkedMap<>();
    if (alt != null) {
        alt = !alt;
    } else {
        alt = checkAltEncounter();
    }
    List<ObjType> waves = getWaveTypes(getDungeon().getType(), alt);
    List<ObjType> waveBuffer = new ArrayList<>(waves);
    for (ENCOUNTER_TYPE type : encounter_sequence) {
        if (waveBuffer.isEmpty()) {
            waveBuffer = DataManager.getTypesGroup(DC_TYPE.ENCOUNTERS, StringMaster.getWellFormattedString(type.toString()));
        }
        waves = new ArrayList<>(waveBuffer);
        Conditions conditions = new Conditions(getEncounterTypeCondition(type));
        List<ObjType> filteredWaves = new Filter<ObjType>(game, conditions).filter(waves);
        if (!filteredWaves.isEmpty()) {
            waves = filteredWaves;
        } else {
            continue;
        }
        ObjType waveType = getWaveType(waves, type);
        waveType = new ObjType(waveType);
        FACING_DIRECTION side = null;
        // getMaster().getDungeonMaster().getPositioner().nextSide();
        waveType.setProperty(PROPS.SPAWNING_SIDE, side.getName());
        Coordinates c = pickSpawnCoordinateForWave(type, round, waveType);
        Wave wave = new Wave(c, waveType, game, new Ref(game), game.getPlayer(false));
        wave.initUnitMap();
        map.put(wave, round);
        if (Eidolons.DEV_MODE) {
            game.getLogManager().logInfo(wave.toString() + " on round #" + round);
        }
        LogMaster.log(1, wave.toString() + " on round #" + round);
        // TODO subtract from
        round += getRoundsToFight(waveType, type);
    // total pool
    }
    setIndex(getIndex() + 1);
    return map;
}
Also used : XLinkedMap(main.data.XLinkedMap) ENCOUNTER_TYPE(main.content.enums.EncounterEnums.ENCOUNTER_TYPE) Coordinates(main.game.bf.Coordinates) ArrayList(java.util.ArrayList) Conditions(main.elements.conditions.Conditions) FACING_DIRECTION(main.game.bf.Coordinates.FACING_DIRECTION) Ref(main.entity.Ref) ObjType(main.entity.type.ObjType)

Example 24 with Conditions

use of main.elements.conditions.Conditions in project Eidolons by IDemiurge.

the class BindingDamageEffect method applyThis.

@Override
public boolean applyThis() {
    // Can be initialized() just once
    GroupImpl group = ref.getGroup();
    Effects effects = new Effects();
    STANDARD_EVENT_TYPE event_type;
    if (shareOrRedirect) {
        // TODO splitMode!
        event_type = STANDARD_EVENT_TYPE.UNIT_IS_DEALT_TOUGHNESS_DAMAGE;
        if (spellDmgOnly != null) {
            if (spellDmgOnly) {
                event_type = STANDARD_EVENT_TYPE.UNIT_HAS_BEEN_DEALT_SPELL_DAMAGE;
            }
        }
        if (physicalDmgOnly != null) {
            if (physicalDmgOnly) {
                event_type = STANDARD_EVENT_TYPE.UNIT_HAS_BEEN_DEALT_PHYSICAL_DAMAGE;
            }
        }
    } else {
        effects.add(new AlteringEffect(false, formula.getNegative().toString()));
        event_type = Event.STANDARD_EVENT_TYPE.UNIT_IS_BEING_DEALT_DAMAGE;
        if (spellDmgOnly != null) {
            if (spellDmgOnly) {
                event_type = STANDARD_EVENT_TYPE.UNIT_IS_BEING_DEALT_SPELL_DAMAGE;
            }
        }
        if (physicalDmgOnly != null) {
            if (physicalDmgOnly) {
                event_type = STANDARD_EVENT_TYPE.UNIT_IS_BEING_DEALT_PHYSICAL_DAMAGE;
            }
        }
    }
    Targeting targeting_other_units = new AutoTargeting(new Conditions(new GroupCondition(Ref.KEYS.MATCH.name(), group), // negative
    new RefCondition(KEYS.EVENT_TARGET, KEYS.MATCH, true)));
    effects.add(new CustomTargetEffect(targeting_other_units, new DealDamageEffect(getDamageFormula(), GenericEnums.DAMAGE_TYPE.PURE)));
    /*
         * ensure there is no deadlock
		 */
    conditions = new Conditions();
    conditions.add(new NonTriggeredEventCondition());
    KEYS OBJ_REF = Ref.KEYS.EVENT_TARGET;
    conditions.add(new GroupCondition(OBJ_REF, group));
    // has the group...
    Ref REF = Ref.getCopy(ref);
    // REF.setTarget(null); // ???
    new AddTriggerEffect(event_type, conditions, OBJ_REF, effects).apply(REF);
    return true;
}
Also used : AutoTargeting(main.elements.targeting.AutoTargeting) Targeting(main.elements.targeting.Targeting) AutoTargeting(main.elements.targeting.AutoTargeting) NonTriggeredEventCondition(main.elements.conditions.standard.NonTriggeredEventCondition) STANDARD_EVENT_TYPE(main.game.logic.event.Event.STANDARD_EVENT_TYPE) RefCondition(main.elements.conditions.RefCondition) CustomTargetEffect(main.ability.effects.continuous.CustomTargetEffect) DealDamageEffect(eidolons.ability.effects.oneshot.DealDamageEffect) Effects(main.ability.effects.Effects) Conditions(main.elements.conditions.Conditions) AddTriggerEffect(eidolons.ability.effects.attachment.AddTriggerEffect) Ref(main.entity.Ref) GroupImpl(main.entity.group.GroupImpl) KEYS(main.entity.Ref.KEYS) AlteringEffect(eidolons.ability.effects.oneshot.misc.AlteringEffect) GroupCondition(main.elements.conditions.standard.GroupCondition)

Example 25 with Conditions

use of main.elements.conditions.Conditions in project Eidolons by IDemiurge.

the class FilterMaster method newFilter.

public static void newFilter() {
    Conditions conditions = new Conditions();
    OBJ_TYPE TYPE = ArcaneVault.getSelectedOBJ_TYPE();
    CONDITION_TEMPLATES[] templates = CONDITION_TEMPLATES.values();
    while (true) {
        // CHOOSE TYPE? OR USE SELECTED TAB!
        int i = DialogMaster.optionChoice(templates, "choose filter template");
        if (i == -1) {
            break;
        }
        CONDITION_TEMPLATES template = CONDITION_TEMPLATES.values()[i];
        String value = DialogMaster.inputText("Enter filter's value name");
        if (StringMaster.isEmpty(value)) {
            break;
        }
        VALUE val = ContentManager.findValue(value);
        value = DialogMaster.inputText("Enter filtering value");
        if (StringMaster.isEmpty(value)) {
            break;
        }
        conditions.add(new ConditionMaster().getConditionFromTemplate(template, StringMaster.getValueRef(KEYS.MATCH, val), value));
    }
    if (conditions.isEmpty()) {
        return;
    }
    if (TYPE == null) {
    }
    // Document node = XML_Converter.getDoc(XML_Converter.openXml("conditions")
    // + XML_Converter.closeXml("conditions"));
    // String conditionString = XML_Converter.getStringFromXML(node);
    TypeFilter filter = new TypeFilter(conditions, TYPE);
    // save!
    filters.add(filter);
    ArcaneVault.getMainBuilder().getTabBuilder().addFilter(filter);
}
Also used : OBJ_TYPE(main.content.OBJ_TYPE) VALUE(main.content.VALUE) CONDITION_TEMPLATES(main.system.entity.ConditionMaster.CONDITION_TEMPLATES) ConditionMaster(main.system.entity.ConditionMaster) Conditions(main.elements.conditions.Conditions)

Aggregations

Conditions (main.elements.conditions.Conditions)43 Ref (main.entity.Ref)12 Condition (main.elements.conditions.Condition)7 SelectiveTargeting (main.elements.targeting.SelectiveTargeting)6 Obj (main.entity.obj.Obj)6 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)5 ArrayList (java.util.ArrayList)5 NumericCondition (main.elements.conditions.NumericCondition)5 AutoTargeting (main.elements.targeting.AutoTargeting)5 Unit (eidolons.entity.obj.unit.Unit)4 ObjType (main.entity.type.ObjType)4 Coordinates (main.game.bf.Coordinates)4 FacingCondition (eidolons.ability.conditions.FacingCondition)3 AddTriggerEffect (eidolons.ability.effects.attachment.AddTriggerEffect)3 TemplateSelectiveTargeting (eidolons.ability.targeting.TemplateSelectiveTargeting)3 Effects (main.ability.effects.Effects)3 OrConditions (main.elements.conditions.OrConditions)3 RefCondition (main.elements.conditions.RefCondition)3 Targeting (main.elements.targeting.Targeting)3 GroupImpl (main.entity.group.GroupImpl)3