Module:Abilities: Difference between revisionsGive feedback
Created page with "local p = {} return p" |
m Added notice to not add code here |
||
| Line 1: | Line 1: | ||
-- EMPTY MODULE TO ENABLE DOCUMENTATION | |||
-- ANY CODE SHOULD BE ADDED TO A SUBMODULE "Module:Abilities/*" | |||
Revision as of 17:13, 26 October 2024
Overview
The Abilities module provides functions for retrieving data about hero abilities and their upgrades.
- The function
get_ability_namereferences Data:AbilityCards.json to link a hero and ability slot to an ability's display name. - The functions
get_ability_propandget_ability_upgrade_propreference Data:AbilityData.json to get specific stats from an ability's base data or its upgrades.
Examples
get_ability_name
To get the localized display name of a hero's ability (numbered 1 to 4):
{{#invoke:Abilities|get_ability_name|hero_atlas|1}}
Returns:
Script error: The module returned a nil value. It is supposed to return an export table.
Function can be passed with lang parameter to override the current language to a specific language code.
{{#invoke:Abilities|get_ability_name|hero_atlas|1|lang=ru}}
Returns:
Script error: The module returned a nil value. It is supposed to return an export table.
get_ability_prop
To get a property from the base stats of an ability. You can use the ability's key (e.g., "ability_afterburn") or its proper name (e.g., "Afterburn").
{{#invoke:Abilities|get_ability_prop|Afterburn|BurnDuration}}
Returns:
Script error: The module returned a nil value. It is supposed to return an export table.
You can also retrieve nested properties by using dot notation to drill down into the data structure. For example, to get a value nested inside a Scale table:
{{#invoke:Abilities|get_ability_prop|Lycan Curse|MaxRage.Scale.Value}}
Returns:
Script error: The module returned a nil value. It is supposed to return an export table.
get_ability_upgrade_prop
To get a property from a specific upgrade of an ability.
{{#invoke:Abilities|get_ability_upgrade_prop|Afterburn|3|DPS}}
This example gets the DPS value from the 3rd upgrade for the ability "Afterburn".
Returns:
Script error: The module returned a nil value. It is supposed to return an export table.
Another example, getting the `DamageAmplificationPerStack` from the 2nd upgrade of "Marksman":
{{#invoke:Abilities|get_ability_upgrade_prop|Marksman|2|DamageAmplificationPerStack}}
Returns:
Script error: The module returned a nil value. It is supposed to return an export table.
Submodules
Abilities - Simple functions. Eg. getting ability name
Abilities/utils - Common internal functions that are shared amongst any Abilities/ modules
Abilities/card - Generates hero ability cards
Abilities/icon - Functions for retrieving ability and attribute icon data
Abilities/details table (WIP) - Generates details table to show raw ability data