net.sf.freecol.common.model
Class Ability

java.lang.Object
  extended by net.sf.freecol.common.model.FreeColObject
      extended by net.sf.freecol.common.model.Feature
          extended by net.sf.freecol.common.model.Ability

public final class Ability
extends Feature

The Ability class encapsulates a bonus or penalty that can be applied to any action within the game, most obviously combat.


Field Summary
static java.lang.String ADD_TAX_TO_BELLS
          The ability to add the current tax as a bonus to the production of bells.
static java.lang.String AUTO_PRODUCTION
          The ability of certain buildings (e.g.
static java.lang.String AVOID_EXCESS_PRODUCTION
          The ability of certain buildings (e.g.
static java.lang.String BOMBARD
          The ability to bombard other units, i.e.
static java.lang.String BORN_IN_COLONY
          The ability to be born in a Colony.
static java.lang.String BORN_IN_INDIAN_SETTLEMENT
          The ability to be born in an IndianSettlement.
static java.lang.String BUILD
          The ability to build BuildableTypes, such as units.
static java.lang.String CAN_BE_CAPTURED
          The ability of certain unarmed units to be captured by another player's units.
static java.lang.String CAN_BE_EQUIPPED
          The ability of certain units to be equipped with tools, muskets, etc.
static java.lang.String CAN_TEACH
          The ability of some buildings (e.g.
static java.lang.String CAPTURE_GOODS
          The ability of certain units (e.g.
static java.lang.String CAPTURE_UNITS
          The ability of certain armed units to capture another player's units.
static java.lang.String CARRY_GOODS
          The ability of certain units (e.g.
static java.lang.String CARRY_TREASURE
          The ability of certain units (e.g.
static java.lang.String CARRY_UNITS
          The ability of certain units (e.g.
static java.lang.String CONSUME_ALL_OR_NOTHING
          The ability of certain consumers (e.g.
static java.lang.String EXPERT_MISSIONARY
          The ability of certain units to work as missionaries more effectively.
static java.lang.String EXPERT_PIONEER
          The ability of certain units to build TileImprovements faster.
static java.lang.String EXPERT_SCOUT
          The ability of certain units to work as scouts more effectively.
static java.lang.String EXPERT_SOLDIER
          The ability of certain units to work as soldiers more effectively.
static java.lang.String EXPERTS_USE_CONNECTIONS
          The somewhat controversial ability of expert units in factory level buildings to produce a certain amount of goods even when no raw materials are available.
static java.lang.String EXPORT
          The ability to export goods to Europe directly.
static java.lang.String NAVAL_UNIT
          The ability of ships to move across water tiles.
static java.lang.String PIRACY
          The ability of certain units (e.g.
static java.lang.String PRODUCE_IN_WATER
          The ability to produce goods (e.g.
private  boolean value
           
 
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
 
Constructor Summary
Ability(Ability template)
          Creates a new Ability instance.
Ability(org.w3c.dom.Element element)
          Creates a new Ability instance.
Ability(java.lang.String id)
          Creates a new Ability instance.
Ability(java.lang.String id, boolean value)
          Creates a new Ability instance.
Ability(java.lang.String id, FreeColGameObjectType source, boolean value)
          Creates a new Ability instance.
Ability(javax.xml.stream.XMLStreamReader in, Specification specification)
          Creates a new Ability instance.
 
Method Summary
 boolean equals(java.lang.Object o)
          
 boolean getValue()
          Get the Value value.
static java.lang.String getXMLElementTagName()
          Returns the XML tag name for this element.
 int hashCode()
          
protected  void readAttributes(javax.xml.stream.XMLStreamReader in, Specification specification)
          Reads the attributes of this object from an XML stream.
 void setValue(boolean newValue)
          Set the Value value.
 java.lang.String toString()
           
 void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
          This method writes an XML-representation of this object to the given stream.
protected  void writeAttributes(javax.xml.stream.XMLStreamWriter out)
          Write the attributes of this object to a stream.
 
Methods inherited from class net.sf.freecol.common.model.Feature
appliesTo, appliesTo, copy, getFirstTurn, getLastTurn, getNameKey, getScopes, getSource, hasScope, hasTimeLimit, isOutOfDate, readChildren, setFirstTurn, setLastTurn, setScopes, setSource, writeChildren
 
Methods inherited from class net.sf.freecol.common.model.FreeColObject
addPropertyChangeListener, addPropertyChangeListener, dumpObject, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getId, getPropertyChangeListeners, getPropertyChangeListeners, getSpecification, hasAbility, hasAttribute, hasListeners, readAttributes, readChild, readChild, readChildren, readFromArrayElement, readFromArrayElement, readFromListElement, readFromXML, readFromXMLElement, readFromXMLImpl, readFromXMLImpl, readFromXMLPartialImpl, removePropertyChangeListener, removePropertyChangeListener, save, save, setId, toXML, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, toXMLPartialImpl, writeAttribute
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ADD_TAX_TO_BELLS

public static final java.lang.String ADD_TAX_TO_BELLS
The ability to add the current tax as a bonus to the production of bells. Provided by the FoundingFather Thomas Paine.

See Also:
Constant Field Values

AUTO_PRODUCTION

public static final java.lang.String AUTO_PRODUCTION
The ability of certain buildings (e.g. the stables) to produce goods even if no units are present.

See Also:
Constant Field Values

AVOID_EXCESS_PRODUCTION

public static final java.lang.String AVOID_EXCESS_PRODUCTION
The ability of certain buildings (e.g. the stables) to avoid producing more goods than the colony can store, which would normally go to waste.

See Also:
Constant Field Values

BOMBARD

public static final java.lang.String BOMBARD
The ability to bombard other units, i.e. attack them from a distance without risking damage.

See Also:
Constant Field Values

BORN_IN_COLONY

public static final java.lang.String BORN_IN_COLONY
The ability to be born in a Colony. Only Units with this ability can be produced by a Colony.

See Also:
Constant Field Values

BORN_IN_INDIAN_SETTLEMENT

public static final java.lang.String BORN_IN_INDIAN_SETTLEMENT
The ability to be born in an IndianSettlement. Only Units with this ability can be produced by an IndianSettlement.

See Also:
Constant Field Values

BUILD

public static final java.lang.String BUILD
The ability to build BuildableTypes, such as units. The shipyard provides the ability to build ships, for example.

See Also:
Constant Field Values

CAN_BE_CAPTURED

public static final java.lang.String CAN_BE_CAPTURED
The ability of certain unarmed units to be captured by another player's units. Units lacking this ability (e.g. braves) will be destroyed instead.

See Also:
Constant Field Values

CAN_BE_EQUIPPED

public static final java.lang.String CAN_BE_EQUIPPED
The ability of certain units to be equipped with tools, muskets, etc.

See Also:
Constant Field Values

CAN_TEACH

public static final java.lang.String CAN_TEACH
The ability of some buildings (e.g. the schoolhouse) to teach skills.

See Also:
Constant Field Values

CAPTURE_GOODS

public static final java.lang.String CAPTURE_GOODS
The ability of certain units (e.g. privateers) to capture goods carried by another player's units.

See Also:
Constant Field Values

CAPTURE_UNITS

public static final java.lang.String CAPTURE_UNITS
The ability of certain armed units to capture another player's units.

See Also:
Constant Field Values

CARRY_GOODS

public static final java.lang.String CARRY_GOODS
The ability of certain units (e.g. wagon trains) to carry goods.

See Also:
Constant Field Values

CARRY_UNITS

public static final java.lang.String CARRY_UNITS
The ability of certain units (e.g. ships) to carry other units.

See Also:
Constant Field Values

CARRY_TREASURE

public static final java.lang.String CARRY_TREASURE
The ability of certain units (e.g. treasure trains) to carry treasures.

See Also:
Constant Field Values

CONSUME_ALL_OR_NOTHING

public static final java.lang.String CONSUME_ALL_OR_NOTHING
The ability of certain consumers (e.g. BuildQueues) to consume a large amount of goods at once instead of turn by turn.

See Also:
Constant Field Values

EXPERT_MISSIONARY

public static final java.lang.String EXPERT_MISSIONARY
The ability of certain units to work as missionaries more effectively.

See Also:
Constant Field Values

EXPERT_PIONEER

public static final java.lang.String EXPERT_PIONEER
The ability of certain units to build TileImprovements faster.

See Also:
Constant Field Values

EXPERT_SCOUT

public static final java.lang.String EXPERT_SCOUT
The ability of certain units to work as scouts more effectively.

See Also:
Constant Field Values

EXPERT_SOLDIER

public static final java.lang.String EXPERT_SOLDIER
The ability of certain units to work as soldiers more effectively.

See Also:
Constant Field Values

EXPERTS_USE_CONNECTIONS

public static final java.lang.String EXPERTS_USE_CONNECTIONS
The somewhat controversial ability of expert units in factory level buildings to produce a certain amount of goods even when no raw materials are available. Allegedly, this is a feature of the original game.

See Also:
Constant Field Values

EXPORT

public static final java.lang.String EXPORT
The ability to export goods to Europe directly.

See Also:
Constant Field Values

NAVAL_UNIT

public static final java.lang.String NAVAL_UNIT
The ability of ships to move across water tiles.

See Also:
Constant Field Values

PIRACY

public static final java.lang.String PIRACY
The ability of certain units (e.g. privateers) to attack and plunder another player's units without causing war.

See Also:
Constant Field Values

PRODUCE_IN_WATER

public static final java.lang.String PRODUCE_IN_WATER
The ability to produce goods (e.g. fish) on water tiles.

See Also:
Constant Field Values

value

private boolean value
Constructor Detail

Ability

public Ability(java.lang.String id)
Creates a new Ability instance.

Parameters:
id - a String value

Ability

public Ability(java.lang.String id,
               boolean value)
Creates a new Ability instance.

Parameters:
id - a String value
value - a boolean value

Ability

public Ability(java.lang.String id,
               FreeColGameObjectType source,
               boolean value)
Creates a new Ability instance.

Parameters:
id - a String value
source - a FreeColGameObjectType value
value - a boolean value

Ability

public Ability(Ability template)
Creates a new Ability instance.

Parameters:
template - an Ability value

Ability

public Ability(org.w3c.dom.Element element)
Creates a new Ability instance.

Parameters:
element - an Element value

Ability

public Ability(javax.xml.stream.XMLStreamReader in,
               Specification specification)
        throws javax.xml.stream.XMLStreamException
Creates a new Ability instance.

Parameters:
in - a XMLStreamReader value
specification - a Specification value
Throws:
javax.xml.stream.XMLStreamException - if an error occurs
Method Detail

getValue

public boolean getValue()
Get the Value value.

Returns:
a boolean value

setValue

public void setValue(boolean newValue)
Set the Value value.

Parameters:
newValue - The new Value value.

hashCode

public int hashCode()
Description copied from class: Feature

Overrides:
hashCode in class Feature

equals

public boolean equals(java.lang.Object o)
Description copied from class: Feature

Overrides:
equals in class Feature

toXMLImpl

public void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
               throws javax.xml.stream.XMLStreamException
This method writes an XML-representation of this object to the given stream.

Specified by:
toXMLImpl in class FreeColObject
Parameters:
out - The target stream.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.

writeAttributes

protected void writeAttributes(javax.xml.stream.XMLStreamWriter out)
                        throws javax.xml.stream.XMLStreamException
Write the attributes of this object to a stream.

Overrides:
writeAttributes in class Feature
Parameters:
out - The target stream.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.

readAttributes

protected void readAttributes(javax.xml.stream.XMLStreamReader in,
                              Specification specification)
                       throws javax.xml.stream.XMLStreamException
Reads the attributes of this object from an XML stream.

Overrides:
readAttributes in class Feature
Parameters:
in - The XML input stream.
specification - A Specification to use.
Throws:
javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getXMLElementTagName

public static java.lang.String getXMLElementTagName()
Returns the XML tag name for this element.

Returns:
"ability".