Search in sources :

Example 31 with Conditions

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

the class FilterMaster method getPlayerControlledUnits.

public static Set<Obj> getPlayerControlledUnits(Player player) {
    Conditions c = new Conditions();
    Ref ref;
    if (player == Player.NEUTRAL) {
        c.add(new OwnershipCondition("MATCH", true));
        c.add(ConditionMaster.getBFObjTypesCondition());
        ref = new Ref(player.getGame());
    } else {
        c.add(new OwnershipCondition("MATCH", "SOURCE"));
        c.add(ConditionMaster.getBFObjTypesCondition());
        ref = player.getHeroObj().getRef();
    }
    // spells too?
    Filter<Obj> filter = new Filter<>(ref, c);
    Set<Obj> set = filter.getObjects();
    return set;
}
Also used : Ref(main.entity.Ref) OwnershipCondition(main.elements.conditions.standard.OwnershipCondition) Filter(main.elements.Filter) Obj(main.entity.obj.Obj) Conditions(main.elements.conditions.Conditions)

Example 32 with Conditions

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

the class ObjectiveMaster method initObjectiveTrigger.

public static void initObjectiveTrigger(OBJECTIVE_TYPE type, String data, Location mission) {
    Dungeon dungeon = mission.getBossLevel();
    objectiveData = data;
    STANDARD_EVENT_TYPE eventType = null;
    Conditions conditions = new Conditions();
    Abilities abilities = new Abilities();
    abilities.add(new ActiveAbility(new FixedTargeting(), new EndGameEffect(true)));
    Ref ref = new Ref();
    Integer id = null;
    String name;
    switch(type) {
        case BOSS:
            eventType = STANDARD_EVENT_TYPE.UNIT_HAS_BEEN_KILLED;
            Coordinates c = DC_ObjInitializer.getCoordinatesFromObjString(objectiveData);
            // new Coordinates(s);
            name = DC_ObjInitializer.getNameFromObjString(objectiveData);
            // conditions.add(new ObjComparison(KEY, KEYS.TARGET.toString()));
            break;
        case CAPTURE_HOLD:
            // "As long as
            break;
        case SURVIVE_TIME:
            break;
        case ESCAPE:
            // eventType = STANDARD_EVENT_TYPE.UNIT_GONE_THRU_ENTRANCE;
            break;
        case ITEM:
            break;
    }
    // some objectives will be initialized on a condition, e.g. capture-hold
    addTrigger(eventType, conditions, abilities);
}
Also used : ActiveAbility(main.ability.ActiveAbility) Ref(main.entity.Ref) Abilities(main.ability.Abilities) FixedTargeting(main.elements.targeting.FixedTargeting) Dungeon(eidolons.game.battlecraft.logic.dungeon.universal.Dungeon) STANDARD_EVENT_TYPE(main.game.logic.event.Event.STANDARD_EVENT_TYPE) EndGameEffect(eidolons.ability.effects.special.meta.EndGameEffect) Coordinates(main.game.bf.Coordinates) Conditions(main.elements.conditions.Conditions)

Example 33 with Conditions

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

the class ObjectiveMaster method addTrigger.

private static void addTrigger(EVENT_TEMPLATE ET, String eventData, SCRIPT_CONDITION_TEMPLATE CT, String conditionData, ACTION_TEMPLATE AT, String actionData) {
    STANDARD_EVENT_TYPE eventType = null;
    Conditions conditions = null;
    Abilities abilities = null;
    addTrigger(eventType, conditions, abilities);
}
Also used : Abilities(main.ability.Abilities) STANDARD_EVENT_TYPE(main.game.logic.event.Event.STANDARD_EVENT_TYPE) Conditions(main.elements.conditions.Conditions)

Example 34 with Conditions

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

the class ActivesConstructor method addTargetingMods.

