forked from MagicBane/Server
More generalized curve helper
This commit is contained in:
@@ -418,6 +418,24 @@ public class WpakPowerManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static float applyCurveToValue(mbEnums.CompoundCurveType curve, float value, int rank) {
|
||||
|
||||
float scaledValue;
|
||||
|
||||
// Method scales by either integer or float values driven by the curve type
|
||||
|
||||
if (EnumSet.of(mbEnums.CompoundCurveType.DefaultFlat, mbEnums.CompoundCurveType.DefaultSlope,
|
||||
mbEnums.CompoundCurveType.DefaultSlopeDown).contains(curve))
|
||||
scaledValue = curve.getValue() + (value * rank);
|
||||
else
|
||||
scaledValue = curve.getValue() * (1 + (value * rank));
|
||||
|
||||
scaledValue = scaledValue * 0.01f;
|
||||
|
||||
return scaledValue;
|
||||
}
|
||||
|
||||
|
||||
public static float applyCurveToModifier(PowerAction powerAction, ModifierEntry modifierEntry, int rank) {
|
||||
|
||||
float scaledValue;
|
||||
@@ -425,10 +443,10 @@ public class WpakPowerManager {
|
||||
// Method scales by either integer or float values driven by the curve type
|
||||
|
||||
if (EnumSet.of(mbEnums.CompoundCurveType.DefaultFlat, mbEnums.CompoundCurveType.DefaultSlope,
|
||||
mbEnums.CompoundCurveType.DefaultSlopeDown).contains(powerAction.rampCurve))
|
||||
scaledValue = powerAction.rampCurve.getValue() + (modifierEntry.compoundCurveType.getValue() * rank);
|
||||
mbEnums.CompoundCurveType.DefaultSlopeDown).contains(powerAction.compoundCurve))
|
||||
scaledValue = powerAction.compoundCurve.getValue() + (modifierEntry.compoundCurveType.getValue() * rank);
|
||||
else
|
||||
scaledValue = powerAction.rampCurve.getValue() * (1 + (modifierEntry.compoundCurveType.getValue() * rank));
|
||||
scaledValue = powerAction.compoundCurve.getValue() * (1 + (modifierEntry.compoundCurveType.getValue() * rank));
|
||||
|
||||
scaledValue = scaledValue * 0.01f;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user