0


普通土万象

普通土万象

前言

自动普通土万象

步骤

① 开始游戏
② 抢英雄
③ 判断进入预备地图
④ 多线程 1-自动寻路 2-跳过动画
⑤ 主线程阻塞-判断进入战斗地图
⑥ 战斗
1、多线程 1-蓄力+中闪 2-转向队友以修正方向
2、主线程阻塞-判断通关成功(战斗超时如80s,打破阻塞)
⑦ 返回大厅
以上为匹配,单打开启振刀(振早调延时)和转向敌人(土万象和背景颜色差不多很难识别好)。效率很低,大概4分钟一把,最好匹配。

源码

Call dmcj
Call dmOcr

For 9999
    Call 开始游戏()
    Call 使用角色()
    Call 进入预备地图()
    xl =BeginThread(寻路(1599,322))
    Call 跳过()
    StopThread xl
    Call 进入战斗地图()
    Call 战斗()
    Call 返回大厅()
Next

Function 战斗()
    TracePrint "战斗"
    xlid =BeginThread(蓄力迦南)//    jzsd =BeginThread(矫正索敌)//    zd =BeginThread(振刀(xlid))
    sddy =BeginThread(锁定队友)
    Call 通关成功(xlid, sddy)//    StopThread jzsd
//    StopThread zd
End Function

Sub 蓄力
    TracePrint "蓄力"
    While 1=1
        RightUp 1
        RightDown 1
        Delay 730
        RightUp 1
        Delay 1000
        KeyPress "Shift",1// 后摇
        Delay 760
    Wend
End Sub

Sub 蓄力迦南
    TracePrint "蓄力"
    While 1=1
        RightUp 1
        RightDown 1
        Delay 20
        RightUp 1
        Delay 30
        KeyPress "Shift",1
        Delay 30
    Wend
End Sub

Sub 振刀(xlid)
    Call dmcj
    While 1=1
        Delay 10
        NUM = Plugin.Color.CountColor(456,259,1495,840,"FCEFE2",0.9)//        TracePrint NUM
//        If NUM >600 Then 
        If NUM >1000 Then 
            PauseThread xlid
            Delay 50
             KeyPress "G",1
                   Delay 1000
                   LeftClick 1
                   Delay 4000
                   ContinueThread xlid
        End If
    Wend
End Sub

Sub 矫正索敌()
    Call dmcj
    判断颜色 ="C1DFF8"
    While 1=1
        Delay 10
        NUM = Plugin.Color.CountColor(746,0,1080,720, 判断颜色,0.92)
        TracePrint NUM
        If NUM >5 Then 
            Delay 3000
            dm.MoveR -500,0
        Else 
            dm.MoveR 100,0
        End If
        Delay 10
    Wend
End Sub

Sub 锁定队友()
    Delay 1000
    TracePrint "锁定队友"
    Call dmcj
    判断颜色 ="688522"// 如果自己是绿色 就不能判断绿色
    IfColor 121,1007,"688522",0 Then
        判断颜色 ="AD5A47"
    End If
    IfColor 121,1007,"000000",0 Then
        判断颜色 ="AD5A47"
    End If
    While 1=1
        Delay 10
        FindColor 746,0,1080,720, 判断颜色, intX, intY
        If intX >0 And intY >0 Then 
            Delay 1000
            dm.MoveR -300,0
        Else 
            dm.MoveR 150,0
        End If        
        Delay 10
    Wend
End Sub

Function 获取坐标()
    xy = dm.Ocr(1654,115,1780,136,"ffffff-524e4a",0.92)
    x =Left(xy,5)
    y =Right(xy,5)//    TracePrint xy
End Function

Function 开始游戏()
    intXgb =-1
    While intXgb <1
        KeyPress "Space",1
        Delay 10
        dm.MoveTo 0,0
        Delay 10
        gb = dm.FindStr(1547,941,1880,1029,"开始游戏","ffffff-767b83",0.90, intXgb, intYgb)
        If intXgb >0 Then 
            Delay 100
            dm.MoveTo intXgb, intYgb
            Delay 200
            LeftClick 1
            Delay 100
        End If
//        TracePrint gb
        Delay 100
    Wend
End Function

Function 使用角色()
    intXur =-1
    While intXur <1// 移到角色位置
//        dm.MoveTo 229,365
        dm.MoveTo 334,226
        
        ur = dm.FindStr(1613,919,1667,952,"使用","ffffff-c3abaa",0.90, intXur, intYur)
        If intXur >0 Then 
            LeftClick 1
            Delay 100
            dm.MoveTo intXur, intYur
            Delay 100
            LeftClick 1
            Delay 100
        End If
//        TracePrint ur
        Delay 100
    Wend
End Function

Function 进入预备地图()
    intXrd =-1
    While intXrd <1
        dm.MoveTo 0,0
        rd = dm.FindStr(65,64,177,108,"预备","ffffff-9f9fa0",0.90, intXrd, intYrd)//        TracePrint rd
        Delay 100
    Wend
End Function

