Package com.takenoko.engine
Class Board
java.lang.Object
com.takenoko.engine.Board
Board class. The board contains the tiles.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BambooLayerprivate final BoardStatisticsprivate final GameAssetsprivate final Gardenerprivate final IrrigationLayerprivate final Panda(package private) intprivate final TileLayerprivate Weather -
Constructor Summary
ConstructorsConstructorDescriptionBoard()Constructor for the Board class.Board(TileLayer tileLayer, BambooLayer bambooLayer, Panda panda, Gardener gardener, GameAssets gameAssets, IrrigationLayer irrigationLayer, BoardStatistics boardStatistics) Constructor for the Board class. -
Method Summary
Modifier and TypeMethodDescriptionvoidanalyze()voidapplyImprovement(ImprovementType improvementType, PositionVector positionVector) voidchooseTileInTileDeck(Tile tile) copy()drawImprovement(ImprovementType improvementType) voidvoiddrawObjective(ObjectiveType objectiveType) voidvoideatBamboo(PositionVector positionVector) Eat a bamboo from a tile.booleanReturns the available tile positions.Return the list of available tiles.getBambooAt(PositionVector positionVector) Get the bamboo stack at the position.Get the Position of the GardenerReturns possible moves for the gardener.Get the Position of the PandaReturns possible moves for the panda.intReturn the list of objectives for the starting deckgetTileAt(PositionVector positionVector) Returns the tile at the position.getTiles()Returns a copy of the hashmap of tiles.Returns a copy of the hashmap of tiles without the pond.growBamboo(PositionVector positionVector) Grow bamboo on a tile.inthashCode()booleanbooleanhasImprovementInDeck(ImprovementType improvementType) booleanbooleanhasObjectiveTypeInDeck(ObjectiveType objectiveType) booleanisBambooEatableAt(PositionVector positionVector) Check if the bamboo at the position is eatable.booleanisBambooGrowableAt(PositionVector positionVector) booleanisIrrigatedAt(PositionVector position) booleanbooleanisTile(PositionVector positionVector) Returns if the position is a tile.booleanmoveGardener(PositionVector vector) Move the gardener with a vector.movePanda(PositionVector vector) Move the panda with a vector.voidReturns last improvement drawn.voidplaceIrrigation(EdgePosition edgePosition) placeTile(Tile tile, PositionVector position) Place a tile on the board.voidChanges the weather to null.voidvoidsetWeather(Weather weather) void
-
Field Details
-
tileLayer
-
bambooLayer
-
irrigationLayer
-
panda
-
gardener
-
gameAssets
-
weather
-
roundNumber
int roundNumber -
boardStatistics
-
-
Constructor Details
-
Board
public Board(TileLayer tileLayer, BambooLayer bambooLayer, Panda panda, Gardener gardener, GameAssets gameAssets, IrrigationLayer irrigationLayer, BoardStatistics boardStatistics) Constructor for the Board class.- Parameters:
tileLayer- the tile layerbambooLayer- the bamboo layerpanda- the pandagardener- the gardenergameAssets- the game assets : diceirrigationLayer- the irrigation layer
-
Board
public Board()Constructor for the Board class. -
Board
-
-
Method Details
-
rollWeather
public void rollWeather() -
peekWeather
-
getAvailableTiles
Return the list of available tiles.- Returns:
- the list of available tiles
-
getTiles
Returns a copy of the hashmap of tiles.- Returns:
- the map of tiles
-
getAvailableTilePositions
Returns the available tile positions.- Returns:
- the available tile positions
-
getTilesWithoutPond
Returns a copy of the hashmap of tiles without the pond.- Returns:
- the map of tiles without the pond
-
isTile
Returns if the position is a tile.- Parameters:
positionVector- the position of the tile- Returns:
- if there is a tile at the position
-
getTileAt
Returns the tile at the position.- Parameters:
positionVector- the position of the tile- Returns:
- the tile at the position
-
placeTile
Place a tile on the board. and update the available tiles and the available tile positions.- Parameters:
tile- the tile to add to the boardposition- the position of the tile- Returns:
- the LayerBambooStack at the position of the tile
-
getBambooAt
Get the bamboo stack at the position.- Parameters:
positionVector- the position of the tile
-
growBamboo
Grow bamboo on a tile. By default, the number of bamboo is 1 if the tile is irrigated.- Parameters:
positionVector- the position of the tile- Returns:
- the bamboo stack at the position
-
eatBamboo
Eat a bamboo from a tile.- Parameters:
positionVector- the position of the tile
-
isBambooEatableAt
Check if the bamboo at the position is eatable.- Parameters:
positionVector- the position of the tile- Returns:
- if the bamboo at the position is eatable
-
getPandaPosition
Get the Position of the Panda -
getGardenerPosition
Get the Position of the Gardener -
getPandaPossibleMoves
Returns possible moves for the panda.- Returns:
- the possible moves
-
getGardenerPossibleMoves
Returns possible moves for the gardener.- Returns:
- the possible moves
-
movePanda
Move the panda with a vector.- Parameters:
vector- the vector to move the panda- Returns:
- bamboo stack of one if the panda ate bamboo
-
moveGardener
Move the gardener with a vector.- Parameters:
vector- the vector to move the gardener- Returns:
- bamboo stack of one if the gardener planted bamboo
-
equals
-
hashCode
public int hashCode() -
copy
-
getWeather
-
setWeather
-
resetWeather
public void resetWeather()Changes the weather to null. This is used when the weather is over. -
isBambooGrowableAt
-
drawImprovement
- Parameters:
improvementType- the type of improvement- Returns:
- the improvement of the type
-
peekImprovement
Returns last improvement drawn.- Returns:
- the last improvement drawn
-
hasImprovementInDeck
- Parameters:
improvementType- the type of improvement- Returns:
- if the improvement is available
-
getAvailableImprovementPositions
-
drawTiles
public void drawTiles() -
peekTileDeck
-
chooseTileInTileDeck
-
isTileDeckEmpty
public boolean isTileDeckEmpty() -
applyImprovement
-
drawObjective
-
peekObjectiveDeck
-
isObjectiveDeckEmpty
public boolean isObjectiveDeckEmpty() -
drawIrrigation
public void drawIrrigation() -
hasIrrigation
public boolean hasIrrigation() -
updateAvailableIrrigationChannelPositions
-
placeIrrigation
-
getAvailableIrrigationPositions
-
isIrrigatedAt
-
getRoundNumber
public int getRoundNumber() -
nextRound
public void nextRound() -
getGrowablePositions
-
getStarterDeck
Return the list of objectives for the starting deck- Returns:
- list of objectives
-
getBoardStatistics
-
analyze
public void analyze() -
getPlacedIrrigations
-
hasImprovementInDeck
public boolean hasImprovementInDeck() -
hasObjectiveTypeInDeck
-