|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.common.model.FreeColObject
net.sf.freecol.common.model.FreeColGameObjectType
net.sf.freecol.common.model.BuildableType
net.sf.freecol.common.model.UnitType
public final class UnitType
| Field Summary | |
|---|---|
private TypeCountMap<GoodsType> |
consumption
The goods consumed per turn when in a settlement. |
static int |
DEFAULT_DEFENCE
The default offence value. |
static int |
DEFAULT_OFFENCE
The default offence value. |
private EquipmentType |
defaultEquipment
Describe defaultEquipment here. |
private int |
defence
The defence of this UnitType. |
private GoodsType |
expertProduction
The expert production of this UnitType. |
private int |
hitPoints
The number of hit points this UnitType has. |
private int |
lineOfSight
The maximum distance of tiles this UnitType can observe. |
private int |
maximumAttrition
The maximum attrition this UnitType can accumulate without being destroyed. |
private int |
maximumExperience
The maximum experience a unit of this type can accumulate. |
private int |
movement
The initial moves of this UnitType. |
private int |
offence
The offence of this UnitType. |
private int |
price
The price of this UnitType. |
private int |
recruitProbability
The probability of recruiting a Unit of this type in Europe. |
private int |
scoreValue
How much a Unit of this type contributes to the Player's score. |
private int |
skill
The skill level of this UnitType. |
private UnitType |
skillTaught
The skill this UnitType teaches, mostly its own. |
private int |
space
The capacity of this UnitType. |
private int |
spaceTaken
The space taken by this UnitType. |
private java.util.List<UnitTypeChange> |
typeChanges
The possible type changes for this unit type. |
| Fields inherited from class net.sf.freecol.common.model.BuildableType |
|---|
NOTHING |
| Fields inherited from class net.sf.freecol.common.model.FreeColObject |
|---|
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, INFINITY, logger, NO_ID, PARTIAL_ATTRIBUTE, UNDEFINED, VALUE_TAG |
| Fields inherited from interface net.sf.freecol.common.model.Consumer |
|---|
BUILDING_PRIORITY, COLONY_PRIORITY, COMPARATOR, POPULATION_PRIORITY, UNIT_PRIORITY |
| Constructor Summary | |
|---|---|
UnitType(java.lang.String id,
Specification specification)
Creates a new UnitType instance. |
|
| Method Summary | |
|---|---|
boolean |
canBeBuilt()
Returns true if this UnitType can be built. |
boolean |
canBeUpgraded(UnitType newType,
UnitTypeChange.ChangeType changeType)
Return true if this UnitType can be upgraded to the given UnitType by the given means of education. |
boolean |
canCarryGoods()
Returns true if Units of this type can carry Goods. |
boolean |
canCarryUnits()
Returns true if Units of this type can carry other Units. |
int |
compareTo(UnitType other)
|
java.util.List<AbstractGoods> |
getConsumedGoods()
Returns a list of GoodsTypes this Consumer consumes. |
int |
getConsumptionOf(GoodsType goodsType)
Returns the number of units of the given GoodsType this UnitType consumes per turn (when in a settlement). |
EquipmentType[] |
getDefaultEquipment()
|
EquipmentType |
getDefaultEquipmentType()
Get the DefaultEquipment value. |
int |
getDefence()
Get the Defence value. |
int |
getEducationTurns(UnitType unitType)
Get the EducationTurns value. |
UnitType |
getEducationUnit(int maximumSkill)
Get a UnitType to learn with a level skill less or equal than given level |
GoodsType |
getExpertProduction()
Get the ExpertProduction value. |
int |
getHitPoints()
Get the HitPoints value. |
int |
getLineOfSight()
Get the LineOfSight value. |
int |
getMaximumAttrition()
Get the MaximumAttrition value. |
int |
getMaximumExperience()
Get the MaximumExperience value. |
int |
getMovement()
Get the Movement value. |
int |
getOffence()
Get the Offence value. |
int |
getPrice()
Get the Price value. |
int |
getPriority()
The priority of this Consumer. |
int |
getRecruitProbability()
Get the RecruitProbability value. |
int |
getScoreValue()
Get the ScoreValue value. |
int |
getSkill()
Get the Skill value. |
UnitType |
getSkillTaught()
Get the SkillTaught value. |
int |
getSpace()
Get the Space value. |
int |
getSpaceTaken()
Get the SpaceTaken value. |
UnitType |
getTargetType(UnitTypeChange.ChangeType changeType,
Player player)
Describe getUnitTypeChange method here. |
java.util.List<UnitTypeChange> |
getTypeChanges()
|
UnitTypeChange |
getUnitTypeChange(UnitType newType)
Returns the UnitTypeChange associated with the
given UnitType, or null if there is
none. |
UnitTypeChange |
getUnitTypeChange(UnitTypeChange.ChangeType changeType,
Player player)
Describe getUnitTypeChange method here. |
java.util.List<UnitType> |
getUnitTypesLearntInLostCity()
Get a list of UnitType which can learn in a lost city rumour |
java.lang.String |
getWorkingAsKey()
|
static java.lang.String |
getXMLElementTagName()
Returns the tag name of the root element representing this object. |
boolean |
hasPrice()
Returns true if this UnitType has a price. |
boolean |
hasSkill()
Returns true if this UnitType has a skill. |
boolean |
isAvailableTo(Player player)
Returns true if the UnitType is available to the given Player. |
boolean |
isNaval()
Is this a naval unit type? |
boolean |
isRecruitable()
If this UnitType is recruitable in Europe |
protected void |
readAttributes(javax.xml.stream.XMLStreamReader in)
Reads the attributes of this object from an XML stream. |
protected void |
readChild(javax.xml.stream.XMLStreamReader in)
Reads a child object. |
void |
setDefaultEquipmentType(EquipmentType newDefaultEquipment)
Set the DefaultEquipment value. |
void |
setDefence(int newDefence)
Set the Defence value. |
void |
setExpertProduction(GoodsType newExpertProduction)
Set the ExpertProduction value. |
void |
setHitPoints(int newHitPoints)
Set the HitPoints value. |
void |
setLineOfSight(int newLineOfSight)
Set the LineOfSight value. |
void |
setMaximumAttrition(int newMaximumAttrition)
Set the MaximumAttrition value. |
void |
setMaximumExperience(int newMaximumExperience)
Set the MaximumExperience value. |
void |
setMovement(int newMovement)
Set the Movement value. |
void |
setOffence(int newOffence)
Set the Offence value. |
void |
setPrice(int newPrice)
Set the Price value. |
void |
setRecruitProbability(int newRecruitProbability)
Set the RecruitProbability value. |
void |
setScoreValue(int newScoreValue)
Set the ScoreValue value. |
void |
setSkill(int newSkill)
Set the Skill value. |
void |
setSkillTaught(UnitType newSkillTaught)
Set the SkillTaught value. |
void |
setSpace(int newSpace)
Set the Space value. |
void |
setSpaceTaken(int newSpaceTaken)
Set the SpaceTaken value. |
java.lang.String |
toString()
Debug print helper. |
protected void |
toXMLImpl(javax.xml.stream.XMLStreamWriter out)
Makes an XML-representation of this object. |
protected void |
writeAttributes(javax.xml.stream.XMLStreamWriter out)
Write the attributes of this object to a stream. |
protected void |
writeChildren(javax.xml.stream.XMLStreamWriter out)
Write the children of this object to a stream. |
| Methods inherited from class net.sf.freecol.common.model.BuildableType |
|---|
getAbilitiesRequired, getAmountRequiredOf, getGoodsRequired, getLimits, getPopulationRequired, needsGoodsToBuild, setGoodsRequired, setLimits, setPopulationRequired |
| Methods inherited from class net.sf.freecol.common.model.FreeColGameObjectType |
|---|
addAbility, addModifier, applyDifficultyLevel, getDescriptionKey, getFeatureContainer, getIndex, getModifierIndex, getModifierIndex, getModifierSet, getNameKey, hasAbility, hasAbility, isAbstractType, readChildren, setAbstractType, setFeatureContainer, setIndex, setModifierIndex, toXMLImpl |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface net.sf.freecol.common.model.Consumer |
|---|
getModifierSet, hasAbility |
| Field Detail |
|---|
public static final int DEFAULT_OFFENCE
public static final int DEFAULT_DEFENCE
private int offence
private int defence
private int space
private int hitPoints
private int spaceTaken
private int skill
private int price
private int movement
private int lineOfSight
private int recruitProbability
private GoodsType expertProduction
private int scoreValue
private int maximumExperience
private int maximumAttrition
private UnitType skillTaught
private EquipmentType defaultEquipment
private TypeCountMap<GoodsType> consumption
private java.util.List<UnitTypeChange> typeChanges
| Constructor Detail |
|---|
public UnitType(java.lang.String id,
Specification specification)
UnitType instance.
| Method Detail |
|---|
public final java.lang.String getWorkingAsKey()
public boolean canCarryUnits()
true if Units of this type can carry other Units.
boolean valuepublic boolean canCarryGoods()
true if Units of this type can carry Goods.
boolean valuepublic int getScoreValue()
ScoreValue value.
int valuepublic void setScoreValue(int newScoreValue)
ScoreValue value.
newScoreValue - The new ScoreValue value.public int getOffence()
Offence value.
int valuepublic void setOffence(int newOffence)
Offence value.
newOffence - The new Offence value.public int getDefence()
Defence value.
int valuepublic void setDefence(int newDefence)
Defence value.
newDefence - The new Defence value.public int getLineOfSight()
LineOfSight value.
int valuepublic void setLineOfSight(int newLineOfSight)
LineOfSight value.
newLineOfSight - The new Defence value.public int getSpace()
Space value.
int valuepublic void setSpace(int newSpace)
Space value.
newSpace - The new Space value.public int getHitPoints()
HitPoints value.
int valuepublic void setHitPoints(int newHitPoints)
HitPoints value.
newHitPoints - The new HitPoints value.public int getSpaceTaken()
SpaceTaken value.
int valuepublic void setSpaceTaken(int newSpaceTaken)
SpaceTaken value.
newSpaceTaken - The new SpaceTaken value.public boolean isRecruitable()
boolean valuepublic int getRecruitProbability()
RecruitProbability value.
int valuepublic void setRecruitProbability(int newRecruitProbability)
RecruitProbability value.
newRecruitProbability - The new RecruitProbability value.public int getSkill()
Skill value.
int valuepublic void setSkill(int newSkill)
Skill value.
newSkill - The new Skill value.public int getPrice()
Price value.
int value
This returns the base price of the UnitType
For the actual price of the unit, use Europe.getUnitPrice(UnitType)public void setPrice(int newPrice)
Price value.
newPrice - The new Price value.public int getMovement()
Movement value.
int valuepublic void setMovement(int newMovement)
Movement value.
newMovement - The new Movement value.public final int getMaximumExperience()
MaximumExperience value.
int valuepublic final void setMaximumExperience(int newMaximumExperience)
MaximumExperience value.
newMaximumExperience - The new MaximumExperience value.public int getMaximumAttrition()
MaximumAttrition value.
int valuepublic void setMaximumAttrition(int newMaximumAttrition)
MaximumAttrition value.
newMaximumAttrition - The new MaximumAttrition value.public GoodsType getExpertProduction()
ExpertProduction value.
GoodsType valuepublic void setExpertProduction(GoodsType newExpertProduction)
ExpertProduction value.
newExpertProduction - The new ExpertProduction value.public EquipmentType getDefaultEquipmentType()
DefaultEquipment value.
EquipmentType valuepublic void setDefaultEquipmentType(EquipmentType newDefaultEquipment)
DefaultEquipment value.
newDefaultEquipment - The new DefaultEquipment value.public EquipmentType[] getDefaultEquipment()
public java.util.List<UnitTypeChange> getTypeChanges()
public UnitType getSkillTaught()
SkillTaught value.
UnitType valuepublic void setSkillTaught(UnitType newSkillTaught)
SkillTaught value.
newSkillTaught - The new SkillTaught value.public boolean isAvailableTo(Player player)
player - a Player value
boolean value
public UnitType getTargetType(UnitTypeChange.ChangeType changeType,
Player player)
getUnitTypeChange method here.
changeType - an UnitTypeChange.Type valueplayer - a Player value
UnitType value
public UnitTypeChange getUnitTypeChange(UnitTypeChange.ChangeType changeType,
Player player)
getUnitTypeChange method here.
changeType - an UnitTypeChange.Type valueplayer - a Player value
UnitType valuepublic UnitTypeChange getUnitTypeChange(UnitType newType)
UnitTypeChange associated with the
given UnitType, or null if there is
none.
newType - the target UnitType
public boolean canBeUpgraded(UnitType newType,
UnitTypeChange.ChangeType changeType)
newType - The UnitType to learn (may be null in the case
of attempting to move to a native settlement when the skill
taught there is still unknown).changeType - an ChangeType value
true if can learn the given UnitTypepublic java.util.List<UnitType> getUnitTypesLearntInLostCity()
UnitType with a skill equal or less than given
maximumpublic UnitType getEducationUnit(int maximumSkill)
maximumSkill - the maximum level skill which we are searching for
UnitType with a skill equal or less than given
maximumpublic int getEducationTurns(UnitType unitType)
EducationTurns value.
int valuepublic boolean isNaval()
public boolean hasSkill()
boolean valuepublic boolean canBeBuilt()
boolean valuepublic boolean hasPrice()
boolean valuepublic int getConsumptionOf(GoodsType goodsType)
public int compareTo(UnitType other)
compareTo in interface java.lang.Comparable<UnitType>public java.util.List<AbstractGoods> getConsumedGoods()
getConsumedGoods in interface ConsumerList valuepublic int getPriority()
getPriority in interface Consumerint value
protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
toXMLImpl in class FreeColGameObjectTypeout - The output stream.
javax.xml.stream.XMLStreamException - if there are any problems writing to the
stream.
protected void writeAttributes(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
writeAttributes in class BuildableTypeout - The target stream.
javax.xml.stream.XMLStreamException - if there are any problems writing to
the stream.
protected void writeChildren(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
writeChildren in class BuildableTypeout - The target stream.
javax.xml.stream.XMLStreamException - if there are any problems writing to
the stream.
protected void readAttributes(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
readAttributes in class FreeColGameObjectTypein - The XML input stream.
javax.xml.stream.XMLStreamException - if a problem was encountered
during parsing.
protected void readChild(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
readChild in class BuildableTypein - The XML stream to read.
javax.xml.stream.XMLStreamException - if an error occurspublic java.lang.String toString()
toString in class FreeColGameObjectTypepublic static java.lang.String getXMLElementTagName()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||