|
|||||||||
| 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.FreeColGameObject
net.sf.freecol.common.model.Settlement
net.sf.freecol.common.model.IndianSettlement
public class IndianSettlement
Represents an Indian settlement.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class net.sf.freecol.common.model.Settlement |
|---|
Settlement.SettlementType |
| Field Summary | |
|---|---|
private java.util.Map<Player,Tension> |
alarm
Stores the alarm levels. |
static int |
ALARM_NEW_MISSIONARY
|
static int |
ALARM_RADIUS
|
static java.lang.String |
ALARM_TAG_NAME
|
static int |
ALARM_TILE_IN_USE
|
private int |
convertProgress
Used for monitoring the progress towards creating a convert. |
private java.util.Comparator<Goods> |
exportGoodsComparator
|
static java.lang.String |
IS_VISITED_TAG_NAME
|
static int |
KEEP_RAW_MATERIAL
The amount of raw material that should be available before producing manufactured goods. |
(package private) int |
lastTribute
The number of the turn during which the last tribute was paid. |
private UnitType |
learnableSkill
This is the skill that can be learned by Europeans at this settlement. |
private static java.util.logging.Logger |
logger
|
static int |
MAX_CONVERT_DISTANCE
|
static int |
MAX_HORSES_PER_TURN
|
private Unit |
missionary
|
static java.lang.String |
MISSIONARY_TAG_NAME
|
static int |
MISSIONARY_TENSION
|
static java.lang.String |
OWNED_UNITS_TAG_NAME
|
private java.util.ArrayList<Unit> |
ownedUnits
|
static int |
TURNS_PER_TRIBUTE
|
private java.util.List<Unit> |
units
|
static java.lang.String |
UNITS_TAG_NAME
|
private java.util.Set<Player> |
visitedBy
A map that tells if a player has visited the settlement. |
static java.lang.String |
WANTED_GOODS_TAG_NAME
|
private GoodsType[] |
wantedGoods
|
private java.util.Comparator<GoodsType> |
wantedGoodsComparator
|
| Fields inherited from class net.sf.freecol.common.model.Settlement |
|---|
featureContainer, FOOD_CONSUMPTION, goodsContainer, owner, RADIUS, tile |
| Fields inherited from class net.sf.freecol.common.model.FreeColObject |
|---|
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, PARTIAL_ATTRIBUTE |
| Constructor Summary | |
|---|---|
IndianSettlement(Game game,
org.w3c.dom.Element e)
Initiates a new IndianSettlement from an Element. |
|
IndianSettlement(Game game,
Player player,
Tile tile,
java.lang.String name,
boolean isCapital,
UnitType learnableSkill,
java.util.Set<Player> isVisited,
Unit missionary)
The constructor to use. |
|
IndianSettlement(Game game,
java.lang.String id)
Initiates a new IndianSettlement
with the given ID. |
|
IndianSettlement(Game game,
javax.xml.stream.XMLStreamReader in)
Initiates a new IndianSettlement from an Element. |
|
| Method Summary | |
|---|---|
void |
add(Locatable locatable)
Adds a Locatable to this Location. |
void |
addOwnedUnit(Unit unit)
Adds the given Unit to the list of units that belongs to this
IndianSettlement. |
boolean |
allowContact(Unit unit)
Is a unit permitted to contact with this settlement? The unit must be from a nation that has already contacted, or in the first instance must be arriving by land (apparently including ships in adjacent ports in Col1). |
private void |
breedHorses()
If horses are available and enough food is produced, increase horses |
boolean |
canAdd(Locatable locatable)
Checks whether or not the specified locatable may be added to this Location. |
private void |
checkForNewIndian()
|
boolean |
checkForNewMissionaryConvert()
|
private void |
consumeGoods(GoodsType type,
int amount)
|
boolean |
contains(Locatable locatable)
Checks if this Location contains the specified
Locatable. |
void |
createGoodsContainer()
Creates the GoodsContainer. |
void |
dispose()
Disposes this settlement and removes its claims to adjacent tiles. |
void |
equipBraves()
Equips braves with horses and muskets. |
java.util.Map<Player,Tension> |
getAlarm()
Returns the alarm Map. |
Tension |
getAlarm(Player player)
Gets the alarm level towards the given player. |
java.lang.String |
getAlarmLevelMessage(Player player)
Gets the ID of the alarm message associated with the alarm level of this player. |
int |
getBonusMultiplier()
Get general bonus multiplier. |
Colony |
getColony()
An Indian settlement is no colony. |
Unit |
getDefendingUnit(Unit attacker)
Gets the Unit that is currently defending this IndianSettlement. |
Unit |
getFirstUnit()
|
int |
getGeneratedUnitCount()
Provide some variation in unit count for different types of IndianSettlement. |
Unit |
getLastUnit()
|
UnitType |
getLearnableSkill()
Returns the skill that can be learned at this settlement. |
int |
getMaximumProduction(GoodsType goodsType)
Gets the maximum possible production of the given type of goods. |
Unit |
getMissionary()
Returns the missionary from this settlement if there is one or null if there is none. |
java.util.Iterator<Unit> |
getOwnedUnitsIterator()
Gets an iterator over all the units this IndianSettlement is owning. |
int |
getPrice(Goods goods)
Gets the amount of gold this IndianSettlment
is willing to pay for the given Goods. |
int |
getPrice(GoodsType type,
int amount)
Gets the amount of gold this IndianSettlment
is willing to pay for the given Goods. |
private int |
getPriceAddition()
Get the extra bonus if this is a LONGHOUSE,
CITY or a capital. |
int |
getPriceToSell(Goods goods)
Gets the amount of gold this IndianSettlment
is willing to pay for the given Goods. |
int |
getPriceToSell(GoodsType type,
int amount)
Gets the amount of gold this IndianSettlment
is willing to pay for the given Goods. |
int |
getProductionOf(GoodsType type)
Returns the production of the given type of goods. |
java.lang.String |
getResponseToMissionaryAttempt(Tension.Level tension,
java.lang.String success)
Gets the response to an attempt to create a mission |
java.util.List<Goods> |
getSellGoods()
Returns an array with goods to sell |
int |
getTribute(Player player)
Returns the amount of gold this settlement pays as a tribute. |
Settlement.SettlementType |
getTypeOfSettlement()
Gets the kind of Indian settlement. |
int |
getUnitCount()
Returns the amount of Units at this Location. |
java.util.Iterator<Unit> |
getUnitIterator()
Gets a Iterator of every Unit directly
located on this Location. |
java.util.List<Unit> |
getUnitList()
Returns a list containing all the Units present at this Location. |
GoodsType[] |
getWantedGoods()
|
static java.lang.String |
getXMLElementTagName()
Returns the tag name of the root element representing this object. |
private boolean |
hasBeenContacted(Player player)
Has this settlement been contacted by a player? Supposed to be true if a unit has arrived by land and done something in the village (speak to chief, learn skill, missionary, trade, etc). |
boolean |
hasBeenVisited()
Returns true if a European player has visited this settlement to speak with the chief. |
boolean |
hasBeenVisited(Player player)
Returns true if a the given player has visited this settlement to speak with the chief. |
private void |
increaseAlarm()
|
void |
modifyAlarm(Player player,
int addToAlarm)
Modifies the alarm level towards the given player. |
void |
newTurn()
|
void |
propagatedAlarm(Player player,
int addToAlarm)
Propagates the tension felt towards a given nation from the tribe down to each settlement that has already met that nation. |
protected void |
readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
Initialize this object from an XML-representation of this object. |
void |
remove(Locatable locatable)
Removes a Locatable from this Location. |
boolean |
removeOwnedUnit(Unit unit)
Removes the given Unit to the list of units that
belongs to this IndianSettlement. |
void |
setAlarm(Player player,
Tension newAlarm)
Sets alarm towards the given player. |
void |
setLearnableSkill(UnitType skill)
Sets the learnable skill for this Indian settlement. |
void |
setMissionary(Unit missionary)
Sets the missionary for this settlement. |
void |
setVisited(Player player)
Sets the visited status of this settlement to true, indicating that a European has had a chat with the chief. |
void |
setWantedGoods(int index,
GoodsType type)
|
java.lang.String |
toString()
Returns a string representation of the object. |
protected void |
toXMLImpl(javax.xml.stream.XMLStreamWriter out,
Player player,
boolean showAll,
boolean toSavedGame)
This method writes an XML-representation of this object to the given stream. |
void |
tradeGoodsWithSetlement(IndianSettlement settlement)
Allows spread of horses and arms between settlements |
void |
updateWantedGoods()
Updates the variable wantedGoods. |
| Methods inherited from class net.sf.freecol.common.model.Settlement |
|---|
addGoods, addGoods, canBuildEquipment, claimTile, getCompactGoods, getFeatureContainer, getFoodConsumption, getFoodConsumptionByType, getFoodCount, getGoodsContainer, getGoodsCount, getGoodsIterator, getLineOfSight, getName, getOwner, getRadius, getTile, getTile, isCapital, placeSettlement, removeFood, removeGoods, removeGoods, removeGoods, setCapital, setName, setOwner |
| Methods inherited from class net.sf.freecol.common.model.FreeColGameObject |
|---|
addModelMessage, addModelMessage, addModelMessage, addToRemoveElement, equals, equals, getFreeColGameObject, getFreeColGameObject, getGame, getGameOptions, getIntegerID, hashCode, hasID, isDisposed, isUninitialized, readFromXML, readFromXMLPartialByClass, setFakeID, setGame, setId, toSavedXML, toXML, toXMLImpl, toXMLPartialByClass, updateFreeColGameObject, updateID |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface net.sf.freecol.common.model.Location |
|---|
getId |
| Field Detail |
|---|
private static final java.util.logging.Logger logger
public static final int MISSIONARY_TENSION
public static final int MAX_CONVERT_DISTANCE
public static final int TURNS_PER_TRIBUTE
public static final int ALARM_RADIUS
public static final int ALARM_TILE_IN_USE
public static final int ALARM_NEW_MISSIONARY
public static final int MAX_HORSES_PER_TURN
public static final java.lang.String UNITS_TAG_NAME
public static final java.lang.String OWNED_UNITS_TAG_NAME
public static final java.lang.String IS_VISITED_TAG_NAME
public static final java.lang.String ALARM_TAG_NAME
public static final java.lang.String MISSIONARY_TAG_NAME
public static final java.lang.String WANTED_GOODS_TAG_NAME
public static final int KEEP_RAW_MATERIAL
private UnitType learnableSkill
private GoodsType[] wantedGoods
private java.util.Set<Player> visitedBy
private java.util.List<Unit> units
private java.util.ArrayList<Unit> ownedUnits
private Unit missionary
private int convertProgress
int lastTribute
private java.util.Map<Player,Tension> alarm
private final java.util.Comparator<GoodsType> wantedGoodsComparator
private final java.util.Comparator<Goods> exportGoodsComparator
| Constructor Detail |
|---|
public IndianSettlement(Game game,
Player player,
Tile tile,
java.lang.String name,
boolean isCapital,
UnitType learnableSkill,
java.util.Set<Player> isVisited,
Unit missionary)
game - The Game in which this object belong.player - The Player owning this settlement.name - The name for this settlement.tile - The location of the IndianSettlement.isCapital - True if settlement is tribe's capitallearnableSkill - The skill that can be learned by Europeans at this settlement.isVisited - Indicates if any European scout has asked to speak with the chief.missionary - The missionary in this settlement (or null).
java.lang.IllegalArgumentException - if an invalid tribe or kind is given
public IndianSettlement(Game game,
javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
IndianSettlement from an Element.
game - The Game in which this object belong.in - The input stream containing the XML.
javax.xml.stream.XMLStreamException - if a problem was encountered
during parsing.
public IndianSettlement(Game game,
org.w3c.dom.Element e)
IndianSettlement from an Element.
game - The Game in which this object belong.e - An XML-element that will be used to initialize
this object.
public IndianSettlement(Game game,
java.lang.String id)
IndianSettlement
with the given ID. The object should later be
initialized by calling either
FreeColGameObject.readFromXML(XMLStreamReader) or
FreeColObject.readFromXMLElement(Element).
game - The Game in which this object belong.id - The unique identifier for this object.| Method Detail |
|---|
public java.util.Map<Player,Tension> getAlarm()
public int getTribute(Player player)
player - a Player value
int value
public void modifyAlarm(Player player,
int addToAlarm)
player - The Player.addToAlarm - The amount to add to the current alarm level.
public void propagatedAlarm(Player player,
int addToAlarm)
player - The Player towards whom the alarm is felt.addToAlarm - The amount to add to the current alarm level.
public void setAlarm(Player player,
Tension newAlarm)
player - The Player.newAlarm - The new alarm value.public Tension getAlarm(Player player)
player - The Player to get the alarm level for.
public java.lang.String getAlarmLevelMessage(Player player)
player - The other player.
public boolean hasBeenVisited()
private boolean hasBeenContacted(Player player)
player - The Player to consider.
public boolean allowContact(Unit unit)
unit - The Unit that proposes to contact this
settlement.
public boolean hasBeenVisited(Player player)
player - The player to check if has visited the settlement
public void setVisited(Player player)
player - a Player valuepublic void addOwnedUnit(Unit unit)
Unit to the list of units that belongs to this
IndianSettlement.
unit - The Unit to be added.public java.util.Iterator<Unit> getOwnedUnitsIterator()
IndianSettlement is owning.
Iterator.public boolean removeOwnedUnit(Unit unit)
Unit to the list of units that
belongs to this IndianSettlement. Returns true if
the Unit was removed.
unit - The Unit to be removed from the
list of the units this IndianSettlement
owns.
boolean valuepublic UnitType getLearnableSkill()
public Unit getMissionary()
public void setMissionary(Unit missionary)
missionary - The missionary for this settlement.
public java.lang.String getResponseToMissionaryAttempt(Tension.Level tension,
java.lang.String success)
public GoodsType[] getWantedGoods()
public void setWantedGoods(int index,
GoodsType type)
public void setLearnableSkill(UnitType skill)
skill - The new learnable skill for this Indian settlement.public Settlement.SettlementType getTypeOfSettlement()
public void add(Locatable locatable)
Locatable to this Location.
add in interface Locationadd in class Settlementlocatable - The Locatable to add to this Location.public void remove(Locatable locatable)
Locatable from this Location.
remove in interface Locationremove in class Settlementlocatable - The Locatable to remove from this Location.public int getUnitCount()
getUnitCount in interface LocationgetUnitCount in class Settlementpublic java.util.List<Unit> getUnitList()
Location
public java.util.Iterator<Unit> getUnitIterator()
LocationIterator of every Unit directly
located on this Location.
Iterator.public Unit getFirstUnit()
public Unit getLastUnit()
public Unit getDefendingUnit(Unit attacker)
Unit that is currently defending this IndianSettlement.
getDefendingUnit in class Settlementattacker - The unit that would be attacking this IndianSettlement.
Unit that has been chosen to defend this IndianSettlement.public int getPrice(Goods goods)
IndianSettlment
is willing to pay for the given Goods.
GoodsContainer
is hidden from the clients.
goods - The Goods to price.
public int getPrice(GoodsType type,
int amount)
IndianSettlment
is willing to pay for the given Goods.
GoodsContainer
is hidden from the clients.
type - The type of Goods to price.amount - The amount of Goods to price.
public int getMaximumProduction(GoodsType goodsType)
goodsType - The type of goods to check.
public void updateWantedGoods()
GoodsContainer
is hidden from the clients.
private int getPriceAddition()
LONGHOUSE,
CITY or a capital.
public int getBonusMultiplier()
LONGHOUSE,
CITY or a capital.
public int getGeneratedUnitCount()
IndianSettlement.
public boolean contains(Locatable locatable)
LocationLocation contains the specified
Locatable.
contains in interface Locationcontains in class Settlementlocatable - The Locatable to test the presence of.
Locatable is
on this Location and
public boolean canAdd(Locatable locatable)
LocationLocation.
canAdd in interface LocationcanAdd in class Settlementlocatable - The Locatable to add.
public int getProductionOf(GoodsType type)
Settlement
getProductionOf in class Settlementtype - The type of goods to get the production for.
Settlementpublic void newTurn()
newTurn in class Settlementpublic boolean checkForNewMissionaryConvert()
private void checkForNewIndian()
private void increaseAlarm()
private void consumeGoods(GoodsType type,
int amount)
public void equipBraves()
public void dispose()
dispose in class Settlementpublic void createGoodsContainer()
GoodsContainer.
FreeColServer.loadGame(net.sf.freecol.common.io.FreeColSavegameFile):
Only for compatibility when loading savegames with pre-0.0.3 protocols.
private void breedHorses()
protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out,
Player player,
boolean showAll,
boolean toSavedGame)
throws javax.xml.stream.XMLStreamException
Player will
be added to that representation if showAll is
set to false.
toXMLImpl in class FreeColGameObjectout - The target stream.player - The Player this XML-representation
should be made for, or null if
showAll == true.showAll - Only attributes visible to player
will be added to the representation if showAll
is set to false.toSavedGame - If true then information that
is only needed when saving a game is added.
javax.xml.stream.XMLStreamException - if there are any problems writing
to the stream.
protected void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
readFromXMLImpl in class FreeColObjectin - The input stream with the XML.
javax.xml.stream.XMLStreamException - if a problem was encountered
during parsing.public static java.lang.String getXMLElementTagName()
public Colony getColony()
public java.util.List<Goods> getSellGoods()
public int getPriceToSell(Goods goods)
IndianSettlment
is willing to pay for the given Goods.
GoodsContainer
is hidden from the clients.
goods - The Goods to price.
public int getPriceToSell(GoodsType type,
int amount)
IndianSettlment
is willing to pay for the given Goods.
GoodsContainer
is hidden from the clients.
type - The type of Goods to price.amount - The amount of Goods to price.
public java.lang.String toString()
FreeColGameObject
toString in class FreeColGameObjectStringpublic void tradeGoodsWithSetlement(IndianSettlement settlement)
settlement -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||