17,101
edits
Falterfire (talk | contribs) (Added p.buildAstrologyValueTable) |
(buildAstrologyValueTable: Add cumulative chance column) |
||
Line 754: | Line 754: | ||
function p.buildAstrologyValueTable() | function p.buildAstrologyValueTable() | ||
local result = '{|class="wikitable sortable"' | local result = '{|class="wikitable sortable"' | ||
result = result..'\r\n!Value!!Chance' | result = result..'\r\n!rowspan="2"| Value!!colspan="2"| Chance' | ||
result = result..'\r\n|-\r\n! This Value!! This Value or Greater' | |||
local lastChance = 0 | local lastChance = 0 | ||
local cumulativeChance = 100 | |||
for i, chance in Shared.skpairs(SkillData.Astrology.Defaults.valueWeight) do | for i, chance in Shared.skpairs(SkillData.Astrology.Defaults.valueWeight) do | ||
local thisChance = (i == 5 and chance) or chance - lastChance | |||
result = result..'\r\n|-' | result = result..'\r\n|-' | ||
result = result..'\r\n|'..i | result = result..'\r\n|style="text-align:right"| '..i | ||
result = result..'\r\n|style="text-align:right"| ' .. thisChance .. '%' | |||
result = result..'\r\n|style="text-align:right"| ' .. cumulativeChance .. '%' | |||
cumulativeChance = cumulativeChance - thisChance | |||
lastChance = chance | lastChance = chance | ||
end | end |