Class Round

java.lang.Object
javatro.core.round.Round

public class Round extends Object
Represents a round in the Javatro game.
  • Constructor Details

    • Round

      public Round(Ante ante, int remainingPlays, Deck deck, HeldJokers heldJokers, String roundName, String roundDescription) throws JavatroException
      Constructs a new round with detailed configuration.
      Parameters:
      ante - The ante configuration containing the target score for this round
      remainingPlays - The initial number of plays allowed in this round
      deck - The deck of cards to be used for this round
      heldJokers - The player's collection of jokers available for this round
      roundName - The display name for this round
      roundDescription - A detailed description of the round's rules or theme
      Throws:
      JavatroException - If any of the provided parameters are invalid
    • Round

      public Round(Ante ante, int remainingPlays, Deck deck, HeldJokers heldJokers, BossType bossType) throws JavatroException
      Constructs a new round with specified boss type This constructor is not intended for use in normal gameplay. It is only for testing purposes.
      Parameters:
      ante - The ante configuration to use
      remainingPlays - The number of plays allowed in this round
      deck - The deck of cards to be used for this round
      heldJokers - The player's collection of jokers available for this round
      Throws:
      JavatroException - If any of the provided parameters are invalid
    • Round

      public Round(Ante ante, int remainingPlays, Deck deck, HeldJokers heldJokers) throws JavatroException
      Constructs a new round with the specified ante and blind settings without specifying round name and description.
      Throws:
      JavatroException
  • Method Details

    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener pcl)
      Registers a listener for round state changes.
      Parameters:
      pcl - The property change listener to register
    • updateRoundVariables

      public void updateRoundVariables()
      Notifies all registered observers of changes in the round state.
    • playCards

      public void playCards(List<Integer> cardIndices) throws JavatroException
      Plays a selection of cards from the player's hand.
      Parameters:
      cardIndices - Indices of cards to play from the holding hand
      Throws:
      JavatroException - If the play is invalid or no plays remain
    • discardCards

      public void discardCards(List<Integer> cardIndices) throws JavatroException
      Discards a selection of cards from the player's hand.
      Parameters:
      cardIndices - Indices of cards to discard from the holding hand
      Throws:
      JavatroException - If the discard is invalid or no discards remain
    • getCurrentScore

      public long getCurrentScore()
      Gets the current score accumulated in this round.
      Returns:
      The current score
    • setCurrentScore

      public void setCurrentScore(int score)
    • getBlindScore

      public int getBlindScore()
      Gets the target score needed to win this round.
      Returns:
      The blind score target
    • getRemainingDiscards

      public int getRemainingDiscards()
      Gets the number of remaining discards available to the player.
      Returns:
      The number of remaining discards
    • getRemainingPlays

      public int getRemainingPlays()
      Gets the number of remaining plays available to the player.
      Returns:
      The number of remaining plays
    • getPlayerHand

      public HoldingHand getPlayerHand()
      Gets the player's current hand of cards.
      Returns:
      The player's hand
    • getPlayerHandCards

      public List<Card> getPlayerHandCards()
      Gets the player's current hand of cards as a list.
      Returns:
      The player's hand as a list of cards
    • getPlayerJokers

      public HeldJokers getPlayerJokers()
      Gets the player's current held jokers.
      Returns:
      The player's jokers
    • isLost

      public boolean isLost()
      Checks if the game is lost based on game rules.
      Returns:
      true if the game is lost, false otherwise
    • isWon

      public boolean isWon()
      Checks if the round was won by the player.
      Returns:
      true if the player won the round, false otherwise
    • isRoundOver

      public boolean isRoundOver()
      Checks if the round is over based on game rules.
      Returns:
      true if the game is lost, false otherwise
    • getRoundName

      public String getRoundName()
      Gets the display name of this round.
      Returns:
      The round name
    • setRoundName

      public void setRoundName(String roundName)
      Sets the display name of this round.
      Parameters:
      roundName - The new round name
    • getRoundDescription

      public String getRoundDescription()
      Gets the description of this round.
      Returns:
      The round description
    • setRoundDescription

      public void setRoundDescription(String roundDescription)
      Sets the description of this round.
      Parameters:
      roundDescription - The new round description
    • getState

      public javatro.core.round.RoundState getState()
      Gets the state object for this round.
      Returns:
      The round state object
    • updatePlays

      public void updatePlays(int plays)
    • updateDiscards

      public void updateDiscards(int discards)
    • getConfig

      public javatro.core.round.RoundConfig getConfig()
      Gets the configuration object for this round.
      Returns:
      The round configuration object
    • getObservable

      public javatro.core.round.RoundObservable getObservable()
      Gets the observable object for this round.
      Returns:
      The round observable object
    • getBossType

      public BossType getBossType()
      Gets the boss type for this round.
      Returns:
      The boss type
    • getDeck

      public Deck getDeck()
      Gets the deck used in this round.
      Returns:
      The deck object
    • getPlayedCards

      public List<Card> getPlayedCards()
      Gets the played cards in this round.
      Returns:
      The list of played cards
    • getPlayedHand

      public PokerHand getPlayedHand() throws JavatroException
      Gets the played hand of cards in this round.
      Returns:
      The poker hand evaluated from the played cards
      Throws:
      JavatroException - If the played cards are invalid or empty
    • setPlayerHandCards

      public void setPlayerHandCards(List<Card> playerHandCards) throws IllegalArgumentException
      @warn This method will be deprecated in future versions. Reordering of player hands should be done in UI and not in Round class. Updates the player hand.
      Parameters:
      playerHandCards - The new holding hand to set
      Throws:
      IllegalArgumentException - if the player hand is null