mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-01-03 06:37:47 +01:00
Fixed min/max for stat formulas
This commit is contained in:
parent
ff6252e419
commit
f027111ee5
@ -98,8 +98,8 @@ public class NumericStatFormula implements RandomStatData<DoubleData>, Updatable
|
||||
hasMin = config.contains("min");
|
||||
hasMax = config.contains("max");
|
||||
uniform = !config.contains("spread") && !config.contains("scale") && !config.contains("base") && hasMin && hasMax;
|
||||
min = config.getDouble("min");
|
||||
max = config.getDouble("max");
|
||||
min = hasMin ? config.getDouble("min") : 0;
|
||||
max = hasMax ? config.getDouble("max") : 0;
|
||||
}
|
||||
|
||||
// Error
|
||||
@ -168,7 +168,7 @@ public class NumericStatFormula implements RandomStatData<DoubleData>, Updatable
|
||||
|
||||
/**
|
||||
* @return When the item has a certain level or tier, this is how much each level shifts
|
||||
* the peak, so that it is centered at {@code base + scale*level}
|
||||
* the peak, so that it is centered at {@code base + scale*level}
|
||||
* @see #getBase()
|
||||
*/
|
||||
public double getScale() {
|
||||
@ -184,15 +184,15 @@ public class NumericStatFormula implements RandomStatData<DoubleData>, Updatable
|
||||
|
||||
/**
|
||||
* @return For gaussian distributions, there always is that INSANELY SMALL
|
||||
* chance of getting an INSANELY LARGE number.
|
||||
* <p>
|
||||
* For example: At base atk dmg 10, and standard deviation 1:
|
||||
* <p>68% of rolls will fall between 9 and 11;
|
||||
* </p>95% of rolls will fall between 8 and 12;
|
||||
* <p>99.7% of rolls will fall between 7 and 13;
|
||||
* </p>10E-42 of a roll that will give you an epic 300 dmg sword
|
||||
* <p></p>
|
||||
* Whatever, this constrains to a minimum and maximum of output.
|
||||
* chance of getting an INSANELY LARGE number.
|
||||
* <p>
|
||||
* For example: At base atk dmg 10, and standard deviation 1:
|
||||
* <p>68% of rolls will fall between 9 and 11;
|
||||
* </p>95% of rolls will fall between 8 and 12;
|
||||
* <p>99.7% of rolls will fall between 7 and 13;
|
||||
* </p>10E-42 of a roll that will give you an epic 300 dmg sword
|
||||
* <p></p>
|
||||
* Whatever, this constrains to a minimum and maximum of output.
|
||||
*/
|
||||
public double getMaxSpread() {
|
||||
return maxSpread;
|
||||
@ -227,15 +227,15 @@ public class NumericStatFormula implements RandomStatData<DoubleData>, Updatable
|
||||
* the formula is <code>base + (scale*level)</code>.
|
||||
* This is the <code>level</code>
|
||||
* @return <b>Legacy formula: ???</b><br>
|
||||
* Let A = {base} + {scale} * lvl, then the returned value is a
|
||||
* random value taken in respect to a gaussian distribution
|
||||
* centered on A, with average spread of {spread}%, and with a
|
||||
* maximum offset of {maxSpread}% (relative to average value)
|
||||
* <p></p>
|
||||
* <b>Formula: Spread = Standard Deviation</b>
|
||||
* The mean, the peak is located at <code>{base} + {scale}*lvl</code>. <br>
|
||||
* The 'spread' is the standard deviation of the distribution. <br>
|
||||
* 'Max Spread' constrains the result of this operation at <code>{mean}±{max spread}</code>
|
||||
* Let A = {base} + {scale} * lvl, then the returned value is a
|
||||
* random value taken in respect to a gaussian distribution
|
||||
* centered on A, with average spread of {spread}%, and with a
|
||||
* maximum offset of {maxSpread}% (relative to average value)
|
||||
* <p></p>
|
||||
* <b>Formula: Spread = Standard Deviation</b>
|
||||
* The mean, the peak is located at <code>{base} + {scale}*lvl</code>. <br>
|
||||
* The 'spread' is the standard deviation of the distribution. <br>
|
||||
* 'Max Spread' constrains the result of this operation at <code>{mean}±{max spread}</code>
|
||||
*/
|
||||
public double calculate(double levelScalingFactor) {
|
||||
|
||||
@ -269,7 +269,7 @@ public class NumericStatFormula implements RandomStatData<DoubleData>, Updatable
|
||||
|
||||
value = RELATIVE_SPREAD ? actualBase * (1 + spreadCoef) : actualBase + spreadCoef;
|
||||
if (hasMin) value = Math.max(min, value);
|
||||
if (hasMax) value = Math.max(max, value);
|
||||
if (hasMax) value = Math.min(max, value);
|
||||
}
|
||||
|
||||
return value;
|
||||
|
Loading…
Reference in New Issue
Block a user