java.lang.Object
All Implemented Interfaces:
RuleSetStrategy

public class MoveAgain
extends MovementStrategy
Move, move(optional), build

This effect alters the player's movement actions; the player must perform a movement action, then it can choose to perform another movement action (it cannot move on the same cell its worker started the turn on); after that, it must perform a build action to end its turn

  • Constructor Details

  • Method Details

    • initialize

      public void initialize()
      Sets the parameters for a new turn

      Using this ruleSet, a player is granted two movement and one building action, to be performed by the same worker following the rules mentioned in the class documentation.

      Overrides:
      initialize in class RuleSetBase
    • doEffect

      public void doEffect()
      Applies end turn effects

      Using this ruleSet, the end turn effects simply resets the attributes changed during the turn

      Specified by:
      doEffect in interface RuleSetStrategy
      Overrides:
      doEffect in class RuleSetBase
    • getPossibleActions

      public java.util.List<PossibleActions> getPossibleActions​(Worker worker)
      Provides a list of possible actions for a player to perform, based on the chosen worker

      g this ruleSet, the possible actions for a worker are:

      • Change Worker/Move, if the worker has not been moved yet
      • Move, Build, if the worker has been moved once
      • Build, if the worker has been moved once
      • None, in any other case
      Specified by:
      getPossibleActions in interface RuleSetStrategy
      Overrides:
      getPossibleActions in class RuleSetBase
      Parameters:
      worker - the worker to perform an action with
      Returns:
      a list of possible performable actions
    • isMoveActionValid

      public boolean isMoveActionValid​(MoveAction action)
      Determines if a moveAction is legal and applies it

      g this ruleSet, a movement action is considered valid if the following conditions are all true:

      • no worker has been moved yet during the turn OR the worker to be moved has already been moved once during the turn
      • the target cell is a walkable cell (see getWalkableCells(Worker)) for the worker to be moved
      • in case of the second movement, the target cell must not be the same as the cell from which the worker started its turn
      Specified by:
      isMoveActionValid in interface RuleSetStrategy
      Overrides:
      isMoveActionValid in class RuleSetBase
      Parameters:
      action - the movement action to validate
      Returns:
      true if the action has been applied, false otherwise
    • getWalkableCells

      public java.util.List<Cell> getWalkableCells​(Worker worker)
      Provides a list of cells on which the worker can walk on

      Using this ruleSet, a worker can walk on the cells adjacent to its starting cell which height difference is at most one compared to the starting cell; in case the player decides to move a second time, the worker can move into a cell adjacent to its current position, except for the cell it started its turnn from

      Specified by:
      getWalkableCells in interface RuleSetStrategy
      Overrides:
      getWalkableCells in class RuleSetBase
      Parameters:
      worker - the worker to be moved
      Returns:
      a list of walkable cells
    • checkLoseCondition

      public boolean checkLoseCondition​(MoveAction moveAction)
      Determines if the lose conditions are satisfied upon a movement action

      Using this ruleSet, a player can lose upon a movement action if the worker which has been moved cannot build any block around it and it already used all of its movement actions

      Specified by:
      checkLoseCondition in interface RuleSetStrategy
      Overrides:
      checkLoseCondition in class RuleSetBase
      Parameters:
      moveAction - the action to analyze
      Returns:
      true if the action led to a loss, false otherwise
    • cloneStrategy

      public RuleSetStrategy cloneStrategy​(Game game)
      Creates a clone of this object
      Specified by:
      cloneStrategy in interface RuleSetStrategy
      Overrides:
      cloneStrategy in class RuleSetBase
      Parameters:
      game - the current game
      Returns:
      a clone of this object