Module AM37

Interface RuleSetStrategy

All Known Implementing Classes:
AffectMyTurnStrategy, AffectOpponentTurnStrategy, BuildAgainDifferentCell, BuildAgainSameCell, BuildBeforeAfterMovement, BuildDome, BuildingStrategy, CannotMoveUp, Down2Levels, MoveAgain, MovementStrategy, Push, RuleSetBase, Swap, WinConditionStrategy

public interface RuleSetStrategy
Strategy interface for the implementation of the Strategy pattern on the various gods effects
  • Method Details

    • doEffect

      void doEffect()
      Applies end turn effects
    • getMovesUpAvailable

      int getMovesUpAvailable()
      movesUpAvailable getter
      Returns:
      the number of moves available on a taller building
    • setMovesUpAvailable

      void setMovesUpAvailable​(int num)
      movesUpAvailable setter

      Used when an effect has a malus on other players' available moves

      Parameters:
      num - the number of moves up to be made available
    • getMovesAvailable

      int getMovesAvailable()
      movesAvailable getter
      Returns:
      the number of moves available
    • hasMovedUp

      boolean hasMovedUp()
      hasMovedUp getter
      Returns:
      true if the player moved up during the last turn, false otherwise
    • getBuildsAvailable

      int getBuildsAvailable()
      buildsAvailable getter
      Returns:
      the number of buildings the player can build
    • getMovedWorker

      Worker getMovedWorker()
      movedWorker getter
      Returns:
      the worker which has been moved during the last turn (can be null)
    • getPossibleActions

      java.util.List<PossibleActions> getPossibleActions​(Worker worker)
      Provides a list of possible actions for a player to perform, based on the chosen worker
      Parameters:
      worker - the worker to perform an action with
      Returns:
      a list of possible performable actions
    • isMoveActionValid

      boolean isMoveActionValid​(MoveAction action)
      Determines if a moveAction is legal and applies it
      Parameters:
      action - the movement action to validate
      Returns:
      true if the action has been applied, false otherwise
    • isBuildActionValid

      boolean isBuildActionValid​(BuildAction action)
      Determines if a buildAction is legal and applies it
      Parameters:
      action - the build action to validate
      Returns:
      true if the action has been applied, false otherwise
    • checkWinCondition

      boolean checkWinCondition​(MoveAction action)
      Determines if the win conditions are satisfied upon a movement action
      Parameters:
      action - the action to analyze
      Returns:
      true if the action led to victory, false otherwise
    • checkLoseCondition

      boolean checkLoseCondition​(MoveAction moveAction)
      Determines if the lose conditions are satisfied upon a movement action
      Parameters:
      moveAction - the action to analyze
      Returns:
      true if the action led to a loss, false otherwise
    • checkLoseCondition

      boolean checkLoseCondition()
      Checks if the turn can begin, checking for both players to be free
      Returns:
      true if there is at least one action to perform, false otherwise
    • checkLoseCondition

      boolean checkLoseCondition​(BuildAction buildAction)
      Determines if the lose conditions are satisfied upon a movement action
      Parameters:
      buildAction - the action to analyze
      Returns:
      true if the action led to a loss, false otherwise
    • getBuildableCells

      java.util.List<Cell> getBuildableCells​(Worker worker)
      Provides a list of cells on which the worker can build on
      Parameters:
      worker - the worker to build with
      Returns:
      a list of buildable cells
    • getBlocks

      java.util.List<Block> getBlocks​(Cell selectedCell)
      Provides the possible blocks buildable on a given cell
      Parameters:
      selectedCell - the cell to get the buildable blocks for
      Returns:
      a list of blocks that can be built on the given cell
    • getWalkableCells

      java.util.List<Cell> getWalkableCells​(Worker worker)
      Provides a list of cells on which the worker can walk on
      Parameters:
      worker - the worker to be moved
      Returns:
      a list of walkable cells
    • setGame

      void setGame​(Game game)
      game setter
      Parameters:
      game - the game in which the effect is used
    • canEndTurn

      boolean canEndTurn()
      Determines whether a player can end its turn
      Returns:
      true if the player can end its turn, false otherwise
    • canEndTurnAutomatically

      boolean canEndTurnAutomatically()
      Determines whether a player can end its turn

      This method should never be invoked directly from the player

      Returns:
      true if the player can end its turn, false otherwise
    • cloneStrategy

      RuleSetStrategy cloneStrategy​(Game game)
      Creates a clone of this object
      Parameters:
      game - the current game
      Returns:
      a clone of this object