Package net.sf.freecol.server.ai
Class AIMessage
- java.lang.Object
-
- net.sf.freecol.server.ai.AIMessage
-
public class AIMessage extends java.lang.ObjectWrapper class for AI message handling.
-
-
Constructor Summary
Constructors Constructor Description AIMessage()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanaskAttack(AIUnit aiUnit, Direction direction)An AIUnit attacks in the given direction.static booleanaskBuildColony(AIUnit aiUnit, java.lang.String name)An AIUnit builds a colony.static booleanaskCashInTreasureTrain(AIUnit aiUnit)An AIUnit cashes in.static booleanaskChangeState(AIUnit aiUnit, Unit.UnitState state)An AIUnit changes state.static booleanaskChangeWorkImprovementType(AIUnit aiUnit, TileImprovementType type)An AIUnit changes its work improvement type.static booleanaskChangeWorkType(AIUnit aiUnit, GoodsType type)An AIUnit changes its work type.static booleanaskChooseFoundingFather(AIPlayer aiPlayer, java.util.List<FoundingFather> fathers, FoundingFather father)Choose a founding father for an AI player.static booleanaskClaimLand(Tile tile, AIColony aic, int price)Claims a tile for a colony.static booleanaskClaimLand(Tile tile, AIUnit aiUnit, int price)Claims a tile.static booleanaskClearSpeciality(AIUnit aiUnit)Clears the speciality of a unit.static booleanaskDiplomacy(AIPlayer aiPlayer, FreeColGameObject our, FreeColGameObject other, DiplomaticTrade dt)Do some diplomacy.static booleanaskDisband(AIUnit aiUnit)An AIUnit disbands.static booleanaskDisembark(AIUnit aiUnit)An AIUnit disembarks.static booleanaskEmbark(AIUnit aiUnit, Unit unit, Direction direction)An AIUnit embarks.static booleanaskEmigrate(AIPlayer aiPlayer, int slot)A unit in Europe emigrates.static booleanaskEndTurn(AIPlayer aiPlayer)Ends the player turn.static booleanaskEquipForRole(AIUnit aiUnit, Role role, int roleCount)Change the role of a unit.static booleanaskEstablishMission(AIUnit aiUnit, Direction direction, boolean denounce)Establishes a mission in the given direction.static booleanaskFirstContact(AIPlayer aiPlayer, Player contactor, Player contactee, Tile tile, boolean ack)Handle a first contact.static booleanaskIndianDemand(AIPlayer aiPlayer, Unit unit, Colony colony, GoodsType type, int amount, Constants.IndianDemandAction result)Makes demands to a colony.static booleanaskLoadGoods(Location loc, GoodsType type, int amount, AIUnit aiUnit)An AI unit loads some cargo.static booleanaskLoot(AIUnit aiUnit, java.lang.String defenderId, java.util.List<Goods> goods)An AI unit loots some cargo.static booleanaskMonarchAction(AIPlayer aiPlayer, Monarch.MonarchAction action, boolean accept)Handle answering the monarch.static booleanaskMove(AIUnit aiUnit, Direction direction)Moves an AIUnit in the given direction.static booleanaskMoveTo(AIUnit aiUnit, Location destination)Moves an AIUnit across the high seas.static booleanaskNationSummary(AIPlayer owner, Player player)Gets a nation summary for a player.static booleanaskNativeGift(AIUnit aiUnit, Colony colony)A native AIUnit delivers a gift to a colony.static booleanaskNativeTrade(AIPlayer aiPlayer, NativeTrade.NativeTradeAction action, NativeTrade nt)Respond to a native trade offer.static booleanaskNewLandName(AIPlayer aiPlayer, Unit unit, java.lang.String name)Response to discovering the new world.static booleanaskNewRegionName(AIPlayer aiPlayer, Region region, Tile tile, Unit unit, java.lang.String name)Response to discovering a new region.static booleanaskPutOutsideColony(AIUnit aiUnit)An AIUnit is put outside a colony.static booleanaskRearrangeColony(AIColony aiColony, java.util.List<Unit> workers, Colony scratch)Rearrange an AI colony.static booleanaskScoutSpeakToChief(AIUnit aiUnit, IndianSettlement is)An AI unit speaks to the chief of a native settlement.static booleanaskSetBuildQueue(AIColony aiColony, java.util.List<BuildableType> queue)Set the build queue in a colony.static booleanaskTrainUnitInEurope(AIPlayer aiPlayer, UnitType type)Train unit in Europe.static booleanaskUnloadGoods(GoodsType type, int amount, AIUnit aiUnit)An AI unit unloads some cargo.static booleanaskWork(AIUnit aiUnit, WorkLocation workLocation)Set a unit to work in a work location.
-
-
-
Method Detail
-
askAttack
public static boolean askAttack(AIUnit aiUnit, Direction direction)
An AIUnit attacks in the given direction.- Parameters:
aiUnit- TheAIUnitto attack with.direction- TheDirectionto attack in.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askBuildColony
public static boolean askBuildColony(AIUnit aiUnit, java.lang.String name)
An AIUnit builds a colony.- Parameters:
aiUnit- TheAIUnitto build the colony.name- The name of the colony.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askCashInTreasureTrain
public static boolean askCashInTreasureTrain(AIUnit aiUnit)
An AIUnit cashes in.- Parameters:
aiUnit- TheAIUnitcashing in.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askChangeState
public static boolean askChangeState(AIUnit aiUnit, Unit.UnitState state)
An AIUnit changes state.- Parameters:
aiUnit- TheAIUnitto change the state of.state- The newUnitState.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askChangeWorkType
public static boolean askChangeWorkType(AIUnit aiUnit, GoodsType type)
An AIUnit changes its work type.- Parameters:
aiUnit- TheAIUnitto change the work type of.type- TheGoodsTypeto produce.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askChangeWorkImprovementType
public static boolean askChangeWorkImprovementType(AIUnit aiUnit, TileImprovementType type)
An AIUnit changes its work improvement type.- Parameters:
aiUnit- TheAIUnitto change the work type of.type- TheTileImprovementTypeto produce.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askChooseFoundingFather
public static boolean askChooseFoundingFather(AIPlayer aiPlayer, java.util.List<FoundingFather> fathers, FoundingFather father)
Choose a founding father for an AI player.- Parameters:
aiPlayer- TheAIPlayerthat is choosing.fathers- A list ofFoundingFathers to choose from.father- TheFoundingFatherthat has been chosen.- Returns:
- True if the message was sent.
-
askClaimLand
public static boolean askClaimLand(Tile tile, AIColony aic, int price)
Claims a tile for a colony.- Parameters:
tile- TheTileto claim.aic- TheAIColonythat is claiming.price- The price to pay.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askClaimLand
public static boolean askClaimLand(Tile tile, AIUnit aiUnit, int price)
Claims a tile.- Parameters:
tile- TheTileto claim.aiUnit- TheAIUnitthat is claiming.price- The price to pay.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askClearSpeciality
public static boolean askClearSpeciality(AIUnit aiUnit)
Clears the speciality of a unit.- Parameters:
aiUnit- TheAIUnitto clear.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askDiplomacy
public static boolean askDiplomacy(AIPlayer aiPlayer, FreeColGameObject our, FreeColGameObject other, DiplomaticTrade dt)
Do some diplomacy.- Parameters:
aiPlayer- TheAIPlayerbeing diplomatic.our- Our object (UnitorColony) conducting the diplomacy.other- The other object (UnitorColony) to negotiate with.dt- TheDiplomaticTradeagreement to propose.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askDisband
public static boolean askDisband(AIUnit aiUnit)
An AIUnit disbands.- Parameters:
aiUnit- TheAIUnitto disband.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askDisembark
public static boolean askDisembark(AIUnit aiUnit)
An AIUnit disembarks.- Parameters:
aiUnit- TheAIUnitdisembarking.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askEmbark
public static boolean askEmbark(AIUnit aiUnit, Unit unit, Direction direction)
An AIUnit embarks.- Parameters:
aiUnit- TheAIUnitcarrier.unit- TheUnitthat is embarking.direction- TheDirectionto embark in (may be null).- Returns:
- True if the message was sent, and a non-error reply returned.
-
askEmigrate
public static boolean askEmigrate(AIPlayer aiPlayer, int slot)
A unit in Europe emigrates.- Parameters:
aiPlayer- TheAIPlayerrequiring emigration.slot- The slot to emigrate from.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askEndTurn
public static boolean askEndTurn(AIPlayer aiPlayer)
Ends the player turn.- Parameters:
aiPlayer- TheAIPlayerending the turn.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askEquipForRole
public static boolean askEquipForRole(AIUnit aiUnit, Role role, int roleCount)
Change the role of a unit.- Parameters:
aiUnit- TheAIUnitto equip.role- TheRoleto equip for.roleCount- The role count.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askEstablishMission
public static boolean askEstablishMission(AIUnit aiUnit, Direction direction, boolean denounce)
Establishes a mission in the given direction.- Parameters:
aiUnit- TheAIUnitestablishing the mission.direction- TheDirectionto move the unit.denounce- Is this a denunciation?- Returns:
- True if the message was sent, and a non-error reply returned.
-
askFirstContact
public static boolean askFirstContact(AIPlayer aiPlayer, Player contactor, Player contactee, Tile tile, boolean ack)
Handle a first contact.- Parameters:
aiPlayer- TheAIPlayerbeing contacted.contactor- The contactingPlayer.contactee- The contactedPlayer.tile- The contactTile.ack- The treaty acceptance state.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askIndianDemand
public static boolean askIndianDemand(AIPlayer aiPlayer, Unit unit, Colony colony, GoodsType type, int amount, Constants.IndianDemandAction result)
Makes demands to a colony. One and only one of goods or gold is valid.- Parameters:
aiPlayer- TheAIPlayerthat is demanding or responding.unit- TheUnitthat is demanding.colony- TheColonyto demand of.type- TheGoodsTypeto demand.amount- The amount of goods to demand.result- Null if this is the initial demand, true/false if this is a response.- Returns:
- True if the message was sent, a non-error reply returned, and the demand was accepted.
-
askLoadGoods
public static boolean askLoadGoods(Location loc, GoodsType type, int amount, AIUnit aiUnit)
An AI unit loads some cargo.- Parameters:
loc- TheLocationwhere the goods are.type- TheGoodsTypeto load.amount- The amount of goods to load.aiUnit- TheAIUnitthat is loading.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askLoot
public static boolean askLoot(AIUnit aiUnit, java.lang.String defenderId, java.util.List<Goods> goods)
An AI unit loots some cargo.- Parameters:
aiUnit- TheAIUnitthat is looting.defenderId- The object identifier of the defending unit.goods- A list ofGoodsto loot.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askMonarchAction
public static boolean askMonarchAction(AIPlayer aiPlayer, Monarch.MonarchAction action, boolean accept)
Handle answering the monarch.- Parameters:
aiPlayer- TheAIPlayerthat is responding.action- TheMonarchActionresponded to.accept- Whether the action is accepted or not.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askMove
public static boolean askMove(AIUnit aiUnit, Direction direction)
Moves an AIUnit in the given direction.- Parameters:
aiUnit- TheAIUnitto move.direction- TheDirectionto move the unit.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askMoveTo
public static boolean askMoveTo(AIUnit aiUnit, Location destination)
Moves an AIUnit across the high seas.- Parameters:
aiUnit- TheAIUnitto move.destination- TheLocationto move to.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askNationSummary
public static boolean askNationSummary(AIPlayer owner, Player player)
Gets a nation summary for a player.- Parameters:
owner- TheAIPlayermaking the inquiry.player- ThePlayerto summarize.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askNativeGift
public static boolean askNativeGift(AIUnit aiUnit, Colony colony)
A native AIUnit delivers a gift to a colony.- Parameters:
aiUnit- TheAIUnitdelivering the gift.colony- TheColonyto give to.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askNativeTrade
public static boolean askNativeTrade(AIPlayer aiPlayer, NativeTrade.NativeTradeAction action, NativeTrade nt)
Respond to a native trade offer.- Parameters:
aiPlayer- TheAIPlayerthat is trading.action- TheNativeTradeActionto take.nt- The proposedNativeTrade.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askNewLandName
public static boolean askNewLandName(AIPlayer aiPlayer, Unit unit, java.lang.String name)
Response to discovering the new world.- Parameters:
aiPlayer- The discoveringAIPlayer.unit- TheUnitthat made the discovery.name- The new land name.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askNewRegionName
public static boolean askNewRegionName(AIPlayer aiPlayer, Region region, Tile tile, Unit unit, java.lang.String name)
Response to discovering a new region.- Parameters:
aiPlayer- The discoveringAIPlayer.region- TheRegionthat was discovered.tile- TheTileof discovery.unit- TheUnitthat was discovering.name- The new region name.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askPutOutsideColony
public static boolean askPutOutsideColony(AIUnit aiUnit)
An AIUnit is put outside a colony.- Parameters:
aiUnit- TheAIUnitto put out.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askRearrangeColony
public static boolean askRearrangeColony(AIColony aiColony, java.util.List<Unit> workers, Colony scratch)
Rearrange an AI colony.- Parameters:
aiColony- TheAIColonyto rearrange.workers- A list of workerUnits that may change.scratch- A copy of the underlyingColonywith the workers arranged as required.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askScoutSpeakToChief
public static boolean askScoutSpeakToChief(AIUnit aiUnit, IndianSettlement is)
An AI unit speaks to the chief of a native settlement.- Parameters:
aiUnit- TheAIUnitthat is scouting.is- TheIndianSettlementto scout.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askSetBuildQueue
public static boolean askSetBuildQueue(AIColony aiColony, java.util.List<BuildableType> queue)
Set the build queue in a colony.- Parameters:
aiColony- TheAIColonythat is building.queue- The list ofBuildableTypes to build.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askTrainUnitInEurope
public static boolean askTrainUnitInEurope(AIPlayer aiPlayer, UnitType type)
Train unit in Europe.- Parameters:
aiPlayer- TheAIPlayerrequiring training.type- TheUnitTypeto train.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askUnloadGoods
public static boolean askUnloadGoods(GoodsType type, int amount, AIUnit aiUnit)
An AI unit unloads some cargo.- Parameters:
type- TheGoodsTypeto unload.amount- The amount of goods to unload.aiUnit- TheAIUnitthat is unloading.- Returns:
- True if the message was sent, and a non-error reply returned.
-
askWork
public static boolean askWork(AIUnit aiUnit, WorkLocation workLocation)
Set a unit to work in a work location.- Parameters:
aiUnit- TheAIUnitto work.workLocation- TheWorkLocationto work in.- Returns:
- True if the message was sent, and a non-error reply returned.
-
-