Files
2009scape/Server/src/main/content/data/consumables/effects/RestoreEffect.java
T
Ceikry a100affda2 Repository reorganisation
Unified kotlin and java into just src/main
Unified the rs09 and core packages
Took all content out of the core package, and placed it into the new content package
Reorganised all source code relating to content to be easier to find and explore
2023-01-26 13:59:28 +00:00

27 lines
880 B
Java

package content.data.consumables.effects;
import core.game.node.entity.player.Player;
import core.game.consumable.ConsumableEffect;
import core.game.node.entity.skill.Skills;
public class RestoreEffect extends ConsumableEffect {
double base,bonus;
public RestoreEffect(double base, double bonus){
this.base = base;
this.bonus = bonus;
}
final int[] SKILLS = new int[] { Skills.DEFENCE, Skills.ATTACK, Skills.STRENGTH, Skills.MAGIC, Skills.RANGE };
@Override
public void activate(Player p) {
Skills sk = p.getSkills();
for(int skill : SKILLS){
int statL = sk.getStaticLevel(skill);
int curL = sk.getLevel(skill);
if(curL < statL){
int boost = (int) (base + (statL * bonus));
p.getSkills().updateLevel(skill, boost, statL);
}
}
}
}