java.lang.Object
it.polimi.ingsw.model.rules.RuleSetBase
it.polimi.ingsw.model.godCardsEffects.movementEffects.MovementStrategy
- All Implemented Interfaces:
RuleSetStrategy
public class MovementStrategy extends RuleSetBase
Effects subclass
Generalizes all the gods effects that affect player's movement actions
-
Field Summary
Fields inherited from class it.polimi.ingsw.model.rules.RuleSetBase
buildsAvailable, game, hasMovedUp, movedWorker, movesAvailable, movesUpAvailable, startingCell
-
Constructor Summary
Constructors Constructor Description MovementStrategy()
-
Method Summary
Modifier and Type Method Description protected boolean
canGo(Worker worker, Cell cell)
Determines if a given cell is reachable by a workerprotected boolean
isNotSameOwner(Cell cell)
Determines if a cell contains a worker which owner is the same as the strategy userMethods inherited from class it.polimi.ingsw.model.rules.RuleSetBase
addBuildableCells, addWalkableCells, canBuild, canEndTurn, canEndTurnAutomatically, checkLoseCondition, checkLoseCondition, checkLoseCondition, checkWinCondition, cloneStrategy, doEffect, getBlocks, getBuildableCells, getBuildsAvailable, getMovedWorker, getMovesAvailable, getMovesUpAvailable, getPossibleActions, getWalkableCells, hasMovedUp, initialize, isBuildActionValid, isCorrectBlock, isCorrectDistance, isInsideBuildableCells, isInsideWalkableCells, isMoveActionValid, setGame, setMovesUpAvailable
-
Constructor Details
-
MovementStrategy
public MovementStrategy()
-
-
Method Details
-
canGo
Determines if a given cell is reachable by a workerBy 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 movedcell
- the target cell- Returns:
- true if the worker can reach the cell, false otherwise
-
isNotSameOwner
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
-