Module:Ability

-- --Start Module local p = {}

local getArgs = require('Module:Arguments').getArgs local yesno = require('Module:Yesno')

--Define basic styling for each module local styling = { ['abilityName'] = { name = 'Ability', color = '#FFA500', noshow = true, },	['full_set'] = { name = 'Full Set Bonus', color = '#FFA500' },	['piece'] = { name = 'Piece Bonus', color = '#FFA500' },	['tiered'] = { name = 'Tiered Bonus', color = '#FFA500' },	['ability'] = { name = 'Ability', color = '#FFA500' },	['secret'] = { name = 'Secret', color = '#FF0000' }, }

- -- Template:Ability -- -- Formats the ability - function p.ability(frame) local args = getArgs(frame) local text = args[1] local secret = args['secret'] or args['s'] secret = yesno(secret) return p._ability(text, secret, 'ability') end - -- Template:Full Set Bonus -- --Formats the full set bonus - function p.fullSetBonus(frame) local args = getArgs(frame) local text = args[1] local secret = args['secret'] or args['s'] secret = yesno(secret) return p._ability(text, secret, 'full_set') end - -- Template:Piece Bonus -- -- Formats the piece bonus - function p.pieceBonus(frame) local args = getArgs(frame) local text = args[1] local secret = args['secret'] or args['s'] secret = yesno(secret) return p._ability(text, secret, 'piece') end - -- Template:Tiered Armor Bonus -- -- Formats the tiered armor bonus - function p.tieredBonus(frame) local args = getArgs(frame) local text = args[1] local secret = args['secret'] or args['s'] secret = yesno(secret) return p._ability(text, secret, 'tiered') end

p.tieredArmorBonus = p.tieredBonus - -- Template:AbilityName -- -- Formats just the text, or returns 'AbilityName' string if no text is provided - function p.abilityName(frame) local args = getArgs(frame) local text = args[1] local secret = args['secret'] or args['s'] secret = yesno(secret) return p._ability(text, secret, 'abilityName') end

-- Main function processing the information provided by template access points function p._ability(text, secret, outputType) local abilityStyling = styling[outputType] or styling.ability local noshow, name = abilityStyling.noshow or (text and text:find('[Aa]bilit[yi]e?s?')) and true, abilityStyling.name if secret then abilityStyling = styling.secret end -- Apply fomatting if noshow then return table.concat{ '', text or name, ' ',		}	else return table.concat{ '', secret and (abilityStyling.name .. ' ') or '', name, text and ': ' or '', text or '', ' ',		}	end end

--Finish Module return p