Please note that some information on this wiki is still based on the demo version.
If you notice any errors, feel free to correct them.
Module:Stats
From Super Fantasy Kingdom Official Wiki
Displays stats for units. Call with Template:Stats, code is in Module:Stats.
Parameters
inline: If not empty stats will be shown in one line, else in a table formatalign: Optional, valid values areleft,centerorright. It will display the stats in a simple column with the stated alignment.hp: Healthma: Manash: Shieldpd: Physical Defensemd: Magical Defensedm: Damagecr: Critical Chancera: Rangecd: Cooldownar: Areakb: Knockbacksp: Speeddu: Durationrg: Ragegr: Greedrr: Rerollba: Banishcu: Curse
Examples
{{stats|hp=33|dm=8|sh=4|cr=2%|pd=20%|md=10%}}
{{stats|hp=20.5|ra=8.33 m|cd=1.2 s|cr=2%}}
{{stats|hp=33|dm=8|sh=4|cr=2%|pd=20%|md=10%|inline=1}}
{{stats|hp=33|dm=8|sh=4|cr=2%|pd=20%|md=10%|align=center}}
{{stats
| first = Base stats
| second = Maxed<br/>Base stats
| dm = 5
| dm2 = 6.25
| dmGain = 1
| hp = 11
| hp2 = 14.3
| hpGain = 1
| sh = 13 m
| sh2 = 16.9 m
| shGain = 2
| cr = 5%
| cr2 = 5.63%
| crGain = 1
| pd = 0%
| pd2 = 15%
| pdGain = 3
| md = 0%
| md2 = 15%
| mdGain = 3
}}
local p = {}
function p.stats(f)
local args = f:getParent().args
-- argument name and full name (also used for icon name)
local possibleStats = {{"hp", "Health Points"},
{"shield", "Shield"},
{"pdef", "Physical Defense"},
{"mdef", "Magical Defense"},
{"dmg", "Damage"},
{"crit", "Critical Chance"},
{"range", "Range"},
{"cd", "Cooldown"},
{"aoe", "Area of Effect"}
}
local usedStats = {}
for i, s in ipairs(possibleStats) do
if args[s[1]] then
table.insert(usedStats, args[s[1]]..' [[File:'..s[2]..'.png|link='..s[2]..']]')
end
end
if #usedStats == 0 then
return ''
end
if args.inline ~= nil then
-- one line, separated by bullet points
return table.concat(usedStats, '•')
end
-- table
return '<div style="text-align:right;display:inline-block">'..table.concat(usedStats, '<br/>')..'</div>'
end
return p


