public abstract class BaseShipConstructionSelectionStrategy extends Object implements ch.sahits.game.openpatrician.model.player.IAIConstructionSelectionStrategy
| Modifier and Type | Field and Description |
|---|---|
private int |
constructMaxShips
Maximum ships being ordered
|
private int |
maxFeetSize
The maximal fleet size up to which ships are ordered.
|
private int |
maxTotalCargoCapacity
The macimal cargo capacity of the fleet above which no ships are ordered.
|
private int |
minCash
The minimum of cash that is required before considering building a ship.
|
private ShipFactory |
shipFactory |
private ch.sahits.game.openpatrician.model.city.Shipyards |
shipyards |
| Modifier | Constructor and Description |
|---|---|
protected |
BaseShipConstructionSelectionStrategy(int minCash,
int maxFeetSize,
int maxTotalCargoCapacity) |
| Modifier and Type | Method and Description |
|---|---|
protected int |
getFleetCapacity(List<ch.sahits.game.openpatrician.model.ship.IShip> fleet)
Calculate the fleets total capacity.
|
private boolean |
isVesselEligibleForCollecting(ch.sahits.game.openpatrician.model.IAIPlayer player,
ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel) |
protected Optional<ch.sahits.game.openpatrician.model.ship.INavigableVessel> |
selectCollectingVessel(ch.sahits.game.openpatrician.model.IAIPlayer player,
ch.sahits.game.openpatrician.model.ship.EShipType shipType)
Find a vessel that will do the collection.
|
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.
|
private int constructMaxShips
@Autowired private ShipFactory shipFactory
@Autowired private ch.sahits.game.openpatrician.model.city.Shipyards shipyards
private final int minCash
private final int maxFeetSize
private final int maxTotalCargoCapacity
protected BaseShipConstructionSelectionStrategy(int minCash,
int maxFeetSize,
int maxTotalCargoCapacity)
public boolean shouldOrderNewConstruction(ch.sahits.game.openpatrician.model.IAIPlayer player)
shouldOrderNewConstruction in interface ch.sahits.game.openpatrician.model.player.IAIConstructionSelectionStrategyplayer - for which the check should be done.protected int getFleetCapacity(List<ch.sahits.game.openpatrician.model.ship.IShip> fleet)
fleet - protected Optional<ch.sahits.game.openpatrician.model.ship.INavigableVessel> selectCollectingVessel(ch.sahits.game.openpatrician.model.IAIPlayer player, ch.sahits.game.openpatrician.model.ship.EShipType shipType)
player - owning the vesselshipType - of the ship to be built and thereby the definition of the required wares.private boolean isVesselEligibleForCollecting(ch.sahits.game.openpatrician.model.IAIPlayer player,
ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel)
Copyright © 2011-2017 Sahits GmbH. All Rights Reserved.