Editing Module:AbilityTable/ComplexRenderers

Warning: You are not logged in. Once you make an edit, a temporary account will be created for you. Learn more. Log in or create an account to continue receiving notifications after this account expires, and to access other features.
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 81: Line 81:
end
end


-- Pads a whole-number scaling out to one decimal, so a running total of 2
-- Formats one barrier step. Spirit scaling goes through {{Ss}}, expanded via
-- reads "2.0" next to its "1.5" neighbours instead of "2". Values that already
-- the frame the surrounding #invoke is already running under: module return
-- carry decimals are left alone, which keeps precision on things like 0.75.
-- values are not re-expanded, so a literal "{{Ss|0.8}}" would reach the page
local function format_scale(scale)
-- as text. The plain fallback covers a nil frame (module console).
    local text = tostring(scale)
    if not text:find(".", 1, true) then text = text .. ".0" end
    return text
end
 
-- Formats one barrier step. Spirit scaling goes through the compact {{Ss}}
-- form, expanded via the frame the surrounding #invoke is already running
-- under: module return values are not re-expanded, so a literal "{{Ss|0.8}}"
-- would reach the page as text. The plain fallback covers a nil frame
-- (module console).
local function format_barrier(value, scale)
local function format_barrier(value, scale)
     local out = tostring(value)
     local out = tostring(value)
     if scale and scale ~= 0 then
     if scale and scale ~= 0 then
        local scale_text = format_scale(scale)
         local frame = mw.getCurrentFrame()
         local frame = mw.getCurrentFrame()
         if frame then
         if frame then
             out = out .. " " .. frame:expandTemplate{
             out = out .. " " .. frame:expandTemplate{ title = "Ss", args = { scale } }
                title = "Ss",
                args = { scale_text, compact = "1", show_value = "1" },
            }
         else
         else
             out = out .. " ×" .. scale_text
             out = out .. " ×" .. scale
         end
         end
     end
     end
Please note that all contributions to The Deadlock Wiki are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see Deadlock:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)
Preview page with this template