Class CheapProductionTradeStrategy

  • All Implemented Interfaces:
    IAITradeStrategy

    public class CheapProductionTradeStrategy
    extends BasePlayerTradeStrategy
    This trade strategy focuses on the cheap production of wares and sells them in the nearest city where there is a need.
    • Field Detail

      • clientServerEventBus

        @Autowired
        @Qualifier("serverClientEventBus")
        private com.google.common.eventbus.AsyncEventBus clientServerEventBus
      • shipService

        @Autowired
        private ShipService shipService
      • mapService

        @Autowired
        private MapService mapService
    • Constructor Detail

      • CheapProductionTradeStrategy

        public CheapProductionTradeStrategy()
    • Method Detail

      • init

        @PostConstruct
        private void init()
      • destroy

        @PreDestroy
        private void destroy()
      • initializeTradeCycle

        public void initializeTradeCycle​(IAIPlayer player,
                                         INavigableVessel vessel)
        Description copied from interface: IAITradeStrategy
        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 cycle
        vessel - for which to initialize the trade cycle
      • findWareToBuy

        private java.util.Optional<IWare> findWareToBuy​(ICity city,
                                                        IAIPlayer player)
      • handleShipArrivesInPort

        public void handleShipArrivesInPort​(IShipEntersPortEvent event)
        Description copied from interface: IAITradeStrategy
        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