[BLEEDING] Partly fix up bunny hop conditions.

Conditions have been warped for some time. Could lead to more false
positives on hdist.
This commit is contained in:
asofold 2015-11-29 14:54:24 +01:00
parent 2e11cdac0b
commit 1053c21e56
2 changed files with 21 additions and 11 deletions

View File

@ -800,7 +800,7 @@ public class SurvivalFly extends Check {
strictVdistRel = false;
}
else if (data.lastYDist != Double.MAX_VALUE) {
if (data.lastYDist >= -GRAVITY_MAX / 2.0 && data.lastYDist <= 0.0 && data.fromWasReset) {
if (data.lastYDist >= -Math.max(GRAVITY_MAX / 2.0, 1.3 * Math.abs(yDistance)) && data.lastYDist <= 0.0 && data.fromWasReset) {
if (resetTo) { // TODO: Might have to use max if resetto.
vAllowedDistance = cc.sfStepHeight;
}
@ -1531,7 +1531,7 @@ public class SurvivalFly extends Check {
// Allow hop for special cases.
if (!allowHop && (from.isOnGround() || data.noFallAssumeGround)) {
if (data.bunnyhopDelay <= 6 || from.isHeadObstructed() || to.isHeadObstructed()) {
if (data.bunnyhopDelay <= 6 || yDistance >= 0.0 && from.isHeadObstructed() || to.isHeadObstructed()) {
// TODO: headObstructed: check always and set a flag in data + consider regain buffer?
tags.add("ediblebunny");
allowHop = true;
@ -1550,17 +1550,17 @@ public class SurvivalFly extends Check {
// TODO: Allow slightly higher speed on lost ground?
// TODO: LiftOffEnvelope.allowBunny ?
if (data.liftOffEnvelope == LiftOffEnvelope.NORMAL
&& !data.sfLowJump || data.sfNoLowJump
&& (!data.sfLowJump || data.sfNoLowJump)
// Y-distance envelope.
&& (
yDistance > 0.0
&& yDistance > data.liftOffEnvelope.getMaxJumpGain(data.jumpAmplifier) - GRAVITY_SPAN
|| yDistance > 0.0 && from.isHeadObstructed()
|| cc.sfGroundHop && yDistance >= 0
&& yDistance > data.liftOffEnvelope.getMinJumpGain(data.jumpAmplifier) - GRAVITY_SPAN
|| yDistance > 0.0 && from.isHeadObstructed(yDistance + from.getyOnGround())
|| (cc.sfGroundHop && yDistance >= 0 || yDistance == 0.0 && !data.fromWasReset) // TODO: (2nd) demand try next jump.
&& hAllowedDistance > 0.0 && hDistance / hAllowedDistance < 1.35
)
// Bad auto indent.
&& (data.sfJumpPhase == 0 && from.isOnGround() || data.sfJumpPhase <= 1 && data.noFallAssumeGround || double_bunny)
&& (data.sfJumpPhase == 0 && from.isOnGround() || data.sfJumpPhase <= 1 && (data.noFallAssumeGround || data.fromWasReset) || double_bunny)
&& !from.isResetCond() && !to.isResetCond() // TODO: !to.isResetCond() should be reviewed.
) {
// TODO: Jump effect might allow more strictness.

View File

@ -33,19 +33,30 @@ public enum LiftOffEnvelope {
this.jumpEffectApplies = jumpEffectApplies;
}
/**
* Minimal distance expected with lift-off.
* @param jumpAmplifier
* @return
*/
public double getMinJumpGain(double jumpAmplifier) {
if (jumpEffectApplies && jumpAmplifier != 0.0) {
return Math.max(0.0, maxJumpGain + 0.1 * jumpAmplifier);
}
else {
return maxJumpGain;
}
}
public double getMaxJumpGain(double jumpAmplifier) {
// TODO: Count in effect level.
if (jumpEffectApplies && jumpAmplifier != 0.0) {
return Math.max(0.0, maxJumpGain + 0.2 * jumpAmplifier);
}
else {
return maxJumpGain;
}
}
public double getMaxJumpHeight(double jumpAmplifier) {
// TODO: Count in effect level.
if (jumpEffectApplies && jumpAmplifier > 0.0) {
// Note: The jumpAmplifier value is one higher than the MC level.
if (jumpAmplifier < 10.0) {
@ -61,7 +72,6 @@ public enum LiftOffEnvelope {
// Quadratic, with some amount of gravity counted in.
return 0.6 + (jumpAmplifier + 3.2) * (jumpAmplifier + 3.2) / 16.0 - (jumpAmplifier * (jumpAmplifier - 1.0) / 2.0) * (0.0625 / 2.0);
}
} // TODO: < 0.0 ?
else {
return maxJumpHeight;