Interface IAIBuyWeaponStrategy


  • public interface IAIBuyWeaponStrategy
    Strategy to determine when and how to purchase ship weapons.
    Author:
    Andi Hotz, (c) Sahits GmbH, 2017 Created on Oct 18, 2017
    • 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 bought
        player - who is purchasing the weapons
        city - 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.
      • 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 bought
        player - who is purchasing the weapons
        city - 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 in target. 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 bought
        player - who is purchasing the weapons
        city - in which to buy weapons