public class Unit extends GameObject
Modifier and Type | Field and Description |
---|---|
boolean |
acted
Whether this Unit has performed its action this turn.
|
int |
crew
How many crew are on this Tile.
|
int |
crewHealth
How much total health the crew on this Tile have.
|
int |
gold
How much gold this Unit is carrying.
|
int |
moves
How many more times this Unit may move this turn.
|
Player |
owner
The Player that owns and can control this Unit, or null if the Unit is neutral.
|
java.util.List<Tile> |
path
(Merchants only) The path this Unit will follow.
|
int |
shipHealth
If a ship is on this Tile, how much health it has remaining.
|
int |
stunTurns
(Merchants only) The number of turns this merchant ship won't be able to move.
|
Port |
targetPort
(Merchants only) The Port this Unit is moving to.
|
Tile |
tile
The Tile this Unit is on.
|
logs
Modifier and Type | Method and Description |
---|---|
boolean |
attack(Tile tile,
java.lang.String target)
Attacks either the 'crew' or 'ship' on a Tile in range.
|
boolean |
bury(int amount)
Buries gold on this Unit's Tile.
|
boolean |
deposit()
Defaults the value for the optional arg 'amount' to '0'
|
boolean |
deposit(int amount)
Puts gold into an adjacent Port.
|
boolean |
dig()
Defaults the value for the optional arg 'amount' to '0'
|
boolean |
dig(int amount)
Digs up gold on this Unit's Tile.
|
boolean |
move(Tile tile)
Moves this Unit from its current Tile to an adjacent Tile.
|
boolean |
rest()
Regenerates this Unit's health.
|
boolean |
split(Tile tile)
Defaults the value for the optional arg 'amount' to '1'
|
boolean |
split(Tile tile,
int amount)
Defaults the value for the optional arg 'gold' to '0'
|
boolean |
split(Tile tile,
int amount,
int gold)
Moves a number of crew from this Unit to the given Tile.
|
boolean |
withdraw()
Defaults the value for the optional arg 'amount' to '0'
|
boolean |
withdraw(int amount)
Takes gold from the Player.
|
log
public boolean acted
public int crew
public int crewHealth
public int gold
public int moves
public Player owner
public java.util.List<Tile> path
public int shipHealth
public int stunTurns
public Port targetPort
public Tile tile
public boolean attack(Tile tile, java.lang.String target)
tile
- The Tile to attack.target
- Whether to attack 'crew' or 'ship'. Crew deal damage to crew and ships deal damage to ships. Consumes any remaining moves.public boolean bury(int amount)
amount
- How much gold this Unit should bury. Amounts <= 0 will bury as much as possible.public boolean deposit()
deposit(int)
public boolean deposit(int amount)
amount
- The amount of gold to deposit. Amounts <= 0 will deposit all the gold on this Unit.public boolean dig()
dig(int)
public boolean dig(int amount)
amount
- How much gold this Unit should take. Amounts <= 0 will dig up as much as possible.public boolean move(Tile tile)
tile
- The Tile this Unit should move to.public boolean rest()
public boolean split(Tile tile)
split(Tile, int, int)
public boolean split(Tile tile, int amount)
split(Tile, int, int)
public boolean split(Tile tile, int amount, int gold)
tile
- The Tile to move the crew to.amount
- The number of crew to move onto that Tile. Amount <= 0 will move all the crew to that Tile.gold
- The amount of gold the crew should take with them. Gold < 0 will move all the gold to that Tile.public boolean withdraw()
withdraw(int)
public boolean withdraw(int amount)
amount
- The amount of gold to withdraw. Amounts <= 0 will withdraw everything.© 2020 MST ACM SIG-GAME