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
+4 -6
View File
@@ -20,25 +20,23 @@ public class Behaviours {
public static Object Flag(AbstractCharacter caster, Power power, Integer rank, AbstractWorldObject target,
PowerAction powerAction, Effect effect, ModifierEntry modifierEntry) {
boolean modValue = true;
return modValue;
return true;
}
public static Object MapIntToInts(AbstractCharacter caster, Power power, Integer rank, AbstractWorldObject target,
PowerAction powerAction, Effect effect, ModifierEntry modifierEntry) {
return powerAction.attackAnimations.clone();
}
public static Object Standard(AbstractCharacter caster, Power power, Integer rank, AbstractWorldObject target,
PowerAction powerAction, Effect effect, ModifierEntry modifierEntry) {
return WpakPowerManager.applyCurveToModifier(powerAction, modifierEntry, rank);
return WpakPowerManager.applyCurveToValue(powerAction.compoundCurve, modifierEntry.compoundCurveType.getValue(), rank);
}
public static Object FPSubTypeAttr(AbstractCharacter caster, Power power, Integer rank, AbstractWorldObject target,
PowerAction powerAction, Effect effect, ModifierEntry modifierEntry) {
return WpakPowerManager.applyCurveToModifier(powerAction, modifierEntry, rank);
return WpakPowerManager.applyCurveToValue(powerAction.compoundCurve, modifierEntry.compoundCurveType.getValue(), rank);
}
public static Object SubTypeSourceType(AbstractCharacter caster, Power power, Integer rank, AbstractWorldObject target,
@@ -60,7 +58,7 @@ public class Behaviours {
public static Object FPSubTypeDmg(AbstractCharacter caster, Power power, Integer rank, AbstractWorldObject target,
PowerAction powerAction, Effect effect, ModifierEntry modifierEntry) {
String key = modifierEntry.arg1;
float value = WpakPowerManager.applyCurveToModifier(powerAction, modifierEntry, rank);
float value = WpakPowerManager.applyCurveToValue(powerAction.compoundCurve, modifierEntry.compoundCurveType.getValue(), rank);
return new Pair<>(key,value);
}
+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;