Class God
java.lang.Object
it.polimi.ingsw.server.controller.god.God
- Direct Known Subclasses:
Apollo,Artemis,Athena,Atlas,Charon,Demeter,Hephaestus,Hera,Hestia,Minotaur,Pan,Prometheus,Triton,Zeus
public abstract class God
extends java.lang.Object
This abstract class allows to see the Gods' main methods and their default implementation.
-
Field Summary
Fields Modifier and Type Field Description protected GodControllergodController -
Constructor Summary
Constructors Constructor Description God(GodController godController) -
Method Summary
Modifier and Type Method Description voidbuild(Worker worker)Lets the worker build a block or a dome.voidevolveTurn(Worker worker)Default evolution of the turn: move, checks if win condition is met, builds.abstract java.lang.StringgetDescription()GodControllergetGodController()voidmove(Worker worker)Default rules to move the worker during a turn of the game.java.lang.StringtoString()WorkerBuildMapupdateBuildMap(Worker worker)Sets the permissions to build of the selected worker.WorkerMoveMapupdateMoveMap(Worker worker)Sets the permissions to move of the selected worker.voidwin(Worker worker)Checks if default win conditions are met.
-
Field Details
-
Constructor Details
-
Method Details
-
evolveTurn
public void evolveTurn(Worker worker) throws UnableToMoveException, UnableToBuildException, WinExceptionDefault evolution of the turn: move, checks if win condition is met, builds.- Parameters:
worker- Selected worker that will act in the current turn.- Throws:
UnableToMoveException- The worker isn't allowed to move anywhere.UnableToBuildException- The worker isn't allowed to build anywhere.WinException- The worker has reached the third level of a building and so wins the game.
-
move
Default rules to move the worker during a turn of the game.- Parameters:
worker- Selected worker that will move.- Throws:
UnableToMoveException- The worker isn't allowed to move anywhere.
-
build
Lets the worker build a block or a dome.- Parameters:
worker- worker playing the current turn.- Throws:
UnableToBuildException- The worker isn't allowed to build anywhere.
-
win
Checks if default win conditions are met.- Parameters:
worker- Worker playing the turn.- Throws:
WinException- The worker has reached the third level of a building and so wins the game.
-
updateMoveMap
Sets the permissions to move of the selected worker. It is called at the beginning of each move, which will then comply with the matrix.- Parameters:
worker- worker playing the turn.- Returns:
- The WorkerMoveMap of the worker chosen for this turn.
- Throws:
UnableToMoveException- signals that the worker cannot move anywhere
-
updateBuildMap
Sets the permissions to build of the selected worker.- Parameters:
worker- worker playing the turn.- Returns:
- The WorkerBuildMap of the chosen worker of this turn.
- Throws:
UnableToBuildException- signals that the worker cannot build anywhere.
-
getGodController
-
getDescription
public abstract java.lang.String getDescription() -
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-