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;
}
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;
}
Aggregations