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
    void cannotBuildDomeUnderneath()
    Warns user of invalid build action: he cannot build a dome underneath himself.
    void displayBoard()
    Prompts the view to display the board.
    void errorBuildBlockScreen()
    Allows to manage the error saw by the player when his block cannot be built
    boolean errorBuildDecisionScreen()
    Allows to manage the decision of the player to retry the build of his worker.
    void errorBuildInSamePosition()
    Allows to manage the error when there's not the possibility to build in the same position.
    void errorBuildScreen()
    Allows to manage the error saw by the player when his building phase fails.
    boolean errorMoveDecisionScreen()
    Allows to manage the decision of the player to retry the move of his worker.
    void errorMoveScreen()
    Allows to call the viewClient to print the error when a wrong move input was given to the server.
    Worker forceMoveEnemy​(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.
    VirtualView getCurrentClient()  
    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.
    void updateCurrentClient​(VirtualView client)  
    boolean wantToBuildAgain​(God god)
    Allows to translate the players' answer to the will of build another time, all related to a specific God.
    boolean wantToMoveAgain()
    Allows to manage the will to move again.
    boolean wantToMoveEnemy()
    Allows to manage the will of moving an enemy on the board.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • updateCurrentClient

      public void updateCurrentClient​(VirtualView client)
    • getCurrentClient

      public VirtualView 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

      public Worker forceMoveEnemy​(java.util.ArrayList<Worker> enemyWorkers, Worker worker)
      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

      public boolean wantToBuildAgain​(God god)
      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.