public class Unit extends GameObject
Modifier and Type | Field and Description |
---|---|
boolean |
acted
Whether or not this Unit has performed its action this turn (attack or build).
|
int |
health
The remaining health of a unit.
|
UnitJob |
job
The type of unit this is.
|
int |
moves
The number of moves this unit has left this turn.
|
Player |
owner
The Player that owns and can control this Unit.
|
Tile |
tile
The Tile this Unit is on.
|
logs
Modifier and Type | Method and Description |
---|---|
boolean |
attack(Tile tile)
Attacks an enemy tower on an adjacent tile.
|
boolean |
build(java.lang.String title)
Unit, if it is a worker, builds a tower on the tile it is on, only workers can do this.
|
boolean |
fish(Tile tile)
Stops adjacent to a river tile and begins fishing for mana.
|
boolean |
mine(Tile tile)
Enters a mine and is put to work gathering resources.
|
boolean |
move(Tile tile)
Moves this Unit from its current Tile to an adjacent Tile.
|
log
public boolean acted
public int health
public UnitJob job
public int moves
public Player owner
public Tile tile
public boolean attack(Tile tile)
tile
- The Tile to attack.public boolean build(java.lang.String title)
title
- The tower type to build, as a string.public boolean fish(Tile tile)
tile
- The tile the unit will stand on as it fishes.public boolean mine(Tile tile)
tile
- The tile the mine is located on.public boolean move(Tile tile)
tile
- The Tile this Unit should move to.© 2020 MST ACM SIG-GAME