Class SupplyCentralTradingStationAIStrategy
- java.lang.Object
-
- ch.sahits.game.openpatrician.engine.player.strategy.BasePlayerTradeStrategy
-
- ch.sahits.game.openpatrician.engine.player.strategy.SupplyCentralTradingStationAIStrategy
-
- All Implemented Interfaces:
IAITradeStrategy
public class SupplyCentralTradingStationAIStrategy extends BasePlayerTradeStrategy
Strategy to supply a central station with required wares. Required are all wares that are needed bor the basic requirement. This strategy is only chosable if there are multiple vessels available and there is a trading office in the target city.- Author:
- Andi Hotz, (c) Sahits GmbH, 2017 Created on Oct 21, 2017
-
-
Field Summary
Fields Modifier and Type Field Description private MapProxymapprivate MapServicemapServiceprivate ShipServiceshipService-
Fields inherited from class ch.sahits.game.openpatrician.engine.player.strategy.BasePlayerTradeStrategy
tradeStrategyType
-
-
Constructor Summary
Constructors Constructor Description SupplyCentralTradingStationAIStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private ICityfindCitySupplingWares(IAIPlayer player, INavigableVessel vessel, CentralStorageHintContext context)voidhandleShipArrivesInPort(IShipEntersPortEvent event)Event handler for a ship entering port.voidinitializeTradeCycle(IAIPlayer player, INavigableVessel vessel)Initialize the trade cycle.booleanisSelectable(IAIPlayer player, INavigableVessel vessel)Check if this strategy can be selected in the current setup.(package private) javafx.util.Pair<ICity,CentralStorageStrategyHint>setupContextHint(IAIPlayer player, INavigableVessel vessel)-
Methods inherited from class ch.sahits.game.openpatrician.engine.player.strategy.BasePlayerTradeStrategy
addDefaultTradeSteps, append, createAggregatedBuyTradeStep, createAggregatedCheckedBuyTradeStep, createAggregatedCheckedSellStep, createAggregatedDumpStep, createAggregatedSellStep, createCheckAndTakeLoanStep, createCheckedTransferToOfficeTradeStep, createCheckRepairStep, createConditionalAggregatedDumpStep, createHireCaptain, createHireDismissTradeManagerTradeStep, createHireSailorStep, createJoinGuildTradeStep, createPaybackLoanStep, createTransferToOfficeTradeStep, createTransferToShipTradeStep, createTravelToStep, createUpgradeShipTradeStep, createWeaponBuyTradeStep, executeTradeSteps, findCitySupplyingWare, findCityWithAllRequiredWares, findDestinationToBuyRequiredProductionWares, findNextStopForBuying, findNextStopForSelling, findProvidingWares, findWaresOfInterest, getCityToRestartTradeCycle, getLoadedWares, getMostNeededWares, getMostNeededWares, getNextStep, getWaresNeedIn, handleHireSailors, handleRefitFinished, handleRepairFinished, hasBlockingMission, hasMoreTradeSteps, inject, isMatchingTradeStrategy, isNeeded
-
-
-
-
Field Detail
-
map
@Autowired private MapProxy map
-
mapService
@Autowired private MapService mapService
-
shipService
@Autowired private ShipService shipService
-
-
Method Detail
-
initializeTradeCycle
public void initializeTradeCycle(IAIPlayer player, INavigableVessel vessel)
Description copied from interface:IAITradeStrategyInitialize 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
-
findCitySupplingWares
private ICity findCitySupplingWares(IAIPlayer player, INavigableVessel vessel, CentralStorageHintContext context)
-
setupContextHint
javafx.util.Pair<ICity,CentralStorageStrategyHint> setupContextHint(IAIPlayer player, INavigableVessel vessel)
-
handleShipArrivesInPort
public void handleShipArrivesInPort(IShipEntersPortEvent event)
Description copied from interface:IAITradeStrategyEvent 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
public boolean isSelectable(IAIPlayer player, INavigableVessel vessel)
Description copied from interface:IAITradeStrategyCheck 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.
-
-