|
||||||||||
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 | |
---|---|
static int |
ALARM_NEW_MISSIONARY
|
static int |
ALARM_RADIUS
|
static java.lang.String |
ALARM_TAG_NAME
|
static int |
ALARM_TILE_IN_USE
|
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. |
static int |
MAX_CONVERT_DISTANCE
|
static int |
MAX_HORSES_PER_TURN
|
static java.lang.String |
MISSIONARY_TAG_NAME
|
static int |
MISSIONARY_TENSION
|
static java.lang.String |
OWNED_UNITS_TAG_NAME
|
static int |
TURNS_PER_TRIBUTE
|
static java.lang.String |
UNITS_TAG_NAME
|
static java.lang.String |
WANTED_GOODS_TAG_NAME
|
Fields inherited from class net.sf.freecol.common.model.Settlement |
---|
FOOD_CONSUMPTION, RADIUS |
Fields inherited from class net.sf.freecol.common.model.FreeColObject |
---|
ID_ATTRIBUTE_TAG |
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). |
boolean |
canAdd(Locatable locatable)
Checks whether or not the specified locatable may be added to this Location . |
boolean |
checkForNewMissionaryConvert()
|
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 . |
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. |
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. |
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. |
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. |
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, removeGoods, removeGoods, removeGoods, setCapital, setName, setOwner |
Methods inherited from class net.sf.freecol.common.model.FreeColGameObject |
---|
addToRemoveElement, equals, equals, getFreeColGameObject, getFreeColGameObject, getGame, getGameOptions, getIntegerID, hashCode, hasID, isDisposed, isUninitialized, readFromXML, setGame, setId, toSavedXML, toXML, updateFreeColGameObject, updateID |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.sf.freecol.common.model.Location |
---|
getId |
Field Detail |
---|
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
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 givenpublic 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
valuepublic 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()
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 Location
add
in class Settlement
locatable
- The Locatable
to add to this Location.public void remove(Locatable locatable)
Locatable
from this Location.
remove
in interface Location
remove
in class Settlement
locatable
- The Locatable
to remove from this Location.public int getUnitCount()
getUnitCount
in interface Location
getUnitCount
in class Settlement
public java.util.List<Unit> getUnitList()
Location
public java.util.Iterator<Unit> getUnitIterator()
Location
Iterator
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 Settlement
attacker
- 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.
public int getBonusMultiplier()
LONGHOUSE
,
CITY
or a capital.
public int getGeneratedUnitCount()
IndianSettlement
.
public boolean contains(Locatable locatable)
Location
Location
contains the specified
Locatable
.
contains
in interface Location
contains
in class Settlement
locatable
- The Locatable
to test the presence of.
Locatable
is
on this Location
and
public boolean canAdd(Locatable locatable)
Location
Location
.
canAdd
in interface Location
canAdd
in class Settlement
locatable
- The Locatable
to add.
public int getProductionOf(GoodsType type)
Settlement
getProductionOf
in class Settlement
type
- The type of goods to get the production for.
Settlement
public void newTurn()
newTurn
in class Settlement
public boolean checkForNewMissionaryConvert()
public void equipBraves()
public void dispose()
dispose
in class Settlement
public void createGoodsContainer()
GoodsContainer
.
FreeColServer.loadGame(net.sf.freecol.common.io.FreeColSavegameFile)
:
Only for compatibility when loading savegames with pre-0.0.3 protocols.
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 FreeColGameObject
String
public void tradeGoodsWithSetlement(IndianSettlement settlement)
settlement
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |