Class ExecutingEntityTargetTargetingStrategy

java.lang.Object
de.gurkenlabs.litiengine.abilities.targeting.TargetingStrategy
de.gurkenlabs.litiengine.abilities.targeting.ExecutingEntityTargetTargetingStrategy

public class ExecutingEntityTargetTargetingStrategy extends TargetingStrategy

A targeting strategy that resolves to the current target of the executing entity.

This strategy ignores the impact area and instead delegates to the executor's own target reference. It is useful for abilities that should be applied to whatever entity the caster is currently focused on (for example, a tab-targeted spell).

Note: if the executor has no current target, the returned collection will contain a single null element. Callers should be prepared to handle this case.

See Also:
  • Constructor Details

    • ExecutingEntityTargetTargetingStrategy

      public ExecutingEntityTargetTargetingStrategy()

      Creates a new ExecutingEntityTargetTargetingStrategy.

      The strategy is configured as single-target and unsorted, since the resulting collection always contains at most one entity (the executor's current target).

  • Method Details

    • findTargetsInternal

      public Collection<ICombatEntity> findTargetsInternal(Shape impactArea, ICombatEntity executor)
      Returns the executor's current target as the sole target, regardless of the given impact area.
      Specified by:
      findTargetsInternal in class TargetingStrategy
      Parameters:
      impactArea - the shape representing the ability's area of effect; ignored by this strategy.
      executor - the combat entity executing the ability; its current target is returned.
      Returns:
      an immutable collection containing exactly the executor's current target. The element may be null if the executor has no target set.