Class Cell
java.lang.Object
model.map.Cell
Represents a single cell on the 11x11 map, storing its type, item, goblin, and zone state.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intColumn of this cell.private GoblinGoblin on this cell (nullif none).private booleanWhether this cell has been converted to lava by the shrinking zone.private ItemItem placed on this cell (nullif none).private final intRow of this cell.private CellTypeType of this cell. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
row
private final int rowRow of this cell. -
col
private final int colColumn of this cell. -
type
Type of this cell. -
item
Item placed on this cell (nullif none). -
goblin
Goblin on this cell (nullif none). -
inZone
private boolean inZoneWhether this cell has been converted to lava by the shrinking zone.
-
-
Constructor Details
-
Cell
Creates a new Cell.- Parameters:
row- Rowcol- Columntype- 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:
trueif walkable
-
getRow
public int getRow()- Returns:
- Row of this cell.
-
getCol
public int getCol()- Returns:
- Column of this cell.
-
getType
- Returns:
- Type of this cell.
-
setType
- Parameters:
type- New type
-
getItem
- Returns:
- Item on this cell, or
null
-
setItem
- Parameters:
item- Item to place (nullto remove)
-
getGoblin
- Returns:
- Goblin on this cell, or
null
-
setGoblin
- Parameters:
goblin- Goblin to place (nullto remove)
-
isInZone
public boolean isInZone()- Returns:
trueif this cell is lava
-
setInZone
public void setInZone(boolean b) - Parameters:
b-trueif this cell has entered the lava zone
-