Class RequestActionFunction
java.lang.Object
net.demilich.metastone.game.behaviour.AbstractBehaviour
net.demilich.metastone.game.behaviour.UtilityBehaviour
net.demilich.metastone.game.behaviour.RequestActionFunction
- All Implemented Interfaces:
Serializable
,Cloneable
,Behaviour
Delegates the behaviour to a function passed in the constructor of this class.
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionRequestActionFunction
(RequestActionFunction.T delegate) The provided delegate will be called whenever this instance'srequestAction(GameContext, Player, List)
is called. -
Method Summary
Modifier and TypeMethodDescriptiongetName()
Gets a name for the behaviour.mulligan
(GameContext context, Player player, List<Card> cards) Use the provided context, player and first hand cards to determine which cards to discard during a mulligan phase.requestAction
(GameContext context, Player player, List<GameAction> validActions) Requests an action from the player.Methods inherited from class net.demilich.metastone.game.behaviour.AbstractBehaviour
clone, isHuman, mulliganAsync, onGameOver, requestActionAsync
-
Constructor Details
-
RequestActionFunction
The provided delegate will be called whenever this instance'srequestAction(GameContext, Player, List)
is called.- Parameters:
delegate
-
-
-
Method Details
-
getName
Description copied from interface:Behaviour
Gets a name for the behaviour. This should correspond to how the decisions are being made, e.g., a"Human Behaviour"
or an"AI Behaviour
.- Returns:
- A
String
description of the behaviour.
-
mulligan
Description copied from interface:Behaviour
Use the provided context, player and first hand cards to determine which cards to discard during a mulligan phase.- Parameters:
context
- The game context.player
- The player who's mulliganing.cards
- The cards in the player's first hand.- Returns:
- The cards the player chose to discard.
-
requestAction
Description copied from interface:Behaviour
Requests an action from the player.- 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.- Returns:
- One of the
validActions
that correspond to the player's choice.
-