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 boolean
canBeExecutedOn
(GameContext context, Player player, Entity entity) Some discover actions cannot be called on certain kinds of cards.clone()
static DiscoverAction
createDiscover
(@NotNull SpellDesc spell) Creates a discover action from the given spell description.boolean
void
execute
(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 SpellDesc
getSpell()
getTargets
(GameContext context, int player) For visualization purposes, what are the targets of this notification?int
hashCode()
void
toString()
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.CARD
as an argument.- Returns:
- A DiscoverAction.
-
clone
- Overrides:
clone
in 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:
canBeExecutedOn
in classGameAction
- Parameters:
context
- The contextplayer
- The playerentity
- The entity to test- Returns:
true
if the discover action can be called on a particular entity.
-
execute
Description copied from class:GameAction
The implementation of this method actually represents the game effects of this action.For example, the
PlayMinionCardAction
eventually callsGameLogic.summon(int, Minion, Entity, int, boolean)
.- Specified by:
execute
in 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:
getSource
in interfaceNotification
- Overrides:
getSource
in classGameAction
-
getTargets
Description copied from interface:Notification
For visualization purposes, what are the targets of this notification?- Specified by:
getTargets
in interfaceNotification
- Overrides:
getTargets
in 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:Notification
A user-renderable description of what occurred in this notification.- Specified by:
getDescription
in interfaceNotification
- Overrides:
getDescription
in classGameAction
- Parameters:
context
- the game contextplayerId
- the player ID- Returns:
- a description string
-
getSpell
-
setCard
-
toString
- Overrides:
toString
in classGameAction
-
equals
- Overrides:
equals
in classGameAction
-
hashCode
public int hashCode()- Overrides:
hashCode
in classGameAction
-
getSourceCard
- Specified by:
getSourceCard
in interfaceHasCard
-