UnitTemplate.UnitTemplateView

public static class UnitTemplateView extends TemplateView implements Serializable

An immutable representation of a UnitTemplate.

Constructors

UnitTemplateView

public UnitTemplateView(UnitTemplate template)

Copy all information from a template and save it.

Parameters:
  • template

Methods

canAcceptGold

public boolean canAcceptGold()

Get whether units with this template can successfully be the target of a deposit action by a unit carrying gold.

Returns:Whether this template makes units that can be the target of a gold deposit.

canAcceptWood

public boolean canAcceptWood()

Get whether units with this template can successfully be the target of a deposit action by a unit carrying wood.

Returns:Whether this template makes units that can be the target of a wood deposit.

canAttack

public boolean canAttack()

Get whether units with this template can make attacks.

Returns:true if this template makes units that can attack, false if it makes units that cannot attack.

canBuild

public boolean canBuild()

Get whether units with this template uses the build action to make things. This is independent of whether the template can actually make anything.

Returns:true if this template makes units with build actions, false if produce actions are used instead.

canGather

public boolean canGather()

canMove

public boolean canMove()

Get whether units with this template can move

Returns:true if this template makes units that can move, false if it makes units that can’t move (like buildings)

canProduce

public boolean canProduce(Integer templateID)

Get whether units with this template are able to make a specific other template. This includes making by either building or producing. Currently just a List.contains()

Parameters:
  • templateID – The ID of the template that may be able to BE produced.
Returns:

Whether this template can make the template in the parameter.

getArmor

public int getArmor()

Get the armor of units with this template. Higher armor causes greater reduction of the Basic Attack component of damage.

Returns:The amount of armor of units with this template.

getBaseHealth

public int getBaseHealth()

Get the starting health of units with this template.

Returns:The amount of health/hit points that units made with this template start with.

getBasicAttack

public int getBasicAttack()

Get the Basic Attack of units with this template. This is one of the fields used in damage calculations. It represents the portion of the attack that can be mitigated with armor.

Returns:The Basic Attack of units with this template.

getCharacter

public char getCharacter()

Get the character to be used in visualization.

Returns:The character to be used in visualization.

getDurationAttack

public int getDurationAttack()

Get the duration of a primitive attack action. This is the base amount for how many consecutive steps the primitive action needs to be repeated before it has an effect. Actual number of steps may depend on other factors, determined by the Planner and Model being used.

Returns:The base duration of a primitive attack action.

getDurationDeposit

public int getDurationDeposit()

Get the duration of a primitive deposit action. This is the base amount for how many consecutive steps the primitive action needs to be repeated before it has an effect. Actual number of steps may depend on other factors, determined by the Planner and Model being used.

Returns:The base duration of a primitive deposit action.

getDurationGatherGold

public int getDurationGatherGold()

Get the duration of a primitive gather action on a gold mine. This is the base amount for how many consecutive steps the primitive action needs to be repeated before it has an effect. Actual number of steps may depend on other factors, determined by the Planner and Model being used.

Returns:The base duration of a primitive gather action on a gold mine.

getDurationGatherWood

public int getDurationGatherWood()

Get the duration of a primitive gather action on a tree. This is the base amount for how many consecutive steps the primitive action needs to be repeated before it has an effect. Actual number of steps may depend on other factors, determined by the Planner and Model being used.

Returns:The base duration of a primitive gather action on a tree.

getDurationMove

public int getDurationMove()

Get the duration of a primitive move action. This is the base amount for how many consecutive steps the primitive action needs to be repeated before it has an effect. Actual number of steps may depend on other factors, determined by the Planner and Model being used.

Returns:The base duration of a primitive move action.

getFoodProvided

public int getFoodProvided()

Get the amount of food provided by a unit with this template.

Returns:The amount of food/supply that units made with this template provide.

getPiercingAttack

public int getPiercingAttack()

Get the Piercing Attack of units with this template. This is one of the fields used in damage calculations. It represents the portion of the attack that is unaffected by armor.

Returns:The Piercing Attack of units with this template.

getProduces

public List<Integer> getProduces()

Get a list of template ids that can be produced by this unit. The list is unmodifiable.

Returns:A list of ids of templates this unit can make.

getRange

public int getRange()

Get the maximum distance at which units with this template are able to make successful attacks.

Returns:The range of attack for units with this template.

getSightRange

public int getSightRange()

Get the sight range of units with this template. A unit “sees” only units and events that occur at distances not exceeding it’s sight range. In partially observable maps, an agent is only able to observe events and units that can be seen by units it controls.