Class AdditiveModifier
java.lang.Object
de.Keyle.MyPet.api.skill.experience.modifier.ExperienceModifier
de.Keyle.MyPet.api.skill.experience.modifier.AdditiveModifier
An experience modifier that adds a fixed amount to the incoming experience value.
The modifier value defaults to 0 (no change). Positive values increase experience;
negative values decrease it.
Example: if a mob kill yields 10 XP and this modifier is set to 5, the result
passed to the next modifier in the chain will be 15.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an additive modifier with a bonus of0(no-op).AdditiveModifier(double modifier) Creates an additive modifier with the specified bonus. -
Method Summary
Modifier and TypeMethodDescriptiondoubleThe amount added to the incoming experience.doublemodify(double experience, double baseExperience) Applies this modifier to the given experience value.voidsetModifier(double modifier) The amount added to the incoming experience.
-
Constructor Details
-
AdditiveModifier
public AdditiveModifier(double modifier) Creates an additive modifier with the specified bonus.- Parameters:
modifier- the flat amount to add (can be negative to subtract)
-
AdditiveModifier
public AdditiveModifier()Creates an additive modifier with a bonus of0(no-op).
-
-
Method Details
-
modify
public double modify(double experience, double baseExperience) Applies this modifier to the given experience value. Adds the configured flat modifier value to the experience.- Specified by:
modifyin classExperienceModifier- Parameters:
experience- the experience value as modified by prior modifiers in the chainbaseExperience- the original unmodified experience from the mob kill- Returns:
- the modified experience value to pass to the next modifier (or to award)
-
setModifier
public void setModifier(double modifier) The amount added to the incoming experience.- Parameters:
modifier- the new value
-
getModifier
public double getModifier()The amount added to the incoming experience.- Returns:
- the current value
-