Function 进入战斗地图()
    intXnd =-1
    While intXnd <1
        dm.MoveTo 0,0
        nd = dm.FindStr(598,19,693,45,"战斗地图","ffffff-342826",0.90,intXnd,intYnd)//        TracePrint nd
        Delay 100
    Wend
End Function

Function 跳过()
    intXps =-1
    While intXps <1
        dm.MoveTo 0,0
        ps = dm.FindStr(1825,1034,1872,1066,"跳过","ffffff-cecece",0.90, intXps, intYps)
        If intXps >0 Then 
            Delay 100
            dm.MoveTo intXps, intYps
            Delay 100
            KeyPress "Esc",1
            Delay 100
        End If
//        TracePrint ps
        Delay 100
    Wend
End Function

Function 通关成功(xlid, sddy)
    tBegin = Plugin.Sys.GetTime()
    intXpss =-1 
    While intXpss <1
        Delay 1000
        dm.MoveTo 0,0
        ps = dm.FindStr(898,204,1023,228,"即将返回大厅","ffffff-342826",0.90, intXpss, intYpss)
        tUse = Plugin.Sys.GetTime()- tBegin
        
        If tUse >80000 Then 
            intXpss =10
        End If
        
        If intXpss >0 Then 
            Delay 100
            dm.MoveTo intXpss, intYpss
            Delay 100
            KeyPress "Esc",1
            Delay 100
            TracePrint "用时:"& tUse
        End If
    Wend
    
    StopThread xlid
    StopThread sddy
End Function

Function 返回大厅()
    intXbk =-1
    While intXbk <1
        dm.MoveTo 0,0
        ps = dm.FindStr(915,766,1006,794,"返回大厅","ffffff-78716f",0.90, intXbk, intYbk)
        If intXbk >0 Then 
            Delay 100
            dm.MoveTo intXbk, intYbk
            Delay 100
            LeftClick 1
            Delay 300
            KeyPress "Space",1
        End If
//        TracePrint ps
        Delay 1000
    Wend
End Function

Function 矫正方向()
    dm.MoveTo 0,0
    intX =-1
    While intX =-1
        dm_ret = dm.FindStr(820,40,865,85,"西南","ffffff-524e4a",0.70, intX, intY)
        dm.MoveR 10,0
        Delay 5
    Wend
End Function

Sub 寻路(mbx, mby)
    Call dmOcr
    
    误差 =0.6
    微调 =8
    倍数 =30

    KeyPress "M",1
    Delay 500
    Do
        Call 获取坐标()
        If X ="" OR Y ="" Then
            KeyPress "W",1
        Else 
            If(y - mby)<-误差 Then
//                TracePrint "按w"&(y - mby)&"上"
                KeyDown "W",1
                If Abs(y - mby)> 微调 Then 
                    KeyDown "Shift",1
                End If
//                KeyPress "Space",1
                Delay Abs(y - mby)* 倍数
                KeyUp "W",1
                If Abs(y - mby)> 微调 Then 
                    KeyUp "Shift",1
                End If
                
            ElseIf(y - mby)> 误差 Then
//                TracePrint "按s"&(y - mby)&"下"
                KeyDown "S",1
                If Abs(y - mby)> 微调 Then 
                    KeyDown "Shift",1
                End If
                Delay Abs(y - mby)*倍数
                KeyUp "S",1
                If Abs(y - mby)> 微调 Then 
                    KeyUp "Shift",1
                End If
            Else 
//                TracePrint "X到达"
            End If
            
            If(x - mbx)> 误差 Then 
//                TracePrint "按A"&(x - mbx)&"左"
                KeyDown "A",1
                If Abs(x - mbx)> 微调 Then 
                    KeyDown "Shift",1
                End If
                Delay Abs(x - mbx)*倍数
                KeyUp "A",1
                If Abs(x - mbx)> 微调 Then 
                    KeyUp "Shift",1
                End If
            ElseIf(x - mbx)<-误差  Then 
//                TracePrint "按D"&(x - mbx)&"右"
                KeyDown "D",1
                If Abs(x - mbx)> 微调 Then 
                    KeyDown "Shift",1
                End If
                Delay Abs(x - mbx)*倍数
                KeyUp "D",1
                If Abs(x - mbx)> 微调 Then 
                    KeyUp "Shift",1
                End If
            Else 
//                TracePrint "Y到达"
            End If
            
            count = count +1//            TracePrint 误差 &" "&Abs(mbx - x)&" "&Abs(y - mby)//            TracePrint Abs(mbx - x)&" "&(Abs(mbx - x)< 误差)&" "&Abs(y - mby)&" :"&(Abs(y - mby)< 误差)
            If Abs(mbx - x)< 误差 And Abs(y - mby)< 误差 Then 
                TracePrint "XY到达"
                Exit Do
            End If
        End If
        
        Delay 100    
    Loop
    Delay 200
    KeyPress "M",1
    Delay 500
    KeyPress "E",1
End Sub

Sub dmcj
   大漠,其它地方找,复制进来
End Sub

Sub dmOcr
    set dm =createobject("dm.dmsoft")
    base_path = dm.GetBasePath()
    dm_ret = dm.SetPath(base_path)
    dm_ret = dm.SetDict(0,"字库.txt")
