Package javatro.core.round
Class Round
java.lang.Object
javatro.core.round.Round
Represents a round in the Javatro game.
-
Constructor Summary
ConstructorsConstructorDescriptionRound(Ante ante, int remainingPlays, Deck deck, HeldJokers heldJokers) Constructs a new round with the specified ante and blind settings without specifying round name and description.Round(Ante ante, int remainingPlays, Deck deck, HeldJokers heldJokers, String roundName, String roundDescription) Constructs a new round with detailed configuration.Round(Ante ante, int remainingPlays, Deck deck, HeldJokers heldJokers, BossType bossType) Constructs a new round with specified boss type This constructor is not intended for use in normal gameplay. -
Method Summary
Modifier and TypeMethodDescriptionvoidRegisters a listener for round state changes.voiddiscardCards(List<Integer> cardIndices) Discards a selection of cards from the player's hand.intGets the target score needed to win this round.Gets the boss type for this round.javatro.core.round.RoundConfigGets the configuration object for this round.longGets the current score accumulated in this round.getDeck()Gets the deck used in this round.javatro.core.round.RoundObservableGets the observable object for this round.Gets the played cards in this round.Gets the played hand of cards in this round.Gets the player's current hand of cards.Gets the player's current hand of cards as a list.Gets the player's current held jokers.intGets the number of remaining discards available to the player.intGets the number of remaining plays available to the player.Gets the description of this round.Gets the display name of this round.javatro.core.round.RoundStategetState()Gets the state object for this round.booleanisLost()Checks if the game is lost based on game rules.booleanChecks if the round is over based on game rules.booleanisWon()Checks if the round was won by the player.voidPlays a selection of cards from the player's hand.voidsetCurrentScore(int score) voidsetPlayerHandCards(List<Card> playerHandCards) @warnThis method will be deprecated in future versions.voidsetRoundDescription(String roundDescription) Sets the description of this round.voidsetRoundName(String roundName) Sets the display name of this round.voidupdateDiscards(int discards) voidupdatePlays(int plays) voidNotifies all registered observers of changes in the round state.
-
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 roundremainingPlays- The initial number of plays allowed in this rounddeck- The deck of cards to be used for this roundheldJokers- The player's collection of jokers available for this roundroundName- The display name for this roundroundDescription- 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 useremainingPlays- The number of plays allowed in this rounddeck- The deck of cards to be used for this roundheldJokers- 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
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
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
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
Gets the player's current hand of cards.- Returns:
- The player's hand
-
getPlayerHandCards
Gets the player's current hand of cards as a list.- Returns:
- The player's hand as a list of cards
-
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
Gets the display name of this round.- Returns:
- The round name
-
setRoundName
Sets the display name of this round.- Parameters:
roundName- The new round name
-
getRoundDescription
Gets the description of this round.- Returns:
- The round description
-
setRoundDescription
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
Gets the boss type for this round.- Returns:
- The boss type
-
getDeck
Gets the deck used in this round.- Returns:
- The deck object
-
getPlayedCards
Gets the played cards in this round.- Returns:
- The list of played cards
-
getPlayedHand
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
@warnThis 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
-