模块:技能数值计算
其他人
文本为 文本 等级为2 计算结果:文本
文本为 300% 等级为0 计算结果:300%
文本为 300% 等级为1 计算结果:330%
文本为 300% 等级为2 计算结果:360%
文本为 300 等级为3 计算结果:390
极乐
文本为 文本 等级为2 计算结果:文本
文本为 50%*0.2 等级为0 计算结果:50%
文本为 50%*0.2 等级为1 计算结果:60%
文本为 50%*0.2 等级为2 计算结果:70%
文本为 50%*0.2 等级为3 计算结果:80%
local p = {}
function parseArgument(frame)
local arg = {}
return arg
end
p["calculate"] = function(frame)
local baseText = frame.args["baseText"]
local level = tonumber(frame.args["level"]) or 1
local base
local multi = 0.1
local per = false
local color = false
if string.find(baseText, "*") then
base, multi = string.match(baseText, "(.-)%s*%*%s*(.+)")
else
base = baseText
end
if string.sub(base, -1) == "%" then
per = true
base = string.sub(base, 1, -2)
end
if frame.args["颜色"] == "红" then
color = true
end
if tonumber(base) == nil then
return baseText
else
local output = tonumber(base) + tonumber(base) * tonumber(multi) * level
if per then
output = output .. "%"
end
if color then
output = '<span style="color:#F88789;">' .. output .. '</span>'
end
return output
end
end
return p