Search in sources :

Example 16 with Targeting

use of main.elements.targeting.Targeting in project Eidolons by IDemiurge.

the class Action method getTargeting.

public Targeting getTargeting() {
    Targeting targeting = active.getTargeting();
    if (targeting == null) {
        active.construct();
        targeting = active.getTargeting();
    }
    if (targeting == null) {
        try {
            // list?
            targeting = TargetingMaster.findTargeting(active, SelectiveTargeting.class);
        // preCheck
        // both?
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    }
    return targeting;
}
Also used : SelectiveTargeting(main.elements.targeting.SelectiveTargeting) FixedTargeting(main.elements.targeting.FixedTargeting) Targeting(main.elements.targeting.Targeting) AutoTargeting(main.elements.targeting.AutoTargeting) SelectiveTargeting(main.elements.targeting.SelectiveTargeting)

Example 17 with Targeting

use of main.elements.targeting.Targeting in project Eidolons by IDemiurge.

the class Targeter method canTargetAny.

public boolean canTargetAny() {
    Targeting targeting = getTargeting();
    if (!(targeting instanceof SelectiveTargeting)) {
        return true;
    }
    Map<FACING_DIRECTION, Boolean> map = getTargetingAnyCache().get(getOwnerObj().getCoordinates());
    if (map == null) {
        map = new HashMap<>();
        targetingAnyCache.put(getOwnerObj().getCoordinates(), map);
    }
    Boolean canTargetAny = map.get(getOwnerObj().getFacing());
    if (canTargetAny == null) {
        canTargetAny = !targeting.getFilter().getObjects(getRef()).isEmpty();
    }
    map.put(getOwnerObj().getFacing(), canTargetAny);
    return canTargetAny;
}
Also used : TemplateSelectiveTargeting(eidolons.ability.targeting.TemplateSelectiveTargeting) SelectiveTargeting(main.elements.targeting.SelectiveTargeting) FACING_DIRECTION(main.game.bf.Coordinates.FACING_DIRECTION) Targeting(main.elements.targeting.Targeting) MultiTargeting(main.elements.targeting.MultiTargeting) AutoTargeting(main.elements.targeting.AutoTargeting) TemplateSelectiveTargeting(eidolons.ability.targeting.TemplateSelectiveTargeting) SelectiveTargeting(main.elements.targeting.SelectiveTargeting)

Example 18 with Targeting

use of main.elements.targeting.Targeting in project Eidolons by IDemiurge.

the class Targeter method canBeTargeted.

public boolean canBeTargeted(Integer id, boolean caching) {
    Targeting targeting = getTargeting();
    Map<FACING_DIRECTION, Map<Integer, Boolean>> map = getTargetingCache().get(getOwnerObj().getCoordinates());
    if (map == null) {
        map = new HashMap<>();
        getTargetingCache().put(getOwnerObj().getCoordinates(), map);
    }
    Map<Integer, Boolean> map2 = map.get(getOwnerObj().getFacing());
    if (map2 == null) {
        map2 = new HashMap<>();
        map.put(getOwnerObj().getFacing(), map2);
    }
    // TODO for ai?
    Boolean result = map2.get(id);
    if (caching) {
        if (result != null)
            return result;
    }
    if (targeting == null) {
        // TODO ??
        if (getEntity().getActives().size() > 1) {
            return true;
        }
        if (!getEntity().getActives().isEmpty()) {
            if (getEntity().getActives().get(0).getAbilities().getAbils().size() > 1) {
                return true;
            }
        }
        return false;
    }
    Ref REF = getEntity().getRef().getCopy();
    REF.setMatch(id);
    if (targeting instanceof MultiTargeting) {
    // TODO ??
    }
    Conditions conditions = targeting.getFilter().getConditions();
    if (result != null) {
        if (result) {
            if (!conditions.preCheck(REF)) {
                return false;
            }
        }
        if (!result) {
            if (conditions.preCheck(REF)) {
                return true;
            }
        }
    }
    if (conditions.isEmpty())
        if (targeting instanceof TemplateSelectiveTargeting)
            ((TemplateSelectiveTargeting) targeting).initTargeting();
    getEntity().getRef().getSourceObj().getRef().setInfoEntity(getEntity());
    result = conditions.preCheck(REF);
    map2.put(id, result);
    return result;
}
Also used : FACING_DIRECTION(main.game.bf.Coordinates.FACING_DIRECTION) Ref(main.entity.Ref) TemplateSelectiveTargeting(eidolons.ability.targeting.TemplateSelectiveTargeting) Targeting(main.elements.targeting.Targeting) MultiTargeting(main.elements.targeting.MultiTargeting) AutoTargeting(main.elements.targeting.AutoTargeting) TemplateSelectiveTargeting(eidolons.ability.targeting.TemplateSelectiveTargeting) SelectiveTargeting(main.elements.targeting.SelectiveTargeting) MultiTargeting(main.elements.targeting.MultiTargeting) HashMap(java.util.HashMap) Map(java.util.Map) Conditions(main.elements.conditions.Conditions)

Aggregations

Targeting (main.elements.targeting.Targeting)18 FixedTargeting (main.elements.targeting.FixedTargeting)12 SelectiveTargeting (main.elements.targeting.SelectiveTargeting)9 TemplateSelectiveTargeting (eidolons.ability.targeting.TemplateSelectiveTargeting)7 Effects (main.ability.effects.Effects)6 MultiTargeting (main.elements.targeting.MultiTargeting)6 TemplateAutoTargeting (eidolons.ability.targeting.TemplateAutoTargeting)5 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)5 AutoTargeting (main.elements.targeting.AutoTargeting)5 Ref (main.entity.Ref)5 Effect (main.ability.effects.Effect)4 AddTriggerEffect (eidolons.ability.effects.attachment.AddTriggerEffect)3 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)3 ActiveAbility (main.ability.ActiveAbility)3 Conditions (main.elements.conditions.Conditions)3 ActiveObj (main.entity.obj.ActiveObj)3 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)2 WaveEffect (eidolons.ability.effects.containers.customtarget.WaveEffect)2 ZoneEffect (eidolons.ability.effects.containers.customtarget.ZoneEffect)2 DealDamageEffect (eidolons.ability.effects.oneshot.DealDamageEffect)2