Jump to content
Sign in to follow this  
CononC

White hit calculation bugged in the source code? 4% off mark? Please check and confirm!

Recommended Posts

Yo!

 

Making a new post with almost the same content. Please check the source code at

https://github.com/elysium-project/server/blob/master/src/game/Objects/Unit.cpp#L3056

the equation there for normal white hits is

missChance -= (skillDiff + 10) * 0.4f - 2.0f;

when skillDiff < -10.

And if we calculate with this..


skill    def        skilldiff    normal miss
290    315        -25        9
291    315        -24        8,6
292    315        -23        8,2
293    315        -22        7,8
294    315        -21        7,4
295    315        -20        7
296    315        -19        6,6
297    315        -18        6,2
298    315        -17        5,8
299    315        -16        5,4
300    315        -15        5
301    315        -14        4,6
302    315        -13        4,2
303    315        -12        3,8
304    315        -11        3,4
305    315        -10        6
306    315        -9        5,9
307    315        -8        5,8
308    315        -7        5,7
309    315        -6        5,6
310    315        -5        5,5
311    315        -4        5,4
312    315        -3        5,3
313    315        -2        5,2
314    315        -1        5,1
315    315        0        5

 

it seems that the equation is bit bugged, giving a 4% leeway for ppl under weapon skill 305. If this is the case, the equation should read

missChance -= (skillDiff + 10) * 0.4f + 2.0f;

instead. Sorry to rain on everyone's parade :D please doublecheck this for me, I couldn't sleep because something was bothering me... maybe it was this 8)

best regards
Cononchet, tauren warrior of Anathema

Share this post


Link to post
Share on other sites

No, the formula in code is correct.

missChance -= (skillDiff + 10) * 0.4f - 2.0f

is equivalent to:

missChance = missChance - ((skillDiff + 10) * 0.4f - 2.0f)

For example:

weapon skill = 300

mob def = 315

skillDiff = weapon skill - mob def = -15

missChance = 5 - ((skillDiff + 10) * 0.4 - 2) = 5 - ((-15 + 10) * 0.4 - 2) = 5 - (-5 * 0.4 - 2) = 5 + 2 + 2 = 9

 

Share this post


Link to post
Share on other sites

Yay! Thanks, I forgot that the -= operator has the whole calculation on the right-hand side done first before subtracting, so I ran a test of 

for (i in -25:0) {
miss <- 5
if (i < -10) {miss <- miss - (i + 10) * 0.4 - 2.0}
else {miss <- miss - i*0.1}
print(miss)}

instead, phew 8) glad to be wrong in this case!

Cononchet

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×