Class BaseShipConstructionSelectionStrategy
- java.lang.Object
-
- ch.sahits.game.openpatrician.engine.player.strategy.BaseShipConstructionSelectionStrategy
-
- All Implemented Interfaces:
ch.sahits.game.openpatrician.model.player.IAIConstructionSelectionStrategy
- Direct Known Subclasses:
BiggestShipConstructionSelectionStrategy,RandomShipConstructionSelectionStrategy
public abstract class BaseShipConstructionSelectionStrategy extends java.lang.Object implements ch.sahits.game.openpatrician.model.player.IAIConstructionSelectionStrategyBase implementation for a ship construction selection strategy that can be easily configured through the non default constructor.- Author:
- Andi Hotz, (c) Sahits GmbH, 2016 Created on Jul 30, 2016
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseShipConstructionSelectionStrategy(int minCash, int maxFeetSize, int maxTotalCargoCapacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intgetFleetCapacity(java.util.List<ch.sahits.game.openpatrician.model.ship.IShip> fleet)Calculate the fleets total capacity.java.util.Optional<ch.sahits.game.openpatrician.model.ship.INavigableVessel>selectCollectingVessel(ch.sahits.game.openpatrician.model.IAIPlayer player, ch.sahits.game.openpatrician.model.ship.EShipType shipType)booleanshouldOrderNewConstruction(ch.sahits.game.openpatrician.model.IAIPlayer player)Ship is ordered if enough cash is available and the fleet size and fleet capacity is below certain thresholds, as defined at construction time.
-
-
-
Method Detail
-
shouldOrderNewConstruction
public boolean shouldOrderNewConstruction(ch.sahits.game.openpatrician.model.IAIPlayer player)
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:
shouldOrderNewConstructionin interfacech.sahits.game.openpatrician.model.player.IAIConstructionSelectionStrategy- Parameters:
player- for which the check should be done.- Returns:
-
getFleetCapacity
protected int getFleetCapacity(java.util.List<ch.sahits.game.openpatrician.model.ship.IShip> fleet)
Calculate the fleets total capacity.- Parameters:
fleet- list of ships- Returns:
- capacity of all ships in
fleet
-
selectCollectingVessel
public java.util.Optional<ch.sahits.game.openpatrician.model.ship.INavigableVessel> selectCollectingVessel(ch.sahits.game.openpatrician.model.IAIPlayer player, ch.sahits.game.openpatrician.model.ship.EShipType shipType)- Specified by:
selectCollectingVesselin interfacech.sahits.game.openpatrician.model.player.IAIConstructionSelectionStrategy
-
-