Class Cell

java.lang.Object
model.map.Cell

public class Cell extends Object
Represents a single cell on the 11x11 map, storing its type, item, goblin, and zone state.
  • Field Details

    • row

      private final int row
      Row of this cell.
    • col

      private final int col
      Column of this cell.
    • type

      private CellType type
      Type of this cell.
    • item

      private Item item
      Item placed on this cell (null if none).
    • goblin

      private Goblin goblin
      Goblin on this cell (null if none).
    • inZone

      private boolean inZone
      Whether this cell has been converted to lava by the shrinking zone.
  • Constructor Details

    • Cell

      public Cell(int row, int col, CellType type)
      Creates a new Cell.
      Parameters:
      row - Row
      col - Column
      type - Initial type
  • Method Details

    • isWalkable

      public boolean isWalkable()
      Checks whether this cell is walkable by default. ROCK, RIVER, and TREE are not walkable (character-specific exceptions are handled in canMoveTo).
      Returns:
      true if walkable
    • getRow

      public int getRow()
      Returns:
      Row of this cell.
    • getCol

      public int getCol()
      Returns:
      Column of this cell.
    • getType

      public CellType getType()
      Returns:
      Type of this cell.
    • setType

      public void setType(CellType type)
      Parameters:
      type - New type
    • getItem

      public Item getItem()
      Returns:
      Item on this cell, or null
    • setItem

      public void setItem(Item item)
      Parameters:
      item - Item to place (null to remove)
    • getGoblin

      public Goblin getGoblin()
      Returns:
      Goblin on this cell, or null
    • setGoblin

      public void setGoblin(Goblin goblin)
      Parameters:
      goblin - Goblin to place (null to remove)
    • isInZone

      public boolean isInZone()
      Returns:
      true if this cell is lava
    • setInZone

      public void setInZone(boolean b)
      Parameters:
      b - true if this cell has entered the lava zone