net.sf.freecol.common.model
Class TileImprovementType

java.lang.Object
  extended by net.sf.freecol.common.model.FreeColObject
      extended by net.sf.freecol.common.model.FreeColGameObjectType
          extended by net.sf.freecol.common.model.TileImprovementType

public final class TileImprovementType
extends FreeColGameObjectType


Field Summary
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ID_ATTRIBUTE_TAG
 
Constructor Summary
TileImprovementType(int index)
           
 
Method Summary
 boolean changeContainsTarget(TileType tileType)
           
 int getAddWorkTurns()
           
 java.lang.String getArtOverlay()
           
 int getBonus(GoodsType goodsType)
           
 TileType getChange(TileType tileType)
           
 int getDeliverAmount()
           
 GoodsType getDeliverGoodsType()
           
 int getExpendedAmount()
           
 EquipmentType getExpendedEquipmentType()
           
 int getMagnitude()
           
 int getMovementCost(int moveCost)
          Performs reduction of the movement-cost.
 java.lang.String getOccupationString()
           
 Modifier getProductionModifier(GoodsType goodsType)
           
 TileImprovementType getRequiredImprovementType()
           
 int getValue(TileType tileType, GoodsType goodsType)
          Returns a value for use in AI decision making.
 int getZIndex()
          Get the ZIndex value.
 boolean isNatural()
           
 boolean isTileAllowed(Tile tile)
          Check if a given Tile is valid for this TileImprovement.
 boolean isTileTypeAllowed(TileType tileType)
          This will check if in principle this type of improvement can be used on this kind of tile, disregarding the current state of an actual tile.
 boolean isWorkerAllowed(Unit unit)
          Check if a given Unit can perform this TileImprovement.
 boolean isWorkerTypeAllowed(UnitType unitType)
           
 void readAttributes(javax.xml.stream.XMLStreamReader in, Specification specification)
           
 void readChildren(javax.xml.stream.XMLStreamReader in, Specification specification)
           
 void setZIndex(int newZIndex)
          Set the ZIndex value.
 
Methods inherited from class net.sf.freecol.common.model.FreeColGameObjectType
addAbility, addModifier, getFeatureContainer, getIndex, getModifierSet, hasAbility, hasAbility, readFromXML, setFeatureContainer, setIndex, toString
 
Methods inherited from class net.sf.freecol.common.model.FreeColObject
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAttribute, getAttribute, getAttribute, getAttribute, getId, getPropertyChangeListeners, getPropertyChangeListeners, getXMLElementTagName, hasAttribute, hasListeners, readFromXML, readFromXMLElement, removePropertyChangeListener, removePropertyChangeListener, toXML, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, writeAttribute, writeFreeColGameObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TileImprovementType

public TileImprovementType(int index)
Method Detail

isNatural

public boolean isNatural()

getMagnitude

public int getMagnitude()

getAddWorkTurns

public int getAddWorkTurns()

getOccupationString

public java.lang.String getOccupationString()

getArtOverlay

public java.lang.String getArtOverlay()

getZIndex

public int getZIndex()
Get the ZIndex value.

Returns:
an int value

setZIndex

public void setZIndex(int newZIndex)
Set the ZIndex value.

Parameters:
newZIndex - The new ZIndex value.

getRequiredImprovementType

public TileImprovementType getRequiredImprovementType()

getExpendedEquipmentType

public EquipmentType getExpendedEquipmentType()

getExpendedAmount

public int getExpendedAmount()

getDeliverGoodsType

public GoodsType getDeliverGoodsType()

getDeliverAmount

public int getDeliverAmount()

isWorkerTypeAllowed

public boolean isWorkerTypeAllowed(UnitType unitType)

isWorkerAllowed

public boolean isWorkerAllowed(Unit unit)
Check if a given Unit can perform this TileImprovement.

Returns:
true if Worker UnitType is allowed and expended Goods are available

isTileTypeAllowed

public boolean isTileTypeAllowed(TileType tileType)
This will check if in principle this type of improvement can be used on this kind of tile, disregarding the current state of an actual tile. If you want to find out if an improvement is allowed for a tile, call isTileAllowed(Tile).

Parameters:
tileType - The type of terrain
Returns:
true if improvement is possible

isTileAllowed

public boolean isTileAllowed(Tile tile)
Check if a given Tile is valid for this TileImprovement.

Returns:
true if Tile TileType is valid and required Improvement (if any) is present.

getBonus

public int getBonus(GoodsType goodsType)

getProductionModifier

public Modifier getProductionModifier(GoodsType goodsType)

getChange

public TileType getChange(TileType tileType)

changeContainsTarget

public boolean changeContainsTarget(TileType tileType)

getValue

public int getValue(TileType tileType,
                    GoodsType goodsType)
Returns a value for use in AI decision making.

Parameters:
tileType - The TileType to be considered. A null entry denotes no interest in a TileImprovementType that changes TileTypes
goodsType - A preferred GoodsType or null
Returns:
Sum of all bonuses with a triple bonus for the preferred GoodsType

getMovementCost

public int getMovementCost(int moveCost)
Performs reduction of the movement-cost.

Parameters:
moveCost - Original movement cost
Returns:
The movement cost after any change

readAttributes

public void readAttributes(javax.xml.stream.XMLStreamReader in,
                           Specification specification)
                    throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

readChildren

public void readChildren(javax.xml.stream.XMLStreamReader in,
                         Specification specification)
                  throws javax.xml.stream.XMLStreamException
Overrides:
readChildren in class FreeColGameObjectType
Throws:
javax.xml.stream.XMLStreamException