java.lang.Object
it.polimi.ingsw.model.rules.RuleSetBase
it.polimi.ingsw.model.godCardsEffects.winConditionEffects.WinConditionStrategy
it.polimi.ingsw.model.godCardsEffects.winConditionEffects.Down2Levels
- All Implemented Interfaces:
RuleSetStrategy
public class Down2Levels extends WinConditionStrategy
Jump down two levels to win
This effect alters the player win conditions: the default rule (move on a level 3 structure) still applies, and an additional one is added: if a worker performs a movement action between two cells which height difference is at least 2 (only going from a taller building to a lower one), the player immediately wins. The movement must be performed by the worker (forced is not moved)
-
Field Summary
Fields inherited from class it.polimi.ingsw.model.rules.RuleSetBase
buildsAvailable, game, hasMovedUp, movedWorker, movesAvailable, movesUpAvailable, startingCell
-
Constructor Summary
Constructors Constructor Description Down2Levels()
Default constructor -
Method Summary
Modifier and Type Method Description boolean
checkWinCondition(MoveAction action)
Determines if the win conditions are satisfied upon a movement actionRuleSetStrategy
cloneStrategy(Game game)
Creates a clone of this objectMethods inherited from class it.polimi.ingsw.model.rules.RuleSetBase
addBuildableCells, addWalkableCells, canBuild, canEndTurn, canEndTurnAutomatically, checkLoseCondition, checkLoseCondition, checkLoseCondition, doEffect, getBlocks, getBuildableCells, getBuildsAvailable, getMovedWorker, getMovesAvailable, getMovesUpAvailable, getPossibleActions, getWalkableCells, hasMovedUp, initialize, isBuildActionValid, isCorrectBlock, isCorrectDistance, isInsideBuildableCells, isInsideWalkableCells, isMoveActionValid, setGame, setMovesUpAvailable
-
Constructor Details
-
Down2Levels
public Down2Levels()Default constructor- See Also:
RuleSetBase.initialize()
-
-
Method Details
-
checkWinCondition
Determines if the win conditions are satisfied upon a movement actionUsing this ruleSet, a player can win upon moving (following the rules already defined in RuleSetBase.isMoveActionValid(MoveAction)) on a level 3 building OR upon jumping to a cell at least two levels shorter than the starting block
- Specified by:
checkWinCondition
in interfaceRuleSetStrategy
- Overrides:
checkWinCondition
in classRuleSetBase
- Parameters:
action
- the action to analyze- Returns:
- true if the action led to victory, false otherwise
-
cloneStrategy
Creates a clone of this object- Specified by:
cloneStrategy
in interfaceRuleSetStrategy
- Overrides:
cloneStrategy
in classRuleSetBase
- Parameters:
game
- the current game- Returns:
- a clone of this object
-