|
||||||||||
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.Player
public class Player
Represents a player. The player can be either a human player or an AI-player.
In addition to storing the name, nation e.t.c. of the player, it also stores
various defaults for the player. One example of this is the
entry location
.
Nested Class Summary | |
---|---|
class |
Player.ActivePredicate
A predicate for determining active units. |
class |
Player.GoingToPredicate
A predicate for determining units going somewhere. |
static class |
Player.PlayerType
|
static class |
Player.Stance
Constants for describing the stance towards a player. |
class |
Player.UnitIterator
An Iterator of Unit s that can be made active. |
class |
Player.UnitPredicate
A predicate that can be applied to a unit. |
Field Summary | |
---|---|
static java.util.Comparator<Player> |
playerComparator
|
static int |
SCORE_INDEPENDENCE_DECLARED
|
static int |
SCORE_INDEPENDENCE_GRANTED
|
static int |
SCORE_SETTLEMENT_DESTROYED
|
static java.lang.String |
UNKNOWN_ENEMY
|
Fields inherited from class net.sf.freecol.common.model.FreeColObject |
---|
ID_ATTRIBUTE_TAG |
Constructor Summary | |
---|---|
Player(Game game,
org.w3c.dom.Element e)
Initiates a new Player from an Element and
registers this Player at the specified game. |
|
Player(Game game,
java.lang.String id)
Initiates a new Player with the given ID. |
|
Player(Game game,
java.lang.String name,
boolean admin)
Creates a new Player with specified name. |
|
Player(Game game,
java.lang.String name,
boolean admin,
boolean ai,
Nation nation)
Creates an new AI Player with the specified name. |
|
Player(Game game,
java.lang.String name,
boolean admin,
Nation newNation)
Creates a new (human) Player with specified name. |
|
Player(Game game,
javax.xml.stream.XMLStreamReader in)
Initiates a new Player from an Element and
registers this Player at the specified game. |
Method Summary | |
---|---|
void |
addFather(FoundingFather father)
Adds a founding father to this player's continental congress. |
void |
addModelMessage(ModelMessage modelMessage)
Adds a ModelMessage for this player. |
void |
addSettlement(Settlement s)
Adds the given Settlement to this Player 's
list of settlements. |
boolean |
canBuildColonies()
Checks if this Player can build colonies. |
boolean |
canHaveFoundingFathers()
Checks if this Player can get founding fathers. |
boolean |
canMoveToEurope()
Checks if this Player can move units to
Europe . |
boolean |
canRecruitUnits()
Checks if this Player can recruit units by producing
immigration. |
boolean |
canSee(Tile tile)
Checks if this Player can see the given Tile . |
boolean |
canTrade(Goods goods)
Returns true if type of goods can be traded in Europe. |
boolean |
canTrade(Goods goods,
int marketAccess)
Returns true if type of goods can be traded at specified place |
boolean |
canTrade(GoodsType type)
Returns true if type of goods can be traded in Europe. |
boolean |
canTrade(GoodsType type,
int marketAccess)
Returns true if type of goods can be traded at specified place. |
void |
changeRelationWithPlayer(Player player,
Player.Stance newStance)
|
boolean |
checkEmigrate()
Checks to see whether or not a colonist can emigrate, and does so if possible. |
static boolean |
checkForDeath(Player player)
Checks if the given player has died. |
void |
clearModelMessages()
Removes all the model messages for this player. |
void |
divertModelMessages(FreeColGameObject source,
FreeColGameObject newSource)
Sometimes an event causes the source (and display) fields in an accumulated model message to become invalid (e.g. |
void |
endTurn()
Gets called when this player's turn has ended. |
boolean |
equals(Player o)
Checks if the given Player equals this object. |
UnitType |
generateRecruitable(java.lang.String id)
Generates a random unit type recruitable by this player. |
java.util.List<RandomChoice<UnitType>> |
generateRecruitablesList()
Generate a weighted list of unit types recruitable by this player. |
int |
getArrears(Goods goods)
Returns the arrears due for a type of goods. |
int |
getArrears(GoodsType type)
Returns the arrears due for a type of goods. |
java.util.List<Colony> |
getColonies()
Returns a list of all Colonies this player owns. |
int |
getColoniesPopulation()
Returns the sum of units currently working in the colonies of this player. |
Colony |
getColony(java.lang.String name)
Returns the Colony with the given name. |
int |
getColonyValue(Tile t)
Gets the value of building a Colony on the given tile. |
java.awt.Color |
getColor()
Returns the color of this player. |
FoundingFather |
getCurrentFather()
Gets the founding father this player is working
towards. |
boolean |
getDead()
Get the player death state. |
java.lang.String |
getDefaultRegionName(Region.RegionType regionType)
Creates a unique region name by fetching a new default name from the list of default names if possible. |
java.lang.String |
getDefaultSettlementName(boolean capital)
Creates a unique settlement name. |
DifficultyLevel |
getDifficulty()
Returns the difficulty level. |
java.util.List<Player> |
getDominionsAtWar()
Gets a list of the players this REF player is currently fighting. |
Location |
getEntryLocation()
Gets the default Location where the units arriving from
Europe will be put. |
Europe |
getEurope()
Returns the europe object that this player has. |
java.lang.String |
getEuropeName()
Describe getEuropeName method here. |
int |
getFatherCount()
Returns the number of founding fathers in this players congress. |
FeatureContainer |
getFeatureContainer()
Get the FeatureContainer value. |
int |
getGold()
Returns the amount of gold that this player has. |
java.util.List<HistoryEvent> |
getHistory()
Get the History value. |
int |
getImmigration()
Gets the number of immigration this player possess. |
int |
getImmigrationRequired()
Gets the number of immigration required to cause a new colonist to emigrate. |
int |
getIncomeAfterTaxes(GoodsType goodsType)
Returns the current incomeAfterTaxes. |
int |
getIncomeBeforeTaxes(GoodsType goodsType)
Returns the current incomeBeforeTaxes. |
java.lang.String |
getIndependentNationName()
Get the IndependentNationName value. |
int |
getIndex()
Returns the index of this Player. |
IndianSettlement |
getIndianSettlement(java.lang.String name)
Returns the IndianSettlement with the given name. |
java.util.List<IndianSettlement> |
getIndianSettlements()
Returns a list of all IndianSettlements this player owns. |
int |
getLandPrice(Tile tile)
Returns the price of the given land. |
int |
getLiberty()
Gets the current amount of liberty this Player has. |
int |
getLibertyProductionNextTurn()
Returns how many total liberty will be produced if no colonies are lost and nothing unexpected happens. |
Market |
getMarket()
Returns this Player's Market. |
java.lang.String |
getMarketName()
What is the name of the player's market? Following a declaration of independence we are assumed to trade broadly with any European market rather than a specific port. |
java.util.List<ModelMessage> |
getModelMessages()
Returns all ModelMessages for this player. |
Monarch |
getMonarch()
Returns the monarch object this player has. |
Goods |
getMostValuableGoods()
Returns the most valuable goods available in one of the player's colonies for the purposes of choosing a threat-to-boycott. |
java.lang.String |
getName()
Returns the name of this player. |
Nation |
getNation()
Return this Player's nation. |
java.lang.String |
getNationID()
Return the ID of this Player's nation. |
NationType |
getNationType()
Returns the nation type of this player. |
java.lang.String |
getNewLandName()
Gets the name this player has chosen for the new land. |
java.util.List<ModelMessage> |
getNewModelMessages()
Returns all new ModelMessages for this player. |
Unit |
getNextActiveUnit()
Gets a new active unit. |
Unit |
getNextGoingToUnit()
Gets a new going_to unit. |
int |
getNumberOfKingLandUnits()
Gets the number of King's land units. |
int |
getNumberOfSettlements()
Returns the known number of settlements of this player. |
int |
getOutpostValue(Tile t)
Calculates the value of an outpost-type colony at this tile. |
Player.PlayerType |
getPlayerType()
Returns the type of this player. |
int |
getRecruitPrice()
Gets the price for a recruit in europe. |
Player |
getREFPlayer()
Gets the Player controlling the "Royal Expeditionary
Force" for this player. |
int |
getRemainingFoundingFatherCost()
Gets the number of liberty points needed to recruit the next founding father. |
Location |
getRepairLocation(Unit unit)
Returns the closest Location in which the given ship can
get repaired. |
java.lang.String |
getRulerName()
Get the RulerName value. |
int |
getSales(GoodsType goodsType)
Returns the current sales. |
int |
getScore()
Returns the current score of the player. |
Settlement |
getSettlement(java.lang.String name)
Find a Settlement by name. |
java.util.List<Settlement> |
getSettlements()
Returns a list of all Settlements this player owns. |
int |
getSoL()
Gets the total percentage of rebels in all this player's colonies. |
Player.Stance |
getStance(Player player)
Returns the stance towards a given player. |
static java.lang.String |
getStanceAsString(Player.Stance stance)
Returns a string describing the given stance. |
int |
getTax()
Returns the current tax. |
Tension |
getTension(Player player)
Gets the hostility this player has against the given player. |
int |
getTotalFoundingFatherCost()
Returns how many liberty points in total are needed to earn the Founding Father we are trying to recruit. |
java.util.List<TradeRoute> |
getTradeRoutes()
Get the TradeRoutes value. |
Unit |
getUnit(java.lang.String id)
Get the Unit value. |
java.util.Iterator<Unit> |
getUnitIterator()
Gets an Iterator containing all the units this player
owns. |
java.util.List<Unit> |
getUnits()
|
static java.lang.String |
getXMLElementTagName()
Gets the tag name of the root element representing this object. |
boolean |
hasAbility(java.lang.String id)
Describe hasAbility method here. |
boolean |
hasBeenAttackedByPrivateers()
Returns whether this player has been attacked by privateers. |
boolean |
hasContacted(Player player)
Returns whether this player has met with the Player if the
given nation . |
boolean |
hasExplored(Tile tile)
Checks if this Player has explored the given
Tile . |
boolean |
hasFather(FoundingFather someFather)
Determines whether this player has a certain Founding father. |
boolean |
hasManOfWar()
Checks if this player has a single Man-of-War. |
boolean |
hasNextActiveUnit()
Checks if a new active unit can be made active. |
boolean |
hasNextGoingToUnit()
Checks if a new active unit can be made active. |
boolean |
hasSettlement(Settlement s)
Checks if this player owns the given Settlement . |
boolean |
hasTraded(GoodsType goodsType)
Has a type of goods been traded? |
void |
incrementImmigration(int amount)
|
void |
incrementLiberty(int amount)
|
void |
invalidateCanSeeTiles()
Forces an update of the canSeeTiles . |
boolean |
isAdmin()
Checks if this player is an admin. |
boolean |
isAI()
Determines whether this player is an AI player. |
boolean |
isAtWar()
Checks whether this player is at war with any other player. |
boolean |
isDead()
Checks if this player is dead. |
boolean |
isEuropean()
Checks if this player is european. |
boolean |
isIndian()
Checks if this player is indian. |
boolean |
isNewLandNamed()
Returns true if the player already selected a new name for the discovered land. |
boolean |
isReady()
Checks if this Player is ready to start the game. |
boolean |
isREF()
Checks if this player is a "royal expeditionary force. |
void |
modifyGold(int amount)
Modifies the amount of gold that this player has. |
void |
modifyIncomeAfterTaxes(GoodsType goodsType,
int amount)
Modifies the current incomeAfterTaxes. |
void |
modifyIncomeBeforeTaxes(GoodsType goodsType,
int amount)
Modifies the current incomeBeforeTaxes. |
void |
modifySales(GoodsType goodsType,
int amount)
Modifies the current sales. |
void |
modifyScore(int value)
Modifies the score of the player by the given value. |
void |
modifyTension(Player player,
int addToTension)
Modifies the hostiliy against the given player. |
void |
modifyTension(Player player,
int addToTension,
IndianSettlement origin)
|
void |
newTurn()
Prepares this Player for a new turn. |
void |
reduceImmigration()
Sets the number of immigration this player possess. |
void |
reinitialiseMarket()
Resets this Player's Market. |
void |
removeModelMessages()
Removes all undisplayed model messages for this player. |
void |
removeSettlement(Settlement s)
Removes the given Settlement from this Player 's
list of settlements. |
void |
removeUnit(Unit oldUnit)
Remove Unit. |
void |
resetArrears(Goods goods)
Resets the arrears for these goods to zero. |
void |
resetArrears(GoodsType goodsType)
Resets the arrears for this type of goods to zero. |
boolean |
resetCanSeeTiles()
Resets this player's "can see"-tiles. |
void |
resetTradeRouteCounts()
Reset the TradeRoute counts associated with the
player's trade routes. |
void |
setAI(boolean ai)
Sets whether this player is an AI player. |
void |
setArrears(Goods goods)
Sets the arrears for these goods. |
void |
setArrears(GoodsType goodsType)
Sets the arrears for a type of goods. |
void |
setAttackedByPrivateers()
Sets the variable attackedByPrivateers to true. |
void |
setColor(java.awt.Color c)
Sets the color for this player. |
void |
setContacted(Player player,
boolean contacted)
Sets whether this player has contacted the given player. |
void |
setCurrentFather(FoundingFather someFather)
Sets this players liberty bell production to work towards recruiting father to its congress. |
void |
setDead(boolean dead)
Sets this player to be dead or not. |
void |
setEntryLocation(Location entryLocation)
Sets the Location where the units arriving from
Europe will be put as a default. |
void |
setExplored(Tile tile)
Sets the given tile to be explored by this player and updates the player's information about the tile. |
void |
setExplored(Unit unit)
Sets the tiles within the given Unit 's line of sight to
be explored by this player. |
void |
setFeatureContainer(FeatureContainer newFeatureContainer)
Set the FeatureContainer value. |
void |
setGold(int newGold)
Set the amount of gold that this player has. |
void |
setHistory(java.util.List<HistoryEvent> newHistory)
Set the History value. |
void |
setImmigration(int immigration)
Sets the number of immigration this player possess. |
void |
setImmigrationRequired(int immigrationRequired)
Sets the number of immigration required to cause a new colonist to emigrate. |
void |
setIndependentNationName(java.lang.String newIndependentNationName)
Set the IndependentNationName value. |
void |
setMonarch(Monarch monarch)
Sets the monarch object this player has. |
void |
setName(java.lang.String newName)
Set the Name value. |
void |
setNation(Nation newNation)
Sets the nation for this player. |
void |
setNationType(NationType newNationType)
Sets the nation type of this player. |
void |
setNewLandName(java.lang.String newLandName)
Sets the name this player uses for the new land. |
void |
setNumberOfSettlements(int number)
|
void |
setPlayerType(Player.PlayerType type)
Sets the player type. |
void |
setReady(boolean ready)
Sets this Player to be ready/not ready for starting the
game. |
void |
setScore(int newScore)
Set the current score of the player. |
void |
setStance(Player player,
Player.Stance newStance)
Sets the stance towards a given player. |
void |
setTax(int amount)
Sets the current tax. |
void |
setTension(Player player,
Tension newTension)
Sets the hostility against the given player. |
void |
setTradeRoutes(java.util.List<TradeRoute> newTradeRoutes)
Set the TradeRoutes value. |
void |
setUnit(Unit newUnit)
Set the Unit value. |
void |
surrenderTo(Player player)
Indian player surrenders |
java.lang.String |
toString()
Returns the name of this player. |
void |
updateImmigrationRequired()
Updates the amount of immigration needed to emigrate a Unit
from Europe . |
Methods inherited from class net.sf.freecol.common.model.FreeColGameObject |
---|
addToRemoveElement, dispose, 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 |
Field Detail |
---|
public static final int SCORE_SETTLEMENT_DESTROYED
public static final int SCORE_INDEPENDENCE_DECLARED
public static final int SCORE_INDEPENDENCE_GRANTED
public static final java.lang.String UNKNOWN_ENEMY
public static final java.util.Comparator<Player> playerComparator
Constructor Detail |
---|
public Player(Game game, java.lang.String name, boolean admin, boolean ai, Nation nation)
Player
with the specified name.
game
- The Game
this Player
belongs
to.name
- The name that this player will use.admin
- Whether or not this AI player shall be considered an Admin.ai
- Whether or not this AI player shall be considered an AI player
(usually true here).nation
- The nation of the Player
.public Player(Game game, java.lang.String name, boolean admin)
Player
with specified name.
game
- The Game
this Player
belongs
to.name
- The name that this player will use.admin
- 'true' if this Player is an admin,
'false' otherwise.public Player(Game game, java.lang.String name, boolean admin, Nation newNation)
Player
with specified name.
game
- The Game
this Player
belongs
to.name
- The name that this player will use.admin
- 'true' if this Player is an admin,
'false' otherwise.newNation
- The nation of the Player
.public Player(Game game, javax.xml.stream.XMLStreamReader in) throws javax.xml.stream.XMLStreamException
Player
from an Element
and
registers this Player
at the specified game.
game
- The Game
this object belongs to.in
- The input stream containing the XML.
javax.xml.stream.XMLStreamException
- if a problem was encountered during parsing.public Player(Game game, org.w3c.dom.Element e)
Player
from an Element
and
registers this Player
at the specified game.
game
- The Game
this object belongs to.e
- An XML-element that will be used to initialize this object.public Player(Game game, java.lang.String id)
Player
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 int getIndex()
int
valuepublic final FeatureContainer getFeatureContainer()
FeatureContainer
value.
FeatureContainer
valuepublic final void setFeatureContainer(FeatureContainer newFeatureContainer)
FeatureContainer
value.
newFeatureContainer
- The new FeatureContainer value.public boolean hasAbility(java.lang.String id)
FreeColObject
hasAbility
method here.
hasAbility
in class FreeColObject
id
- a String
value
boolean
valuepublic void addModelMessage(ModelMessage modelMessage)
ModelMessage
for this player.
modelMessage
- The ModelMessage
.Canvas
,
addModelMessage(ModelMessage)
,
ModelMessage
public java.util.List<ModelMessage> getModelMessages()
public java.util.List<ModelMessage> getNewModelMessages()
public void removeModelMessages()
public void clearModelMessages()
public void divertModelMessages(FreeColGameObject source, FreeColGameObject newSource)
source
- the source field that has become invalidnewSource
- a new source field to replace the old with, or
if null then remove the messagepublic int getScore()
int
valuepublic void setScore(int newScore)
newScore
- The new score.public void modifyScore(int value)
value
- an int
valuepublic Market getMarket()
public void reinitialiseMarket()
public java.lang.String getMarketName()
public boolean hasSettlement(Settlement s)
Settlement
.
s
- The Settlement
.
true
if this Player
owns the given
Settlement
.public void addSettlement(Settlement s)
Settlement
to this Player
's
list of settlements.
s
- public void removeSettlement(Settlement s)
Settlement
from this Player
's
list of settlements.
s
- The Settlement
to remove.public int getNumberOfSettlements()
public void setNumberOfSettlements(int number)
public java.util.List<Settlement> getSettlements()
public java.util.List<Colony> getColonies()
public int getColoniesPopulation()
public Colony getColony(java.lang.String name)
Colony
with the given name.
name
- The name of the Colony
.
Colony
or null
if this player
does not have a Colony
with the specified name.public java.util.List<IndianSettlement> getIndianSettlements()
public IndianSettlement getIndianSettlement(java.lang.String name)
IndianSettlement
with the given name.
name
- The name of the IndianSettlement
.
IndianSettlement
or null
if this player
does not have a IndianSettlement
with the specified name.public Settlement getSettlement(java.lang.String name)
Settlement
by name.
name
- The name of the Settlement
.
Settlement
, or null
if not found.public Player.PlayerType getPlayerType()
public void setPlayerType(Player.PlayerType type)
type
- The new player type.getPlayerType()
public boolean isEuropean()
public boolean isIndian()
isEuropean()
.
public boolean isREF()
true
is the given nation is a royal expeditionary
force and false
otherwise.public boolean isAI()
public void setAI(boolean ai)
ai
- true
if this Player
is controlled
by the computer.public boolean isAdmin()
public static boolean checkForDeath(Player player)
player
- The Player
.
public boolean isDead()
Player
dies when it
looses the game.
true
if this Player
is dead.public boolean getDead()
Player
is dead.public void setDead(boolean dead)
dead
- Should be set to true
when this
Player
dies.isDead()
public boolean isAtWar()
public java.util.List<Player> getDominionsAtWar()
public final Unit getUnit(java.lang.String id)
Unit
value.
List
valuepublic final void setUnit(Unit newUnit)
Unit
value.
newUnit
- The new Units value.public void removeUnit(Unit oldUnit)
oldUnit
- an Unit
valuepublic int getSoL()
public final java.lang.String getIndependentNationName()
IndependentNationName
value.
String
valuepublic final void setIndependentNationName(java.lang.String newIndependentNationName)
IndependentNationName
value.
newIndependentNationName
- The new IndependentNationName value.public Player getREFPlayer()
Player
controlling the "Royal Expeditionary
Force" for this player.
null
if this player does not have a
royal expeditionary force.public java.lang.String getNewLandName()
Player
.
If no land name was chosen, the default name is returned.public boolean isNewLandNamed()
public java.lang.String getDefaultSettlementName(boolean capital)
capital
- True if the name should be the national capital.
String
containing a new unused name from
the list, if any is available, and otherwise an automatically
generated name.public java.lang.String getDefaultRegionName(Region.RegionType regionType)
regionType
- a RegionType
value
String
valuepublic void setNewLandName(java.lang.String newLandName)
newLandName
- This Player
's name for the new world.public int getLandPrice(Tile tile)
tile
- The Tile
to get the price for.
public boolean hasContacted(Player player)
Player
if the
given nation
.
player
- The Player.
true
if this Player
has contacted
the given nation.public void setContacted(Player player, boolean contacted)
player
- The Player
.contacted
- true
if this Player
has
contacted the given Player
.public boolean hasBeenAttackedByPrivateers()
true
if this Player
has been
attacked by privateers.public void setAttackedByPrivateers()
public Location getEntryLocation()
Location
where the units arriving from
Europe
will be put.
Location
.Unit.getEntryLocation()
public void setEntryLocation(Location entryLocation)
Location
where the units arriving from
Europe
will be put as a default.
entryLocation
- The Location
.getEntryLocation()
public boolean hasExplored(Tile tile)
Player
has explored the given
Tile
.
tile
- The Tile
.
Tile
has been explored and
false otherwise.public void setExplored(Tile tile)
tile
- The Tile
to set explored.Tile.updatePlayerExploredTile(Player)
public void setExplored(Unit unit)
Unit
's line of sight to
be explored by this player.
unit
- The Unit
.setExplored(Tile)
,
hasExplored(net.sf.freecol.common.model.Tile)
public void invalidateCanSeeTiles()
canSeeTiles
. This method should
be used to invalidate the current canSeeTiles
. The method
resetCanSeeTiles()
will be called whenever it is needed.
public boolean resetCanSeeTiles()
Unit
s line of sight visible. The other tiles are
made unvisible. invalidateCanSeeTiles()
whenever possible.
true
if successful false
otherwisepublic boolean canSee(Tile tile)
Player
can see the given Tile
.
The Tile
can be seen if it is in a Unit
's line of
sight.
tile
- The given Tile
.
Player
can see the given
Tile
and false otherwise.public boolean canBuildColonies()
Player
can build colonies.
true
if this player is european, not the royal
expeditionary force and not currently fighting the war of
independence.public boolean canHaveFoundingFathers()
Player
can get founding fathers.
true
if this player is european, not the royal
expeditionary force and not currently fighting the war of
independence.public boolean hasFather(FoundingFather someFather)
someFather
- a FoundingFather
value
FoundingFather
public int getFatherCount()
public void setCurrentFather(FoundingFather someFather)
father
to its congress.
someFather
- a FoundingFather
valueFoundingFather
public FoundingFather getCurrentFather()
founding father
this player is working
towards.
setCurrentFather(net.sf.freecol.common.model.FoundingFather)
,
FoundingFather
public int getRemainingFoundingFatherCost()
Player
needs in order to recruit the next founding father.Goods.BELLS
,
incrementLiberty(int)
public int getTotalFoundingFatherCost()
Player
needs to recruit the next founding father.Goods.BELLS
,
incrementLiberty(int)
public void addFather(FoundingFather father)
father
- a FoundingFather
valueFoundingFather
public void endTurn()
public boolean canMoveToEurope()
Player
can move units to
Europe
.
true
if this Player
has an instance
of Europe
.public Europe getEurope()
null
if
this Player
does not have an instance
Europe
.public java.lang.String getEuropeName()
getEuropeName
method here.
String
valuepublic Monarch getMonarch()
null
if this
Player
does not have an instance
Monarch
.public void setMonarch(Monarch monarch)
monarch
- The monarch object this player should have.public int getGold()
-1
if
the amount of gold is unknown.public void setGold(int newGold)
newGold
- The new player gold value.public void modifyGold(int amount)
amount
- The amount of gold that should be added to this player's
gold amount (can be negative!).
java.lang.IllegalArgumentException
- if the player gets a negative amount
of gold after adding amount
.public java.util.Iterator<Unit> getUnitIterator()
Iterator
containing all the units this player
owns.
Iterator
.Unit
public java.util.List<Unit> getUnits()
public int getNumberOfKingLandUnits()
public boolean hasManOfWar()
true
if this player owns
a single Man-of-War.public Unit getNextActiveUnit()
Unit
that can be made active.public Unit getNextGoingToUnit()
Unit
that can be made active.public boolean hasNextActiveUnit()
public boolean hasNextGoingToUnit()
public java.lang.String getName()
getName
in interface Named
public java.lang.String toString()
toString
in class FreeColGameObject
public void setName(java.lang.String newName)
Name
value.
setName
in interface Nameable
newName
- The new Name value.public NationType getNationType()
public void setNationType(NationType newNationType)
newNationType
- a NationType
valuepublic Nation getNation()
String
valuepublic void setNation(Nation newNation)
newNation
- The new nation for this player.public java.lang.String getNationID()
String
valuepublic final java.lang.String getRulerName()
RulerName
value.
String
valuepublic java.awt.Color getColor()
public void setColor(java.awt.Color c)
c
- The new color for this player.public boolean isReady()
Player
is ready to start the game.
true
if this Player
is ready to
start the game.public void setReady(boolean ready)
Player
to be ready/not ready for starting the
game.
ready
- This indicates if the player is ready to start the game.public Location getRepairLocation(Unit unit)
Location
in which the given ship can
get repaired. This is the closest Colony
with a drydock, or
Europe
if this player has no colonies with a drydock.
unit
- The ship that needs a location to be repaired.
Location
in which the ship can be
repaired.
java.lang.IllegalArgumentException
- if the unit
is not a
ship.public void incrementLiberty(int amount)
public void incrementImmigration(int amount)
public void reduceImmigration()
incrementImmigration(int)
public int getImmigration()
reduceImmigration()
public void setImmigration(int immigration)
immigration
- The immigration value for this player.public java.util.List<RandomChoice<UnitType>> generateRecruitablesList()
public UnitType generateRecruitable(java.lang.String id)
public final java.util.List<TradeRoute> getTradeRoutes()
TradeRoutes
value.
List
valuepublic final void setTradeRoutes(java.util.List<TradeRoute> newTradeRoutes)
TradeRoutes
value.
newTradeRoutes
- The new TradeRoutes value.public final void resetTradeRouteCounts()
TradeRoute
counts associated with the
player's trade routes.
public boolean checkEmigrate()
public int getImmigrationRequired()
public void setImmigrationRequired(int immigrationRequired)
immigrationRequired
- The number of immigration required to cause a new
colonist to emigrate.public void updateImmigrationRequired()
Unit
from Europe
.
public boolean canRecruitUnits()
Player
can recruit units by producing
immigration.
true
if units can be recruited by this
Player
.public void modifyTension(Player player, int addToTension)
player
- The Player
.addToTension
- The amount to add to the current tension level.public void modifyTension(Player player, int addToTension, IndianSettlement origin)
public void setTension(Player player, Tension newTension)
player
- The Player
.newTension
- The Tension
.public Tension getTension(Player player)
player
- The Player
.
public void surrenderTo(Player player)
player
- The Player
he surrenders to.public final java.util.List<HistoryEvent> getHistory()
History
value.
List
valuepublic final void setHistory(java.util.List<HistoryEvent> newHistory)
History
value.
newHistory
- The new History value.public int getOutpostValue(Tile t)
public int getColonyValue(Tile t)
Colony
on the given tile.
This method adds bonuses to the colony value if the tile is close to (but
not overlapping with) another friendly colony. Penalties for enemy
units/colonies are added as well.
t
- The Tile
public Player.Stance getStance(Player player)
player
- The Player
.
public static java.lang.String getStanceAsString(Player.Stance stance)
stance
- The stance.
public void setStance(Player player, Player.Stance newStance)
changeRelationsWithPlayer
should be used to set both players
player
- The Player
.newStance
- The stance.public void changeRelationWithPlayer(Player player, Player.Stance newStance)
public int getRecruitPrice()
Europe
.public int getLiberty()
Player
has.
Goods.BELLS
,
incrementLiberty(int)
public int getLibertyProductionNextTurn()
Player
's
Colony
s will make.Goods.BELLS
,
incrementLiberty(int)
public void newTurn()
Player
for a new turn.
public int getArrears(GoodsType type)
type
- a GoodsType
value
public int getArrears(Goods goods)
goods
- The goods.
public void setArrears(GoodsType goodsType)
goodsType
- a GoodsType
valuepublic void setArrears(Goods goods)
goods
- The goods.public void resetArrears(GoodsType goodsType)
goodsType
- a GoodsType
valuepublic void resetArrears(Goods goods)
resetArrears(goods.getType());
goods
- The goods to reset the arrears for.resetArrears(GoodsType)
public boolean canTrade(GoodsType type)
type
- The goods type.
public boolean canTrade(GoodsType type, int marketAccess)
type
- The GoodsType.marketAccess
- Way the goods are traded (Europe OR Custom)
true
if type of goods can be traded.public boolean canTrade(Goods goods, int marketAccess)
goods
- The goods.marketAccess
- Place where the goods are traded (Europe OR Custom)
public boolean canTrade(Goods goods)
goods
- The goods.
public int getTax()
public void setTax(int amount)
amount
- The new tax.public int getSales(GoodsType goodsType)
goodsType
- a GoodsType
value
public void modifySales(GoodsType goodsType, int amount)
goodsType
- a GoodsType
valueamount
- The new sales.public boolean hasTraded(GoodsType goodsType)
goodsType
- a GoodsType
value
public Goods getMostValuableGoods()
public int getIncomeBeforeTaxes(GoodsType goodsType)
goodsType
- The GoodsType.
public void modifyIncomeBeforeTaxes(GoodsType goodsType, int amount)
goodsType
- The GoodsType.amount
- The new incomeBeforeTaxes.public int getIncomeAfterTaxes(GoodsType goodsType)
goodsType
- The GoodsType.
public void modifyIncomeAfterTaxes(GoodsType goodsType, int amount)
goodsType
- The GoodsType.amount
- The new incomeAfterTaxes.public DifficultyLevel getDifficulty()
public boolean equals(Player o)
Player
equals this object.
o
- The Player
to compare against this object.
Player
are equal and none
of both have nation == null
and false
otherwise.public static java.lang.String getXMLElementTagName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |