Class ExponentialScaling
java.lang.Object
io.artificial.enchantments.api.scaling.ExponentialScaling
- All Implemented Interfaces:
LevelScaling
Exponential scaling algorithm: base * multiplier^(level - 1).
This scaling pattern produces values that grow by a percentage each level, rather than by a constant amount. Use with caution at high levels as values can grow rapidly and may become unbalanced.
Formula: value = base * multiplier^(level - 1)
Example: A multiplier of 1.2 means each level is 20% stronger than the previous: base=1.0, multiplier=1.2 produces values 1.0, 1.2, 1.44, 1.73, etc.
- Since:
- 0.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionExponentialScaling(double base, double multiplier) Creates a new exponential scaling with the specified base and multiplier. -
Method Summary
-
Constructor Details
-
ExponentialScaling
public ExponentialScaling(double base, double multiplier) Creates a new exponential scaling with the specified base and multiplier.- Parameters:
base- the value at level 1multiplier- the growth factor per level (must be positive, 1.0 = no growth)- Throws:
IllegalArgumentException- if multiplier is not positive
-
-
Method Details
-
calculate
public double calculate(int level) Description copied from interface:LevelScalingCalculates the scaled value for a given enchantment level.- Specified by:
calculatein interfaceLevelScaling- Parameters:
level- the enchantment level (>= 1)- Returns:
- the calculated value
-
getBase
public double getBase()Gets the base value at level 1.- Returns:
- the base value
- Since:
- 0.1.0
-
getMultiplier
public double getMultiplier()Gets the multiplier applied per level.- Returns:
- the multiplier value
- Since:
- 0.1.0
-
toString
-