- All Known Implementing Classes:
Player
public interface PlayerInterface
Player interface
Offers a series of methods to change the player state
-
Method Summary
Modifier and Type Method Description voidaddBuildableCellsListener(BuildableCellsListener buildableCellsListener)Adds a new listenervoidaddBuildingBlocksListener(BuildingBlocksListener buildingBlocksListener)Adds a new listenervoidaddSelectWorkerListener(SelectWorkerListener selectWorkerListener)Adds a new listenervoidaddWalkableCellsListener(WalkableCellsListener walkableCellsListener)Adds a new listenervoidaddWorker(Cell cell)Adds a worker to the boardvoidaddWorkerListener(AddWorkerListener addWorkerListener)Adds a new listenerbooleanallWorkersArePlaced()Checks if the player has placed all of its workersvoidaskPassTurn()Ends the player's turnvoidobtainBuildableCells()Provides a list of cells on which the selected player can build onvoidobtainBuildingBlocks(Cell selectedCell)Provides a list of blocks which the selected worker can build on the given cellvoidobtainWalkableCells()Provides a list of cells on which the selected player can walk tovoidsetSelectedWorker(Worker selectedWorker)Sets the worker to perform the next actionvoiduseAction(Action action)Applies the given action
-
Method Details
-
addWorker
Adds a worker to the board- Parameters:
cell- the cell to place the worker to- Throws:
AddingFailedException- if the worker could not be added
-
setSelectedWorker
Sets the worker to perform the next action- Parameters:
selectedWorker- the worker to select- Throws:
NotYourWorkerException- if the worker is not owned by the player
-
obtainWalkableCells
Provides a list of cells on which the selected player can walk to- Throws:
WrongSelectionException- if no worker has been selected
-
obtainBuildableCells
Provides a list of cells on which the selected player can build on- Throws:
WrongSelectionException- if no worker has been selected
-
obtainBuildingBlocks
Provides a list of blocks which the selected worker can build on the given cell- Parameters:
selectedCell- the cell to perform the build action on- Throws:
IllegalActionException- if no worker has been selected
-
useAction
Applies the given action- Parameters:
action- the action to be applied- Throws:
IllegalActionException- if the action cannot be performed
-
askPassTurn
Ends the player's turn- Throws:
IllegalEndingTurnException- if the turn cannot be ended
-
addWorkerListener
Adds a new listener- Parameters:
addWorkerListener- the listener to add to the list
-
addBuildableCellsListener
Adds a new listener- Parameters:
buildableCellsListener- the listener to add to the list
-
addWalkableCellsListener
Adds a new listener- Parameters:
walkableCellsListener- the listener to add to the list
-
addSelectWorkerListener
Adds a new listener- Parameters:
selectWorkerListener- the listener to add to the list
-
addBuildingBlocksListener
Adds a new listener- Parameters:
buildingBlocksListener- the listener to add to the list
-
allWorkersArePlaced
boolean allWorkersArePlaced()Checks if the player has placed all of its workers- Returns:
- true if all the player's workers have been placed, false otherwise
-