|
|||||||||
| 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.server.ai.AIObject
net.sf.freecol.server.ai.AIPlayer
net.sf.freecol.server.ai.NativeAIPlayer
public class NativeAIPlayer
Objects of this class contains AI-information for a single Player and is used for controlling this player.
The method startWorking() gets called by the
AIInGameInputHandler when it is this player's turn.
| Field Summary | |
|---|---|
private static java.util.logging.Logger |
logger
|
private static java.lang.String |
MISSIONARY_TRADE_BONUS
The modifier to apply when to trade with a settlement with a missionary if the enhancedMissionaries option is enabled. |
private java.util.HashMap<java.lang.String,java.lang.Integer> |
sessionRegister
Stores temporary information for sessions (trading with another player etc). |
private static java.lang.String |
SHIP_TRADE_PENALTY
The modifier to apply when a ship is trading. |
| Fields inherited from class net.sf.freecol.server.ai.AIPlayer |
|---|
MAX_DISTANCE_TO_BRING_GIFT, MAX_DISTANCE_TO_MAKE_DEMANDS, MAX_NUMBER_OF_DEMANDS, MAX_NUMBER_OF_GIFTS_BEING_DELIVERED |
| Fields inherited from class net.sf.freecol.server.ai.AIObject |
|---|
uninitialized |
| Fields inherited from class net.sf.freecol.common.model.FreeColObject |
|---|
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, INFINITY, NO_ID, PARTIAL_ATTRIBUTE, UNDEFINED, VALUE_TAG |
| Constructor Summary | |
|---|---|
NativeAIPlayer(AIMain aiMain,
org.w3c.dom.Element element)
Creates a new AIPlayer and reads the information from the
given Element. |
|
NativeAIPlayer(AIMain aiMain,
ServerPlayer player)
Creates a new AIPlayer. |
|
NativeAIPlayer(AIMain aiMain,
javax.xml.stream.XMLStreamReader in)
Creates a new AIPlayer. |
|
| Method Summary | |
|---|---|
boolean |
acceptDiplomaticTrade(DiplomaticTrade agreement)
|
private void |
bringGifts()
Brings gifts to nice players with nearby colonies. |
int |
buyProposition(Unit unit,
Settlement settlement,
Goods goods,
int gold)
Called when another Player proposes to buy. |
private void |
demandTribute()
Demands goods from players with nearby colonies. |
void |
equipBraves(IndianSettlement is)
Greedily equips braves with horses and muskets. |
private AIUnit |
getBraveForSeekAndDestroy(IndianSettlement indianSettlement)
|
private java.util.Set<Modifier> |
getMissionaryTradeBonuses(Unit missionary,
boolean sense)
Gets the appropriate missionary trade bonuses. |
private java.util.Set<Modifier> |
getShipTradePenalties(boolean sense)
Gets the appropriate ship trade penalties. |
(package private) int |
getUnitSeekAndDestroyMissionValue(Unit unit,
Tile newTile,
int turns)
Evaluate a potential seek and destroy mission for a given unit to a given tile. |
void |
giveMilitaryMission(AIUnit aiUnit)
Gives a military mission to the given unit. |
private void |
giveNormalMissions()
Gives a mission to non-naval units. |
void |
registerSellGoods(Goods goods)
Called after another Player sends a
trade message. |
(package private) void |
secureIndianSettlement(IndianSettlement is)
Takes the necessary actions to secure an indian settlement TODO: Package for access by a test only - necessary? |
private void |
secureSettlements()
Takes the necessary actions to secure the settlements. |
int |
sellProposition(Unit unit,
Settlement settlement,
Goods goods,
int gold)
Called when another Player proposes a sale. |
void |
startWorking()
Tells this AIPlayer to make decisions. |
| Methods inherited from class net.sf.freecol.server.ai.AIPlayer |
|---|
abortInvalidAndOneTimeMissions, abortInvalidMissions, acceptMercenaries, acceptTax, clearAIUnits, determineStance, determineStances, doMissions, getAIAdvantage, getAIColonies, getAIColony, getAIRandom, getAIUnit, getAIUnitIterator, getAIUnits, getConnection, getId, getPlayer, getXMLElementTagName, indianDemand, isTargetValidForSeekAndDestroy, readFromXMLImpl, selectFoundingFather, setDebuggingConnection, setPlayer, toXMLImpl |
| Methods inherited from class net.sf.freecol.server.ai.AIObject |
|---|
dispose, getAIMain, getGame, getSpecification, isUninitialized, readFromXML |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.util.logging.Logger logger
private static final java.lang.String SHIP_TRADE_PENALTY
private static final java.lang.String MISSIONARY_TRADE_BONUS
private java.util.HashMap<java.lang.String,java.lang.Integer> sessionRegister
| Constructor Detail |
|---|
public NativeAIPlayer(AIMain aiMain,
ServerPlayer player)
AIPlayer.
aiMain - The main AI-class.player - The player that should be associated with this
AIPlayer.
public NativeAIPlayer(AIMain aiMain,
org.w3c.dom.Element element)
AIPlayer and reads the information from the
given Element.
aiMain - The main AI-class.element - The XML-element containing information.
public NativeAIPlayer(AIMain aiMain,
javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
AIPlayer.
aiMain - The main AI-object.in - The input stream containing the XML.
javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.| Method Detail |
|---|
public void startWorking()
AIPlayer to make decisions. The
AIPlayer is done doing work this turn when this method
returns.
startWorking in class AIPlayerpublic boolean acceptDiplomaticTrade(DiplomaticTrade agreement)
acceptDiplomaticTrade in class AIPlayerpublic void registerSellGoods(Goods goods)
Player sends a
trade message.
registerSellGoods in class AIPlayergoods - The goods which we are going to offer
private java.util.Set<Modifier> getMissionaryTradeBonuses(Unit missionary,
boolean sense)
missionary - The missionary Unit.sense - The sense to apply the modifiers.
private java.util.Set<Modifier> getShipTradePenalties(boolean sense)
sense - The sense to apply the modifiers.
public int buyProposition(Unit unit,
Settlement settlement,
Goods goods,
int gold)
Player proposes to buy.
buyProposition in class AIPlayerunit - The foreign Unit trying to trade.settlement - The Settlement this player owns and
which the given Unit is trading.goods - The goods the given Unit is trying to sell.gold - The suggested price.
AIPlayer suggests or
NetworkConstants.NO_TRADE.
public int sellProposition(Unit unit,
Settlement settlement,
Goods goods,
int gold)
Player proposes a sale.
sellProposition in class AIPlayerunit - The foreign Unit trying to trade.settlement - The Settlement this player owns and
which the given Unit if trying to sell goods.goods - The goods the given Unit is trying to sell.gold - The suggested price.
AIPlayer suggests or
NetworkConstants#NO_TRADE*.private void secureSettlements()
public void equipBraves(IndianSettlement is)
is - The IndianSettlement where the equipping occurs.void secureIndianSettlement(IndianSettlement is)
private AIUnit getBraveForSeekAndDestroy(IndianSettlement indianSettlement)
private void giveNormalMissions()
private void bringGifts()
private void demandTribute()
int getUnitSeekAndDestroyMissionValue(Unit unit,
Tile newTile,
int turns)
unit - The Unit to do the mission.newTile - The Tile to go to.turns - How long to travel to the tile.
public void giveMilitaryMission(AIUnit aiUnit)
aiUnit - The AIUnit to give a mission to.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||