diff --git a/pom.xml b/pom.xml index 92bb0f5..f5b3720 100644 --- a/pom.xml +++ b/pom.xml @@ -30,9 +30,13 @@ - 1.8 + 1.8 + 1.8 + ${java.version.source} + ${java.version.target} UTF-8 UTF-8 + 2.0.2 @@ -57,13 +61,13 @@ org.powermock powermock-module-junit4 - 1.7.4 + ${powermock.version} test org.powermock - powermock-api-mockito - 1.7.4 + powermock-api-mockito2 + ${powermock.version} test @@ -75,8 +79,8 @@ maven-compiler-plugin 2.3.2 - ${java.version} - ${java.version} + ${java.version.source} + ${java.version.target} diff --git a/src/main/java/com/github/joonasvali/naturalmouse/support/DefaultSpeedManager.java b/src/main/java/com/github/joonasvali/naturalmouse/support/DefaultSpeedManager.java index 123e2d3..b1e6b97 100644 --- a/src/main/java/com/github/joonasvali/naturalmouse/support/DefaultSpeedManager.java +++ b/src/main/java/com/github/joonasvali/naturalmouse/support/DefaultSpeedManager.java @@ -25,6 +25,7 @@ public DefaultSpeedManager() { new Flow(FlowTemplates.interruptedFlow2()), new Flow(FlowTemplates.slowStartupFlow()), new Flow(FlowTemplates.slowStartup2Flow()), + new Flow(FlowTemplates.adjustingFlow()), new Flow(FlowTemplates.jaggedFlow()), new Flow(FlowTemplates.stoppingFlow()) )); diff --git a/src/main/java/com/github/joonasvali/naturalmouse/util/FactoryTemplates.java b/src/main/java/com/github/joonasvali/naturalmouse/util/FactoryTemplates.java index 42789f8..5e20e9a 100644 --- a/src/main/java/com/github/joonasvali/naturalmouse/util/FactoryTemplates.java +++ b/src/main/java/com/github/joonasvali/naturalmouse/util/FactoryTemplates.java @@ -34,12 +34,14 @@ public static MouseMotionFactory createGrannyMotionFactory() { */ public static MouseMotionFactory createGrannyMotionFactory(MouseMotionNature nature) { MouseMotionFactory factory = new MouseMotionFactory(nature); - List flows = new ArrayList<>(); - flows.add(new Flow(FlowTemplates.jaggedFlow())); - flows.add(new Flow(FlowTemplates.random())); - flows.add(new Flow(FlowTemplates.interruptedFlow())); - flows.add(new Flow(FlowTemplates.interruptedFlow2())); - flows.add(new Flow(FlowTemplates.stoppingFlow())); + List flows = new ArrayList<>(Arrays.asList( + new Flow(FlowTemplates.jaggedFlow()), + new Flow(FlowTemplates.random()), + new Flow(FlowTemplates.interruptedFlow()), + new Flow(FlowTemplates.interruptedFlow2()), + new Flow(FlowTemplates.adjustingFlow()), + new Flow(FlowTemplates.stoppingFlow()) + )); DefaultSpeedManager manager = new DefaultSpeedManager(flows); factory.setDeviationProvider(new SinusoidalDeviationProvider(9)); factory.setNoiseProvider(new DefaultNoiseProvider(1.6)); @@ -116,6 +118,7 @@ public static MouseMotionFactory createFastGamerMotionFactory(MouseMotionNature new Flow(FlowTemplates.variatingFlow()), new Flow(FlowTemplates.slowStartupFlow()), new Flow(FlowTemplates.slowStartup2Flow()), + new Flow(FlowTemplates.adjustingFlow()), new Flow(FlowTemplates.jaggedFlow()) )); DefaultSpeedManager manager = new DefaultSpeedManager(flows); @@ -149,19 +152,20 @@ public static MouseMotionFactory createAverageComputerUserMotionFactory() { public static MouseMotionFactory createAverageComputerUserMotionFactory(MouseMotionNature nature) { MouseMotionFactory factory = new MouseMotionFactory(nature); List flows = new ArrayList<>(Arrays.asList( - new Flow(FlowTemplates.constantSpeed()), new Flow(FlowTemplates.variatingFlow()), new Flow(FlowTemplates.interruptedFlow()), new Flow(FlowTemplates.interruptedFlow2()), new Flow(FlowTemplates.slowStartupFlow()), new Flow(FlowTemplates.slowStartup2Flow()), + new Flow(FlowTemplates.adjustingFlow()), new Flow(FlowTemplates.jaggedFlow()), new Flow(FlowTemplates.stoppingFlow()) )); DefaultSpeedManager manager = new DefaultSpeedManager(flows); factory.setDeviationProvider(new SinusoidalDeviationProvider(SinusoidalDeviationProvider.DEFAULT_SLOPE_DIVIDER)); factory.setNoiseProvider(new DefaultNoiseProvider(DefaultNoiseProvider.DEFAULT_NOISINESS_DIVIDER)); - manager.setMouseMovementBaseTimeMs(450); + factory.getNature().setReactionTimeVariationMs(110); + manager.setMouseMovementBaseTimeMs(400); DefaultOvershootManager overshootManager = (DefaultOvershootManager) factory.getOvershootManager(); overshootManager.setOvershoots(4); diff --git a/src/main/java/com/github/joonasvali/naturalmouse/util/FlowTemplates.java b/src/main/java/com/github/joonasvali/naturalmouse/util/FlowTemplates.java index 954a484..354c133 100644 --- a/src/main/java/com/github/joonasvali/naturalmouse/util/FlowTemplates.java +++ b/src/main/java/com/github/joonasvali/naturalmouse/util/FlowTemplates.java @@ -75,6 +75,14 @@ public static double[] stoppingFlow() { }; } + public static double[] adjustingFlow() { + return new double[] { + 1, 1, 1, 3, 8, 7, 2, 2, 4, 8, 6, 3, 7, 13, 18, 19, 24, 35, 26, 14, 31, + 43, 49, 55, 61, 67, 61, 50, 43, 37, 30, 16, 5, 4, 4, 3, 3, 3, 4, 4, 3, + 2, 2, 3, 10, 14, 10, 7, 5, 5 + }; + } + public static double[] random() { double[] result = new double[100]; for (int i = 0; i < result.length; i++) { diff --git a/src/test/java/com/github/joonavali/naturalmouse/screenadjustednature/ScreenAdjustedNatureDefaultsTest.java b/src/test/java/com/github/joonavali/naturalmouse/screenadjustednature/ScreenAdjustedNatureDefaultsTest.java index 42426fe..5d29619 100644 --- a/src/test/java/com/github/joonavali/naturalmouse/screenadjustednature/ScreenAdjustedNatureDefaultsTest.java +++ b/src/test/java/com/github/joonavali/naturalmouse/screenadjustednature/ScreenAdjustedNatureDefaultsTest.java @@ -39,6 +39,7 @@ public class ScreenAdjustedNatureDefaultsTest { public void setup() throws Exception { mouse = new MockMouse(60, 60); DefaultSystemCalls mockSystemCalls = new MockSystemCalls(mouse, 800, 500); + whenNew(DefaultSystemCalls.class).withAnyArguments().thenReturn(mockSystemCalls); whenNew(DefaultMouseInfoAccessor.class).withAnyArguments().thenReturn(mouse);