- 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 void
addBuildableCellsListener(BuildableCellsListener buildableCellsListener)
Adds a new listenervoid
addBuildingBlocksListener(BuildingBlocksListener buildingBlocksListener)
Adds a new listenervoid
addSelectWorkerListener(SelectWorkerListener selectWorkerListener)
Adds a new listenervoid
addWalkableCellsListener(WalkableCellsListener walkableCellsListener)
Adds a new listenervoid
addWorker(Cell cell)
Adds a worker to the boardvoid
addWorkerListener(AddWorkerListener addWorkerListener)
Adds a new listenerboolean
allWorkersArePlaced()
Checks if the player has placed all of its workersvoid
askPassTurn()
Ends the player's turnvoid
obtainBuildableCells()
Provides a list of cells on which the selected player can build onvoid
obtainBuildingBlocks(Cell selectedCell)
Provides a list of blocks which the selected worker can build on the given cellvoid
obtainWalkableCells()
Provides a list of cells on which the selected player can walk tovoid
setSelectedWorker(Worker selectedWorker)
Sets the worker to perform the next actionvoid
useAction(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
-