|
||||||||||
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.mission.Mission
public abstract class Mission
A mission describes what a unit should do; attack, build colony, wander etc.
Every AIUnit
should have a mission. By extending this class,
you create different missions.
Field Summary |
---|
Fields inherited from class net.sf.freecol.common.model.FreeColObject |
---|
ID_ATTRIBUTE_TAG |
Constructor Summary | |
---|---|
Mission(AIMain aiMain)
Creates a mission. |
|
Mission(AIMain aiMain,
AIUnit aiUnit)
Creates a mission for the given AIUnit . |
Method Summary | |
---|---|
void |
attack(Connection connection,
Unit unit,
Map.Direction direction)
|
boolean |
buyGoods(Connection connection,
Unit carrier,
GoodsType goodsType,
int amount)
|
void |
dispose()
Disposes this mission by removing any references to it. |
abstract void |
doMission(Connection connection)
Performs the mission. |
PathNode |
findNearestColony(Unit unit)
|
AIUnit |
getAIUnit()
Gets the AI-unit this mission has been created for. |
java.lang.String |
getDebuggingInfo()
Gets debugging information about this mission. |
Tile |
getTransportDestination()
Returns the destination of a required transport. |
int |
getTransportPriority()
Returns the priority of getting the unit to the transport destination. |
Unit |
getUnit()
Gets the unit this mission has been created for. |
boolean |
isValid()
Checks if this mission is still valid to perform. |
Methods inherited from class net.sf.freecol.server.ai.AIObject |
---|
getAIMain, getGame, getXMLElementTagName, isUninitialized, readFromXML |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Mission(AIMain aiMain)
aiMain
- The main AI-object.public Mission(AIMain aiMain, AIUnit aiUnit)
AIUnit
.
aiMain
- The main AI-object.aiUnit
- The AIUnit
this mission
is created for.
java.lang.NullPointerException
- if aiUnit == null
.Method Detail |
---|
public Tile getTransportDestination()
null
if no transport is needed.public int getTransportPriority()
public void dispose()
dispose
in class AIObject
public abstract void doMission(Connection connection)
connection
- The Connection
to the server.public boolean isValid()
true
.public Unit getUnit()
Unit
.public AIUnit getAIUnit()
AIUnit
.public java.lang.String getDebuggingInfo()
String
. Should be
replaced by subclasses.public void attack(Connection connection, Unit unit, Map.Direction direction)
public boolean buyGoods(Connection connection, Unit carrier, GoodsType goodsType, int amount)
public PathNode findNearestColony(Unit unit)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |