Skip to content
Snippets Groups Projects
Commit ad034f8a authored by dg's avatar dg
Browse files

Changed the checkhit method to make low and high results more significant

git-svn-id: http://svn.net-core.org/repos/t-engine4@2964 51575b47-30f0-44d4-a5cc-537603b46e54
parent 05af7f2e
No related branches found
No related tags found
No related merge requests found
......@@ -186,13 +186,12 @@ function _M:checkHit(atk, def, min, max, factor)
if atk == 0 then atk = 1 end
local hit = nil
factor = factor or 5
if atk > def then
local d = atk - def
hit = math.log10(1 + 5 * d / 50) * 100 + 50
else
local d = def - atk
hit = -math.log10(1 + 5 * d / 50) * 100 + 50
end
local one = 1 / (1 + math.exp(-(atk - def) / 7))
local two = 0
if atk + def ~= 0 then two = atk / (atk + def) end
hit = 50 * (one + two)
hit = util.bound(hit, min or 5, max or 95)
print("=> chance to hit", hit)
return rng.percent(hit), hit
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment