Template:Data mathFormula

From Wildermyth Wiki
Revision as of 14:26, 30 January 2022 by FeralKitty (talk | contribs) (Prepend damage type to math formula, as not all math formulas are "Damage: ". Add Invigoration, Skunk Spray, Splinterskin, Static Shock, Thunder Stomp)
This documentation is transcluded from Template:Data mathFormula/doc

This template is used by the game data process to help automatically keep pages up-to-date.

Warning: Manually editing this template data may cause your changes to be overwritten or lost if the template is automatically updated. If specific game data is missing from this template, please ask about it on the Discord #wiki channel (to arrange for its data to automatically be added to these templates).

Usage

This template returns the (math) formula for a specific theme ability. A future update will add hero abilities.

The template uses the following parameter:

1
The name associated with the specific math formula.

Examples

Theme ability math formula

{{Data mathFormula|Bash}}

Damage: (((1d4+3)+(((self.PHYSICAL_DAMAGE_BONUS+self.POTENCY)*0.5)*(1+self.theme_tree_upgrade)))+self.theme_tree_upgrade)+target.distanceTo.targetTile

Hero ability math formula (to be added)

{{Data mathFormula|Shieldshear}}

(No math formula is returned, as this hero ability data has not been added yet to the template.)

Technical details

Math formula data comes from Wildermyth's.json files. For example, assets/data/effects/attack/morthagiArmHammer.json includes the following line:

"amount": "(((1d4+3)+(((self.PHYSICAL_DAMAGE_BONUS+self.POTENCY)*0.5)*(1+self.theme_morthagi_upgrade)))+self.theme_morthagi_upgrade)+target.distanceTo.targetTile"

This shows the actual formula used to calculate the damage amount, based on the hero's Bonus Damage, Potency, and whether the morthagi theme has been upgraded or not.

Note: An expression like self.theme_morthagi_upgrade evaluates to 0 if that aspect does not exist (i.e., the theme is not upgraded), or (the aspect value of) 1.0 if that aspect does exist.

{{Formulas
| damage = {{Data mathFormula|Hammer}}
}}