Search in sources :

Example 1 with PassiveAbilityObj

use of main.ability.PassiveAbilityObj in project Eidolons by IDemiurge.

the class UpkeepRule method addUpkeep.

public static void addUpkeep(Obj payObj) {
    Obj spell = payObj.getRef().getObj(KEYS.ACTIVE);
    if (spell == null) {
        return;
    }
    Obj abil = payObj.getRef().getObj(KEYS.ABILITY);
    if (abil != null) {
        if (abil instanceof PassiveAbilityObj) {
            return;
        }
    }
    String property = spell.getProperty(PROPS.UPKEEP_FAIL_ACTION);
    if (new EnumMaster<UPKEEP_FAIL_ACTION>().retrieveEnumConst(UPKEEP_FAIL_ACTION.class, property) == null) {
        property = UPKEEP_FAIL_ACTION.DEATH + "";
    }
    payObj.setProperty(PROPS.UPKEEP_FAIL_ACTION, property);
    for (PARAMETER p : ValuePages.UPKEEP_PARAMETERS) {
        Integer param = spell.getIntParam(p);
        if (param > 0) {
            payObj.getType().setParam(p, param);
        }
    }
}
Also used : UPKEEP_FAIL_ACTION(main.ability.effects.Effect.UPKEEP_FAIL_ACTION) EnumMaster(main.system.auxiliary.EnumMaster) BuffObj(main.entity.obj.BuffObj) Obj(main.entity.obj.Obj) PassiveAbilityObj(main.ability.PassiveAbilityObj) PassiveAbilityObj(main.ability.PassiveAbilityObj) PARAMETER(main.content.values.parameters.PARAMETER)

Example 2 with PassiveAbilityObj

use of main.ability.PassiveAbilityObj in project Eidolons by IDemiurge.

the class EffectImpl method apply.

@Override
public boolean apply(Ref ref) {
    setRef(ref);
    // for logging
    boolean active = getLayer() != BUFF_RULE && ref.getObj(KEYS.ACTIVE) != null && (!(ref.getObj(KEYS.ABILITY) instanceof PassiveAbilityObj));
    if ((ref.getGroup() == null && targetGroup == null) || isIgnoreGroupTargeting()) {
        // single-target effect
        return apply();
    } else {
        // multi-target effect, applies to each target
        GroupImpl group = ref.getGroup();
        if (group == null) {
            group = targetGroup;
        } else if (targetGroup == null) {
            // group.setIgnoreGroupTargeting(true);// TODO later instead?
            targetGroup = group;
        }
        if (group.isIgnoreGroupTargeting()) {
            return apply();
        }
        List<Integer> groupIds = group.getObjectIds();
        boolean result = true;
        for (Integer id : groupIds) {
            if (isInterrupted()) {
                break;
            }
            Ref REF = this.ref.getCopy();
            // REF.setGroup(new GroupImpl(targetGroup));
            REF.getGroup().setIgnoreGroupTargeting(true);
            REF.setTarget(id);
            if (construct != null) {
                result &= getCopy().apply(REF);
            } else {
                // this.ref.setTarget(id);
                setIgnoreGroupTargeting(true);
                result &= apply(REF);
                setIgnoreGroupTargeting(false);
            }
        }
        // game.getManager().refreshAll();
        return result;
    }
}
Also used : Ref(main.entity.Ref) PassiveAbilityObj(main.ability.PassiveAbilityObj) GroupImpl(main.entity.group.GroupImpl)

Aggregations

PassiveAbilityObj (main.ability.PassiveAbilityObj)2 UPKEEP_FAIL_ACTION (main.ability.effects.Effect.UPKEEP_FAIL_ACTION)1 PARAMETER (main.content.values.parameters.PARAMETER)1 Ref (main.entity.Ref)1 GroupImpl (main.entity.group.GroupImpl)1 BuffObj (main.entity.obj.BuffObj)1 Obj (main.entity.obj.Obj)1 EnumMaster (main.system.auxiliary.EnumMaster)1