Class CardSelectOption

java.lang.Object
javatro.manager.options.CardSelectOption
All Implemented Interfaces:
Option

public class CardSelectOption extends Object implements Option
The CardSelectOption class handles card selection operations for the player, allowing them to either play cards into their current poker hand or discard cards, depending on the active game screen. The number of selectable cards is limited by a configurable maximum (default: 5).
  • Field Details

    • DEFAULT_SELECTION_LIMIT

      public static final int DEFAULT_SELECTION_LIMIT
      Default maximum number of cards that can be selected in one operation
      See Also:
  • Constructor Details

    • CardSelectOption

      public CardSelectOption() throws JavatroException
      Constructs a card selector with default selection limit (5).
      Throws:
      JavatroException - if initialization fails due to internal constraints
    • CardSelectOption

      public CardSelectOption(int selectionLimit) throws JavatroException
      Constructs a card selector with a custom selection limit.
      Parameters:
      selectionLimit - Maximum number of cards that can be selected (must be ≥ 1)
      Throws:
      JavatroException - if invalid selection limit is provided
  • Method Details

    • getDescription

      public String getDescription()
      Returns a human-readable description of this command.
      Specified by:
      getDescription in interface Option
      Returns:
      Brief string describing the card selection operation
    • execute

      public void execute() throws JavatroException
      Executes the card selection operation. Collects user input, processes the selection based on current context (play/discard), updates game state, and handles game progression.
      Specified by:
      execute in interface Option
      Throws:
      JavatroException - if input parsing fails or game state becomes inconsistent