Level Correction Function and pDIF

The Level Correction function
The Level Correction function is a function which modifies your (r)attack / monster defense ratio beforee passing them to pDIF function. Let's say you have 400 attack/ ranged attack and the monster have 400 defense. So your (r)atk/def ratio is 1. If you the monster has a higher level than you, then level corrected ratio is needed before calculating the pDIF. Otherwise, when fighting EM monster or lower, your atk/def ratio will be left as is before plugging them into the pDIF function.(In other words, level correction value is 0)  For this example, Let's say you are fighting level 81 monster and your own character is a level 75 character. Let Ratio as the value of your (r)atk divided by monster defense Ratio = your (r)atk/monster defense Melee cRatio = Ratio - 0.050 x level difference  Ranged cRatio = Ratio - 0.025 x level difference 

So after the level correction, your melee attack ratio is 0.7 and your ranged attack ratio is 0.85

The min and max value of pDIF is the lower bound and upper bound of damage fluctuation.

pDIF
pDIF is the attack/defense function taking your (level corrected) Attack and Defense ratio and output a randomized number in certain value range.


 * Melee and Ranged pDIF have different formulas :

Melee Attack

 * max pDIF have the formulas :
 * {| border="0" cellpadding="2" cellspacing="2"

! Ratio Range ! BGCOLOR="#FFEFD5" align="left"|Function Value
 * - style="background:#ffdead;" align="left"
 * - style="background:#ffdead;" align="left"
 * 0 &le; cRatio &lt; 6/12
 * BGCOLOR="#FFEFD5" align="left"|fMax(cRatio) = 0.4 + 6/5 x cRatio
 * - style="background:#ffdead;" align="left"
 * 6/12 &le; cRatio &le; 10/12
 * BGCOLOR="#FFEFD5" align="left"|fMax(cRatio) = 1
 * - style="background:#ffdead;" align="left"
 * 10/12 &lt; cRatio &le; 24/12
 * BGCOLOR="#FFEFD5" align="left" |fMax(cRatio) = 1 + 6/5 x (cRatio - 10/12)
 * }


 * and Min pDIF have the formulas :
 * {| border="0" cellpadding="2" cellspacing="2"

! Ratio Range ! BGCOLOR="#FFEFD5" align="left"|Function Value if fMin &lt; 0 &rarr; fMin = 0
 * - style="background:#ffdead;" align="left"
 * - style="background:#ffdead;" align="left"
 * 0 &le; cRatio &lt; 15/12
 * BGCOLOR="#FFEFD5" align="left"|fMin(cRatio) = 6/5 x (cRatio - 5/12)
 * - style="background:#ffdead;" align="left"
 * 15/12 &le; cRatio &le; 18/12
 * BGCOLOR="#FFEFD5" align="left"|fMin(cRatio) = 1
 * - style="background:#ffdead;" align="left"
 * 18/12 &lt; cRatio &le; 24/12
 * BGCOLOR="#FFEFD5" align="left" |fMin(cRatio) = 1 + 6/5 x (cRatio - 18/12)
 * }
 * When cRatio exceeds 2.0, cRatio is 2.0 (capped for melee)
 * Melee Critical Hit
 * When critical hit occurs, your pDIF will be raised by 1 and the max pDIF cap is 3.0 instead of 2.4
 * Examples :
 * When your pDIF is 0.4 and you score a critical hit, your pDIF is raised to 1.4
 * When your pDIF is 2.3 and you score a critical hit, your pDIF is raised to 3.0
 * When your pDIF is -0.4 and you score a critical hit, your pDIF is raised to 0.6, but your normal attack will have pDIF=0



Ranged Attack

 * {| border="0" cellpadding="2" cellspacing="2"

! Ratio Range ! BGCOLOR="#FFEFD5" align="left"|Function Value
 * - style="background:#ffdead;" align="left"
 * - style="background:#ffdead;" align="left"
 * 0 &le; cRatio &lt; 0.9
 * BGCOLOR="#FFEFD5" align="left"|fMax(cRatio) = 10/9 x cRatio
 * - style="background:#ffdead;" align="left"
 * 0.9 &le; cRatio &le; 1.1
 * BGCOLOR="#FFEFD5" align="left"|fMax(cRatio) = 1
 * - style="background:#ffdead;" align="left"
 * 1.1 &lt; cRatio &le; 3.0
 * BGCOLOR="#FFEFD5" align="left" |fMax(cRatio) = 1.1 + (cRatio - 1.1)
 * }


 * {| border="0" cellpadding="2" cellspacing="2"

! Ratio Range ! BGCOLOR="#FFEFD5" align="left"|Function Value
 * - style="background:#ffdead;" align="left"
 * - style="background:#ffdead;" align="left"
 * 0 &le; cRatio &lt; 0.9
 * BGCOLOR="#FFEFD5" align="left"|fMin(cRatio) = cRatio
 * - style="background:#ffdead;" align="left"
 * 0.9 &le; cRatio &le; 1.1
 * BGCOLOR="#FFEFD5" align="left"|fMin(cRatio) = 1
 * - style="background:#ffdead;" align="left"
 * 1.1 &lt; cRatio &le; 3.0
 * BGCOLOR="#FFEFD5" align="left" |fMin(cRatio) = 1 + 20/19 x (cRatio - 1.1)
 * }
 * When cRatio exceeds 3.0, cRatio is 3.0 (capped for ranged)


 * Ranged Critical Hit
 * Ranged critical hit always multiply your pDIF by 1.25
 * Example :
 * When your pDIF is 3.0 and you score a critical hit, your pDIF will be 3.75