Class ChameleonTile
- java.lang.Object
-
- page.codeberg.terratactician_expandoria.world.tiles.Tile
-
- page.codeberg.terratactician_expandoria.world.tiles.ChameleonTile
-
public class ChameleonTile extends Tile
A chameleon tile can be used in chameleon mode, for visual purposes.
-
-
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 java.lang.String
text
Text displayed above this tile.Tile.TileType
type
Tile variant the chameleon tile is morphed into.-
Fields inherited from class page.codeberg.terratactician_expandoria.world.tiles.Tile
coord, reclaimTime
-
-
Constructor Summary
Constructors Constructor Description ChameleonTile()
Creates a coordinate less chameleon tile.ChameleonTile(CubeCoordinate coord)
Creates a chameleon tile with coordinates.ChameleonTile(CubeCoordinate coord, org.json.JSONObject data)
Creates a chameleon tile with a coordinate and extra json meta data.ChameleonTile(ChameleonTile other)
Create a copy/clone of a house.
-
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`.java.lang.String
getName()
Name of Tile in Api interface.org.json.JSONObject
serializeData()
Serializes extra Data of an Tile, to be send.ChameleonTile
withData(Tile.TileType type, java.lang.String text)
Short hand for.withType(type)
.withText(text)
Will only be applied when placing the tile.ChameleonTile
withText(java.lang.String text)
Set debug text displayed above..ChameleonTile
withType(Tile.TileType type)
Set tile type.-
Methods inherited from class page.codeberg.terratactician_expandoria.world.tiles.Tile
deserialize, deserialize, getCoordinate, reclaimable, serialize, takeable, toString
-
-
-
-
Field Detail
-
type
public Tile.TileType type
Tile variant the chameleon tile is morphed into.
-
text
public java.lang.String text
Text displayed above this tile.
-
-
Constructor Detail
-
ChameleonTile
public ChameleonTile()
Creates a coordinate less chameleon tile.
-
ChameleonTile
public ChameleonTile(CubeCoordinate coord)
Creates a chameleon tile with coordinates.- Parameters:
coord
- coordinate of the chameleon tile
-
ChameleonTile
public ChameleonTile(ChameleonTile other)
Create a copy/clone of a house.- Parameters:
other
- tile to clone
-
ChameleonTile
public ChameleonTile(CubeCoordinate coord, org.json.JSONObject data)
Creates a chameleon tile 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.
-
withText
public ChameleonTile withText(java.lang.String text)
Set debug text displayed above.. Is only effective when this instance is send to the game. e.g. via a place action. To change a tile, useConfigureChameleonTileAction
instead.- Parameters:
text
- displayed text- Returns:
- reference to this
-
withType
public ChameleonTile withType(Tile.TileType type) throws java.lang.IllegalArgumentException
Set tile type. Is only effective when this instance is send to the game. e.g. via a place action. To change a tile, useConfigureChameleonTileAction
instead.- Parameters:
type
- Tile variant the chameleon tile should morph into.- Returns:
- reference to this
- Throws:
java.lang.IllegalArgumentException
- gets thrown if this is not a valid tile type.
-
withData
public ChameleonTile withData(Tile.TileType type, java.lang.String text)
Short hand for.withType(type)
.withText(text)
Will only be applied when placing the tile. UseConfigureChameleonTileAction
to change an existing tile.- Parameters:
type
- Tile variant the chameleon tile should morph into.text
- displayed text- Returns:
- reference to 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
-
-