|
||||||||||
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 |
---|
Fields inherited from class net.sf.freecol.common.model.FreeColObject |
---|
ID_ATTRIBUTE_TAG |
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 | |
---|---|
int |
buyProposition(Unit unit,
Goods goods,
int gold)
Deprecated. Called when another Player proposes a trade. |
java.util.Iterator<AIUnit> |
getAIUnitIterator()
Deprecated. Returns an iterator over all the AIUnit s 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. |
static java.lang.String |
getXMLElementTagName()
Deprecated. Returns the tag name of the root element representing this object. |
void |
registerSellGoods(Goods goods)
Deprecated. Called after another Player sends a trade message |
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. |
Methods inherited from class net.sf.freecol.server.ai.AIObject |
---|
dispose, getAIMain, getGame, isUninitialized, readFromXML |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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.
public Unit getBestTreasureTrain(Tile tile)
Tile
.
tile
- a Tile
value
null
if no treasure
train is located on this Tile
.public java.util.Iterator<AIUnit> getAIUnitIterator()
AIUnit
s 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
public static java.lang.String getXMLElementTagName()
public void registerSellGoods(Goods goods)
Player
sends a trade
message
goods
- The goods which we are going to offerpublic 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
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |