Class GameAction
java.lang.Object
net.demilich.metastone.game.actions.GameAction
- All Implemented Interfaces:
Serializable
,Cloneable
,Notification
- Direct Known Subclasses:
DiscoverAction
,EndTurnAction
,OpenerAction
,PhysicalAttackAction
,PlayCardAction
An action a player can take in the game.
This class both represents the piece of data that a player should consider from a list from GameLogic.getValidActions(int)
. It also has the code that executes the action in
the GameLogic
.
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canBeExecutedOn
(GameContext gameContext, Player player, Entity entity) clone()
boolean
abstract void
execute
(GameContext context, int playerId) The implementation of this method actually represents the game effects of this action.com.hiddenswitch.spellsource.rpc.Spellsource.ActionTypeMessage.ActionType
getDescription
(GameContext context, int playerId) A user-renderable description of what occurred in this notification.int
getId()
For visualization purposes, what is the source of this notification?getSource
(GameContext context) getTargets
(GameContext context, int player) For visualization purposes, what are the targets of this notification?int
hashCode()
boolean
Should this notification be sent to the client?boolean
boolean
When true, indicates to processors of this notification that it belongs in the power history.protected void
setActionType
(com.hiddenswitch.spellsource.rpc.Spellsource.ActionTypeMessage.ActionType actionType) void
setChooseOneOptionIndex
(Integer chooseOneOptionIndex) void
setId
(int id) setOverrideChild
(boolean overrideChild) void
setSourceReference
(EntityReference sourceReference) void
void
setTargetReference
(EntityReference targetKey) void
setTargetRequirement
(TargetSelection targetRequirement) toString()
withTargetReference
(EntityReference reference)
-
Field Details
-
chooseOneOptionIndex
-
-
Constructor Details
-
GameAction
public GameAction()
-
-
Method Details
-
canBeExecutedOn
-
clone
-
execute
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)
.- Parameters:
context
- The game contextplayerId
- The invoking player- See Also:
-
getActionType
public com.hiddenswitch.spellsource.rpc.Spellsource.ActionTypeMessage.ActionType getActionType() -
getSourceReference
-
getTargetReference
-
getTargetRequirement
-
setSourceReference
-
setTarget
-
setTargetReference
-
setTargetRequirement
-
equals
-
hashCode
public int hashCode() -
getId
public int getId() -
setId
public void setId(int id) -
isPowerHistory
public boolean isPowerHistory()Description copied from interface:Notification
When true, indicates to processors of this notification that it belongs in the power history.- Specified by:
isPowerHistory
in interfaceNotification
- Returns:
true
if this notification should be stored in the power history of the game where it occurred.
-
getDescription
Description copied from interface:Notification
A user-renderable description of what occurred in this notification.- Specified by:
getDescription
in interfaceNotification
- Parameters:
context
- the game contextplayerId
- the player ID- Returns:
- a description string
-
getSource
Description copied from interface:Notification
For visualization purposes, what is the source of this notification?- Specified by:
getSource
in interfaceNotification
- Returns:
- A reference to the entity that is the visualizable source of this notification.
-
getSource
- Specified by:
getSource
in interfaceNotification
-
getTargets
Description copied from interface:Notification
For visualization purposes, what are the targets of this notification?- Specified by:
getTargets
in interfaceNotification
- Parameters:
context
- game contextplayer
- the player- Returns:
- A reference to the entity that is the visualizable target of this notification.
-
withTargetReference
-
isClientInterested
public boolean isClientInterested()Description copied from interface:Notification
Should this notification be sent to the client?- Specified by:
isClientInterested
in interfaceNotification
- Returns:
false
by default.
-
getChooseOneOptionIndex
-
setChooseOneOptionIndex
-
toString
-
isOverrideChild
public boolean isOverrideChild() -
setOverrideChild
-