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 CelltargetCellprotected WorkertargetWorker -
Constructor Summary
-
Method Summary
Modifier and Type Method Description abstract voidapply()Forces an action to be appliedCellgetStartingCell()startingCell getterCellgetTargetCell()targetCell getterWorkergetTargetWorker()targetWorker getterabstract voidgetValidation(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
-