Package it.polimi.ingsw.server.model
Class Worker
java.lang.Object
it.polimi.ingsw.server.model.Worker
public class Worker
extends java.lang.Object
The worker owned by a player.
Actions of the player in the game will be referred to the selected worker in each turn.
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description voidbuildBlock(int x, int y)The worker builds a new block in the specified cell.voidbuildDome(int x, int y)The worker builds a new dome in the specified cell.WorkerBuildMapgetBuildMap()intgetLevel()intgetLevelVariation()WorkerMoveMapgetMoveMap()PlayergetPlayer()CellgetPosition()SexgetSex()voidsetPosition(int x, int y)Changes position of the worker and updates level and movedUp.voidsetPosition(Cell newPosition)Changes position of the worker and updates level and movedUp.voidswapPosition(Cell newPosition)Swaps the Worker with the other worker in the newPosition.
-
Constructor Details
-
Worker
Creates a worker.- Parameters:
player- The worker's owner.sex- A worker can be Male or Female.
-
-
Method Details
-
setPosition
public void setPosition(int x, int y)Changes position of the worker and updates level and movedUp.- Parameters:
x- Coordinate of the new position of the worker.y- Coordinate of the new position of the worker.
-
setPosition
Changes position of the worker and updates level and movedUp.- Parameters:
newPosition- Cell the worker is moving into.
-
swapPosition
Swaps the Worker with the other worker in the newPosition. Assumes that there is a worker in the newPosition. If there's no one this method should not be invoked.- Parameters:
newPosition- Cell the worker wants to move into.
-
buildBlock
public void buildBlock(int x, int y)The worker builds a new block in the specified cell.- Parameters:
x- Coordinate of the position to build in.y- Coordinate of the position to build in.
-
buildDome
public void buildDome(int x, int y)The worker builds a new dome in the specified cell.- Parameters:
x- Coordinate of the position to build in.y- Coordinate of the position to build in.
-
getPlayer
- Returns:
- The specific player that owns this worker.
-
getPosition
- Returns:
- The specific cell of the board of the game where the worker stands on.
-
getLevel
public int getLevel()- Returns:
- The level of the cell of the board where the worker stands on.
-
getLevelVariation
public int getLevelVariation()- Returns:
- When the worker moves, the difference between the levels of the cells is the level variation.
-
getSex
-
getMoveMap
-
getBuildMap
-