- 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 Summary
Modifier and Type Method Description boolean
canEndTurn()
Determines whether a player can end its turnboolean
canEndTurnAutomatically()
Determines whether a player can end its turnboolean
checkLoseCondition()
Checks if the turn can begin, checking for both players to be freeboolean
checkLoseCondition(BuildAction buildAction)
Determines if the lose conditions are satisfied upon a movement actionboolean
checkLoseCondition(MoveAction moveAction)
Determines if the lose conditions are satisfied upon a movement actionboolean
checkWinCondition(MoveAction action)
Determines if the win conditions are satisfied upon a movement actionRuleSetStrategy
cloneStrategy(Game game)
Creates a clone of this objectvoid
doEffect()
Applies end turn effectsjava.util.List<Block>
getBlocks(Cell selectedCell)
Provides the possible blocks buildable on a given celljava.util.List<Cell>
getBuildableCells(Worker worker)
Provides a list of cells on which the worker can build onint
getBuildsAvailable()
buildsAvailable getterWorker
getMovedWorker()
movedWorker getterint
getMovesAvailable()
movesAvailable getterint
getMovesUpAvailable()
movesUpAvailable getterjava.util.List<PossibleActions>
getPossibleActions(Worker worker)
Provides a list of possible actions for a player to perform, based on the chosen workerjava.util.List<Cell>
getWalkableCells(Worker worker)
Provides a list of cells on which the worker can walk onboolean
hasMovedUp()
hasMovedUp getterboolean
isBuildActionValid(BuildAction action)
Determines if a buildAction is legal and applies itboolean
isMoveActionValid(MoveAction action)
Determines if a moveAction is legal and applies itvoid
setGame(Game game)
game settervoid
setMovesUpAvailable(int num)
movesUpAvailable setter
-
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 setterUsed 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
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
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
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
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
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
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
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
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
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
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 turnThis method should never be invoked directly from the player
- Returns:
- true if the player can end its turn, false otherwise
-
cloneStrategy
Creates a clone of this object- Parameters:
game
- the current game- Returns:
- a clone of this object
-