点击隐藏登陆框
方便面三国
265G首页|专题首页|新闻公告|新手指南|经验心得|心情故事|游戏截图|常见问题|专题论坛
按键精灵方便面三国最短路径算法

作者:lidf来源:互联网时间:2008-10-07

FirstPage 是山寨的首页的攻击,nextpage 是翻页的攻击,Direction表示翻页的方向,1上2右3下4左

'进入地图页面,循环攻击山寨

-------------------------------------------------

Public Sub OpenMapWindow()

Dim a

If GetPixelColor(MapCheckX,MapCheckY)<>"4BA5C6" Or Direction>0 Then

TracePrint "点击地图按钮准备打山寨,等待山寨地图出现。。。"

MoveTo MapClickX,MapClickY

Delay 2000

CSOld=GetCursorShape(0)

LeftClick 1

WaitWindowOpen

a=WaitPoint(1,MapCheckX,MapCheckY,"4BA5C6")

End If

If Direction=1 Then

TracePrint "地图上翻一页。。。"

MoveTo NPTX,NPTY

Delay 200

CSOld=GetCursorShape(0)

LeftClick 1

WaitWindowOpen

ElseIf Direction=2  Then

TracePrint "地图右翻一页。。。"

MoveTo NPRX,NPRY

Delay 200

CSOld=GetCursorShape(0)

LeftClick 1

WaitWindowOpen

ElseIf Direction=3 Then

TracePrint "地图下翻一页。。。"

MoveTo NPBX,NPBY

Delay 200

CSOld=GetCursorShape(0)

LeftClick 1

WaitWindowOpen

ElseIf Direction=4 Then

TracePrint "地图左翻一页。。。"

MoveTo NPLX,NPLY

Delay 200

CSOld=GetCursorShape(0)

LeftClick 1

WaitWindowOpen

ElseIf Direction>0 Then

Direction=9

End If

End Sub

Public Function GoMapWindowFun

Dim Ret,WT

WT=True

While WT

If(Ret=1) Then OpenMapWindow

If Direction=0 Then

Ret=GoFirstPage

Direction=Direction+1

ElseIf Direction<5 Then

Ret=GoNextPage

Direction=Direction+1

Else

Ret=-1

Direction=0

End If

If Ret=-1 Then

WT=False

End If

Wend

TracePrint "退出山寨页面..."

Delay 100000

End Function

Public Function GoFirstPage

Dim I,J,K

GoFirstPage=1

For I=1 To 3

'If I=3 Then Exit For

If(GoPoint1(-I,0)<0) Then

GoFirstPage=-1

Exit Function

End If

If(GoPoint1(0,-I)<0) Then

GoFirstPage=-1

Exit Function

End If

If(GoPoint1(0,I)<0) Then

GoFirstPage=-1

Exit Function

End If

If(GoPoint1(I,0)<0) Then

GoFirstPage=-1

Exit Function

End If

For J=1 To I

If J=I Then

For K=1 To J

If(GoPoint1(-I,-K)<0) Then

GoFirstPage=-1

Exit Function

End If

If(GoPoint1(-I,K)<0) Then

GoFirstPage=-1

Exit Function

End If

If(GoPoint1(I,-K)<0)Then

GoFirstPage=-1

Exit Function

End If

If(GoPoint1(I,K)<0) Then

GoFirstPage=-1

Exit Function

End If

Next

Else

If(GoPoint1(-J,-I)<0) Then

GoFirstPage=-1

Exit Function

End If

If(GoPoint1(-J,I)<0) Then

GoFirstPage=-1

Exit Function

End If

If(GoPoint1(J,-I)<0) Then

GoFirstPage=-1

Exit Function

End If

If(GoPoint1(J,I)<0) Then

GoFirstPage=-1

Exit Function

End If

End If

Next

Next

End Function

Public Function GoNextPage()

Dim I

For I=1 To 7

If Direction=1 Then

If(GoPoint(4,8-I)<0) Then

GoNextPage=-1

Exit Function

End If

If(GoPoint(3,8-I)<0) Then

GoNextPage=-1

Exit Function

End If

If(GoPoint(5,8-I)<0) Then

GoNextPage=-1

Exit Function

End If

If(GoPoint(2,8-I)<0) Then

GoNextPage=-1

Exit Function

End If

If(GoPoint(6,8-I)<0) Then

GoNextPage=-1

Exit Function

End If

If(GoPoint(1,8-I)<0) Then

GoNextPage=-1

Exit Function

End If

If(GoPoint(7,8-I)<0) Then

GoNextPage=-1

Exit Function

End If

ElseIF Direction=2 Then

If(GoPoint(I,4)<0) Then

GoNextPage=-1

Exit Function

End If

If(GoPoint(I,3)<0) Then

GoNextPage=-1

Exit Function

End If

If(GoPoint(I,5)<0) Then

GoNextPage=-1

Exit Function

End If

If(GoPoint(I,2)<0) Then

GoNextPage=-1

Exit Function

End If

If(GoPoint(I,6)<0) Then

GoNextPage=-1

Exit Function

End If

If(GoPoint(I,1)<0) Then

GoNextPage=-1

Exit Function

End If

If(GoPoint(I,7)<0) Then

GoNextPage=-1

Exit Function

