Search in sources :

Example 1 with Targeter

use of eidolons.entity.handlers.active.Targeter in project Eidolons by IDemiurge.

the class ActionExecutor method createTargeter.

@Override
protected Targeter createTargeter(DC_ActiveObj active, ActiveMaster entityMaster) {
    return new Targeter(active, entityMaster) {

        @Override
        public Targeting getTargeting() {
            initTargetingMode();
            if (AI_Manager.isRunning()) {
                return super.getTargeting();
            }
            if (getAction().isAttackGeneric()) {
                Conditions conditions = new OrConditions();
                int maxRange = 0;
                for (DC_ActiveObj attack : getAction().getSubActions()) {
                    if (attack.isThrow()) {
                        continue;
                    }
                    if (!attack.canBeActivated()) {
                        continue;
                    }
                    conditions.add(attack.getTargeting().getFilter().getConditions());
                    if (maxRange < attack.getRange()) {
                        maxRange = attack.getRange();
                    }
                }
                conditions.setFastFailOnCheck(true);
                conditions = ConditionMaster.getFilteredConditions(conditions, DistanceCondition.class);
                conditions.add(new DistanceCondition("" + maxRange));
                SelectiveTargeting selectiveTargeting = new SelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.ATTACK, conditions);
                return selectiveTargeting;
            }
            return super.getTargeting();
        }
    };
}
Also used : SelectiveTargeting(main.elements.targeting.SelectiveTargeting) OrConditions(main.elements.conditions.OrConditions) DistanceCondition(main.elements.conditions.DistanceCondition) Targeter(eidolons.entity.handlers.active.Targeter) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Conditions(main.elements.conditions.Conditions) OrConditions(main.elements.conditions.OrConditions)

Aggregations

DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)1 Targeter (eidolons.entity.handlers.active.Targeter)1 Conditions (main.elements.conditions.Conditions)1 DistanceCondition (main.elements.conditions.DistanceCondition)1 OrConditions (main.elements.conditions.OrConditions)1 SelectiveTargeting (main.elements.targeting.SelectiveTargeting)1