public static void addTargetingMods(Targeting targeting, DC_ActiveObj obj) {
    Conditions c = new Conditions();
    String property = obj.getProperty(PROPS.TARGETING_MODIFIERS);
    if (obj.getActionGroup() == ActionEnums.ACTION_TYPE_GROUPS.MOVE) {
        // SPELL_TAGS.TELEPORT
        if (!obj.checkProperty(G_PROPS.ACTION_TAGS, ActionEnums.ACTION_TAGS.FLYING.toString())) {
            if (!obj.checkProperty(PROPS.TARGETING_MODIFIERS, AbilityEnums.TARGETING_MODIFIERS.CLEAR_SHOT.toString())) {
                property += AbilityEnums.TARGETING_MODIFIERS.CLEAR_SHOT.toString();
            }
            if (!obj.checkProperty(PROPS.TARGETING_MODIFIERS, AbilityEnums.TARGETING_MODIFIERS.SPACE.toString())) {
                property += AbilityEnums.TARGETING_MODIFIERS.SPACE.toString();
            }
        }
    }
    if (StringMaster.isEmpty(property)) {
        return;
    }
    for (String mod : StringMaster.open(property)) {
        Condition targetingModConditions;
        TARGETING_MODIFIERS MOD = new EnumMaster<TARGETING_MODIFIERS>().retrieveEnumConst(TARGETING_MODIFIERS.class, mod);
        if (MOD == null) {
            targetingModConditions = ConditionMaster.toConditions(mod);
        } else {
            targetingModConditions = DC_ConditionMaster.getTargetingModConditions(MOD);
        }
        if (targetingModConditions != null) {
            if (!c.contains(targetingModConditions)) // if (ConditionMaster.contains(c,
            // targetingModConditions.getClass())) //you sure?
            {
                c.add(targetingModConditions);
            }
        }
    }
    if (targeting instanceof TemplateSelectiveTargeting) {
        TemplateSelectiveTargeting tst = (TemplateSelectiveTargeting) targeting;
        if (tst.getTemplate() == SELECTIVE_TARGETING_TEMPLATES.GRAVE_CELL) {
            // TODO
            if (tst.getConditions() != null) {
                try {
                    ((GraveCondition) tst.getConditions().get(0)).getConditions().add(c);
                } catch (Exception e) {
                    main.system.auxiliary.log.LogMaster.log(1, tst.getConditions().get(0) + " in " + obj);
                    main.system.ExceptionMaster.printStackTrace(e);
                }
            }
        }
    }
    if (!c.isEmpty()) {
        targeting.getFilter().addCondition(c);
    }
    targeting.setModsAdded(true);
}
Also used : Condition(main.elements.conditions.Condition) GraveCondition(eidolons.ability.conditions.special.GraveCondition) TARGETING_MODIFIERS(main.content.enums.entity.AbilityEnums.TARGETING_MODIFIERS) TemplateSelectiveTargeting(eidolons.ability.targeting.TemplateSelectiveTargeting) Conditions(main.elements.conditions.Conditions)

Example 35 with Conditions

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

the class TrampleRule method initConditions.

@Override
public void initConditions() {
    conditions = new Conditions(// make sure the *source* is correct ref!
    new StdPassiveCondition(UnitEnums.STANDARD_PASSIVES.TRAMPLE, KEYS.EVENT_SOURCE), new AttackCondition(false), new NumericCondition("{source_total_weight}+{Strength}*2", "{event_target_bludgeoning_resistance}/100*{event_target_total_weight}*2+{event_target_Strength}*6"), // reflex roll?
    new RollCondition(GenericEnums.ROLL_TYPES.REFLEX));
    conditions.setFastFailOnCheck(true);
}
Also used : AttackCondition(eidolons.ability.conditions.special.AttackCondition) StdPassiveCondition(eidolons.ability.conditions.shortcut.StdPassiveCondition) NumericCondition(main.elements.conditions.NumericCondition) Conditions(main.elements.conditions.Conditions) RollCondition(eidolons.ability.conditions.special.RollCondition)

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