-- y_low (optional) = value to match when x = x_low
--returns (limit - add)*x/(x + halfpoint) + add (= add when x = 0 and limit when x = infinity)
-- halfpoint and add are internally computed to match the desired high/low values
-- note that the progression low->high->limit must be monotone, consistently increasing or decreasing
-- y_low = value to match when x = x_low
--returns limit * (1-{a*(x)^0.75+b})
-- (1-(e)^(-x)) ranges from 0 to 1 and can effectively be thought of as giving a percent of limit based on talent level (note that a*(x)^0.75+b will be < 0 for all x)
-- note that the progression low->high->limit must be monotone, consistently increasing or decreasing
-- local x_low, x_high = 1,5 -- Implied talent levels for low and high values respectively
-- local tl = type(t) == "table" and (raw and self:getTalentLevelRaw(t) or self:getTalentLevel(t)) or t
ify_lowandx_lowthen
localp=limit*(x_high-x_low)
localm=x_high*y_high-x_low*y_low
-- local halfpoint = (p-m)/(y_high - y_low)
-- local add = (limit*(x_high*y_low-x_low*y_high) + y_high*y_low*(x_low-x_high))/(p-m)
-- return (limit-add)*x/(x + halfpoint) + add
localah=(limit*(x_high*y_low-x_low*y_high)+y_high*y_low*(x_low-x_high))/(y_high-y_low)-- add*halfpoint product calculated at once to avoid possible divide by zero
return(limit*x+ah)/(x+(p-m)/(y_high-y_low))--factored version of above formula
localx_low,x_high=1,5-- Implied talent levels for low and high values respectively
-- mastery = value used for determining high and low
-- returns limit * (1-exp{a*sqrt(tl)+b})
-- (1-(e)^(-x)) ranges from 0 to 1 and can effectively be thought of as giving a percent of limit based on talent level (note that a*sqrt(tl)+b will be < 0 for all tl)
-- note that the progression low->high->limit must be monotone, consistently increasing or decreasing
-- Compute a diminishing returns value based on a stat value using exponentials that cannot go beyond a limit
-- stat == "str", "con",.... or a numeric value
-- limit = value approached as talent levels increase
-- limit = value approached as stats increase
-- high = value to match when stat = 100
-- low = value to match when stat = 10 (optional)
--returns (limit - add)*stat/(stat + halfpoint) + add == add when STAT = 0 and limit when stat = infinity
-- halfpoint and add are internally computed to match the desired high/low values
-- note that the progression low->high->limit must be monotone, consistently increasing or decreasing
-- low = value to match when stat = 10
--returns limit * (1-exp{a*(stat)^0.75+b})
-- (1-(e)^(-x)) ranges from 0 to 1 and can effectively be thought of as giving a percent of limit based on talent level (note that a*(stat)^0.75+b will be < 0 for all tl)
-- note that the progression low->high->limit must be monotone, consistently increasing or decreasing
function_M:combatStatLimit(stat,limit,low,high)
localx_low,x_high=10,100-- Implied stat levels for low and high values respectively