new durationFactor function

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
Susramanian
Spiderkin
Posts: 454
Joined: Sat May 15, 2010 3:09 am

new durationFactor function

#1 Post by Susramanian »

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:

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

Post Reply