8,290
edits
imported>Ontoclasm mNo edit summary |
(turns out these values also need to be rounded for character stats... tried making a few adjustments.) |
||
Line 1: | Line 1: | ||
require 'math' | |||
local Dice = require'Module:Dice' | local Dice = require'Module:Dice' | ||
Line 19: | Line 20: | ||
local range = dice:range() * mult | local range = dice:range() * mult | ||
local variance = dice:variance() * mult | local variance = dice:variance() * mult | ||
-- For character stats which have a multiplier, the game rounds up to the | |||
-- nearest integer; this also affects the calculated average. These values | |||
-- are used by Template:Character/Attribute and /DetailedAttribute. | |||
local maximum_ceil = math.floor(maximum + 0.5) | |||
local minimum_ceil = math.floor(minimum + 0.5) | |||
local ceil_based_average = (maximum_ceil + minimum_ceil) / 2.0 | |||
local ceil_based_average_truncated = ('%d'):format(ceil_based_average) | |||
return frame:expandTemplate{ | return frame:expandTemplate{ | ||
Line 29: | Line 38: | ||
range = range, | range = range, | ||
variance = variance, | variance = variance, | ||
maximum_ceil = maximum_ceil, | |||
minimum_ceil = minimum_ceil, | |||
ceil_based_average = ceil_based_average, | |||
ceil_based_average_truncated = ceil_based_average_truncated, | |||
-- for backwards compatibility | -- for backwards compatibility |