Class OtherEntityTargetingStrategy
java.lang.Object
de.gurkenlabs.litiengine.abilities.targeting.TargetingStrategy
de.gurkenlabs.litiengine.abilities.targeting.OtherEntityTargetingStrategy
- Direct Known Subclasses:
EnemyTargetingStrategy, FriendlyTargetingStrategy
A targeting strategy that selects other combat entities within the ability's impact area, filtered by their relationship to the executor and their alive/dead state.
This strategy queries the current environment for combat entities intersecting the given impact area and filters them according to three configurable criteria:
- friendly – whether to select allied entities or hostile ones,
- includeExecutor – whether the executing entity itself may be returned,
- includeDead – whether dead entities may be returned.
It serves as the common base for FriendlyTargetingStrategy and
EnemyTargetingStrategy.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionOtherEntityTargetingStrategy(boolean multiTarget, boolean sortByDistance, boolean friendly) Creates a newOtherEntityTargetingStrategythat excludes both the executor and dead entities.OtherEntityTargetingStrategy(boolean multiTarget, boolean sortByDistance, boolean friendly, boolean includeExecutor, boolean includeDead) Creates a newOtherEntityTargetingStrategywith full control over inclusion rules. -
Method Summary
Modifier and TypeMethodDescriptionprotected Collection<ICombatEntity> findTargetsInternal(Shape impactArea, ICombatEntity executor) Finds all combat entities in the current environment that intersect the given impact area and satisfy this strategy's friendly/executor/dead filters.Methods inherited from class TargetingStrategy
custom, enemies, executingEntity, findTargets, fixed, friendly, friendlyDead, isMultiTarget, none, prioritizeByDistance, setCustomTargetPriorityComparator, setMultiTarget, setPrioritizeByDistance, withCondition
-
Constructor Details
-
OtherEntityTargetingStrategy
public OtherEntityTargetingStrategy(boolean multiTarget, boolean sortByDistance, boolean friendly) Creates a newOtherEntityTargetingStrategythat excludes both the executor and dead entities.- Parameters:
multiTarget- iftrue, the strategy may return multiple matching targets; otherwise only a single target is selected.sortByDistance- iftrue, the resulting targets are ordered by their distance to the executing entity (closest first).friendly- iftrue, only friendly entities are targeted; otherwise only hostile entities are targeted.
-
OtherEntityTargetingStrategy
public OtherEntityTargetingStrategy(boolean multiTarget, boolean sortByDistance, boolean friendly, boolean includeExecutor, boolean includeDead) Creates a newOtherEntityTargetingStrategywith full control over inclusion rules.- Parameters:
multiTarget- iftrue, the strategy may return multiple matching targets; otherwise only a single target is selected.sortByDistance- iftrue, the resulting targets are ordered by their distance to the executing entity (closest first).friendly- iftrue, only friendly entities are targeted; otherwise only hostile entities are targeted.includeExecutor- iftrue, the executing entity itself may be included in the result; otherwise it is filtered out.includeDead- iftrue, dead entities are considered valid targets; otherwise only living entities are selected.
-
-
Method Details
-
findTargetsInternal
Finds all combat entities in the current environment that intersect the given impact area and satisfy this strategy's friendly/executor/dead filters.- Specified by:
findTargetsInternalin classTargetingStrategy- Parameters:
impactArea- the shape representing the ability's area of effect; only entities intersecting this area are considered.executor- the combat entity executing the ability; used as the reference for friend/foe classification and (optionally) excluded from the result.- Returns:
- a collection of combat entities matching all configured filter criteria. May be empty if no entity qualifies.
-