Search in sources :

Example 1 with GroupCondition

use of main.elements.conditions.standard.GroupCondition in project Eidolons by IDemiurge.

the class AlertRule method getWakeUpConditions.

public static Condition getWakeUpConditions() {
    // TODO will be checked with a ref from UNIT_ACTION_COMPLETE event!
    Conditions conditions = new OrConditions();
    // adjacent enemy condition - the problem is that it will then be
    // impossible to be *alert* if there are enemies adjacent already... or
    // is it a good design?
    // action was targeting *source* - directly or as one of the targets -
    // the problem is that it won't work for allies which could be exploited
    // largely
    // all in all, Alert Mode is probably not for *complicated situations*,
    // it's for the simple ones when you just wait for the fight
    // patiently...
    // new PropCondition(prop, str2)
    conditions.add(new Conditions(new NotCondition(new OwnershipCondition(KEYS.SOURCE, KEYS.EVENT_SOURCE)), new OrConditions(new RefCondition(KEYS.EVENT_TARGET, KEYS.SOURCE), new GroupCondition(KEYS.SOURCE.toString(), true))));
    conditions.add(new ListSizeCondition(true, new Conditions(ConditionMaster.getAliveAndConsciousFilterCondition(), ConditionMaster.getEnemyCondition(), ConditionMaster.getAdjacentCondition()), "1"));
    return conditions;
}
Also used : ListSizeCondition(main.elements.conditions.standard.ListSizeCondition) OwnershipCondition(main.elements.conditions.standard.OwnershipCondition) GroupCondition(main.elements.conditions.standard.GroupCondition)

Example 2 with GroupCondition

use of main.elements.conditions.standard.GroupCondition 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)

Aggregations

GroupCondition (main.elements.conditions.standard.GroupCondition)2 AddTriggerEffect (eidolons.ability.effects.attachment.AddTriggerEffect)1 DealDamageEffect (eidolons.ability.effects.oneshot.DealDamageEffect)1 AlteringEffect (eidolons.ability.effects.oneshot.misc.AlteringEffect)1 Effects (main.ability.effects.Effects)1 CustomTargetEffect (main.ability.effects.continuous.CustomTargetEffect)1 Conditions (main.elements.conditions.Conditions)1 RefCondition (main.elements.conditions.RefCondition)1 ListSizeCondition (main.elements.conditions.standard.ListSizeCondition)1 NonTriggeredEventCondition (main.elements.conditions.standard.NonTriggeredEventCondition)1 OwnershipCondition (main.elements.conditions.standard.OwnershipCondition)1 AutoTargeting (main.elements.targeting.AutoTargeting)1 Targeting (main.elements.targeting.Targeting)1 Ref (main.entity.Ref)1 KEYS (main.entity.Ref.KEYS)1 GroupImpl (main.entity.group.GroupImpl)1 STANDARD_EVENT_TYPE (main.game.logic.event.Event.STANDARD_EVENT_TYPE)1