Search in sources :

Example 1 with MultiTargeting

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

the class ActivesConstructor method getTargeting.

public static Targeting getTargeting(TARGETING_MODE mode, DC_ActiveObj obj) {
    Targeting targeting = null;
    switch(mode) {
        case BF_OBJ:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.BF_OBJ);
            break;
        case CORPSE:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.GRAVE_CELL);
            break;
        case BOLT_ANY:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.SHOT);
            break;
        case BOLT_UNITS:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.SHOT, ConditionMaster.getBFObjTypesCondition());
            break;
        case SELF:
            targeting = getSelfTargeting(obj);
            break;
        case SINGLE:
            targeting = getSingleTargeting(obj);
            break;
        case RAY:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.RAY);
            break;
        case CELL:
            // bolt-targeting?
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.CELL);
            break;
        case BLAST:
            // bolt-targeting?
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.BLAST);
            break;
        case DOUBLE:
            targeting = new MultiTargeting(getSingleTargeting(obj), getSingleTargeting(obj));
            ((MultiTargeting) targeting).setIgnoreGroupTargeting(false);
            break;
        case MULTI:
        case TRIPPLE:
            break;
        case ALL_UNITS:
            targeting = new TemplateAutoTargeting(AUTO_TARGETING_TEMPLATES.ALL_UNITS);
            break;
        case ANY_UNIT:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.ANY_UNIT);
            break;
        case ANY_ENEMY:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.ANY_ENEMY);
            break;
        case ANY_ALLY:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.ANY_ALLY);
            break;
        case ALL_ALLIES:
            targeting = new TemplateAutoTargeting(AUTO_TARGETING_TEMPLATES.ALL_ALLIES);
            break;
        case ALL_ENEMIES:
            targeting = new TemplateAutoTargeting(AUTO_TARGETING_TEMPLATES.ALL_ENEMIES);
            break;
        case ALL:
            targeting = new TemplateAutoTargeting(AUTO_TARGETING_TEMPLATES.ALL);
            break;
        case NOVA:
            targeting = new FixedTargeting(KEYS.SOURCE);
            break;
        case WAVE:
            targeting = new FixedTargeting(KEYS.SOURCE);
            break;
        case SPRAY:
            targeting = new FixedTargeting(KEYS.SOURCE);
            break;
        case TRAP:
            break;
        case ANY_ARMOR:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.ANY_ARMOR);
            break;
        case ANY_ITEM:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.ANY_ITEM);
            break;
        case ANY_WEAPON:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.ANY_WEAPON);
            break;
        case ENEMY_ARMOR:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.ENEMY_ARMOR);
            break;
        case ENEMY_ITEM:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.ENEMY_ITEM);
            break;
        case ENEMY_WEAPON:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.ENEMY_WEAPON);
            break;
        case MY_ARMOR:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.MY_ARMOR);
            break;
        case MY_ITEM:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.MY_ITEM);
            break;
        case MY_WEAPON:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.MY_WEAPON);
            break;
        default:
            break;
    }
    if (targeting == null) {
        targeting = getSingleTargeting(obj);
    }
    if (targeting != null) {
        if (!targeting.isModsAdded()) {
            addTargetingMods(targeting, obj);
        }
    }
    return targeting;
}
Also used : TemplateSelectiveTargeting(eidolons.ability.targeting.TemplateSelectiveTargeting) FixedTargeting(main.elements.targeting.FixedTargeting) TemplateAutoTargeting(eidolons.ability.targeting.TemplateAutoTargeting) TemplateSelectiveTargeting(eidolons.ability.targeting.TemplateSelectiveTargeting) Targeting(main.elements.targeting.Targeting) MultiTargeting(main.elements.targeting.MultiTargeting) SelectiveTargeting(main.elements.targeting.SelectiveTargeting) FixedTargeting(main.elements.targeting.FixedTargeting) MultiTargeting(main.elements.targeting.MultiTargeting) TemplateAutoTargeting(eidolons.ability.targeting.TemplateAutoTargeting)

Example 2 with MultiTargeting

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

TemplateSelectiveTargeting (eidolons.ability.targeting.TemplateSelectiveTargeting)2 MultiTargeting (main.elements.targeting.MultiTargeting)2 SelectiveTargeting (main.elements.targeting.SelectiveTargeting)2 Targeting (main.elements.targeting.Targeting)2 TemplateAutoTargeting (eidolons.ability.targeting.TemplateAutoTargeting)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Conditions (main.elements.conditions.Conditions)1 AutoTargeting (main.elements.targeting.AutoTargeting)1 FixedTargeting (main.elements.targeting.FixedTargeting)1 Ref (main.entity.Ref)1 FACING_DIRECTION (main.game.bf.Coordinates.FACING_DIRECTION)1