public class EquipmentType extends BuildableType
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
BY_INDIANS_TAG |
private static java.lang.String |
CAPTURE_EQUIPMENT_TAG |
private boolean |
captureEquipmentByIndians |
private java.lang.String |
captureEquipmentId
What this equipment type becomes if it is captured by Indians
(if captureEquipmentByIndians is true) or Europeans (otherwise).
|
private static java.lang.String |
COMBAT_LOSS_PRIORITY_TAG |
private int |
combatLossPriority
Determines which type of Equipment will be lost first if the
Unit carrying it is defeated.
|
private static java.lang.String |
COMPATIBLE_EQUIPMENT_TAG |
private java.util.List<java.lang.String> |
compatibleEquipment
A list containing the object identifiers of equipment types
compatible with this one.
|
private static java.lang.String |
MAXIMUM_COUNT_TAG |
private int |
maximumCount
The maximum number of equipment items that can be combined.
|
private boolean |
militaryEquipment
Is this military equipment?
|
static EquipmentType[] |
NO_EQUIPMENT |
private static java.lang.String |
REQUIRED_LOCATION_ABILITY_TAG |
private Role |
role
The default Role of the Unit carrying this type of Equipment.
|
private static java.lang.String |
ROLE_TAG |
REQUIRED_POPULATION_TAG
DELETE_TAG, EXTENDS_TAG, PRESERVE_TAG
ARRAY_SIZE_TAG, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, INFINITY, logger, UNDEFINED, VALUE_TAG
Constructor and Description |
---|
EquipmentType(java.lang.String id,
Specification specification)
Simple constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
addCompatibleEquipment(java.lang.String equipmentId)
Add a compatible equipment identifier.
|
boolean |
canBeCaptured()
Can this equipment type be captured in combat?
|
boolean |
equals(java.lang.Object obj) |
EquipmentType |
getCaptureEquipment(boolean byIndians)
Get the type of equipment to capture, handling the case where
Europeans and Indians use different
EquipmentType s
for the same underlying goods. |
int |
getCombatLossPriority()
Get the combat loss priority.
|
int |
getMaximumCount()
Get the maximum combinable amount of this equipment type.
|
Role |
getRole()
Get the role for this equipment type.
|
static java.lang.String |
getXMLElementTagName()
Gets the tag name of the root element representing this object.
|
java.lang.String |
getXMLTagName()
Gets the tag name used to serialize this object, generally the
class name starting with a lower case letter.
|
int |
hashCode() |
boolean |
isCompatibleWith(EquipmentType otherType)
Is this type of equipment compatible with the given type of equipment?
|
boolean |
isMilitaryEquipment()
Is this military equiment?
(True if it grants an offensive or defensive bonus)
|
protected void |
readAttributes(FreeColXMLReader xr)
Reads the attributes of this object from an XML stream.
|
protected void |
readChild(FreeColXMLReader xr)
Reads a single child object.
|
protected void |
readChildren(FreeColXMLReader xr)
Reads the children of this object from an XML stream.
|
void |
setRole(Role role)
Set the role for this equipment type.
|
protected void |
writeAttributes(FreeColXMLWriter xw)
Write the attributes of this object to a stream.
|
protected void |
writeChildren(FreeColXMLWriter xw)
Write the children of this object to a stream.
|
getCurrentlyBuildingLabel, getLimits, getRequiredAbilities, getRequiredAmountOf, getRequiredGoods, getRequiredPopulation, isAvailableTo, needsGoodsToBuild, requiresAbility, setLimits, setRequiredAbilities, setRequiredPopulation
getDescriptionKey, getFeatureContainer, getIndex, getNameKey, isAbstractType, setIndex, toString
addAbility, addFeatures, addModifier, addPropertyChangeListener, addPropertyChangeListener, applyModifiers, applyModifiers, applyModifiers, compareIds, compareTo, containsAbilityKey, containsModifierKey, copy, dumpCollection, dumpObject, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAbilities, getAbilities, getAbilities, getAbilities, getDefenceModifiers, getId, getIdNumber, getIdType, getIdType, getModifiers, getModifiers, getModifiers, getModifiers, getPropertyChangeListeners, getPropertyChangeListeners, getSortedAbilities, getSortedCopy, getSortedModifiers, getSpecification, getSuffix, getSuffix, hasAbility, hasAbility, hasAbility, hasListeners, hasModifier, hasModifier, hasModifier, internId, invokeMethod, logFreeColObjects, readFromXML, readFromXMLElement, readFromXMLPartial, readId, removeAbilities, removeAbility, removeFeatures, removeModifier, removeModifiers, removePropertyChangeListener, removePropertyChangeListener, save, save, save, save, serialize, serialize, setId, setSpecification, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, toXMLPartial
public static final EquipmentType[] NO_EQUIPMENT
private int maximumCount
private int combatLossPriority
private java.lang.String captureEquipmentId
private boolean captureEquipmentByIndians
private Role role
private boolean militaryEquipment
private java.util.List<java.lang.String> compatibleEquipment
private static final java.lang.String BY_INDIANS_TAG
private static final java.lang.String CAPTURE_EQUIPMENT_TAG
private static final java.lang.String COMBAT_LOSS_PRIORITY_TAG
private static final java.lang.String COMPATIBLE_EQUIPMENT_TAG
private static final java.lang.String MAXIMUM_COUNT_TAG
private static final java.lang.String ROLE_TAG
private static final java.lang.String REQUIRED_LOCATION_ABILITY_TAG
public EquipmentType(java.lang.String id, Specification specification)
id
- The object identifier.specification
- The Specification
to refer to.public final int getMaximumCount()
public final int getCombatLossPriority()
public boolean canBeCaptured()
public EquipmentType getCaptureEquipment(boolean byIndians)
EquipmentType
s
for the same underlying goods.byIndians
- Is the capture by the Indians?EquipmentType
.public boolean isCompatibleWith(EquipmentType otherType)
otherType
- The other EquipmentType
.private void addCompatibleEquipment(java.lang.String equipmentId)
equipmentId
- The equipment identifier.public final Role getRole()
public void setRole(Role role)
role
- The new equipment related Role
.public final boolean isMilitaryEquipment()
public int hashCode()
hashCode
in class FreeColObject
public boolean equals(java.lang.Object obj)
equals
in class FreeColObject
protected void writeAttributes(FreeColXMLWriter xw) throws javax.xml.stream.XMLStreamException
writeAttributes
in class BuildableType
xw
- The FreeColXMLWriter
to write to.javax.xml.stream.XMLStreamException
- if there are any problems writing
to the stream.protected void writeChildren(FreeColXMLWriter xw) throws javax.xml.stream.XMLStreamException
writeChildren
in class BuildableType
xw
- The FreeColXMLWriter
to write to.javax.xml.stream.XMLStreamException
- if there are any problems writing
to the stream.protected void readAttributes(FreeColXMLReader xr) throws javax.xml.stream.XMLStreamException
readAttributes
in class BuildableType
xr
- The FreeColXMLReader
to read from.javax.xml.stream.XMLStreamException
- if there is a problem reading the stream.protected void readChildren(FreeColXMLReader xr) throws javax.xml.stream.XMLStreamException
readChildren
in class BuildableType
xr
- The FreeColXMLReader
to read from.javax.xml.stream.XMLStreamException
- if there is a problem reading the stream.protected void readChild(FreeColXMLReader xr) throws javax.xml.stream.XMLStreamException
readChild
in class BuildableType
xr
- The FreeColXMLReader
to read from.javax.xml.stream.XMLStreamException
- if there is a problem reading the stream.public java.lang.String getXMLTagName()
getXMLTagName
in class FreeColObject
public static java.lang.String getXMLElementTagName()