Class TargetLogic
java.lang.Object
net.demilich.metastone.game.logic.TargetLogic
- All Implemented Interfaces:
Serializable
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindEntity
(GameContext context, EntityReference targetKey) Find an entity in the game context using targeting rules.getEntities
(GameContext context, Player player, TargetSelection targetRequirement, boolean omitPermanents) getValidTargets
(GameContext context, Player player, GameAction action) resolveTargetKey
(GameContext context, Player player, Entity source, EntityReference targetKey) Resolves anEntityReference
from the point of view of the specified player, context and entity.withoutPermanents
(List<E> in)
-
Constructor Details
-
TargetLogic
public TargetLogic()
-
-
Method Details
-
findEntity
public Entity findEntity(GameContext context, EntityReference targetKey) throws TargetNotFoundException Find an entity in the game context using targeting rules.- Parameters:
context
- The current game contexttargetKey
- AEntityReference
- Returns:
- The found entity.
- Throws:
TargetNotFoundException
- If the entity isn't found.
-
getEntities
public List<Entity> getEntities(GameContext context, Player player, TargetSelection targetRequirement, boolean omitPermanents) -
withoutPermanents
-
getValidTargets
-
resolveTargetKey
public List<Entity> resolveTargetKey(GameContext context, Player player, Entity source, EntityReference targetKey) Resolves anEntityReference
from the point of view of the specified player, context and entity.- Parameters:
context
- The game contextplayer
- The player from whose point of view this resolution is being interpreted. For example,EntityReference.FRIENDLY_MINIONS
will interpret this argument as friendly.source
- The entity from whose point of view this resolution is being interpreted. For example,EntityReference.SELF
will return the source entity;EntityReference.MINIONS_TO_RIGHT
will refer to the right of this argument.targetKey
- TheEntityReference
to interpet.- Returns:
null
if no target key is specified or anEntityReference.NONE
was passed; otherwise, a possibly empty list of entities.- See Also:
-