End If

ElseIF Direction=3 Then

If(GoPoint(4,I)<0) Then

GoNextPage=-1

Exit Function

End If

If(GoPoint(3,I)<0) Then

GoNextPage=-1

Exit Function

End If

If(GoPoint(5,I)<0) Then

GoNextPage=-1

Exit Function

End If

If(GoPoint(2,I)<0) Then

GoNextPage=-1

Exit Function

End If

If(GoPoint(6,I)<0) Then

GoNextPage=-1

Exit Function

End If

If(GoPoint(1,I)<0) Then

GoNextPage=-1

Exit Function

End If

If(GoPoint(7,I)<0) Then

GoNextPage=-1

Exit Function

End If

ElseIF Direction=4 Then

If(GoPoint(8-I,4)<0) Then

GoNextPage=-1

Exit Function

End If

If(GoPoint(8-I,3)<0) Then

GoNextPage=-1

Exit Function

End If

If(GoPoint(8-I,5)<0) Then

GoNextPage=-1

Exit Function

End If

If(GoPoint(8-I,2)<0) Then

GoNextPage=-1

Exit Function

End If

If(GoPoint(8-I,6)<0) Then

GoNextPage=-1

Exit Function

End If

If(GoPoint(8-I,1)<0) Then

GoNextPage=-1

Exit Function

End If

If(GoPoint(8-I,7)<0) Then

GoNextPage=-1

Exit Function

End If

End If

Next

End Function

Public Function GoPoint1(StepX,StepY)

GoPoint1=GoPoint(StepX+4,StepY+4)

End Function

Public Function GoPoint(StepX,StepY)

GoPoint=1

TracePrint "地图坐标(" & StepX & "," & StepY & ")."

PType=ShanZhai1280(FirstX+(StepX-1)*48,FirstY+(StepY-1)*48)

If PType=2 and CInt(Szdj)>=Mindj then

TracePrint "山寨等级=" & Szdj

WSNumber=WuSunGongJi(Szdj)

If Setdj=1 And CInt(Szdj)>Mindj Then

TracePrint "只攻击指定等级" & Mindj & "的山寨,该山寨等级是" & Szdj & ",不攻击"

Gopoint=2

Exit Function

End If

If LeftSoliders=0 Or LeftSoliders>=CInt(WSNumber) Then

If LeftSolider=0 Then

TracePrint "首次攻击,获取当前兵力,无损攻击" & WSNumber

Else

TracePrint "剩余兵力=" & LeftSoliders & ",无损攻击=" & WSNumber

End If

If FightIt<0 Then

TracePrint "本次结束攻击,等待攻击返回."

GoPoint=-1

Else

TracePrint "攻击(" & StepX  & "," & StepY & ")完毕."

OpenMapWindow

End If

Else

TracePrint "无损攻击兵力不足:剩余兵力=" & LeftSoliders & "无损攻击=" & WSNumber

GoPoint=0

End If

Else

If PType=1 Then

TracePrint "这是城市"

ElseIf PType=2 Then

TracePrint "山寨等级" & Szdj & "比设定的最小等级" & MinDj& "低,不攻击."

Else

TracePrint "这是荒原"

End If

End If

Delay 200

End Function

Public Function WuSunGongJi(Dj)

Dim a

a=Cint(Dj/5)

If Country=1 Then

WuSunGongJI=WuSun1(a)

ElseIf Country=2 Then

WuSunGongJI=WuSun2(a)

Else

WuSunGongJI=WuSun3(a)

End If

End Function

------------------------------------------------------------------------

上面是个框架程序,核心攻击程序 FightIt 程序片段

'攻击山寨

'返回值:

'-1:  没有武将

'-2: 没有士兵

'-3: 士兵人数小于最低等级山寨的无损攻击人数

'1:   攻击成功

'2:   山寨荒凉

'3:  无损攻击不足

Public Function FightIt

Dim a,b

FightIt=1

TracePrint "点击山寨,等待山寨页面出现。。。"

CSOld=CsNor

LeftClick 1

Delay 200

WaitWindowOpen

Delay 100

。。。。。

TracePrint "检测士兵人数" & LeftSoliders & "是否小于最低等级山寨的无损攻击人数" & WuSunGongJi(MinDj)

If LeftSoliders<Cint(WuSunGongJi(MinDj)) Then

TracePrint "小于最低等级山寨的无损攻击人数,停止攻击。进入城外等待1分钟。。。"

MoveTo OutCityClickX,OutCityClickY

Delay 100

LeftClick 1

Delay 500

FightIt=-3

Else

TracePrint "大于最低等级山寨的无损攻击人数,继续攻击。"

End If

Delay 500

End Function

 

责任编辑:小雪


END

我顶

上一篇:没有了

下一篇:没有了

评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
 匿名?
关于本站|免责声明|广告服务|网站地图|网站搜索|友情链接|联系我们

健康游戏忠告:抵制不良游戏 拒绝盗版游戏 注意自我保护 谨防受骗上当 适度游戏益脑 沉迷游戏伤身 合理安排时间 享受健康生活

本站通用网址:网页游戏    如有意见和建议,请惠赐E-mail至 webgame@foxmail.com

Copyright © 2006-2008 265g.com    粤ICP备07039898号