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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanBeExecutedOn(GameContext gameContext, Player player, Entity entity) clone()booleanabstract voidexecute(GameContext context, int playerId) The implementation of this method actually represents the game effects of this action.com.hiddenswitch.spellsource.rpc.Spellsource.ActionTypeMessage.ActionTypegetDescription(GameContext context, int playerId) A user-renderable description of what occurred in this notification.intgetId()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?inthashCode()booleanShould this notification be sent to the client?booleanbooleanWhen true, indicates to processors of this notification that it belongs in the power history.protected voidsetActionType(com.hiddenswitch.spellsource.rpc.Spellsource.ActionTypeMessage.ActionType actionType) voidsetChooseOneOptionIndex(Integer chooseOneOptionIndex) voidsetId(int id) setOverrideChild(boolean overrideChild) voidsetSourceReference(EntityReference sourceReference) voidvoidsetTargetReference(EntityReference targetKey) voidsetTargetRequirement(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
PlayMinionCardActioneventually 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:NotificationWhen true, indicates to processors of this notification that it belongs in the power history.- Specified by:
isPowerHistoryin interfaceNotification- Returns:
trueif this notification should be stored in the power history of the game where it occurred.
-
getDescription
Description copied from interface:NotificationA user-renderable description of what occurred in this notification.- Specified by:
getDescriptionin interfaceNotification- Parameters:
context- the game contextplayerId- the player ID- Returns:
- a description string
-
getSource
Description copied from interface:NotificationFor visualization purposes, what is the source of this notification?- Specified by:
getSourcein interfaceNotification- Returns:
- A reference to the entity that is the visualizable source of this notification.
-
getSource
- Specified by:
getSourcein interfaceNotification
-
getTargets
Description copied from interface:NotificationFor visualization purposes, what are the targets of this notification?- Specified by:
getTargetsin 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:NotificationShould this notification be sent to the client?- Specified by:
isClientInterestedin interfaceNotification- Returns:
falseby default.
-
getChooseOneOptionIndex
-
setChooseOneOptionIndex
-
toString
-
isOverrideChild
public boolean isOverrideChild() -
setOverrideChild
-