Class AbstractBehaviour
java.lang.Object
net.demilich.metastone.game.behaviour.AbstractBehaviour
- All Implemented Interfaces:
Serializable,Cloneable,Behaviour
- Direct Known Subclasses:
IntelligentBehaviour,UtilityBehaviour
A base class for behaviours that implement no action or a default action when its methods are called.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Clones the behaviour, typically with its internal state.booleanisHuman()Determines whether this behaviour's actions were determined by a human.voidmulliganAsync(GameContext context, Player player, List<Card> cards, Consumer<List<Card>> handler) Asynchronously request a mulligan.voidonGameOver(GameContext context, int playerId, int winningPlayerId) Notify the behaviour that the game is over, allowing it to clean up any state.voidrequestActionAsync(GameContext context, Player player, List<GameAction> validActions, Consumer<GameAction> callback) Requests an action from a player asynchronously.Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.demilich.metastone.game.behaviour.Behaviour
getName, mulligan, requestAction
-
Constructor Details
-
AbstractBehaviour
public AbstractBehaviour()
-
-
Method Details
-
clone
Description copied from interface:BehaviourClones the behaviour, typically with its internal state. -
onGameOver
Description copied from interface:BehaviourNotify the behaviour that the game is over, allowing it to clean up any state.- Specified by:
onGameOverin interfaceBehaviour- Parameters:
context- The context of the game that has ended.playerId- The player that corresponds to this behaviour.winningPlayerId- The winning player.
-
mulliganAsync
public void mulliganAsync(GameContext context, Player player, List<Card> cards, Consumer<List<Card>> handler) Description copied from interface:BehaviourAsynchronously request a mulligan.- Specified by:
mulliganAsyncin interfaceBehaviour- Parameters:
context- The game context.player- The player who is mulliganing.cards- The cards in the player's first hand.handler- The callback when the player chose which cards to discard.- See Also:
-
requestActionAsync
public void requestActionAsync(GameContext context, Player player, List<GameAction> validActions, Consumer<GameAction> callback) Description copied from interface:BehaviourRequests an action from a player asynchronously.- Specified by:
requestActionAsyncin interfaceBehaviour- Parameters:
context- The game context where the choice is being made.player- The player who is making the choice.validActions- The valid actions the player has to choose from.callback- The callback whose argument is one of thevalidActionsthat correspond to the player's
-
isHuman
public boolean isHuman()Description copied from interface:BehaviourDetermines whether this behaviour's actions were determined by a human.
-