java.lang.Object
All Implemented Interfaces:
RuleSetStrategy

public class Push
extends MovementStrategy
Kick opponent workers when moving

This effect alters the workers' walkable cells: workers can push opponent an opponent worker in the cell behind them (see GameBoard.getCellBehind(Cell, Cell))

  • Constructor Details

  • Method Details

    • 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
      • the target cell is a walkable cell (see getWalkableCells(Worker)) for the worker to be moved
      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 (domes do not count) and has no dome built on it; a worker can walk on a cell occupied by another worker if it can be pushed (see canPush(Cell, Cell))

      Specified by:
      getWalkableCells in interface RuleSetStrategy
      Overrides:
      getWalkableCells in class RuleSetBase
      Parameters:
      worker - the worker to be moved
      Returns:
      a list of walkable cells
    • 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