Class DiscoverAction
java.lang.Object
net.demilich.metastone.game.actions.GameAction
net.demilich.metastone.game.actions.DiscoverAction
- All Implemented Interfaces:
Serializable,Cloneable,HasCard,Notification
A DiscoverAction is a card and spell tuple that corresponds to a particular card selected by the player and the spell
that will take that card as an argument.
Typically, discover actions have a ReceiveCardSpell that puts the card in
getCard() into the player's hand. But any kind of spell that takes a SpellArg.CARD argument will work with a DiscoverAction.
Discover cards should never be executed directly. They are presented to the Behaviour in GameLogic.requestAction(Player, List), so they will always be some kind of "recursive" call inside a Behaviour.
- See Also:
-
Field Summary
Fields inherited from class net.demilich.metastone.game.actions.GameAction
chooseOneOptionIndex -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleancanBeExecutedOn(GameContext context, Player player, Entity entity) Some discover actions cannot be called on certain kinds of cards.clone()static DiscoverActioncreateDiscover(@NotNull SpellDesc spell) Creates a discover action from the given spell description.booleanvoidexecute(GameContext context, int playerId) The implementation of this method actually represents the game effects of this action.getCard()Gets a reference to the card this discover action corresponds to.getDescription(GameContext context, int playerId) A user-renderable description of what occurred in this notification.getSource(GameContext context) @NotNull SpellDescgetSpell()getTargets(GameContext context, int player) For visualization purposes, what are the targets of this notification?inthashCode()voidtoString()Methods inherited from class net.demilich.metastone.game.actions.GameAction
getActionType, getChooseOneOptionIndex, getId, getSource, getSourceReference, getTargetReference, getTargetRequirement, isClientInterested, isOverrideChild, isPowerHistory, setActionType, setChooseOneOptionIndex, setId, setOverrideChild, setSourceReference, setTarget, setTargetReference, setTargetRequirement, withTargetReference
-
Constructor Details
-
DiscoverAction
-
-
Method Details
-
createDiscover
Creates a discover action from the given spell description.- Parameters:
spell- A spell that takesSpellArg.CARDas an argument.- Returns:
- A DiscoverAction.
-
clone
- Overrides:
clonein classGameAction
-
canBeExecutedOn
Some discover actions cannot be called on certain kinds of cards. This is not currently used because DiscoverActions are not unrolled inActionLogic.rollout(GameAction, GameContext, Player, Collection).- Overrides:
canBeExecutedOnin classGameAction- Parameters:
context- The contextplayer- The playerentity- The entity to test- Returns:
trueif the discover action can be called on a particular entity.
-
execute
Description copied from class:GameActionThe implementation of this method actually represents the game effects of this action.For example, the
PlayMinionCardActioneventually callsGameLogic.summon(int, Minion, Entity, int, boolean).- Specified by:
executein classGameAction- Parameters:
context- The game contextplayerId- The invoking player- See Also:
-
getCard
Gets a reference to the card this discover action corresponds to.- Returns:
- The card.
-
getSource
- Specified by:
getSourcein interfaceNotification- Overrides:
getSourcein classGameAction
-
getTargets
Description copied from interface:NotificationFor visualization purposes, what are the targets of this notification?- Specified by:
getTargetsin interfaceNotification- Overrides:
getTargetsin classGameAction- Parameters:
context- game contextplayer- the player- Returns:
- A reference to the entity that is the visualizable target of this notification.
-
getDescription
Description copied from interface:NotificationA user-renderable description of what occurred in this notification.- Specified by:
getDescriptionin interfaceNotification- Overrides:
getDescriptionin classGameAction- Parameters:
context- the game contextplayerId- the player ID- Returns:
- a description string
-
getSpell
-
setCard
-
toString
- Overrides:
toStringin classGameAction
-
equals
- Overrides:
equalsin classGameAction
-
hashCode
public int hashCode()- Overrides:
hashCodein classGameAction
-
getSourceCard
- Specified by:
getSourceCardin interfaceHasCard
-