Let target switching only count with significant yaw changes.

This commit is contained in:
asofold 2015-05-31 20:33:13 +02:00
parent 35a9171934
commit 70ce2086ab
2 changed files with 9 additions and 4 deletions

View File

@ -21,6 +21,7 @@ public class Angle extends Check {
public static class AttackLocation { public static class AttackLocation {
public final double x, y, z; public final double x, y, z;
/** Yaw of the attacker. */
public final float yaw; public final float yaw;
public long time; public long time;
public final UUID damagedId; public final UUID damagedId;
@ -104,16 +105,20 @@ public class Angle extends Check {
continue; continue;
} }
deltaMove += refLoc.distSqLast; deltaMove += refLoc.distSqLast;
deltaYaw += Math.abs(refLoc.yawDiffLast); final double yawDiff = Math.abs(refLoc.yawDiffLast);
deltaYaw += yawDiff;
deltaTime += refLoc.timeDiff; deltaTime += refLoc.timeDiff;
deltaSwitchTarget += refLoc.idDiffLast ? 1 : 0; if (refLoc.idDiffLast && yawDiff > 30.0) {
// TODO: Configurable sensitivity ? Scale with yawDiff?
deltaSwitchTarget += 1;
}
} }
// Check if there is enough data present. // Check if there is enough data present.
if (data.angleHits.size() < 2) { if (data.angleHits.size() < 2) {
return false; return false;
} }
final double n = (double) (data.angleHits.size() - 1); final double n = (double) (data.angleHits.size() - 1);
// Let's calculate the average move. // Let's calculate the average move.

View File

@ -115,7 +115,7 @@ public class FightConfig extends ACheckConfig {
public final boolean yawRateCheck; public final boolean yawRateCheck;
public final boolean cancelDead; public final boolean cancelDead;
public final boolean knockBackVelocityPvP; public final boolean knockBackVelocityPvP;
/** Maximum latency counted in ticks for the loop checks (reach, direction). */ /** Maximum latency counted in ticks for the loop checks (reach, direction). */
public final long loopMaxLatencyTicks = 15; // TODO: Configurable, sections for players and entities. public final long loopMaxLatencyTicks = 15; // TODO: Configurable, sections for players and entities.