Acrobatics: cap same-location fall counter for XP gain

It used to increase boundlessly, thus preventing players from gaining XP for a while even after moving to another place.
This commit is contained in:
Ivo Julca 2014-09-26 05:42:54 -05:00 committed by TfT_02
parent ec1a125809
commit 958c116fd0

View File

@ -142,13 +142,14 @@ public class AcrobaticsManager extends SkillManager {
} }
Location fallLocation = player.getLocation(); Location fallLocation = player.getLocation();
int maxTries = Config.getInstance().getAcrobaticsAFKMaxTries();
boolean sameLocation = (lastFallLocation != null && Misc.isNear(lastFallLocation, fallLocation, 2)); boolean sameLocation = (lastFallLocation != null && Misc.isNear(lastFallLocation, fallLocation, 2));
fallTries = sameLocation ? fallTries + 1 : Math.max(fallTries - 1, 0); fallTries = sameLocation ? Math.min(fallTries + 1, maxTries) : Math.max(fallTries - 1, 0);
lastFallLocation = fallLocation; lastFallLocation = fallLocation;
return fallTries > Config.getInstance().getAcrobaticsAFKMaxTries(); return fallTries >= maxTries;
} }
private boolean isFatal(double damage) { private boolean isFatal(double damage) {