public class Unit extends GameObject
Modifier and Type | Field and Description |
---|---|
boolean |
acted
Whether this Unit has performed its action this turn.
|
double |
energy
The amount of energy this Unit has (from 0.0 to 100.0).
|
int |
food
The amount of food this Unit is holding.
|
Job |
job
The Job this Unit was recruited to do.
|
int |
materials
The amount of materials this Unit is holding.
|
Tile |
movementTarget
The tile this Unit is moving to.
|
int |
moves
How many moves this Unit has left this turn.
|
Player |
owner
The Player that owns and can control this Unit, or null if the Unit is neutral.
|
java.util.List<Unit> |
squad
The Units in the same squad as this Unit.
|
boolean |
starving
Whether this Unit is starving.
|
Tile |
tile
The Tile this Unit is on.
|
int |
turnsToDie
The number of turns before this Unit dies.
|
logs
Modifier and Type | Method and Description |
---|---|
boolean |
attack(Tile tile)
Attacks an adjacent Tile.
|
boolean |
changeJob(java.lang.String job)
Changes this Unit's Job.
|
boolean |
construct(Tile tile,
java.lang.String type)
Constructs a Structure on an adjacent Tile.
|
boolean |
convert(Tile tile)
Converts an adjacent Unit to your side.
|
boolean |
deconstruct(Tile tile)
Removes materials from an adjacent Tile's Structure.
|
boolean |
drop(Tile tile,
java.lang.String resource)
Defaults the value for the optional arg 'amount' to '0'
|
boolean |
drop(Tile tile,
java.lang.String resource,
int amount)
Drops some of the given resource on or adjacent to the Unit's Tile.
|
boolean |
harvest(Tile tile)
Harvests the food on an adjacent Tile.
|
boolean |
move(Tile tile)
Moves this Unit from its current Tile to an adjacent Tile.
|
boolean |
pickup(Tile tile,
java.lang.String resource)
Defaults the value for the optional arg 'amount' to '0'
|
boolean |
pickup(Tile tile,
java.lang.String resource,
int amount)
Picks up some materials or food on or adjacent to the Unit's Tile.
|
boolean |
rest()
Regenerates energy.
|
log
public boolean acted
public double energy
public int food
public Job job
public int materials
public Tile movementTarget
public int moves
public Player owner
public java.util.List<Unit> squad
public boolean starving
public Tile tile
public int turnsToDie
public boolean attack(Tile tile)
tile
- The Tile to attack.public boolean changeJob(java.lang.String job)
job
- The name of the Job to change to.public boolean construct(Tile tile, java.lang.String type)
tile
- The Tile to construct the Structure on. It must have enough materials on it for a Structure to be constructed.type
- The type of Structure to construct on that Tile.public boolean convert(Tile tile)
tile
- The Tile with the Unit to convert.public boolean deconstruct(Tile tile)
tile
- The Tile to deconstruct. It must have a Structure on it.public boolean drop(Tile tile, java.lang.String resource)
drop(Tile, String, int)
public boolean drop(Tile tile, java.lang.String resource, int amount)
tile
- The Tile to drop materials/food on.resource
- The type of resource to drop ('materials' or 'food').amount
- The amount of the resource to drop. Amounts <= 0 will drop as much as possible.public boolean harvest(Tile tile)
tile
- The Tile you want to harvest.public boolean move(Tile tile)
tile
- The Tile this Unit should move to.public boolean pickup(Tile tile, java.lang.String resource)
pickup(Tile, String, int)
public boolean pickup(Tile tile, java.lang.String resource, int amount)
tile
- The Tile to pickup materials/food from.resource
- The type of resource to pickup ('materials' or 'food').amount
- The amount of the resource to pickup. Amounts <= 0 will pickup as much as possible.public boolean rest()
© 2020 MST ACM SIG-GAME