Sorceress

Untitled

Dec 19th, 2015
221
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. You could convert level difference D into a float:
  2.  
  3. Let X = D / (b + abs(D)), where b is some positive constant that determines how significant level difference is to the outcome.
  4.  
  5. While D can range from -inf to +inf, the derived value X will be "smoothly" clamped between -1 and +1. This is easier to make work with probabilities.
  6.  
  7. If the attack outcomes are (miss, graze, normal, critical) then we can assign some probabilities to each outcome at spot values of X:
  8.  
  9. when X=1, then all attacks will be critical: (0, 0, 0, 1)
  10. when X=0.5 then normal attacks are more likely: (0, 0.25, 0.5, 0.25)
  11. when X=0 then attack outcomes are equally likely: (.25, .25, .25, .25)
  12. when X=-0.5 then grazing attacks are more likely: (.25, 0.5, 0.25, 0)
  13. when X=-1 then all attacks will be misses: (1, 0, 0, 0)
  14.  
  15. Between these spot values, we can interpolate the probabilities
RAW Paste Data