More generalized curve helper

This commit is contained in:
2025-02-22 15:23:15 -05:00
parent 1a64272801
commit 5277fbbe56
6 changed files with 29 additions and 13 deletions
+21 -3
View File
@@ -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;