XML/Upgrade

From MegaGlest
Revision as of 16:07, 6 November 2008 by Daniel Santos (talk) (reformatting to 120 character width, adding summary comments)
Jump to: navigation, search

An upgrade is a "producible" type that a unit may produce to bring about changes in other units or pave the way for other units or upgrade to be produced. An upgrade may alter many stats of one or more unit types.

See also Glest::ProducibleType class in source code.

<?xml version="1.0" standalone="no"?>

<upgrade>
    <image path="images/image.bmp"/>         <!-- UI icon used for the upgrade -->
    <image-cancel path="images/cancel.bmp"/> <!-- UI icon used to cancel the upgrade -->
                          <!-- Time required to upgrade -->
    <unit-requirements/>                     <!-- Units required to be in service before upgrade -->
    <upgrade-requirements>
        <upgrade name="upgrade_name"/>       <!-- Previous upgrades required before upgrade can be initiated -->
    </upgrade-requirements>
    <resource-requirements>
                                             <!-- Resources used for upgrade -->
        <resource name="resource_name" amount="#"/>
    </resource-requirements>
    <effects>
        <unit name="unit_name"/>             <!-- Units affected by the upgrade -->
    </effects>

<!-- These are the actual effects conferred by the upgrade -->

    <max-hp value="0"/>
    <max-ep value="0"/>
    <sight value="0"/>
    <attack-strenght value="0"/>             <!-- Note Spelling; Minor bug, not corrected as of 3.1.2 (nor GAE 0.2.8) -->
    <attack-range value="0"/>
    <armor value="0"/>
    <move-speed value="0"/>
    <production-speed value="0"/>

<!-- GAE Only -->

    <!-- Static modifiers are adjustments to the affected units using fixed values, like 100 hit
         points (meaning +100) and 1 sight.  The following describes each of these parameters,
         although some of them are probably quite obvioius).
         ALSO APPEARS IN: <effect>, <enamation> tags in unit.xml
         SEE ALSO: Effects & upgrades
         RELATED SOURCE CODE: Glest::EnhancementTypeBase class -->
    <static-modifiers>
        <max-hp value="#"/>               <!-- Maximum hit points -->
        <max-ep value="#"/>               <!-- Maximum energy points -->
        <hp-regeneration value="#"/>      <!-- HPs regenerated per second -->
        <ep-regeneration value="#"/>      <!-- EPs regenerated per second -->
        <sight value="#"/>                <!-- How many spaces the unit can see -->
        <armor value="#"/>                <!-- Armor rating (specifically, how many hit points are absorbed by an
                                               attack) -->
        <attack-strength value="#"/>      <!-- How many HPs of damage are done by an attack -->
        <effect-strength value="#"/>      <!-- A multiplier applied to the effects that are generated by a unit.  The
                                               base amount is 100%.  If an upgrade supplies (for example) 20 to this
                                               field, it will add to the current effect-strength of the unit, resulting
                                               in 120%, making all of their effects 20% more powerful than before. -->
        <attack-percent-stolen value="#"/><!-- How much of the damage dealt by this unit will be transfered into the
                                               unit's own hit points, healing them. -->
        <attack-range value="#"/>         <!-- The maximum distance the unit can attack enemy units from. -->
        <move-speed value="#"/>           <!-- Movement speed -->
        <attack-speed value="#"/>         <!-- Attack speed, the higher the number, the faster the attacks. -->
        <production-speed value="#"/>     <!-- How fast the unit is able to produce other units by either summoning,
                                               creating, etc. or by building. -->
        <repair-speed value="#"/>         <!-- How fast the unit is able to repair other units. -->
        <harvest-speed value="#"/>        <!-- How fast the unit is able to harvest resources. -->
    </static-modifiers>

    <!-- Multipliers are make relative adjustments to a stat based upon it's current value.  When
         more than one multiplier are applied to a unit stats, the multipliers are first added
         together (i.e., multiplier1 - 1.0 + multiplier2 - 1.0, etc.) and not multiplied together.
         The same stats specified in <static-modifiers> can be modified under <multipliers>, except
         that you pass a multiplier instead of a static value.  These nodes do not accept value in
         percentage form (i.e., base 1.0 and not 100).
         ALSO APPEARS IN: <effect>, <enamation> tags in unit.xml
         SEE ALSO: Effects & upgrades
         RELATED SOURCE CODE: Glest::EnhancementTypeBase class -->
    <multipliers>
        <!-- As an example the below will add 25% to the unit's movement speed.  If another
            upgrade, effect or emanation also supplies a 25% bonus to movement speed, the total
            multiplier will be 1.5, or +50%, not 1.5625 (as 125% x 125% would result in). -->
        <move-speed value="1.25"/>        
    </multipliers>

    <!-- Restrict an upgrade to only be available in a specific list of subfactions.  If not supplied,
         the default is all subfactions.  If present, however, the default list is erased and the
         upgrade will only be available in the subfactions you list.  Note that the syntax for this
         is the same for units and commands.
         RELATED SOURCE CODE: Glest::RequirableType class -->
    <subfaction-restrictions>
        <subfaction name="subfaction_name"/> <!-- The subfaction name defined in faction.xml or
            "base" (note that the base faction, without having advance to a subfaction that you
            defined, is actually considered the "base" subfaction. -->
    </subfaction-restrictions>

    <!-- Causes this upgrade to "advance" the subfaction from it's current state to the specified
         subfaction.  This is the node that essentially causes a faction to morph into an altered
         faction, or even a completely different one.  This tag can also be used on any unit or
         unit's command.  If is-immediate is true, the change will occur as soon as the upgrade is
         started, if false, then it will occur when the upgrade is completed.
         RELATED SOURCE CODE: Glest::ProducableType and Glest::FactionType classes -->
    <advances-to-subfaction name="subfaction_name" is-immediate="boolean"/>

<!-- GAE Only -->

</upgrade>

Back to XML_Definitions