Class MarketplaceTile
- java.lang.Object
-
- page.codeberg.terratactician_expandoria.world.tiles.Tile
-
- page.codeberg.terratactician_expandoria.world.tiles.MarketplaceTile
-
public class MarketplaceTile extends Tile
A Marketplace is a tile producing money. This tile can sell food an materials for money.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class page.codeberg.terratactician_expandoria.world.tiles.Tile
Tile.TileType
-
-
Field Summary
Fields Modifier and Type Field Description Metrics
economy
contains a economy tracker of this marketplace.double
food
amount of food being solddouble
materials
amount of materials being sold-
Fields inherited from class page.codeberg.terratactician_expandoria.world.tiles.Tile
coord, reclaimTime
-
-
Constructor Summary
Constructors Constructor Description MarketplaceTile()
Creates a coordinate less market place tile.MarketplaceTile(CubeCoordinate coord)
Creates a market place with coordinates.MarketplaceTile(CubeCoordinate coord, org.json.JSONObject data)
Creates a market place with a coordinate and extra json meta data.MarketplaceTile(MarketplaceTile other)
Creates a copy/clone of a market place.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tile
clone()
Creates a clone of the tile.java.lang.String
dataToString()
Can be used by tile to add internal data to `toString`.Metrics
getEconomy()
Marketplaces trade materials and food for money.java.lang.String
getName()
Name of Tile in Api interface.org.json.JSONObject
serializeData()
Serializes extra Data of an Tile, to be send.MarketplaceTile
withFoodRatio(double food)
Sets ratio of food that should be sold in the area around this marketplace.MarketplaceTile
withMaterialsRatio(double materials)
Sets ratio of materials that should be sold in the area around this marketplace.MarketplaceTile
withRatio(double food, double materials)
Configure Marketplace sale ratio shorthand for.withFoodRatio(food)
.withMaterialsRatio(materials)
; Will only be applied when placing the tile.-
Methods inherited from class page.codeberg.terratactician_expandoria.world.tiles.Tile
deserialize, deserialize, getCoordinate, reclaimable, serialize, takeable, toString
-
-
-
-
Field Detail
-
food
public double food
amount of food being sold
-
materials
public double materials
amount of materials being sold
-
economy
public Metrics economy
contains a economy tracker of this marketplace. money is the earned money. food and materials are the sold goods. (note they are negative)
-
-
Constructor Detail
-
MarketplaceTile
public MarketplaceTile()
Creates a coordinate less market place tile.
-
MarketplaceTile
public MarketplaceTile(CubeCoordinate coord)
Creates a market place with coordinates.- Parameters:
coord
- coordinate of the market place
-
MarketplaceTile
public MarketplaceTile(MarketplaceTile other)
Creates a copy/clone of a market place.- Parameters:
other
- marketplace to clone
-
MarketplaceTile
public MarketplaceTile(CubeCoordinate coord, org.json.JSONObject data)
Creates a market place with a coordinate and extra json meta data.- Parameters:
coord
- coordinate of the tiledata
- extra data
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from class:Tile
Name of Tile in Api interface.
-
serializeData
public org.json.JSONObject serializeData()
Description copied from class:Tile
Serializes extra Data of an Tile, to be send.- Overrides:
serializeData
in classTile
- Returns:
- null or JSONObject with at least a valid "type" field.
-
getEconomy
public Metrics getEconomy()
Marketplaces trade materials and food for money. Use this method to get the total amount sold and money collected. Note: materials and food are negative, because you sold them and money is positive, because you got it.- Returns:
- Metrics object encoding Marketplace economy.
-
withRatio
public MarketplaceTile withRatio(double food, double materials)
Configure Marketplace sale ratio shorthand for.withFoodRatio(food)
.withMaterialsRatio(materials)
; Will only be applied when placing the tile. UseConfigureMarketplaceTileAction
to change an existing tile.- Parameters:
food
- Food sale ration [0,1]materials
- Materials sale ration [0,1]- Returns:
- reference to MarketplaceTile object
-
withFoodRatio
public MarketplaceTile withFoodRatio(double food)
Sets ratio of food that should be sold in the area around this marketplace. Will only be applied when placing the tile. UseConfigureMarketplaceTileAction
to change an existing tile.- Parameters:
food
- Materials sale ration [0,1]- Returns:
- returns this
-
withMaterialsRatio
public MarketplaceTile withMaterialsRatio(double materials)
Sets ratio of materials that should be sold in the area around this marketplace. Will only be applied when placing the tile. UseConfigureMarketplaceTileAction
to change an existing tile.- Parameters:
materials
- Materials sale ration [0,1]- Returns:
- returns this
-
dataToString
public java.lang.String dataToString()
Description copied from class:Tile
Can be used by tile to add internal data to `toString`. Returned string should start with: ", "- Overrides:
dataToString
in classTile
- Returns:
- additional data stringified
-
-