|
@@ -0,0 +1,141 @@
|
|
|
+package com.sencorsta.rabs.obj.ai.scene.fight;
|
|
|
+
|
|
|
+import cn.hutool.core.thread.ThreadUtil;
|
|
|
+import com.sencorsta.rabs.annotation.SceneAnnotation;
|
|
|
+import com.sencorsta.rabs.obj.ai.AiManage;
|
|
|
+import com.sencorsta.rabs.obj.ai.api.Scene;
|
|
|
+import com.sencorsta.rabs.obj.ai.api.SceneWhitSubRecord;
|
|
|
+import com.sencorsta.rabs.util.ResettableData;
|
|
|
+import org.opencv.core.Point;
|
|
|
+
|
|
|
+import java.awt.AWTException;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 对决赛
|
|
|
+ */
|
|
|
+@SceneAnnotation("SceneMain_Fight_Gym")
|
|
|
+public class SceneMain_Fight_Gym_Cloud extends SceneWhitSubRecord implements Scene {
|
|
|
+ @Override
|
|
|
+ public float getPriority() {
|
|
|
+ return 1.0f;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static String PathEnter = System.getProperty("user.dir") + "\\opencv\\scene\\fight\\gym\\cloud\\enter.png";
|
|
|
+ private static String PathCheck = System.getProperty("user.dir") + "\\opencv\\scene\\fight\\gym\\cloud\\check.png";
|
|
|
+// private static String PathNotOpen = System.getProperty("user.dir") + "\\opencv\\scene\\fight\\gym\\cloud\\notOpen.png";
|
|
|
+
|
|
|
+ //下面的直接共用一套资源
|
|
|
+ private static String PathBack = System.getProperty("user.dir") + "\\opencv\\scene\\fight\\gym\\dragon\\back.png";
|
|
|
+ private static String PathMovePoint = System.getProperty("user.dir") + "\\opencv\\scene\\fight\\gym\\dragon\\movePoint.png";
|
|
|
+ private static String PathStart = System.getProperty("user.dir") + "\\opencv\\scene\\fight\\gym\\dragon\\start.png";
|
|
|
+ private static String PathStart2 = System.getProperty("user.dir") + "\\opencv\\scene\\fight\\gym\\dragon\\start2.png";
|
|
|
+ private static String PathSkip = System.getProperty("user.dir") + "\\opencv\\scene\\fight\\gym\\dragon\\skip.png";
|
|
|
+ private static String PathOver = System.getProperty("user.dir") + "\\opencv\\scene\\fight\\gym\\dragon\\over.png";
|
|
|
+ private static String PathLose = System.getProperty("user.dir") + "\\opencv\\scene\\fight\\gym\\dragon\\lose.png";
|
|
|
+ private static String PathBuy = System.getProperty("user.dir") + "\\opencv\\scene\\fight\\gym\\dragon\\buy.png";
|
|
|
+ private static String PathClose = System.getProperty("user.dir") + "\\opencv\\scene\\fight\\gym\\dragon\\close.png";
|
|
|
+ private int maxTime = 20;
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void back() throws AWTException {
|
|
|
+ moveToClick(PathBack, AiManage.getInstance().getCheckPoint());
|
|
|
+ ThreadUtil.sleep(2000);
|
|
|
+ }
|
|
|
+
|
|
|
+ int moveCount = 0;
|
|
|
+ boolean goRight = true;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void open() throws AWTException {
|
|
|
+ while (!check()) {
|
|
|
+ AiManage.getInstance().updateWindow();
|
|
|
+ ThreadUtil.sleep(2000);
|
|
|
+ if (checkHas(PathEnter, AiManage.getInstance().getCheckPoint())) {
|
|
|
+ moveToClick(PathEnter, AiManage.getInstance().getCheckPoint());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+// if (checkHas(PathNotOpen, AiManage.getInstance().getCheckPoint())) {
|
|
|
+// getRecordSub().getData().setDone(true);
|
|
|
+// break;
|
|
|
+// }
|
|
|
+ if (goRight) {
|
|
|
+ moveToClick(PathMovePoint, AiManage.getInstance().getCheckPoint(), new Point(0, -50));
|
|
|
+ } else {
|
|
|
+ moveToClick(PathMovePoint, AiManage.getInstance().getCheckPoint(), new Point(-666, -50));
|
|
|
+ }
|
|
|
+ moveCount++;
|
|
|
+ if (moveCount > 5) {
|
|
|
+ moveCount = 0;
|
|
|
+ goRight = !goRight;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean check() throws AWTException {
|
|
|
+ if (checkHas(PathCheck, AiManage.getInstance().getCheckPoint())) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void think() throws AWTException {
|
|
|
+ int count = getRecord().getData().getCount();
|
|
|
+ if (count < maxTime) {
|
|
|
+ ThreadUtil.sleep(4000);
|
|
|
+ moveToClick(PathStart, AiManage.getInstance().getCheckPoint());
|
|
|
+ ThreadUtil.sleep(2000);
|
|
|
+ while (!checkHas(PathStart2, AiManage.getInstance().getCheckPoint())) {
|
|
|
+ if (checkHas(PathBuy, AiManage.getInstance().getCheckPoint())) {
|
|
|
+ //没有次数了 今日结束
|
|
|
+ getRecordSub().getData().setDone(true);
|
|
|
+ moveToClick(PathClose, AiManage.getInstance().getCheckPoint());
|
|
|
+ ThreadUtil.sleep(2000);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ moveToClick(PathStart, AiManage.getInstance().getCheckPoint());
|
|
|
+ ThreadUtil.sleep(2000);
|
|
|
+ }
|
|
|
+ moveToClick(PathStart2, AiManage.getInstance().getCheckPoint());
|
|
|
+ ThreadUtil.sleep(2000);
|
|
|
+
|
|
|
+ while (!checkHas(PathOver, AiManage.getInstance().getCheckPoint())) {
|
|
|
+ if (checkHas(PathLose, AiManage.getInstance().getCheckPoint())) {
|
|
|
+ //发现失败 直接放弃
|
|
|
+ getRecord().getData().setCount(maxTime);
|
|
|
+ randomToClick();
|
|
|
+ ThreadUtil.sleep(2000);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ moveToClick(PathSkip, AiManage.getInstance().getCheckPoint());
|
|
|
+ ThreadUtil.sleep(4000);
|
|
|
+ }
|
|
|
+ ThreadUtil.sleep(6000);
|
|
|
+ randomToClick();
|
|
|
+
|
|
|
+ ThreadUtil.sleep(12000);
|
|
|
+
|
|
|
+ getRecord().getData().setCount(count + 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean isDone() {
|
|
|
+ return getRecord().getData().getCount() >= maxTime||getRecordSub().getData().isDone();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 重置
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResettableData.ResetType getType() {
|
|
|
+ return ResettableData.ResetType.WEEKLY_DOUBLE;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|