Module:Skills

---	Skills stores details of Risk of Rain 2' character skills. --	--	@module		skills --	@alias		p --	@author		Paradoxzyx --	@require	Module:Skills/Data --	@release	stable -- local p = {}

local data = require("Module:Skills/Data") local all_skills = data.skills

---	Gets the formatted skill description. --	@function		p.Skill --	@param			{table} frame Frame object --	@return			{string} Preprocessed wikitext of skill description function p.Skill(frame) return frame:preprocess(all_skills[frame.args[1]].Desc:gsub("|noTooltip=true", "")) end

local tooltip_template = ' ' .. ' ' ..                             ' %s ' .. '' ..                           ' ' ..                            ' ' ..                              ' %s (%s)   %s ' .. ' ' ..                         ' ' function getTypeColor(t) if t == "Primary" or t == "Secondary" then return "damage" elseif t == "Utility" then return "utility" elseif t == "Special" then return "healing" elseif t == "Passive" then return "note" end return "common" end

---	Gets the formatted skill description for tooltips. --	@function		p.SkillTooltip --	@param			{table} frame Frame object --	@return			{string} Preprocessed wikitext of skill description function p.SkillTooltip(frame) local data = all_skills[frame.args[1]] if data == nil then return frame:preprocess("" .. frame.args[1] .. " is not a valid skill. ") end local str = string.format(			tooltip_template,			"",			data.Name,			getTypeColor(data.Type),			data.Type,			data.Desc:gsub("{{Keyword", "{{Color") .. (data.Survivor == nil and "" or (" Survivor: {{Color|" .. string.lower(data.Survivor) .. "|" .. data.Survivor .. "}}"))		) return frame:preprocess(str) end

---	Given skill, gets survivor --	@function		p.SkillSurvivor --	@param			{table} frame Frame object --	@return			{string} Preprocessed wikitext of skill survivor name function p.SkillSurvivor(frame) return frame:preprocess(all_skills[frame.args[1]].Survivor) end

return p --