Unit

public class Unit extends Target

Fields

cargoAmount

protected int cargoAmount

cargoType

protected ResourceType cargoType

currentDurativePrimitive

protected Action currentDurativePrimitive

currentDurativeProgress

protected int currentDurativeProgress

currentHealth

protected int currentHealth

template

protected UnitTemplate template

xPosition

protected int xPosition

yPosition

protected int yPosition

Constructors

Unit

public Unit(UnitTemplate template, int ID)

Methods

canAttack

public boolean canAttack()

canBuild

public boolean canBuild()

canGather

public boolean canGather()

canMove

public boolean canMove()

clearCargo

public void clearCargo()

deepEquals

public boolean deepEquals(Object other)

deprecateOldView

public void deprecateOldView()

equals

public boolean equals(Object o)

getActionProgressAmount

public int getActionProgressAmount()

Get the amount of progress toward the completion of a primitive action.

getActionProgressPrimitive

public Action getActionProgressPrimitive()

Get the primitive action that the unit is working towards.

getCharacter

public char getCharacter()

getCurrentCargoAmount

public int getCurrentCargoAmount()

getCurrentCargoType

public ResourceType getCurrentCargoType()

getCurrentHealth

public int getCurrentHealth()

getPlayer

public int getPlayer()

getTemplate

public UnitTemplate getTemplate()

getView

public UnitView getView()

getxPosition

public int getxPosition()

getyPosition

public int getyPosition()

hashCode

public int hashCode()

resetDurative

public void resetDurative()

setCargo

public boolean setCargo(ResourceType type, int amount)

setDurativeStatus

public void setDurativeStatus(Action primitive, int progress)

Set the status of durative actions.

Parameters:
  • primitive – The primitive action being worked towards.
  • progress – The amount of progress towards the primitive action.

setHP

public void setHP(int amount)

Set the health of this unit to a specific value.

Parameters:
  • amount – The new amount of hit points.

setxPosition

public void setxPosition(int x)

Set the x position of the unit. DO NOT USE THIS TO MOVE UNITS

Parameters:
  • x

setyPosition

public void setyPosition(int y)

Set the y position of the unit. DO NOT USE THIS TO MOVE UNITS

Parameters:
  • y

toString

public String toString()