Class GodController
java.lang.Object
it.polimi.ingsw.server.controller.GodController
public class GodController
extends java.lang.Object
Manages communication between the Gods and the clients.
-
Constructor Summary
Constructors Constructor Description GodController(GameController gameController) -
Method Summary
Modifier and Type Method Description voidcannotBuildDomeUnderneath()Warns user of invalid build action: he cannot build a dome underneath himself.voiddisplayBoard()Prompts the view to display the board.voiderrorBuildBlockScreen()Allows to manage the error saw by the player when his block cannot be builtbooleanerrorBuildDecisionScreen()Allows to manage the decision of the player to retry the build of his worker.voiderrorBuildInSamePosition()Allows to manage the error when there's not the possibility to build in the same position.voiderrorBuildScreen()Allows to manage the error saw by the player when his building phase fails.booleanerrorMoveDecisionScreen()Allows to manage the decision of the player to retry the move of his worker.voiderrorMoveScreen()Allows to call the viewClient to print the error when a wrong move input was given to the server.WorkerforceMoveEnemy(java.util.ArrayList<Worker> enemyWorkers, Worker worker)Allows to manage the constriction of moving an enemy worker.int[]getBuildInput()Asks to the player where he wants to make his worker build and then translates the input into coordinates.int[]getBuildInputAtlas()Asks to the player where he wants to make his worker build and what kind of building, then translates the input into coordinates and type of building.VirtualViewgetCurrentClient()int[]getInputInCoordinates(java.lang.String compassInput)This method translates compass directions (N,S,E,...) into coordinates.int[]getMoveInput()Asks to the player where he wants to move his worker and then translates the input into coordinates.voidupdateCurrentClient(VirtualView client)booleanwantToBuildAgain(God god)Allows to translate the players' answer to the will of build another time, all related to a specific God.booleanwantToMoveAgain()Allows to manage the will to move again.booleanwantToMoveEnemy()Allows to manage the will of moving an enemy on the board.
-
Constructor Details
-
Method Details
-
updateCurrentClient
-
getCurrentClient
-
getInputInCoordinates
public int[] getInputInCoordinates(java.lang.String compassInput)This method translates compass directions (N,S,E,...) into coordinates.- Parameters:
compassInput- Compass direction to be translated.- Returns:
- Variation in coordinates
-
getMoveInput
public int[] getMoveInput()Asks to the player where he wants to move his worker and then translates the input into coordinates.- Returns:
- The coordinates' variation of the chosen movement.
-
wantToMoveAgain
public boolean wantToMoveAgain()Allows to manage the will to move again.- Returns:
- True if the player wants to move again, False otherwise.
-
wantToMoveEnemy
public boolean wantToMoveEnemy()Allows to manage the will of moving an enemy on the board.- Returns:
- True if the player wants to do it, false otherwise.
-
forceMoveEnemy
Allows to manage the constriction of moving an enemy worker.- Parameters:
enemyWorkers- It's the list of the detected enemyWorkers nearby.worker- It's the worker has selected for this turn.- Returns:
- The worker the player has chosen to move.
-
displayBoard
public void displayBoard()Prompts the view to display the board. -
getBuildInputAtlas
public int[] getBuildInputAtlas()Asks to the player where he wants to make his worker build and what kind of building, then translates the input into coordinates and type of building. This method is specifically used when playing with Atlas.- Returns:
- Coordinates' variation and type of building.
-
getBuildInput
public int[] getBuildInput()Asks to the player where he wants to make his worker build and then translates the input into coordinates.- Returns:
- Coordinates' variation.
-
wantToBuildAgain
Allows to translate the players' answer to the will of build another time, all related to a specific God.- Parameters:
god- It's the specific god of the player.- Returns:
- True for the will of build, False otherwise.
-
errorMoveScreen
public void errorMoveScreen()Allows to call the viewClient to print the error when a wrong move input was given to the server. -
errorMoveDecisionScreen
public boolean errorMoveDecisionScreen()Allows to manage the decision of the player to retry the move of his worker.- Returns:
- True if the player wants to retry.
-
errorBuildDecisionScreen
public boolean errorBuildDecisionScreen()Allows to manage the decision of the player to retry the build of his worker.- Returns:
- True if the player wants to retry.
-
errorBuildInSamePosition
public void errorBuildInSamePosition()Allows to manage the error when there's not the possibility to build in the same position. -
errorBuildScreen
public void errorBuildScreen()Allows to manage the error saw by the player when his building phase fails. -
errorBuildBlockScreen
public void errorBuildBlockScreen()Allows to manage the error saw by the player when his block cannot be built -
cannotBuildDomeUnderneath
public void cannotBuildDomeUnderneath()Warns user of invalid build action: he cannot build a dome underneath himself. This error can only occur if player uses Zeus' power.
-