|
|||||||||
| 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.NewAIPlayer
AIPlayer. Eventual
specialization of AI should extend AIPlayer, see ColonialAIPlayer.
The method startWorking() gets called by the
AIInGameInputHandler when it is this player's turn.
public abstract class NewAIPlayer
Objects of this class contains AI-information for a single Player and
is used for controlling this player.
| Field Summary | |
|---|---|
private java.util.ArrayList<AIUnit> |
aiUnits
Deprecated. Temporary variable. |
private Connection |
debuggingConnection
Deprecated. Temporary variable. |
protected static EquipmentType |
horses
Deprecated. |
private static java.util.logging.Logger |
logger
Deprecated. |
protected static EquipmentType |
muskets
Deprecated. |
private ServerPlayer |
player
Deprecated. The FreeColGameObject this AIObject contains AI-information for. |
protected java.util.HashMap<java.lang.String,java.lang.Integer> |
sessionRegister
Deprecated. |
protected static EquipmentType |
toolsType
Deprecated. |
| 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, PARTIAL_ATTRIBUTE |
| Constructor Summary | |
|---|---|
NewAIPlayer()
Deprecated. |
|
NewAIPlayer(AIMain aiMain,
org.w3c.dom.Element element)
Deprecated. Creates a new AIPlayer and reads the information from the
given Element. |
|
NewAIPlayer(AIMain aiMain,
ServerPlayer player)
Deprecated. Creates a new AIPlayer. |
|
NewAIPlayer(AIMain aiMain,
javax.xml.stream.XMLStreamReader in)
Deprecated. Creates a new AIPlayer. |
|
| Method Summary | |
|---|---|
protected void |
abortInvalidAndOneTimeMissions()
Deprecated. Aborts all the missions which are no longer valid. |
protected void |
abortInvalidMissions()
Deprecated. Aborts all the missions which are no longer valid. |
int |
buyProposition(Unit unit,
Goods goods,
int gold)
Deprecated. Called when another Player proposes a trade. |
protected void |
clearAIUnits()
Deprecated. |
protected void |
determineStances()
Deprecated. Determines the stances towards each player. |
protected void |
doMissions()
Deprecated. Makes every unit perform their mission. |
java.util.Iterator<AIUnit> |
getAIUnitIterator()
Deprecated. Returns an iterator over all the AIUnits owned by this
player. |
Unit |
getBestTreasureTrain(Tile tile)
Deprecated. Returns the treasure train carrying the largest treasure located on the given Tile. |
Connection |
getConnection()
Deprecated. Gets the connection to the server. |
java.lang.String |
getId()
Deprecated. Returns the ID for this AIPlayer. |
Player |
getPlayer()
Deprecated. Returns the Player this AIPlayer is
controlling. |
(package private) int |
getUnitSeekAndDestroyMissionValue(Unit unit,
Tile newTile,
int turns)
Deprecated. |
static java.lang.String |
getXMLElementTagName()
Deprecated. Returns the tag name of the root element representing this object. |
(package private) boolean |
isTargetValidForSeekAndDestroy(Unit attacker,
Unit defender)
Deprecated. |
protected void |
readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
Deprecated. Reads information for this object from an XML stream. |
void |
registerSellGoods(Goods goods)
Deprecated. Called after another Player sends a trade message |
protected void |
sendAndWaitSafely(org.w3c.dom.Element element)
Deprecated. Send an element and ignore IO exceptions. |
protected void |
sendUpdatedTilesToAll(java.util.ArrayList<Tile> tiles)
Deprecated. Send some tiles to update to all players which can see them |
void |
setDebuggingConnection(Connection debuggingConnection)
Deprecated. Sets the Connection to be used while communicating with
the server. |
abstract void |
startWorking()
Deprecated. Tells this AIPlayer to make decisions. |
protected void |
toXMLImpl(javax.xml.stream.XMLStreamWriter out)
Deprecated. Writes this object to an XML stream. |
| Methods inherited from class net.sf.freecol.server.ai.AIObject |
|---|
dispose, getAIMain, getAIRandom, getGame, 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
protected static EquipmentType muskets
protected static EquipmentType horses
protected static EquipmentType toolsType
protected java.util.HashMap<java.lang.String,java.lang.Integer> sessionRegister
private ServerPlayer player
private java.util.ArrayList<AIUnit> aiUnits
private Connection debuggingConnection
| Constructor Detail |
|---|
public NewAIPlayer()
public NewAIPlayer(AIMain aiMain,
ServerPlayer player)
AIPlayer.
aiMain - The main AI-class.player - The player that should be associated with this
AIPlayer.
public NewAIPlayer(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 NewAIPlayer(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 abstract void startWorking()
AIPlayer to make decisions. The
AIPlayer is done doing work this turn when this method
returns.
protected void determineStances()
protected void abortInvalidMissions()
protected void abortInvalidAndOneTimeMissions()
protected void sendAndWaitSafely(org.w3c.dom.Element element)
element - The element.protected void sendUpdatedTilesToAll(java.util.ArrayList<Tile> tiles)
tiles - The tiles to update.protected void doMissions()
public Unit getBestTreasureTrain(Tile tile)
Tile.
tile - a Tile value
null if no treasure
train is located on this Tile.
int getUnitSeekAndDestroyMissionValue(Unit unit,
Tile newTile,
int turns)
boolean isTargetValidForSeekAndDestroy(Unit attacker,
Unit defender)
public java.util.Iterator<AIUnit> getAIUnitIterator()
AIUnits owned by this
player.
Iterator.public Player getPlayer()
Player this AIPlayer is
controlling.
Player.public Connection getConnection()
public void setDebuggingConnection(Connection debuggingConnection)
Connection to be used while communicating with
the server.
This method is only used for debugging.
debuggingConnection - The connection to be used for debugging.public java.lang.String getId()
AIPlayer. This is the same as the
ID for the Player this AIPlayer controls.
getId in class FreeColObject
protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
toXMLImpl in class FreeColObjectout - The target stream.
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 there are any problems reading from the
stream.public static java.lang.String getXMLElementTagName()
public void registerSellGoods(Goods goods)
Player sends a trade message
goods - The goods which we are going to offer
public int buyProposition(Unit unit,
Goods goods,
int gold)
Player proposes a trade.
unit - The foreign Unit trying to trade.goods - The goods the given Unit is trying to sell.gold - The suggested price.
AIPlayer suggests or
NetworkConstants.NO_TRADE.protected void clearAIUnits()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||