End Sub

字库.txt

C01800$.$0.0.4$2
3FCE0F00400C02F3CFF0$0$0.0.38$12
401803FFBFF$1$1.2.31$12
40380E03C0CC70FC0400$2$0.0.32$12
40380218430CE0F7CC78$3$0.0.35$12
0180703E0C4709FFFFF804$4$0.0.42$12
1C3F8310660C438FC0F0$5$0.0.37$12
1FCFDF10E208418C50F8$6$0.0.40$12
C0180303E3FDC1E03000$7$0.0.30$12
31EF6718430C60FE4C78$8$0.0.43$12
7C38C20C410C22FFC7E0$9$0.0.39$12
4008FD33A624C8FE1302607F89993126747E000000002FE580B217C6DBF9DB697C2C8590BF900$西南$0.0.171$15
0E03C0780F01E03C0780F01E03C07F8FF1FE3FC7F8F01E03C0780F01E03C0780F01E03C0780F01FE3FC7F8FF1E03C0780F01E03C0780F01E03C000000000000000000020040080100201CFFFFFFFFFE50080100200400801002000000000000000000000601C0F87F7FFFF3F87C06000000000600E03C03803000000000000000000000000000000000300F01E03E03E07C07C07C0F00DC0380700E81DC3FC7FEEFFCFF8FF06E01C0380700E01C0380307EFFFFFFFFFFE87C0F81F03E07C0F81F03E07C0F80F000000000000380780F01E03C0780F01E03C0780F01E03C0780F01F03E07C0F81800000000000001F03FFFFFFFFFFC00000000401C03C07C07C0FC0FC$开始游戏$2.0.3214$46
00401C0F83C1FEFFFE0780BBE77CEE9DC3B8773FFFFFFFE770EE1DC3BE77CEF800000000003FF7FEFFDC638C718E31C63FF7FEE31C638C718E31C63FF7FEFFC$使用$0.0.542$22
7F6FFDFC31F63EFEDFD8E01F3FFFFFFFF001FFFFF87B3E23000000041DC39C79CF19E380740FE1DE39C708E01C1FFFFF8E01C0380$跳过$1.1.401$19
03E00C000000FE1FC00000000000007FFFFE000000000000003F87F000000000007FEFFC3F87F0FE1FC3FFE0FDE1FC3F87F0FE1FDFFBFF000000000200E01C0380700E01C1B87F07E27CC3B87F0FC1E038020000000000300E23FC7F9FFFDFFBDF79FF3FE7F8F716F0DE1FC3F83D$预备$0.1.728$19
0FE1FC00000000000003FFFFE000000000000003F87F000000000007FEFFC3F87F0FE1FC3FFE0FDE1FC3F87F0FE1FDFFBFF000000000000E01C0380700E01C1B87F07E23CC3B87E0F81E038020000000000300E21FC7F9EF7DFFBDF79FF3FE7F8F716F0DE1FC3F801$预备$0.1.692$19
006C0CE18E3086000001FF3FE660CD99B332C618C31963EC798C000000000003FF7FEC018030F63EC7D8C318630C618FB1F600C01803FF7FE000000000180300600C0180300600C01FFFFFF80F0180300600C0180300600C000000000003FE7FCC418C318630C618C318630C798F318630C618C318620$返回大厅$0.0.625$21
0020040080100200400801002004008010020040080000000000000000000000000020040080000000200400F81F007004000000401801000000000000000000000000000000000000000000000000000000000000C018030000040080100000000000000000000000000000000000000000000000000000000000000080100200000000000000000000C01C0$通关成功$9.0.1272$36
3FEFFD10A21442885999FE000000FF900200400801FF000000000000800C008FFF0000042288510A4A58C91126259CE09810020000000460861063800000004FF93022844888A114228590E200000000000007FE8010020043E841082104208410821F400801803FF00000000010020040080100200400DBFE63804C0801002004008010020000000000007FC80110220440881102204408F91022044088110200$即将返回大厅$0.0.491$18
40080100200402DF98C2184308610C21843086107A00400000000000803007918A51983106A9B5F6F25440090120283C000000000000000000000000600C000000000000000016444889113B65448891B2000000085091020059DC03000000000002004028090721F5C8C11022044088110220440881103A00$战斗地图$0.0.295$17

需要改进

① 角色没抢到,应该退出,或者换备选角色
② 有队友退出,应该退出
③ 目前有很多队友g着原地蓄力,跟随容易跟风打空气、 睿智队友一直打远程、队友标点导致识色判断为队友、匹到低等级队友老乱跑甚至躲山崖,
这些都会导致输出不理想,所以设置了战斗超时直接退出。

最后

如果队友正常贴脸输出boss,那么输出也不会差,可以达到40s一把。

标签: 程序人生 开源

本文转载自: https://blog.csdn.net/qq_24054301/article/details/128691595
版权归原作者 bbq烤鸡 所有, 如有侵权,请联系我们删除。

“普通土万象”的评论:

还没有评论