Class CurrentState
java.lang.Object
it.polimi.ingsw.gc14.Model.GamePackage.CurrentState
- All Implemented Interfaces:
Serializable
Represents the current state of the game.
A CurrentState object stores the current player, slot, era, round,
remaining upper and lower cards, and the current game stage.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intThe current era of the game.private GameStagesThe current stage of the game.private intThe number of lower cards currently available.private intThe number of upper cards currently available.private PlayerThe current player associated with the game state.private intThe current round of the game.private SlotThe current slot associated with the game state. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new CurrentState object with default initial values. -
Method Summary
Modifier and TypeMethodDescriptionvoidIncrements the current era by 1.voidgameStageUpdate(GameStages stage) Updates the current game stage.Returns the current player.intgetEra()Returns the current era of the game.Returns the current stage of the game.intReturns the number of lower cards currently available.intReturns the number of upper cards currently available.intgetRound()Returns the current round of the game.getSlot()Returns the current slot.voidDecrements the number of lower cards by 1.voidplayerUpdate(Player player, Slot slot) Updates the current player, slot, and available draws.voidIncrements the current round by 1.toString()Returns a formatted ASCII table representation of the current game state.voidDecrements the number of upper cards by 1.
-
Field Details
-
player
The current player associated with the game state. -
slot
The current slot associated with the game state. -
era
private int eraThe current era of the game. -
round
private int roundThe current round of the game. -
nUpper
private int nUpperThe number of upper cards currently available. -
nLower
private int nLowerThe number of lower cards currently available. -
gameStage
The current stage of the game.
-
-
Constructor Details
-
CurrentState
public CurrentState()Creates a new CurrentState object with default initial values. The initial player and slot arenull, the era and round are set to 1, the number of upper and lower cards is set to 0, and the game stage is set toWAITING.
-
-
Method Details
-
getCurrentPlayer
-
getSlot
-
getEra
public int getEra()Returns the current era of the game.- Returns:
- the current era of the game.
-
getRound
public int getRound()Returns the current round of the game.- Returns:
- the current round of the game.
-
getNUpper
public int getNUpper()Returns the number of upper cards currently available.- Returns:
- the number of upper cards currently available.
-
getNLower
public int getNLower()Returns the number of lower cards currently available.- Returns:
- the number of lower cards currently available.
-
getGameStage
Returns the current stage of the game.- Returns:
- the current stage of the game.
-
eraUpdate
public void eraUpdate()Increments the current era by 1. -
roundUpdate
public void roundUpdate()Increments the current round by 1. -
upperDrawn
public void upperDrawn()Decrements the number of upper cards by 1. -
lowerDrawn
public void lowerDrawn()Decrements the number of lower cards by 1. -
gameStageUpdate
Updates the current game stage.- Parameters:
stage- the new game stage.
-
playerUpdate
-
toString
-