Module:Abilities/card: Difference between revisionsGive feedback
Jump to navigation
Jump to search
Gammaton32 (talk | contribs) note |
m Refactored get_scalar func naming |
||
| Line 11: | Line 11: | ||
-- List of scaling type attributes | -- List of scaling type attributes | ||
local | local SCALING_ICON_MAP = { | ||
["spirit"] = { class = "spirit", icon = "File:Spirit scaling.png", link = "Spirit Power#Spirit Power Scaling", size = "40px" }, | ["spirit"] = { class = "spirit", icon = "File:Spirit scaling.png", link = "Spirit Power#Spirit Power Scaling", size = "40px" }, | ||
["stats_count"] = { class = "spirit", icon = "File:Spirit scaling.png", link = "Spirit Power#Spirit Power Scaling", size = "40px" }, | ["stats_count"] = { class = "spirit", icon = "File:Spirit scaling.png", link = "Spirit Power#Spirit Power Scaling", size = "40px" }, | ||
| Line 22: | Line 22: | ||
} | } | ||
-- get scaling attribute | -- get scaling icon attribute associated with a specified scale type | ||
function p.get_scalar(frame) | function p.get_scalar(frame) | ||
local args = frame.args | local args = frame.args | ||
local | local scaleType = args[1] | ||
local attribute = args[2] | local attribute = args[2] | ||
local | local scalingIcon = SCALING_ICON_MAP[scaleType] | ||
if | if scalingIcon then | ||
return | return scalingIcon[attribute] or "Missing scaling type in Module:Abilities/card" | ||
end | end | ||