Interface IAIBuyWeaponStrategy
-
public interface IAIBuyWeaponStrategyStrategy to determine when and how to purchase ship weapons.- Author:
- Andi Hotz, (c) Sahits GmbH, 2017 Created on Oct 18, 2017
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidbuyWeapons(BuyWeapons target, IShip ship, IAIPlayer player, ICity city)Buy the weapons.voidbuyWeaponsOrdered(BuyWeapons target, IShip ship, IAIPlayer player, ICity city)Buy the weapons.intgetNumberOfEmptyLargeWeaponSlots(IShip ship)Count the empty large weapon slots, where a large weapon can be placed.intgetNumberOfEmptyWeaponSlots(IShip ship)Count the empty large weapon slots, where a large weapon can be placed.java.util.Optional<BuyWeapons>shouldBuyWeapons(IShip ship, IAIPlayer player, ICity city)Determine if weapons should be bougth and if so to meet which target.
-
-
-
Method Detail
-
shouldBuyWeapons
java.util.Optional<BuyWeapons> shouldBuyWeapons(IShip ship, IAIPlayer player, ICity city)
Determine if weapons should be bougth and if so to meet which target.- Parameters:
ship- for which the weapons should be boughtplayer- who is purchasing the weaponscity- in which to buy weapons- Returns:
- optional of
BuyWeaponsdefining the target that should be reached. If the optional is not filled This means, no weapons should be bought.
-
getNumberOfEmptyWeaponSlots
int getNumberOfEmptyWeaponSlots(IShip ship)
Count the empty large weapon slots, where a large weapon can be placed.- Parameters:
ship- for which to retrieve the empty slots- Returns:
- number of empty slots for large weapons
-
getNumberOfEmptyLargeWeaponSlots
int getNumberOfEmptyLargeWeaponSlots(IShip ship)
Count the empty large weapon slots, where a large weapon can be placed.- Parameters:
ship- for which to retrieve the empty slots- Returns:
- number of empty slots for large weapons
-
buyWeapons
void buyWeapons(BuyWeapons target, IShip ship, IAIPlayer player, ICity city)
Buy the weapons. Some of the target may contradict each other. It is in the scope of the implementation which target has more weight. The priority of the weapons order is not relevant.- Parameters:
target- defining the target that should be met by buying the weapons.ship- for which the weapons should be boughtplayer- who is purchasing the weaponscity- in which to buy weapons
-
buyWeaponsOrdered
void buyWeaponsOrdered(BuyWeapons target, IShip ship, IAIPlayer player, ICity city)
Buy the weapons. Some of the target may contradict each other. It is in the scope of the implementation which target has more weight. Respect the order of weapons as defined intarget. The weapons are bought in the order defined.- Parameters:
target- defining the target that should be met by buying the weapons.ship- for which the weapons should be boughtplayer- who is purchasing the weaponscity- in which to buy weapons
-
-