Module AM37

Class MovementStrategy

java.lang.Object
it.polimi.ingsw.model.rules.RuleSetBase
it.polimi.ingsw.model.godCardsEffects.movementEffects.MovementStrategy
All Implemented Interfaces:
RuleSetStrategy
Direct Known Subclasses:
MoveAgain, Push, Swap

public class MovementStrategy
extends RuleSetBase
Effects subclass

Generalizes all the gods effects that affect player's movement actions

  • Constructor Details

  • Method Details

    • canGo

      protected boolean canGo​(Worker worker, Cell cell)
      Determines if a given cell is reachable by a worker

      By reachable we mean that the worker's cell and the target cell are adjacent and there is no dome on the target cell

      Parameters:
      worker - the worker to be moved
      cell - the target cell
      Returns:
      true if the worker can reach the cell, false otherwise
    • isNotSameOwner

      protected boolean isNotSameOwner​(Cell cell)
      Determines if a cell contains a worker which owner is the same as the strategy user
      Parameters:
      cell - the cell to check for a worker
      Returns:
      true if the target cell contains a worker owned by another player, false otherwise