Editing Module:AbilitiesGive feedback
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
| Latest revision | Your text | ||
| Line 36: | Line 36: | ||
end | end | ||
--{{#invoke: | --{{#invoke:AbilityData|get_ability_name|HERO_NAME|ABILITY_NUM|lang=LANG_CODE}}-- | ||
p.get_ability_name = function(frame) | p.get_ability_name = function(frame) | ||
local hero_name = frame.args[1] | local hero_name = frame.args[1] | ||
| Line 52: | Line 52: | ||
end | end | ||
--{{#invoke:AbilityData|get_ability_prop|ability_key_or_name|prop}}-- | |||
--{{#invoke: | |||
p.get_ability_prop = function(frame) | p.get_ability_prop = function(frame) | ||
local ability_identifier = frame.args[1] | local ability_identifier = frame.args[1] | ||
| Line 107: | Line 84: | ||
end | end | ||
--{{#invoke: | --{{#invoke:AbilityData|get_ability_upgrade_prop|ability_key_or_name|upgrade_num|prop}}-- | ||
-- Gets a specific property from a specific upgrade of an ability. | -- Gets a specific property from a specific upgrade of an ability. | ||
-- @param {string} frame.args[1] - The ability's key (e.g., "ability_afterburn") or name (e.g., "Afterburn"). | -- @param {string} frame.args[1] - The ability's key (e.g., "ability_afterburn") or name (e.g., "Afterburn"). | ||
| Line 127: | Line 104: | ||
return "Ability Not Found" | return "Ability Not Found" | ||
end | end | ||
-- Get the list of upgrades for this ability | -- Get the list of upgrades for this ability | ||
local upgrades = ability.Upgrades | local upgrades = ability.Upgrades | ||
| Line 148: | Line 125: | ||
-- Get the desired property from the specific upgrade | -- Get the desired property from the specific upgrade | ||
local element = upgrade[prop] | local element = upgrade[prop] | ||
if | if element == nil then | ||
return "" -- The property doesn't exist in this specific upgrade, which is a valid case. Return empty. | |||
end | |||
-- If the property is a table (like a Damage object), return its Value field | |||
if type(element) == "table" then | |||
return element.Value or "" | |||
end | end | ||
| Line 162: | Line 137: | ||
return element | return element | ||
end | end | ||
return p | return p | ||