Class Ability

  • All Implemented Interfaces:
    java.lang.Comparable<FreeColObject>, Named, ObjectWithId

    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 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
      • ALWAYS_OFFERED_PEACE

        public static final java.lang.String ALWAYS_OFFERED_PEACE
        The ability to always receive a peace offer (Franklin).
        See Also:
        Constant Field Values
      • AMBUSH_BONUS

        public static final java.lang.String AMBUSH_BONUS
        The ability to ambush other units.
        See Also:
        Constant Field Values
      • AMBUSH_PENALTY

        public static final java.lang.String AMBUSH_PENALTY
        The susceptibility to ambush from other units.
        See Also:
        Constant Field Values
      • AMBUSH_TERRAIN

        public static final java.lang.String AMBUSH_TERRAIN
        Terrain in which an ambush may occur.
        See Also:
        Constant Field Values
      • ARMED

        public static final java.lang.String ARMED
        Equipment type ability denoting the holder is armed.
        See Also:
        Constant Field Values
      • AUTOMATIC_EQUIPMENT

        public static final java.lang.String AUTOMATIC_EQUIPMENT
        The ability of a colony to automatocally arm defenders (Revere).
        See Also:
        Constant Field Values
      • AUTOMATIC_PROMOTION

        public static final java.lang.String AUTOMATIC_PROMOTION
        The ability to automatically promote combat winners (Washington).
        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
      • BETTER_FOREIGN_AFFAIRS_REPORT

        public static final java.lang.String BETTER_FOREIGN_AFFAIRS_REPORT
        The ability for better foreign affairs reporting (deWitt).
        See Also:
        Constant Field Values
      • BOMBARD

        public static final java.lang.String BOMBARD
        The ability of a unit to bombard other units.
        See Also:
        Constant Field Values
      • BOMBARD_SHIPS

        public static final java.lang.String BOMBARD_SHIPS
        The ability of a colony to bombard ships.
        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
      • BUILD_CUSTOM_HOUSE

        public static final java.lang.String BUILD_CUSTOM_HOUSE
        The ability to build a customs house. Yes this is misspelled.
        See Also:
        Constant Field Values
      • BUILD_FACTORY

        public static final java.lang.String BUILD_FACTORY
        The ability to build a factories.
        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_BE_SURRENDERED

        public static final java.lang.String CAN_BE_SURRENDERED
        The ability of certain REF units to surrender on defeat.
        See Also:
        Constant Field Values
      • CAN_RECRUIT_UNIT

        public static final java.lang.String CAN_RECRUIT_UNIT
        The ability of a player to recruit units.
        See Also:
        Constant Field Values
      • CAPTURE_EQUIPMENT

        public static final java.lang.String CAPTURE_EQUIPMENT
        The ability of certain armed units to capture equipment.
        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_TREASURE

        public static final java.lang.String CARRY_TREASURE
        The ability of certain units (e.g. treasure trains) to carry treasure.
        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
      • COASTAL_ONLY

        public static final java.lang.String COASTAL_ONLY
        Restrict some buildings to only be buildable on the coast.
        See Also:
        Constant Field Values
      • CUSTOM_HOUSE_TRADES_WITH_FOREIGN_COUNTRIES

        public static final java.lang.String CUSTOM_HOUSE_TRADES_WITH_FOREIGN_COUNTRIES
        The ability of customs houses to trade with other players.
        See Also:
        Constant Field Values
      • DEMAND_TRIBUTE

        public static final java.lang.String DEMAND_TRIBUTE
        The ability to demand tribute even when unarmed.
        See Also:
        Constant Field Values
      • DEMOTE_ON_ALL_EQUIPMENT_LOST

        public static final java.lang.String DEMOTE_ON_ALL_EQUIPMENT_LOST
        Units with this ability are demoted on losing all equipment.
        See Also:
        Constant Field Values
      • DENOUNCE_HERESY

        public static final java.lang.String DENOUNCE_HERESY
        The ability to denounce heresy.
        See Also:
        Constant Field Values
      • DISPOSE_ON_ALL_EQUIPMENT_LOST

        public static final java.lang.String DISPOSE_ON_ALL_EQUIPMENT_LOST
        Units with this ability die on losing all equipment.
        See Also:
        Constant Field Values
      • DISPOSE_ON_COMBAT_LOSS

        public static final java.lang.String DISPOSE_ON_COMBAT_LOSS
        Units with this ability die on losing a combat.
        See Also:
        Constant Field Values
      • DRESS_MISSIONARY

        public static final java.lang.String DRESS_MISSIONARY
        The ability to bless a missionary.
        See Also:
        Constant Field Values
      • ELECT_FOUNDING_FATHER

        public static final java.lang.String ELECT_FOUNDING_FATHER
        The ability to elect founding fathers.
        See Also:
        Constant Field Values
      • ESTABLISH_MISSION

        public static final java.lang.String ESTABLISH_MISSION
        The ability to establish a mission.
        See Also:
        Constant Field Values
      • EVADE_ATTACK

        public static final java.lang.String EVADE_ATTACK
        The ability to evade naval attack.
        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
      • FOUND_COLONY

        public static final java.lang.String FOUND_COLONY
        The ability of a unit to found a colony.
        See Also:
        Constant Field Values
      • FOUND_IN_LOST_CITY

        public static final java.lang.String FOUND_IN_LOST_CITY
        The ability of a unit to be found in a lost city.
        See Also:
        Constant Field Values
      • FOUNDS_COLONIES

        public static final java.lang.String FOUNDS_COLONIES
        The ability of a player to found colonies.
        See Also:
        Constant Field Values
      • HAS_PORT

        public static final java.lang.String HAS_PORT
        The ability of a colony which is a port.
        See Also:
        Constant Field Values
      • IGNORE_EUROPEAN_WARS

        public static final java.lang.String IGNORE_EUROPEAN_WARS
        The ability to ignore the monarchs wars.
        See Also:
        Constant Field Values
      • IMPROVE_TERRAIN

        public static final java.lang.String IMPROVE_TERRAIN
        The ability of a unit to make terrain improvements.
        See Also:
        Constant Field Values
      • INCITE_NATIVES

        public static final java.lang.String INCITE_NATIVES
        The ability to incite the natives.
        See Also:
        Constant Field Values
      • INDEPENDENCE_DECLARED

        public static final java.lang.String INDEPENDENCE_DECLARED
        The ability denoting that a declaration of independence has been made.
        See Also:
        Constant Field Values
      • INDEPENDENT_NATION

        public static final java.lang.String INDEPENDENT_NATION
        The ability denoting that this is an independent nation. Note: this differs from INDEPENDENCE_DECLARED in that the REF is also (representing) an independent nation.
        See Also:
        Constant Field Values
      • MERCENARY_UNIT

        public static final java.lang.String MERCENARY_UNIT
        Units with this ability can be chosen as mercenaries support units.
        See Also:
        Constant Field Values
      • MOUNTED

        public static final java.lang.String MOUNTED
        Equipment type ability denoting the holder is mounted.
        See Also:
        Constant Field Values
      • MOVE_TO_EUROPE

        public static final java.lang.String MOVE_TO_EUROPE
        The ability to move to Europe from a tile.
        See Also:
        Constant Field Values
      • MULTIPLE_ATTACKS

        public static final java.lang.String MULTIPLE_ATTACKS
        The ability to attack multiple times.
        See Also:
        Constant Field Values
      • NATIVE

        public static final java.lang.String NATIVE
        The ability of being a native unit.
        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
      • NEGOTIATE

        public static final java.lang.String NEGOTIATE
        The ability to engage in diplomatic negotiation.
        See Also:
        Constant Field Values
      • PERSON

        public static final java.lang.String PERSON
        Units with this property are persons, not a ship or wagon etc.
        See Also:
        Constant Field Values
      • PILLAGE_UNPROTECTED_COLONY

        public static final java.lang.String PILLAGE_UNPROTECTED_COLONY
        The ability to pillage unprotected colonies.
        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
      • PLUNDER_NATIVES

        public static final java.lang.String PLUNDER_NATIVES
        An ability that enhances the treasure plundered from native settlements.
        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
      • REF_UNIT

        public static final java.lang.String REF_UNIT
        Units with this ability can be added to the REF.
        See Also:
        Constant Field Values
      • REPAIR_UNITS

        public static final java.lang.String REPAIR_UNITS
        The ability to repair certain units.
        See Also:
        Constant Field Values
      • ROYAL_EXPEDITIONARY_FORCE

        public static final java.lang.String ROYAL_EXPEDITIONARY_FORCE
        A national ability required to generate a REF.
        See Also:
        Constant Field Values
      • RUMOURS_ALWAYS_POSITIVE

        public static final java.lang.String RUMOURS_ALWAYS_POSITIVE
        LCRs always yield positive results (deSoto).
        See Also:
        Constant Field Values
      • SEE_ALL_COLONIES

        public static final java.lang.String SEE_ALL_COLONIES
        The ability to see all colonies (Coronado).
        See Also:
        Constant Field Values
      • SELECT_RECRUIT

        public static final java.lang.String SELECT_RECRUIT
        The ability to select recruits (Brewster).
        See Also:
        Constant Field Values
      • SPEAK_WITH_CHIEF

        public static final java.lang.String SPEAK_WITH_CHIEF
        The ability to speak to a native settlement chief.
        See Also:
        Constant Field Values
      • SPY_ON_COLONY

        public static final java.lang.String SPY_ON_COLONY
        The ability to spy on a colony.
        See Also:
        Constant Field Values
      • SUPPORT_UNIT

        public static final java.lang.String SUPPORT_UNIT
        Units with this ability can be chosen as support units from the crown.
        See Also:
        Constant Field Values
      • TEACH

        public static final java.lang.String TEACH
        Buildings with this ability can be used to teach.
        See Also:
        Constant Field Values
      • TRADE_WITH_FOREIGN_COLONIES

        public static final java.lang.String TRADE_WITH_FOREIGN_COLONIES
        The ability to trade with foreign colonies (deWitt).
        See Also:
        Constant Field Values
      • UNDEAD

        public static final java.lang.String UNDEAD
        Undead units have this ability.
        See Also:
        Constant Field Values
      • UPGRADE_CONVERT

        public static final java.lang.String UPGRADE_CONVERT
        Upgrade converts to free colonist with Casas.
        See Also:
        Constant Field Values
      • value

        private boolean value
        The ability value.
    • Constructor Detail

      • Ability

        public Ability​(Specification specification)
        Deliberately trivial constructor.
        Parameters:
        specification - The Specification to use.
      • Ability

        public Ability​(java.lang.String id,
                       FreeColSpecObjectType source,
                       boolean value)
        Creates a new Ability instance.
        Parameters:
        id - The object identifier.
        source - The source FreeColSpecObjectType.
        value - The ability value.
      • Ability

        public Ability​(java.lang.String id)
        Creates a new Ability instance.
        Parameters:
        id - The object identifier.
      • Ability

        public Ability​(java.lang.String id,
                       boolean value)
        Creates a new Ability instance.
        Parameters:
        id - The object identifier.
        value - The ability value.
      • Ability

        public Ability​(Ability template)
        Creates a new Ability instance.
        Parameters:
        template - An Ability to copy from.
      • Ability

        public Ability​(FreeColXMLReader xr,
                       Specification specification)
                throws javax.xml.stream.XMLStreamException
        Creates a new Ability instance.
        Parameters:
        xr - The FreeColXMLReader to read from.
        specification - A Specification to refer to.
        Throws:
        javax.xml.stream.XMLStreamException - if an error occurs
    • Method Detail

      • getValue

        public boolean getValue()
        Get the ability value.
        Returns:
        The ability value.
      • setValue

        public void setValue​(boolean newValue)
        Set the ability value.
        Parameters:
        newValue - The new ability value.
      • copyIn

        public <T extends FreeColObject> boolean copyIn​(T other)
        Copy another FreeColObject into this one if it is compatible.
        Overrides:
        copyIn in class Feature
        Type Parameters:
        T - The FreeColObject subclass of the object to copy in.
        Parameters:
        other - The other object.
        Returns:
        True if the copy in is succesful.
      • writeAttributes

        protected void writeAttributes​(FreeColXMLWriter xw)
                                throws javax.xml.stream.XMLStreamException
        Write the attributes of this object to a stream. To be overridden if required by any object that has attributes and uses the toXML(FreeColXMLWriter, String) call.
        Overrides:
        writeAttributes in class Feature
        Parameters:
        xw - The FreeColXMLWriter to write to.
        Throws:
        javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.
      • readAttributes

        protected void readAttributes​(FreeColXMLReader xr)
                               throws javax.xml.stream.XMLStreamException
        Reads the attributes of this object from an XML stream.
        Overrides:
        readAttributes in class Feature
        Parameters:
        xr - The FreeColXMLReader to read from.
        Throws:
        javax.xml.stream.XMLStreamException - if there is a problem reading the stream.
      • getXMLTagName

        public java.lang.String getXMLTagName()
        Get the serialization tag for this object.
        Specified by:
        getXMLTagName in class FreeColObject
        Returns:
        The tag.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class Feature