Originally Posted by
Motenten
Yes, you got the right constants (though I've played around with +/-1 for the 152 and 755 values). Everything in your table is correct, though I usually express it in calculation limits rather than input limits.
No, I haven't made more progress on this. pchan had some interesting ideas in his posts in the official forum, but they were incomplete, insufficient for a full model. I'll see if I can get some time tonight to poke at the numbers again.
My model is complete and modelize everything accurately.... I'll refer you to the wiki page on pdif.
I'll summerize it here.
given a cratio r, the game computes a and b, the min and max pdif (not the ingame ones). It rolls a uniform variable on [a,b]. There is a bernouilli variable whose parmeter is only dependent on r that makes your damage equal to either the uniform variable or 1 (which rolls your weapons damage, hence the spike), then everything is multiplied by the "randomizer" and the usual stuff (damage..). In other words the game returns
( 1*U+(1-U)*V)*W where
V=uniform on [a,b], U=bernouilli of parameter p=5/6-(b-a), W=uniform on [1,1.05]
More precisely
a(r)=1+(10/9)x(p(max(r,0.5)-1.5)-n(max(r,0.5)-1.25))
b(r)=1+(10/9)x(p(r-0.75)-n(r-0.5))
are the formulas defining max and min pdif with p(x)=max(x,0) and n(x)=max(-x,0) which gives
for b
Code:
Ratio Range 'r' Function Value Observed maximum
0 ≤ r < 0.5 b= 1+(10/9)x(r-0.5) 0.467+1.167xr
0.5 ≤ r ≤ 3/4 b= 1 1.05
3/4 < r ≤ 2 b = 1 +(10/9)x(r-3/4) b=0.175+1.167xr
for a
Code:
Ratio Range Function Value
r ≤ 0.5 a = 1/6
0.5 ≤ r < 1.25 a= 1 + (10/9)x(r-1.25)
1.25 ≤ r ≤ 1.5 a = 1
1.5 < r ≤ 2 a= 1 + (10/9)x(r-1.5)
a is always the the observed value while b must be multiplied by 1.05.
Given those values of a and b, you can define the value of the paramater p of the bernouilli variable
p=5/6 - (b'-a')
generally b'=b and a'=a except for r<0.5 where is set to 0.
From a programing point of view, this is easily done ;
Code:
if rand[0..1] < p then return rand[1,1.05]
else return rand[a,b]*rand(1,1.05)
end if;
This model gives accurate average values
Code:
r ≤ 0.5 m = .2182870370+.3796296294*r+.7592592591*r^2
0.5 ≤ r < 0.75 m=-.0822530866+1.676697531*r-.6327160494*r^2
0.75 ≤ r ≤ 1.25 m = .2024691355+.8225308644*r
1.25 < r ≤ 1.5 m=1.309722223-.8541666666*r+.6327160494*r^2
1.5 < r ≤ 2 m=-.2562500002+1.138888889*r
( 1 handed weapons only)
PS : even though I did not test it, for crits it's probably the same except a is replaced by a+1 and b by b+1, in which case a crit has no spike at pdif=1 and ends up being
min(1+V,3)*W with the above notations (V uniform on [a,b], W uniform on [1,1.05]).
In a program it simply reads
Code:
min(1+rand[a,b],3)*rand(1,1.05)