java.lang.Object
it.polimi.ingsw.model.rules.RuleSetBase
it.polimi.ingsw.model.godCardsEffects.movementEffects.MovementStrategy
it.polimi.ingsw.model.godCardsEffects.movementEffects.Push
- 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))
-
Field Summary
Fields inherited from class it.polimi.ingsw.model.rules.RuleSetBase
buildsAvailable, game, hasMovedUp, movedWorker, movesAvailable, movesUpAvailable, startingCell -
Constructor Summary
Constructors Constructor Description Push()Default constructor -
Method Summary
Modifier and Type Method Description RuleSetStrategycloneStrategy(Game game)Creates a clone of this objectjava.util.List<Cell>getWalkableCells(Worker worker)Provides a list of cells on which the worker can walk onbooleanisMoveActionValid(MoveAction action)Determines if a moveAction is legal and applies itMethods inherited from class it.polimi.ingsw.model.godCardsEffects.movementEffects.MovementStrategy
canGo, isNotSameOwnerMethods inherited from class it.polimi.ingsw.model.rules.RuleSetBase
addBuildableCells, addWalkableCells, canBuild, canEndTurn, canEndTurnAutomatically, checkLoseCondition, checkLoseCondition, checkLoseCondition, checkWinCondition, doEffect, getBlocks, getBuildableCells, getBuildsAvailable, getMovedWorker, getMovesAvailable, getMovesUpAvailable, getPossibleActions, hasMovedUp, initialize, isBuildActionValid, isCorrectBlock, isCorrectDistance, isInsideBuildableCells, isInsideWalkableCells, setGame, setMovesUpAvailable
-
Constructor Details
-
Push
public Push()Default constructor- See Also:
RuleSetBase.initialize()
-
-
Method Details
-
isMoveActionValid
Determines if a moveAction is legal and applies itg 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:
isMoveActionValidin interfaceRuleSetStrategy- Overrides:
isMoveActionValidin classRuleSetBase- Parameters:
action- the movement action to validate- Returns:
- true if the action has been applied, false otherwise
-
getWalkableCells
Provides a list of cells on which the worker can walk onUsing 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:
getWalkableCellsin interfaceRuleSetStrategy- Overrides:
getWalkableCellsin classRuleSetBase- Parameters:
worker- the worker to be moved- Returns:
- a list of walkable cells
-
cloneStrategy
Creates a clone of this object- Specified by:
cloneStrategyin interfaceRuleSetStrategy- Overrides:
cloneStrategyin classRuleSetBase- Parameters:
game- the current game- Returns:
- a clone of this object
-