java.lang.Object
it.polimi.ingsw.model.action.Action
- Direct Known Subclasses:
BuildAction
,MoveAction
public abstract class Action
extends java.lang.Object
Abstraction for Workers' actions
Each action
-
Field Summary
Fields Modifier and Type Field Description protected Cell
targetCell
protected Worker
targetWorker
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description abstract void
apply()
Forces an action to be appliedCell
getStartingCell()
startingCell getterCell
getTargetCell()
targetCell getterWorker
getTargetWorker()
targetWorker getterabstract void
getValidation(Game game)
Checks if the action can be performed, based on the game status
-
Field Details
-
Constructor Details
-
Action
Default constructor- Parameters:
targetWorker
- the worker performing the actiontargetCell
- the cell to perform the action on
-
-
Method Details
-
getTargetWorker
targetWorker getter- Returns:
- the worker performing the action
-
getStartingCell
startingCell getter- Returns:
- the worker's current position
-
getTargetCell
targetCell getter- Returns:
- the action's target cell
-
getValidation
Checks if the action can be performed, based on the game status- Parameters:
game
- the game object which validates the action- Throws:
IllegalActionException
- if the action cannot be performed
-
apply
public abstract void apply()Forces an action to be applied
-