UnitTemplate

public class UnitTemplate extends Template<Unit> implements Serializable

Contains information shared between units of the same type.

Author:Tim

Fields

armor

protected int armor

baseHealth

protected int baseHealth

basicAttack

protected int basicAttack

canAcceptGold

protected boolean canAcceptGold

canAcceptWood

protected boolean canAcceptWood

canBuild

protected boolean canBuild

canGather

protected boolean canGather

canMove

protected boolean canMove

character

protected char character

durationAttack

protected int durationAttack

durationDeposit

protected int durationDeposit

durationGoldGather

protected int durationGoldGather

durationMove

protected int durationMove

durationWoodGather

protected int durationWoodGather

foodProvided

protected int foodProvided

goldCapacity

protected int goldCapacity

goldGatherRate

protected int goldGatherRate

piercingAttack

protected int piercingAttack

range

protected int range

sightRange

protected int sightRange

woodCapacity

protected int woodCapacity

woodGatherRate

protected int woodGatherRate

Constructors

UnitTemplate

public UnitTemplate(int ID)

Methods

addProductionItem

public void addProductionItem(Integer item)

canAcceptGold

public boolean canAcceptGold()

canAcceptWood

public boolean canAcceptWood()

canAttack

public boolean canAttack()

canBuild

public boolean canBuild()

canGather

public boolean canGather()

canMove

public boolean canMove()

canProduce

public boolean canProduce(Template t)

Return whether the unit is capable of producing a specific template

Parameters:
  • t

deepEquals

public boolean deepEquals(Object other)

deprecateOldView

public void deprecateOldView()

getArmor

public int getArmor()

getBaseHealth

public int getBaseHealth()

getBasicAttack

public int getBasicAttack()

getCarryingCapacity

public int getCarryingCapacity(ResourceNode.Type type)

Return the amount of resource that you can gather from each node type.

Parameters:
  • type – The type of resource node to gather from.

getCharacter

public char getCharacter()

getDurationAttack

public int getDurationAttack()

Get the number of steps needed to make a single attack

getDurationDeposit

public int getDurationDeposit()

Get the number of steps needed to make a single deposit.

getDurationGatherGold

public int getDurationGatherGold()

Get the number of steps needed to make a single gather on a mine.

getDurationGatherWood

public int getDurationGatherWood()

Get the number of steps needed to make a single gather on a tree.

getDurationMove

public int getDurationMove()

Get the number of steps needed to make a single move.

getFoodProvided

public int getFoodProvided()

getGatherRate

public int getGatherRate(ResourceNode.Type type)

getPiercingAttack

public int getPiercingAttack()

getProduces

public List<Integer> getProduces()

Get a list of IDs of templates that this unit can make. Changing this list will alter the data of this template.

Returns:A list of IDs for templates that can be produced/built by this unit.

getRange

public int getRange()

getSightRange

public int getSightRange()

getView

public UnitTemplateView getView()

produceInstance

public Unit produceInstance(IDDistributer idsource)

setArmor

public void setArmor(int armor)

setBaseHealth

public void setBaseHealth(int baseHealth)

setBasicAttack

public void setBasicAttack(int basicAttack)

setCanAcceptGold

public void setCanAcceptGold(boolean canAcceptGold)

setCanAcceptWood

public void setCanAcceptWood(boolean canAcceptWood)

setCanBuild

public void setCanBuild(boolean canBuild)

setCanGather

public void setCanGather(boolean canGather)

setCanMove

public void setCanMove(boolean canMove)

setCharacter

public void setCharacter(char character)

setDurationAttack

public void setDurationAttack(int durationAttack)

Set the number of steps needed to make a single attack

Parameters:
  • durationAttack

setDurationDeposit

public void setDurationDeposit(int durationDeposit)

Set the number of steps needed to make a single deposit.

Parameters:
  • durationDeposit

setDurationGatherGold

public void setDurationGatherGold(int durationGoldGather)

Set the number of steps needed to make a single gather on a mine.

Parameters:
  • durationGoldGather

setDurationGatherWood

public void setDurationGatherWood(int durationWoodGather)

Set the number of steps needed to make a single gather on a tree.

Parameters:
  • durationWoodGather

setDurationMove

public void setDurationMove(int durationMove)

Set the number of steps needed to make a single move.

Parameters:
  • durationMove

setFoodProvided

public void setFoodProvided(int numFoodProvided)

setGoldGatherRate

public void setGoldGatherRate(int goldpertrip)

setPiercingAttack

public void setPiercingAttack(int piercingAttack)

setRange

public void setRange(int range)

setSightRange

public void setSightRange(int sightRange)

setWoodGatherRate

public void setWoodGatherRate(int woodpertrip)

toString

public String toString()