Class LinearScaling
java.lang.Object
io.artificial.enchantments.api.scaling.LinearScaling
- All Implemented Interfaces:
LevelScaling
Linear scaling algorithm: base + (level - 1) * increment.
This is the most common scaling pattern, used by vanilla enchantments like Sharpness. Each level adds a constant amount to the base value.
Formula: value = base + (level - 1) * increment
Example: Sharpness adds 0.5 damage per level, starting at 1.0 for level 1: base=1.0, increment=0.5 produces values 1.0, 1.5, 2.0, 2.5, etc.
- Since:
- 0.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionLinearScaling(double base, double increment) Creates a new linear scaling with the specified base and increment. -
Method Summary
-
Constructor Details
-
LinearScaling
public LinearScaling(double base, double increment) Creates a new linear scaling with the specified base and increment.- Parameters:
base- the value at level 1increment- the amount added per additional level
-
-
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
-
getIncrement
public double getIncrement()Gets the increment added per level.- Returns:
- the increment value
- Since:
- 0.1.0
-
toString
-