@chcp 65001 >nul
@echo off
:body
for /l %%i in (1,1,10) do call:night
@REM pause
set /p input=是否继续(Y/N)?
if input=="Y" goto:body
if input=="y" goto:body
goto:eof
:night
@REM start fight x[110,270] y[870,1030]
call:tap 110 870 1
@REM confirm x[1500,270] y[660,1030]
call:tap 1500 660 5
@REM pick hero x[380,270] y[900,1030]
call:tap 380 900 1
@REM click any clearing x[2000,270] y[200,1030]
call:tap 2000 200 1
@REM pick troops x[380,270] y[900,1030]
call:tap 580 900 1
@REM click any clearing x[2000,270] y[200,1030]
call:tap 10 10
call:tap 100 10
call:tap 1000 200
call:tap 2000 200
call:tap 2000 500
call:tap 10 10
call:tap 100 10
call:tap 1000 200
call:tap 2000 200
call:tap 2000 500
@REM wait fight
timeout /t 40 /nobreak >nul
@REM stop fight x[110,270] y[736,1030]
call:tap 110 736 1
@REM confirm x[1250,270] y[640,1030]
call:tap 1250 640 1
@REM home x[1100,270] y[880,1030]
call:tap 1100 880 1
goto:eof
:tap
rem echo tap %1 %2 %3
set /a x = %1 +%random%/256
set /a y = %2 +%random%/512
adb shell input tap %x% %y%
if not "%3"=="" (timeout /t %3 /nobreak >nul)
goto:eof
:swipe
echo swipe暂时用不到
adb shell input swipe %1 %2 %3 %4
goto:eof
:getRand
echo getRand
set /a n=%random%/128
goto:eof
@REM //模拟输入“001”
@REM adb shell input text “001”
@REM //模拟home按键
@REM adb shell input keyevent 3
@REM //模拟点击(540, 1104)坐标
@REM adb shell input tap 540 1104
@REM //模拟滑动,从(250,250)滑动到(300,300)
@REM adb shell input swipe 250 250 300 300
过程中了解到的点
- 判断入参为空
- 与,或,非
- 循环
- 跳转
- 函数,函数参数,函数结果返回
- 延时