Class BuyWeaponHighPirateSuccessAllSlotsFilledStrategy
- java.lang.Object
-
- ch.sahits.game.openpatrician.engine.player.strategy.BaseBuyWeaponStrategy
-
- ch.sahits.game.openpatrician.engine.player.strategy.BuyWeaponHighPirateSuccessAllSlotsFilledStrategy
-
- All Implemented Interfaces:
IAIBuyWeaponStrategy
public class BuyWeaponHighPirateSuccessAllSlotsFilledStrategy extends BaseBuyWeaponStrategy
Strategy to buy weapons when the sucessfull pirate activity is high to fill all the ships slot with weapons.- Author:
- Andi Hotz, (c) Sahits GmbH, 2017 Created on Oct 18, 2017
-
-
Field Summary
Fields Modifier and Type Field Description private static long
CASH_LIMIT
private DangerService
dangerService
private PirateActivity
pirateActivity
private ShipService
shipService
-
Constructor Summary
Constructors Constructor Description BuyWeaponHighPirateSuccessAllSlotsFilledStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<BuyWeapons>
shouldBuyWeapons(IShip ship, IAIPlayer player, ICity city)
Weapons should be bought when: There was a successful pirate attack every 2 weeks There are free weapon slots at least 10'000 cash is available Then the amounts are calculated: one hand weapon per sailor Full the amount of large weapons then there are slots Full the amount of remaining open slots for small weapons 1.5 times the amount of free weapon slots as strength-
Methods inherited from class ch.sahits.game.openpatrician.engine.player.strategy.BaseBuyWeaponStrategy
buyLargeWeapon, buySmallWeapon, buyWeapons, buyWeaponsOrdered, getNumberOfEmptyLargeWeaponSlots, getNumberOfEmptyWeaponSlots, getNumberOfWeaponSlots, getWeaponAmount
-
-
-
-
Field Detail
-
pirateActivity
@Autowired private PirateActivity pirateActivity
-
dangerService
@Autowired private DangerService dangerService
-
shipService
@Autowired private ShipService shipService
-
CASH_LIMIT
private static final long CASH_LIMIT
- See Also:
- Constant Field Values
-
-
Method Detail
-
shouldBuyWeapons
public java.util.Optional<BuyWeapons> shouldBuyWeapons(IShip ship, IAIPlayer player, ICity city)
Weapons should be bought when:- There was a successful pirate attack every 2 weeks
- There are free weapon slots
- at least 10'000 cash is available
- one hand weapon per sailor
- Full the amount of large weapons then there are slots
- Full the amount of remaining open slots for small weapons
- 1.5 times the amount of free weapon slots as strength
- Parameters:
ship
- for which the weapons should be boughtplayer
- who is purchasing the weaponscity
- in which to buy weapons- Returns:
- optional of
BuyWeapons
defining the target that should be reached. If the optional is not filled This means, no weapons should be bought.
-
-