Class WorkerMoveMap

java.lang.Object
it.polimi.ingsw.server.model.WorkerMap
it.polimi.ingsw.server.model.WorkerMoveMap

public class WorkerMoveMap
extends WorkerMap
Represents the positions adjacent to the worker, in which he may or may not move, depending on the boolean value of the cell.
  • Constructor Details

  • Method Details

    • cannotMoveInDomeCell

      public void cannotMoveInDomeCell()
      Forbids worker to move in a cell occupied by a dome.
    • cannotMoveInOccupiedCell

      public void cannotMoveInOccupiedCell()
      Forbids worker to move in a cell occupied by a dome or another worker.
    • cannotMoveInFriendlyWorkerCell

      public void cannotMoveInFriendlyWorkerCell()
      Forbids worker to move in a cell occupied by the other worker of the same player.
    • cannotStayStill

      public void cannotStayStill()
      Forbids worker to not move.
    • isAllowedToMoveBoard

      public boolean isAllowedToMoveBoard​(int i, int j)
      Finds out if worker is allowed to move in a given cell of the board.
      Parameters:
      i - Board coordinate X.
      j - Board coordinate Y.
      Returns:
      True if it can move in cell, false otherwise.
    • isAllowedToMoveWorkersMap

      public boolean isAllowedToMoveWorkersMap​(int i, int j)
      Finds out if worker is allowed to move in a given cell of the moveMap.
      Parameters:
      i - moveMap coordinate X.
      j - moveMap coordinate Y.
      Returns:
      True if it can move in position, false otherwise.
    • updateMoveUpRestrictions

      public void updateMoveUpRestrictions()
      Allows or forbids player to move up based on the canMoveUp attribute of Player.
    • anyAvailableMovePosition

      public boolean anyAvailableMovePosition()
      Checks if the worker can move.
      Returns:
      Returns true if there is a cell the worker can move in, false otherwise.