Search in sources :

Example 11 with SelectiveTargeting

use of main.elements.targeting.SelectiveTargeting 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)

Aggregations

SelectiveTargeting (main.elements.targeting.SelectiveTargeting)11 Unit (eidolons.entity.obj.unit.Unit)5 Conditions (main.elements.conditions.Conditions)5 Ref (main.entity.Ref)5 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)4 Targeting (main.elements.targeting.Targeting)4 DC_SpellObj (eidolons.entity.active.DC_SpellObj)3 DC_HeroItemObj (eidolons.entity.item.DC_HeroItemObj)3 DC_Obj (eidolons.entity.obj.DC_Obj)3 ActiveObj (main.entity.obj.ActiveObj)3 Obj (main.entity.obj.Obj)3 TemplateSelectiveTargeting (eidolons.ability.targeting.TemplateSelectiveTargeting)2 DC_QuickItemObj (eidolons.entity.item.DC_QuickItemObj)2 DistanceCondition (main.elements.conditions.DistanceCondition)2 FixedTargeting (main.elements.targeting.FixedTargeting)2 MultiTargeting (main.elements.targeting.MultiTargeting)2 ObjType (main.entity.type.ObjType)2 Coordinates (main.game.bf.Coordinates)2 Formula (main.system.math.Formula)2 FacingCondition (eidolons.ability.conditions.FacingCondition)1