ElEditors, Interface administrators, Administrators
70,867
edits
No edit summary |
No edit summary |
||
Line 63: | Line 63: | ||
end | end | ||
-- Output passives if provided | -- Output passives if provided | ||
local | local passives = {0, 0, 0} | ||
for i=1, 3 do | |||
if inArgs('passive' .. i) then | |||
passives[i] = args['passive' .. i] | |||
passives[i] = split(frame:preprocess('{{:' .. passives[i] .. '}}{{#arrayprint:' .. passives[i] .. '}}')) | |||
end | |||
end | end | ||
Line 84: | Line 79: | ||
local fvals = {} | local fvals = {} | ||
local tvals = {} | local tvals = {} | ||
local | local pvals = { | ||
[1]={}, | |||
[2]={}, | |||
[3]={}, | |||
[12]={}, | |||
[13]={}, | |||
[23]={}, | |||
[123]={}, | |||
} | |||
-- Check the specified mode and define the prefixes/suffixes first. | -- Check the specified mode and define the prefixes/suffixes first. | ||
Line 172: | Line 173: | ||
tableMerge(ftvals, tvals) | tableMerge(ftvals, tvals) | ||
if | function addPassive(num, loop_table) | ||
local pval_index | |||
for k, v in spairs( | if loop_table == nil then | ||
local dmg_name = k .. ' | pval_index = num | ||
loop_table = ftvals | |||
else | |||
pval_index = tonumber(loop_table .. num) | |||
loop_table = pvals[loop_table] | |||
end | |||
for k, v in spairs(loop_table) do | |||
local dmg_name = k .. '_passive' .. num | |||
if ispvp then | if ispvp then | ||
dmg_name = dmg_name:gsub(su, '') .. su | dmg_name = dmg_name:gsub(su, '') .. su | ||
end | end | ||
local dmg_formula = v * | local dmg_formula = v * passives[num][p_index] | ||
pvals[pval_index][dmg_name] = dmg_formula | |||
end | end | ||
end | |||
-- Add passives and combine them. | |||
if inArgs('passive2') then | |||
addPassive(2) | |||
if inArgs('passive3') then addPassive(3, 2) end | |||
end | end | ||
if inArgs('passive1') then | if inArgs('passive1') then | ||
addPassive(1) | |||
if inArgs('passive2') then | if inArgs('passive2') then | ||
addPassive(2, 1) | |||
if inArgs('passive3') then addPassive(3, 12) end | |||
end | end | ||
if inArgs('passive3') then addPassive(3, 1) end | |||
end | |||
end | if inArgs('passive3') then addPassive(3) end | ||
-- Merge all tables into one. | -- Merge all tables into one. | ||
tableMerge(fvals, tvals) | tableMerge(fvals, tvals) | ||
for k, v in spairs(pvals) do | |||
tableMerge(fvals, v) | |||
end | |||
return fvals | return fvals |