Class AtlantisOrderChanger

  • All Implemented Interfaces:
    OrderChanger

    public class AtlantisOrderChanger
    extends java.lang.Object
    implements OrderChanger
    Order changer for Atlantis game.
    • Field Summary

      • Fields inherited from interface magellan.library.gamebinding.OrderChanger

        ALL
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void addCombatOrder​(Unit unit, int newstate)
      Adds a KÄMPFE order.
      void addDescribeUnitContainerOrder​(Unit unit, UnitContainer uc, java.lang.String descr)
      Adds a command line "DESCRIBE uc \"descr\"" ("BESCHREIBE uc \"descr\"") , e.g.
      void addDescribeUnitOrder​(Unit unit, java.lang.String descr)
      Adds a command line "DESCRIBE UNIT \"descr\"" ("BESCHREIBE EINHEIT \"descr\"") , e.g.
      void addDescribeUnitPrivateOrder​(Unit unit, java.lang.String descr)
      Adds a command line "DESCRIBE PRIVATE \"descr\"" ("BESCHREIBE PRIVAT \"descr\"") , e.g.
      void addGiveOrder​(Unit source, Unit target, int amount, StringID item, java.lang.String comment)
      Adds a GIVE target amount item order.
      void addGroupOrder​(Unit unit, java.lang.String name)
      Adds a command line "GROUP \"name\"" ("GRUPPE \"name\"") , e.g.
      void addHideOrder​(Unit unit, java.lang.String level)
      Adds a command line "HIDE newstate" ("TARNE newstate") , e.g.
      void addMultipleHideOrder​(Unit u)
      Adds command lines for hiding all that could identify this unit, like name, number, description etc.
      void addNamingOrder​(Unit unit, java.lang.String name)
      Adds a command line "NAME UNIT \"name\"" ("BENENNE EINHEIT \"name\"") , e.g.
      void addNamingOrder​(Unit unit, UnitContainer uc, java.lang.String name)
      Adds a command line "NAME uc \"name\"" ("BENENNE uc \"name\"") , e.g.
      void addRecruitOrder​(Unit u, int amount)
      Adds a REKRUTIERE amount order.
      int areCompatibleLongOrders​(Orders orders)
      Determines if the orders in the collection are legal to have at the same time for one unit.
      Order createOrder​(Unit unit, java.lang.String order)
      Turns line of text into an Order object.
      void disableLongOrders​(Unit u)
      searches the orders of the unit for long orders and comments them out
      int extractTempUnits​(GameData gdata, int tempSortIndex, java.util.Locale locale, Unit unit)
      Scans this unit's orders for temp units to create.
      protected GameData getDummyData()  
      java.lang.String getOrder​(java.util.Locale orderLocale, StringID orderId)
      Deprecated.
      java.lang.String getOrder​(java.util.Locale orderLocale, StringID orderId, java.lang.Object[] args)
      Deprecated.
      java.lang.String getOrder​(StringID orderId, java.util.Locale orderLocale)
      Deprecated.
      java.lang.String getOrder​(StringID orderId, java.util.Locale orderLocale, java.lang.Object[] args)
      Deprecated.
      Order getOrderO​(java.util.Locale orderLocale, StringID orderId)
      Returns localized order for given order id
      Order getOrderO​(java.util.Locale orderLocale, StringID orderId, java.lang.Object[] args)
      Returns a localized order for given order id concatenated (separated by spaces) with the argument translations.
      Order getOrderO​(StringID orderId, java.util.Locale orderLocale)
      Returns localized order for given order id
      Order getOrderO​(StringID orderId, java.util.Locale orderLocale, java.lang.Object[] args)
      Returns a localized order for given order id concatenated (separated by spaces) with the argument translations.
      protected Order getOrderTranslation​(StringID orderId, Unit unit)  
      Rules getRules()
      Return rules.
      java.util.Collection<? extends Order> getTempOrders​(boolean writeUnitTagsAsVorlageComment, Unit unit)
      Returns the orders necessary to issue the creation of all the child temp units of this unit.
      java.lang.String getTokenLocalized​(java.util.Locale orderLocale, java.lang.Object arg)
      Returns localized string for given locale and argument.
      boolean isLongOrder​(java.lang.String order)
      checks, if the given order is a long order
      boolean isLongOrder​(Order order)
      checks, if the given order is a long order
      void setLongOrders​(Unit u, java.util.List<java.lang.String> orders, boolean replace)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getRules

        public Rules getRules()
        Return rules.
      • createOrder

        public Order createOrder​(Unit unit,
                                 java.lang.String order)
        Description copied from interface: OrderChanger
        Turns line of text into an Order object.
        Specified by:
        createOrder in interface OrderChanger
      • addDescribeUnitContainerOrder

        public void addDescribeUnitContainerOrder​(Unit unit,
                                                  UnitContainer uc,
                                                  java.lang.String descr)
        Description copied from interface: OrderChanger
        Adds a command line "DESCRIBE uc \"descr\"" ("BESCHREIBE uc \"descr\"") , e.g. "DESCRIBE SHIP \"A wonderful small boat.\"" ("BESCHREIBE SCHIFF \"Ein wundervolles kleines Boot.\"") to the given unit. See EMapDetailsPanel.
        Specified by:
        addDescribeUnitContainerOrder in interface OrderChanger
      • addDescribeUnitOrder

        public void addDescribeUnitOrder​(Unit unit,
                                         java.lang.String descr)
        Description copied from interface: OrderChanger
        Adds a command line "DESCRIBE UNIT \"descr\"" ("BESCHREIBE EINHEIT \"descr\"") , e.g. "DESCRIBE UNIT \"A wonderful sailor.\"" ("BESCHREIBE EINHEIT \"Ein wundervoller Segler.\"") to the given unit. See EMapDetailsPanel.
        Specified by:
        addDescribeUnitOrder in interface OrderChanger
      • addDescribeUnitPrivateOrder

        public void addDescribeUnitPrivateOrder​(Unit unit,
                                                java.lang.String descr)
        Description copied from interface: OrderChanger
        Adds a command line "DESCRIBE PRIVATE \"descr\"" ("BESCHREIBE PRIVAT \"descr\"") , e.g. "DESCRIBE PRIVATE \"My spy!.\"" ("BESCHREIBE PRIVAT \"Mein Spion!\"") to the given unit. See EMapDetailsPanel.
        Specified by:
        addDescribeUnitPrivateOrder in interface OrderChanger
      • addHideOrder

        public void addHideOrder​(Unit unit,
                                 java.lang.String level)
        Description copied from interface: OrderChanger
        Adds a command line "HIDE newstate" ("TARNE newstate") , e.g. "HIDE 3" ("TARNE 3") to the given unit. See EMapDetailsPanel.
        Specified by:
        addHideOrder in interface OrderChanger
      • addGroupOrder

        public void addGroupOrder​(Unit unit,
                                  java.lang.String name)
        Description copied from interface: OrderChanger
        Adds a command line "GROUP \"name\"" ("GRUPPE \"name\"") , e.g. "GROUP \"Magellan.\"" ("GRUPPE \"Magellan.\"") to the given unit. See EMapDetailsPanel.
        Specified by:
        addGroupOrder in interface OrderChanger
      • addNamingOrder

        public void addNamingOrder​(Unit unit,
                                   java.lang.String name)
        Description copied from interface: OrderChanger
        Adds a command line "NAME UNIT \"name\"" ("BENENNE EINHEIT \"name\"") , e.g. "NAME UNIT \"Magellan.\"" ("BENENNE EINHEIT \"Magellan.\"") to the given unit. See EMapDetailsPanel.
        Specified by:
        addNamingOrder in interface OrderChanger
      • addGiveOrder

        public void addGiveOrder​(Unit source,
                                 Unit target,
                                 int amount,
                                 StringID item,
                                 java.lang.String comment)
        Description copied from interface: OrderChanger
        Adds a GIVE target amount item order.
        Specified by:
        addGiveOrder in interface OrderChanger
        amount - use ALL for all, negative amount for each
      • addMultipleHideOrder

        public void addMultipleHideOrder​(Unit u)
        Description copied from interface: OrderChanger
        Adds command lines for hiding all that could identify this unit, like name, number, description etc.
        Specified by:
        addMultipleHideOrder in interface OrderChanger
        Parameters:
        u - The affected unit.
      • disableLongOrders

        public void disableLongOrders​(Unit u)
        Description copied from interface: OrderChanger
        searches the orders of the unit for long orders and comments them out
        Specified by:
        disableLongOrders in interface OrderChanger
      • isLongOrder

        public boolean isLongOrder​(java.lang.String order)
        Description copied from interface: OrderChanger
        checks, if the given order is a long order
        Specified by:
        isLongOrder in interface OrderChanger
        Returns:
        true if the given order is a long order
      • getDummyData

        protected GameData getDummyData()
      • isLongOrder

        public boolean isLongOrder​(Order order)
        Description copied from interface: OrderChanger
        checks, if the given order is a long order
        Specified by:
        isLongOrder in interface OrderChanger
        Returns:
        true if the given order is a long order
      • areCompatibleLongOrders

        public int areCompatibleLongOrders​(Orders orders)
        Description copied from interface: OrderChanger
        Determines if the orders in the collection are legal to have at the same time for one unit.
        Specified by:
        areCompatibleLongOrders in interface OrderChanger
        Returns:
        The number of the first offending order, -1 if the orders are compatible
      • extractTempUnits

        public int extractTempUnits​(GameData gdata,
                                    int tempSortIndex,
                                    java.util.Locale locale,
                                    Unit unit)
        Scans this unit's orders for temp units to create. It constructs them as TempUnit objects and removes the corresponding orders from this unit.
        Specified by:
        extractTempUnits in interface OrderChanger
        Parameters:
        tempSortIndex - an index for sorting units (required to reconstruct the original order in the report) which is incremented with each new temp unit.
        locale - the locale to parse the orders with.
        Returns:
        the new sort index. return value - sortIndex is the number of temp units read from this unit's orders.
      • getTempOrders

        public java.util.Collection<? extends Order> getTempOrders​(boolean writeUnitTagsAsVorlageComment,
                                                                   Unit unit)
        Returns the orders necessary to issue the creation of all the child temp units of this unit.
        Specified by:
        getTempOrders in interface OrderChanger
      • getOrderTranslation

        protected Order getOrderTranslation​(StringID orderId,
                                            Unit unit)
      • getTokenLocalized

        public java.lang.String getTokenLocalized​(java.util.Locale orderLocale,
                                                  java.lang.Object arg)
                                           throws RulesException
        Description copied from interface: OrderChanger
        Returns localized string for given locale and argument.
        Specified by:
        getTokenLocalized in interface OrderChanger
        arg - can be an order ID, a unit ID or anything else
        Throws:
        RulesException - if argument has no translation
      • getOrderO

        public Order getOrderO​(java.util.Locale orderLocale,
                               StringID orderId)
        Description copied from interface: OrderChanger
        Returns localized order for given order id
        Specified by:
        getOrderO in interface OrderChanger
        orderId - an order ID, usually one of the EresseaConstants.OC_... constants.
      • getOrderO

        public Order getOrderO​(java.util.Locale orderLocale,
                               StringID orderId,
                               java.lang.Object[] args)
        Description copied from interface: OrderChanger
        Returns a localized order for given order id concatenated (separated by spaces) with the argument translations.
        Specified by:
        getOrderO in interface OrderChanger
        orderId - an order ID, usually one of the EresseaConstants.OC_... constants.
        args - Additional arguments
        Returns:
        The order
      • getOrderO

        public Order getOrderO​(StringID orderId,
                               java.util.Locale orderLocale)
                        throws RulesException
        Description copied from interface: OrderChanger
        Returns localized order for given order id
        Specified by:
        getOrderO in interface OrderChanger
        Parameters:
        orderId - an order ID, usually one of the EresseaConstants.OC_... constants.
        Throws:
        RulesException - if argument has no translation
      • getOrderO

        public Order getOrderO​(StringID orderId,
                               java.util.Locale orderLocale,
                               java.lang.Object[] args)
                        throws RulesException
        Description copied from interface: OrderChanger
        Returns a localized order for given order id concatenated (separated by spaces) with the argument translations.
        Specified by:
        getOrderO in interface OrderChanger
        Parameters:
        orderId - an order ID, usually one of the EresseaConstants.OC_... constants.
        args - Additional arguments
        Returns:
        The order
        Throws:
        RulesException - if argument has no translation
      • getOrder

        @Deprecated
        public java.lang.String getOrder​(java.util.Locale orderLocale,
                                         StringID orderId)
        Deprecated.
        Description copied from interface: OrderChanger
        Returns localized order for given order id
        Specified by:
        getOrder in interface OrderChanger
        orderId - an order ID, usually one of the EresseaConstants.OC_... constants.
      • getOrder

        @Deprecated
        public java.lang.String getOrder​(java.util.Locale orderLocale,
                                         StringID orderId,
                                         java.lang.Object[] args)
        Deprecated.
        Description copied from interface: OrderChanger
        Returns a localized order for given order id concatenated (separated by spaces) with the argument translations.
        Specified by:
        getOrder in interface OrderChanger
        orderId - an order ID, usually one of the EresseaConstants.OC_... constants.
        args - Additional arguments
        Returns:
        The order
      • getOrder

        @Deprecated
        public java.lang.String getOrder​(StringID orderId,
                                         java.util.Locale orderLocale)
                                  throws RulesException
        Deprecated.
        Description copied from interface: OrderChanger
        Returns localized order for given order id
        Specified by:
        getOrder in interface OrderChanger
        Parameters:
        orderId - an order ID, usually one of the EresseaConstants.OC_... constants.
        Throws:
        RulesException - if argument has no translation
      • getOrder

        @Deprecated
        public java.lang.String getOrder​(StringID orderId,
                                         java.util.Locale orderLocale,
                                         java.lang.Object[] args)
                                  throws RulesException
        Deprecated.
        Description copied from interface: OrderChanger
        Returns a localized order for given order id concatenated (separated by spaces) with the argument translations.
        Specified by:
        getOrder in interface OrderChanger
        Parameters:
        orderId - an order ID, usually one of the EresseaConstants.OC_... constants.
        args - Additional arguments
        Returns:
        The order
        Throws:
        RulesException - if argument has no translation