GAE/Enhancements

From MegaGlest
Revision as of 10:54, 27 June 2011 by 220.244.218.30 (talk) (create EnhancementType page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

EnhancementType

static-modifiers

max-hp

Add or subtract from the unit type's max-hp.

hp-regeneration

Add or subtract from the unit type's hp-regeneration.

max-ep

Add or subtract from the unit type's max-ep.

ep-regeneration

Add or subtract from the unit type's ep-regeneration.

sight

Add or subtract from the unit type's sight.

armor

Add or subtract from the unit type's armor.

attack-strength

Modify the strength of all attack skills by this amount.

effect-strength

Modify the strength of all effects on this unit by this amount.

attack-percent-stolen

Modify the attack-percent-stolen of all attack skills by this much.

attack-range

Add or subtract from all attack skill ranges.

move-speed

Add or subtract from move skill speed.

attack-speed

Add or subtract from attack skill speed.

production-speed

Add or subtract from produce & upgrade skill speed.

repair-speed

Add or subtract from repair and build skill speed.

harvest-speed

Add or subtract from harvest skill speed.


multipliers

max-hp

Multiply the unit type's max-hp by this amount.

hp-regeneration

Multiply the unit type's hp-regeneration by this amount.

max-ep

Multiply the unit type's max-ep by this amount.

ep-regeneration

Multiply the unit type's ep-regeneration by this amount.

sight

Multiply the unit type's sight by this amount.

armor

Multiply the unit type's armor by this amount.

attack-strength

Multiply the strength of all attack skills by this amount.

effect-strength

Multiply the strength of all effects on this unit by this amount.

attack-percent-stolen

Multiply the attack-percent-stolen of all attack skills by this much.

attack-range

Multiply all attack skill ranges by this amount.

move-speed

Multiply move skill speed by this amount.

attack-speed

Multiply attack skill speed by this amount.

production-speed

Multiply produce & upgrade skill speed by this amount.

repair-speed

Multiply repair and build skill speed by this amount.

harvest-speed

Multiply harvest skill speed by this amount.

point-boosts

hp-boost

Applies a one time hp boost.

ep-boost

Applies a one time ep boost.

EnhancementType Evaluation (or, 'How they work')

These tags represent very core data structures that drive many aspects of GAE's design. They are used for levels, upgrades, effects and emanations. On the implementation level, static modifiers are implemented in the C++ UnitStats class and multipliers are implemented in the EnhancementType class (a subclass of UnitStats). Because multiples of these may be applied to a unit, it's important to understand how they are evaluated. Put briefly, multipliers are not applied (i.e., multiplied) against any other bonus, static modifier or multiplier, only against the base stat.

For the long explanation, the static modifiers and multipliers for every unit's level-ups, upgrades, effects and emanations are evaluated in the C++ member function Unit::recalculateStats(). All multipliers for a given stat are [b]added[/b] together, rather than multiplied, and then the count minus one is subtracted.

totalMultiplier = multiplier1 + multiplier2 - (multiplier_count - 1);

Example. A unit with max-hp 1000 is affected by two enhancements, the first has a max-hp multiplier of 1.5 and the second has a max-hp multiplier of 1.5, with these enhancements the unit's current max-hp is,

totalMultiplier = 1.5 + 1.3 - (2 - 1) = 1.8
max-hp = 1000 * 1.8 = 1800

If multipliers were multiplied by each other, the total multiplier would be 1.95 (1.3 x 1.5) and successive multiplier bonuses or penalties would have an exponential effect, the 'multiplier adding' strategy outlined above avoids this problem.

Don't use negative values for multipliers, to apply a penalty set the multiplier to a number less than one, but still positive. eg. <sight value="0.5" /> halves a units sight.

The final multiplier is applied to the base stat only, and then static modifiers are added to that result.

newStatValue = oldStatValue * totalMultiplier + totalStaticModifier

Example. If you have a unit with 500 max-hp (base stat), and it gets a static-modifier bonus of +50 and a multiplier bonus of * 1.5, its hp-max is,

max-hp = 500 * 1.5 + 50 = 800

If static modifier were added to the base stat for the multipler was applied this would have been "(500 + 50) * 1.5 = 825". This behavior is important to keep in mind when designing mods where very low stats have multipliers applied against them, because the effect will be nominal, despite any static modifier bonuses.

Example. A unit with an attack skill of strength 125 has two levels, each providing a 1.2 multiplier to attack-strength, one upgrade affecting the unit provides a static-modifier of +25 to attack-strength. Using this attack skill the strength of an attack will be,

totalMultiplier = 1.2 + 1.2 - (2 - 1) = 1.4
totalStaticModifier = +25
attack-strength = 125 * 1.4 + 25 = 200

Now, suppose this unit gets struck by a special attack that leaves a detretimental Effect on the unit which causes a 0.4 multiplier to attack-strength. The units current attack-strength with this skill is now,

totalMultiplier = 1.2 + 1.2 + 0.4 - (3 - 1) = 0.8
totalStaticModifier = +25
attack-strength = 125 * 0.8 + 25 = 125

Note: The above example assumes the Effect was applied with 1.0 strength, this strength factor may have been modified by distance from the centre of a splash attack (with the 'scale-splash-strength' flag set) or may be modified by the time since it was created (with the 'i-dont-exist-yet' flag). See EffectType for more information on Effects.