Class BaseShipConstructionSelectionStrategy

    • Field Detail

      • constructMaxShips

        private int constructMaxShips
        Maximum ships being ordered
      • shipFactory

        @Autowired
        private ShipFactory shipFactory
      • shipyards

        @Autowired
        private Shipyards shipyards
      • minCash

        private final int minCash
        The minimum of cash that is required before considering building a ship.
      • maxFeetSize

        private final int maxFeetSize
        The maximal fleet size up to which ships are ordered.
      • maxTotalCargoCapacity

        private final int maxTotalCargoCapacity
        The macimal cargo capacity of the fleet above which no ships are ordered.
    • Constructor Detail

      • BaseShipConstructionSelectionStrategy

        protected BaseShipConstructionSelectionStrategy​(int minCash,
                                                        int maxFeetSize,
                                                        int maxTotalCargoCapacity)
    • Method Detail

      • shouldOrderNewConstruction

        public boolean shouldOrderNewConstruction​(IAIPlayer player)
        Check if a new ship should be ordered. Ship is ordered if enough cash is available and the fleet size and fleet capacity is below certain thresholds, as defined at construction time.
        Specified by:
        shouldOrderNewConstruction in interface IAIConstructionSelectionStrategy
        Parameters:
        player - for which the check should be done.
        Returns:
      • getFleetCapacity

        protected int getFleetCapacity​(java.util.List<IShip> fleet)
        Calculate the fleets total capacity.
        Parameters:
        fleet - list of ships
        Returns:
        capacity of all ships in fleet
      • isVesselEligibleForCollecting

        private boolean isVesselEligibleForCollecting​(IAIPlayer player,
                                                      INavigableVessel vessel)