Class EresseaRelationFactory.EresseaExecutionState

  • All Implemented Interfaces:
    ExecutionState
    Enclosing class:
    EresseaRelationFactory

    public static class EresseaRelationFactory.EresseaExecutionState
    extends java.lang.Object
    implements ExecutionState
    A class that stores state information during the execution of the orders.
    Author:
    stm
    • Constructor Detail

      • EresseaExecutionState

        public EresseaExecutionState​(GameData data)
        Parameters:
        data -
    • Method Detail

      • acquireItem

        public java.util.List<UnitRelation> acquireItem​(Unit unit,
                                                        ItemType type,
                                                        int requiredAmount,
                                                        boolean all,
                                                        boolean includeReserved,
                                                        boolean getReserved,
                                                        int line,
                                                        Order order)
        Tries to reserve a certain amount of an item. This method tries to get it from the material pool if possible and may produce and register additional relations.
        Parameters:
        unit - The unit that requires the item
        type - The required item type
        requiredAmount - The required amount
        all - true if ALL of the unit's item should be acquired
        includeReserved - true if the amount of item that was reserved by the unit counts toward the acquired amount.
        getReserved - true if the amount of item that the unit has received counts toward the acquired amount.
        line - The line number of the order (used for relations)
        order - The order that caused this
        Returns:
        A list of ReserveRelations and TransferRelations caused be the request. The last order is a reserve relation of the unit itself. These relations have not been added, yet.
      • reserveItem

        public java.util.List<UnitRelation> reserveItem​(ItemType type,
                                                        boolean all,
                                                        boolean includeReserved,
                                                        int requiredAmount,
                                                        Unit unit,
                                                        int line,
                                                        Order order)
        Tries to reserve a certain amount of an item. This method tries to get it from the material pool if possible and may produce and register additional relations.
        Parameters:
        type -
        requiredAmount -
        unit -
        line -
        Returns:
        The relations created for satisfying this event; The last relation is the main relation.
      • giveItem

        public java.util.List<UnitRelation> giveItem​(Unit source,
                                                     Unit target,
                                                     boolean all,
                                                     int requiredAmount,
                                                     ItemType type,
                                                     int line,
                                                     Order order)
        Tries to reserve a certain amount of an item. This method tries to get it from the material pool if possible and may produce and register additional relations.
        Parameters:
        source -
        target -
        all -
        requiredAmount -
        type -
        line -
        order -
        Returns:
        A list of all created relations
      • getFreeAmount

        protected int getFreeAmount​(ItemType type,
                                    Unit unit,
                                    boolean includeReserved,
                                    boolean includeReceived)
      • getHerbTypes

        public java.util.Collection<ItemType> getHerbTypes()
        Returns all known item types in the HERBS category.
      • addReserve

        public void addReserve​(Unit unit,
                               StringID itemID,
                               java.lang.Integer reserved)
      • getReserve

        public java.lang.Integer getReserve​(Unit unit,
                                            StringID itemID)