Package edu.ntnu.idi.idatt.model.token
Class LudoToken
java.lang.Object
edu.ntnu.idi.idatt.model.token.LudoToken
LudoToken.
Represents a single game piece (token) in a Ludo game. Each token has a unique ID
(within its player's set of tokens), a LudoToken.TokenStatus
indicating its current state (e.g., in
the start area, on the track, or finished), and a reference to the Tile
it currently
occupies (if any).
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enum representing the possible statuses of aLudoToken
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the tile this token currently occupies.Gets the current status of this token.int
Gets the unique ID of this token.void
setCurrentTile
(Tile currentTile) Sets the current tile for this token.void
setStatus
(LudoToken.TokenStatus status) Sets the status of this token.
-
Constructor Details
-
LudoToken
public LudoToken(int tokenId) Constructs aLudoToken
with the given ID. Initially, the token's status is set toLudoToken.TokenStatus.NOT_RELEASED
and its current tile isnull
.- Parameters:
tokenId
- The unique identifier for this token (typically 1-4 for Ludo).
-
-
Method Details
-
getTokenId
public int getTokenId()Gets the unique ID of this token.- Returns:
- The token ID.
-
getStatus
Gets the current status of this token.- Returns:
- The
LudoToken.TokenStatus
of the token.
-
getCurrentTile
Gets the tile this token currently occupies.- Returns:
- The current
Tile
, ornull
if the token is not on a tile (e.g., not released).
-
setStatus
Sets the status of this token.- Parameters:
status
- The newLudoToken.TokenStatus
for the token.
-
setCurrentTile
Sets the current tile for this token.- Parameters:
currentTile
- The newTile
the token occupies.
-