Class LadderGameTile

java.lang.Object
edu.ntnu.idi.idatt.model.tile.Tile
edu.ntnu.idi.idatt.model.tile.LadderGameTile

public class LadderGameTile extends Tile
LadderGameTile.

Represents a specialized Tile for a ladder game. In addition to the standard tile properties, a LadderGameTile can have a specific TileAction associated with it, which is triggered when a player lands on this tile.

See Also:
  • Constructor Details

    • LadderGameTile

      public LadderGameTile(int tileId, int[] coordinates, int nextTileId)
      Constructs a LadderGameTile with a tile ID, coordinates, and the ID of the next tile in sequence. The land action is initially null.
      Parameters:
      tileId - The unique identifier for this tile.
      coordinates - An array representing the (row, column) position of this tile on the board.
      nextTileId - The ID of the tile that logically follows this one in the normal game flow.
    • LadderGameTile

      public LadderGameTile(int tileId, int[] coordinates, int nextTileId, TileAction tileAction)
      Constructs a LadderGameTile with a tile ID, coordinates, the ID of the next tile, and a specific TileAction to be performed when a player lands on this tile.
      Parameters:
      tileId - The unique identifier for this tile.
      coordinates - An array representing the (row, column) position of this tile on the board.
      nextTileId - The ID of the tile that logically follows this one.
      tileAction - The TileAction associated with landing on this tile.
  • Method Details

    • getLandAction

      public TileAction getLandAction()
      Returns the TileAction that occurs when a player lands on this tile. This could be, for example, moving to a different tile (ladder/slide) or another effect.
      Returns:
      The TileAction associated with this tile, or null if none.
    • setLandAction

      public void setLandAction(TileAction landAction)
      Sets the TileAction to be performed when a player lands on this tile. The provided action is validated using tileSetLandActionValidator.
      Parameters:
      landAction - The TileAction to set. Must not be null.
      Throws:
      IllegalArgumentException - if landAction is null.