Class TradeRouteTradeStrategy

  • All Implemented Interfaces:
    ch.sahits.game.openpatrician.model.player.IAITradeStrategy

    public class TradeRouteTradeStrategy
    extends BasePlayerTradeStrategy
    Trade strategy that is based on a preset trade route
    Author:
    Andi Hotz, (c) Sahits GmbH, 2016 Created on Jun 18, 2016
    • Constructor Detail

      • TradeRouteTradeStrategy

        public TradeRouteTradeStrategy()
    • Method Detail

      • initializeTradeCycle

        public void initializeTradeCycle​(ch.sahits.game.openpatrician.model.IAIPlayer player,
                                         ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel)
      • getCityToRestartTradeCycle

        public ch.sahits.game.openpatrician.model.city.ICity getCityToRestartTradeCycle​(ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel)

        The default implementation chooses the closest city.
        Choose the nearest city from the set defined in the trade route.
        Specified by:
        getCityToRestartTradeCycle in interface ch.sahits.game.openpatrician.model.player.IAITradeStrategy
        Overrides:
        getCityToRestartTradeCycle in class BasePlayerTradeStrategy
        Parameters:
        vessel - that should travel to a city, so that the trade cycle can be reinitialized
        Returns:
      • handleShipArrivesInPort

        public void handleShipArrivesInPort​(ch.sahits.game.openpatrician.model.event.IShipEntersPortEvent event)