Interface IAITradeStrategy
-
public interface IAITradeStrategyThis interface defines the API for a trading strategy for the AI.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleanexecuteTradeSteps(IAIPlayer player, INavigableVessel vessel)Execute the trad steps defined for the vessel.ICitygetCityToRestartTradeCycle(INavigableVessel vessel)In the case where the trade cycle must be re-initialized, but the ship is not in a city, determine the city to which the vessel should travel.voidhandleShipArrivesInPort(IShipEntersPortEvent event)Event handler for a ship entering port.voidinitializeTradeCycle(IAIPlayer player, INavigableVessel vessel)Initialize the trade cycle.default booleanisSelectable(IAIPlayer player, INavigableVessel vessel)Check if this strategy can be selected in the current setup.
-
-
-
Method Detail
-
initializeTradeCycle
void initializeTradeCycle(IAIPlayer player, INavigableVessel vessel)
Initialize the trade cycle. Based on the strategy the cycle may be closed, meaning at some point this method can be called again or it may be open with destination defining the next one.- Parameters:
player- for whom to initialize the trade cyclevessel- for which to initialize the trade cycle
-
getCityToRestartTradeCycle
ICity getCityToRestartTradeCycle(INavigableVessel vessel)
In the case where the trade cycle must be re-initialized, but the ship is not in a city, determine the city to which the vessel should travel.- Parameters:
vessel- that should travel to a city, so that the trade cycle can be reinitialized- Returns:
- city to which the vessel travels.
-
executeTradeSteps
boolean executeTradeSteps(IAIPlayer player, INavigableVessel vessel)
Execute the trad steps defined for the vessel.- Parameters:
player- for which to execute trade stepsvessel- for which to execute trade steps
-
handleShipArrivesInPort
void handleShipArrivesInPort(IShipEntersPortEvent event)
Event handler for a ship entering port. This method is not called by subscription from the event bus, but through direct call from tha AIPlayerEngine.- Parameters:
event- ship entering port
-
isSelectable
default boolean isSelectable(IAIPlayer player, INavigableVessel vessel)
Check if this strategy can be selected in the current setup. This method is called when choosing a new strategy for thevessel.- Parameters:
player- for which the strategy is chosen.vessel- for which the strategy is chose.- Returns:
- true if the strategy can be chosen for the
playerandvessel. The default implementation will always return true.
-
-