From 048cada0c7cdfa4caae085a6b2c2a178949a8960 Mon Sep 17 00:00:00 2001 From: asofold Date: Thu, 29 Aug 2013 21:33:29 +0200 Subject: [PATCH] Change buffer amount to positive. --- .../nocheatplus/checks/moving/SurvivalFly.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java index b20049dc..9dce551a 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java @@ -245,11 +245,6 @@ public class SurvivalFly extends Check { } } } - - // Finally check horizontal buffer regain. - if (hDistanceAboveLimit < 0.0 && hDistance > 0.0 && data.sfHorizontalBuffer < hBufMax) { - hBufRegain(hDistance, hDistanceAboveLimit, data); - } ////////////////////////// // Vertical move. @@ -387,6 +382,12 @@ public class SurvivalFly extends Check { if (now - data.sfVLTime > cc.survivalFlyVLFreeze) { data.survivalFlyVL *= 0.95D; } + + // Finally check horizontal buffer regain. + if (hDistanceAboveLimit < 0.0 && result <= 0.0 && hDistance > 0.0 && data.sfHorizontalBuffer < hBufMax) { + // TODO: max min other conditions ? + hBufRegain(hDistance, Math.min(0.1, Math.abs(hDistanceAboveLimit)), data); + } } // Set data for normal move or violation without cancel (cancel would have returned above) @@ -929,10 +930,10 @@ public class SurvivalFly extends Check { /** * Legitimate move: increase horizontal buffer somehow. * @param hDistance - * @param hDistanceAboveLimit + * @param amount Positive amount. * @param data */ - private void hBufRegain(final double hDistance, final double hDistanceAboveLimit, final MovingData data){ + private void hBufRegain(final double hDistance, final double amount, final MovingData data){ /* * TODO: Consider different concepts: * - full resetting with harder conditions. @@ -940,7 +941,7 @@ public class SurvivalFly extends Check { * - reset or regain only every x blocks h distance. */ // TODO: Confine general conditions for buffer regain further (regain in air, whatever)? - data.sfHorizontalBuffer = Math.min(hBufMax, data.sfHorizontalBuffer - hDistanceAboveLimit); + data.sfHorizontalBuffer = Math.min(hBufMax, data.sfHorizontalBuffer + amount); } /**