new durationFactor function
Posted: Tue Mar 29, 2011 12:01 am
Proposal: throw out specific effect resistances on items (stun, confuse, etc.) and revamp the saves system. When an effect is applied, a formula similar to the one in checkHit compares the applicable numbers for the attacker and defender and returns a number from 0 to 2. The duration of the effect is then multiplied by this number and floored, so that it's still possible to completely avoid any ill effects, though more difficult than before.
Here's the proposed formula, inspired by the new checkHit:
Here's the proposed formula, inspired by the new checkHit:
Code: Select all
function _M:durationFactor(atk, def, min, max)
if atk == 0 then atk = 1 end
local factor = nil
local one = 1 / (1 + math.exp(-(atk - def) / 7))
local two = 0
if atk + def ~= 0 then two = atk / (atk + def) end
factor = one + two
factor = util.bound(factor, min or 0, max or 2)
return factor
end