Package it.polimi.ingsw.server.model
Class WorkerBuildMap
java.lang.Object
it.polimi.ingsw.server.model.WorkerMap
it.polimi.ingsw.server.model.WorkerBuildMap
public class WorkerBuildMap extends WorkerMap
Represents the positions adjacent to the worker, in which he
may or may not build, depending on the boolean value of the cell.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description WorkerBuildMap(Worker worker) -
Method Summary
Modifier and Type Method Description booleananyAvailableBuildPosition()Checks if the worker can build.voidcanBuildUnderneath()Allows worker to build underneath himself.voidcannotBuildInOccupiedCell()Forbids worker to build in a cell occupied by a dome or another worker.voidcannotBuildInPerimeter()Forbids the worker to build in a perimeter cell of the board.voidcannotBuildUnderneath()Forbids worker to build underneath himself.booleanisAllowedToBuildBoard(int i, int j)Finds out if worker is allowed to build in a given cell of the board.Methods inherited from class it.polimi.ingsw.server.model.WorkerMap
anyCellOneLevelHigher, anyTrueCell, domeCellFalse, friendlyWorkerCellFalse, getAbsolutePosition, getBooleanCellBoard, getBooleanCellWorkerMap, getWorker, levelDifferenceLessEqualThanX, neighboringEnemyWorkers, occupiedCellFalse, reset, setCell, setCenterPosition, setPerimeterFalse, updateCellsOutOfMap
-
Constructor Details
-
Method Details
-
cannotBuildInOccupiedCell
public void cannotBuildInOccupiedCell()Forbids worker to build in a cell occupied by a dome or another worker. -
cannotBuildUnderneath
public void cannotBuildUnderneath()Forbids worker to build underneath himself. -
canBuildUnderneath
public void canBuildUnderneath()Allows worker to build underneath himself. -
isAllowedToBuildBoard
public boolean isAllowedToBuildBoard(int i, int j)Finds out if worker is allowed to build in a given cell of the board.- Parameters:
i- Board coordinate X.j- Board coordinate Y.- Returns:
- True if it can build in cell, false otherwise.
-
anyAvailableBuildPosition
public boolean anyAvailableBuildPosition()Checks if the worker can build.- Returns:
- Returns true if there is a cell the worker can build in, false otherwise.
-
cannotBuildInPerimeter
public void cannotBuildInPerimeter()Forbids the worker to build in a perimeter cell of the board.
-