## edu.cwru.SimpleRTS.model.unit
Class UnitTemplate

    java.lang.Object
      edu.cwru.SimpleRTS.model.Template<Unit>
          edu.cwru.SimpleRTS.model.unit.UnitTemplate

All Implemented Interfaces:
  java.io.Serializable

    public class UnitTemplate

extends Template<Unit>
implements java.io.Serializable

Contains information about default and invariant attributes of units. The class itself contains some invariant attributes, but defaults, invariants and factory methods for specific types of units should be handles in concrete subclasses.

Author:
  Tim
See Also:
  Serialized Form

Nested Class Summary
`static class` `UnitTemplate.UnitTemplateView`

Nested classes/interfaces inherited from class edu.cwru.SimpleRTS.model.Template
`Template.TemplateView`

Field Summary

Fields inherited from class edu.cwru.SimpleRTS.model.Template
`ID`

Constructor Summary
`UnitTemplate()`

Method Summary
`void` `addProductionItem(java.lang.String item)`
`boolean` `canAcceptGold()`
`boolean` `canAcceptWood()`
`boolean` `canAttack()`
`boolean` `canBuild()`
`boolean` `canGather()`
`boolean` `canMove()`
`boolean` `canProduce(Template t)`
`int` `getArmor()`
`int` `getBaseHealth()`
`int` `getBasicAttack()`
`char` `getCharacter()`
`int` `getFoodProvided()`
`int` `getGatherRate(ResourceNode.Type type)`
`int` `getPiercingAttack()`
`int` `getRange()`
`int` `getSightRange()`
`java.lang.String` `getUnitName()`
`void` `namesToIds(java.util.List<UnitTemplate> unittemplates, java.util.List<UpgradeTemplate> upgradetemplates)` Turn this template's list of prerequisites and things it produces into their ids
`Unit` `produceInstance()` A factory method that produces copies of a "default" object
`void` `setArmor(int armor)`
`void` `setBaseHealth(int baseHealth)`
`void` `setBasicAttack(int basicAttack)`
`void` `setCanAcceptGold(boolean canAcceptGold)`
`void` `setCanAcceptWood(boolean canAcceptWood)`
`void` `setCanBuild(boolean canBuild)`
`void` `setCanGather(boolean canGather)`
`void` `setCanMove(boolean canMove)`
`void` `setCharacter(char character)`
`void` `setFoodProvided(int numFoodProvided)`
`void` `setGoldGatherRate(int goldpertrip)`
`void` `setPiercingAttack(int piercingAttack)`
`void` `setPrerequisite(Prerequisite prerequisite)`
`void` `setRange(int range)`
`void` `setSightRange(int sightRange)`
`void` `setUnitName(java.lang.String unitName)`
`void` `setWoodGatherRate(int woodpertrip)`
`java.lang.String` `toString()`

Methods inherited from class edu.cwru.SimpleRTS.model.Template
`addBuildPrereqItem, addUpgradePrereqItem, canProduce, equals, getFoodCost, getGoldCost, getName, getPlayer, getTimeCost, getView, getWoodCost, hashCode, reserveIDsUpTo, setFoodCost, setGoldCost, setName, setPlayer, setTimeCost, setWoodCost`

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### UnitTemplate

    public UnitTemplate()

Method Detail

### produceInstance

    public Unit produceInstance()

  Description copied from class: `Template`
  A factory method that produces copies of a "default" object

  Specified by:
    `produceInstance` in class `Template<Unit>`
  Returns:

### getUnitName

    public java.lang.String getUnitName()

### setUnitName

    public void setUnitName(java.lang.String unitName)

### getBaseHealth

    public int getBaseHealth()

### setBaseHealth

    public void setBaseHealth(int baseHealth)

### getCharacter

    public char getCharacter()

### setCharacter

    public void setCharacter(char character)

### getBasicAttack

    public int getBasicAttack()

### setBasicAttack

    public void setBasicAttack(int basicAttack)

### getPiercingAttack

    public int getPiercingAttack()

### setPiercingAttack

    public void setPiercingAttack(int piercingAttack)

### getRange

    public int getRange()

### setRange

    public void setRange(int range)

### getArmor

    public int getArmor()

### setArmor

    public void setArmor(int armor)

### getSightRange

    public int getSightRange()

### setSightRange

    public void setSightRange(int sightRange)

### setPrerequisite

    public void setPrerequisite(Prerequisite prerequisite)

### canAttack

    public boolean canAttack()

### canAcceptGold

    public boolean canAcceptGold()

### canAcceptWood

    public boolean canAcceptWood()

### setCanAcceptGold

    public void setCanAcceptGold(boolean canAcceptGold)

### setCanAcceptWood

    public void setCanAcceptWood(boolean canAcceptWood)

### getFoodProvided

    public int getFoodProvided()

### setFoodProvided

    public void setFoodProvided(int numFoodProvided)

### setGoldGatherRate

    public void setGoldGatherRate(int goldpertrip)

### setWoodGatherRate

    public void setWoodGatherRate(int woodpertrip)

### getGatherRate

    public int getGatherRate(ResourceNode.Type type)

### canGather

    public boolean canGather()

### setCanGather

    public void setCanGather(boolean canGather)

### canBuild

    public boolean canBuild()

### setCanBuild

    public void setCanBuild(boolean canBuild)

### canMove

    public boolean canMove()

### setCanMove

    public void setCanMove(boolean canMove)

### addProductionItem

    public void addProductionItem(java.lang.String item)

### canProduce

    public boolean canProduce(Template t)

### namesToIds

    public void namesToIds(java.util.List<UnitTemplate> unittemplates,
                           java.util.List<UpgradeTemplate> upgradetemplates)

  Description copied from class: `Template`
  Turn this template's list of prerequisites and things it produces into their ids

  Overrides:
    `namesToIds` in class `Template<Unit>`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`