-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c1723bd
commit 8fdb201
Showing
16 changed files
with
239 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
from fighter import * | ||
from game_pos import * | ||
|
||
|
||
class ExploreFight(Fighter): | ||
def __init__(self): | ||
# 初始化 | ||
Fighter.__init__(self) | ||
|
||
def next_scene(self): | ||
self.yys.mouse_drag_bg((1130, 118), (20, 118)) | ||
# self.yys.mouse_drag_bg((1130,118),(20,118)) | ||
|
||
def check_exp_full(self): | ||
''' | ||
检查狗粮经验,并自动换狗粮 | ||
''' | ||
# 狗粮经验判断 | ||
gouliang1 = self.yys.find_game_img( | ||
'img\\MAN1.png', 1, (397, 287), (461, 349)) | ||
gouliang2 = self.yys.find_game_img( | ||
'img\\MAN2.png', 1, (628, 333), (693, 394)) | ||
|
||
print(gouliang1) | ||
print(gouliang2) | ||
|
||
# 如果都没满则退出 | ||
if not gouliang1 and not gouliang2: | ||
return | ||
|
||
# 开始换狗粮 | ||
while True: | ||
# 点击狗粮位置 | ||
self.yys.mouse_click_bg( | ||
TansuoPos.change_monster.pos, TansuoPos.change_monster.pos_end) | ||
if self.yys.wait_game_img('img\\QUAN-BU.png', 3, False): | ||
break | ||
time.sleep(1) | ||
|
||
# 点击“全部”选项 | ||
self.yys.mouse_click_bg(TansuoPos.quanbu_btn.pos, | ||
TansuoPos.quanbu_btn.pos_end) | ||
time.sleep(1) | ||
|
||
# 点击“N”卡 | ||
self.yys.mouse_click_bg(TansuoPos.n_tab_btn.pos, | ||
TansuoPos.n_tab_btn.pos_end) | ||
time.sleep(1) | ||
|
||
# 更换狗粮 | ||
if gouliang1: | ||
self.yys.mouse_drag_bg((309, 520), (554, 315)) | ||
if gouliang2: | ||
time.sleep(1) | ||
self.yys.mouse_drag_bg((191, 520), (187, 315)) | ||
|
||
def find_exp_moster(self): | ||
''' | ||
寻找经验怪 | ||
return: 成功返回经验怪的攻打图标位置;失败返回-1 | ||
''' | ||
# 查找经验图标 | ||
exp_pos = self.yys.find_color( | ||
((2, 205), (1127, 545)), (140, 122, 44), 2) | ||
if exp_pos == -1: | ||
return -1 | ||
|
||
# 查找经验怪攻打图标位置 | ||
find_pos = self.yys.find_game_img( | ||
'img\\FIGHT.png', 1, (exp_pos[0]-150, exp_pos[1]-250), (exp_pos[0]+150, exp_pos[1]-50)) | ||
if not find_pos: | ||
return -1 | ||
|
||
# 返回经验怪攻打图标位置 | ||
fight_pos = ((find_pos[0]+exp_pos[0]-150),(find_pos[1]+exp_pos[1]-250)) | ||
return fight_pos | ||
|
||
def fight_moster(self, mood1, mood2): | ||
'''打经验怪''' | ||
while True: | ||
mood1.moodsleep() | ||
# 查看是否进入探索界面 | ||
self.yys.wait_game_img('img\\YING-BING.png') | ||
self.log.writeinfo('In field') | ||
|
||
# 寻找经验怪,未找到则退出 | ||
fight_pos = self.find_exp_moster() | ||
if fight_pos == -1: | ||
self.log.writeinfo('Back') | ||
break | ||
|
||
# 攻击经验怪 | ||
self.yys.mouse_click_bg(fight_pos) | ||
if not self.yys.wait_game_img('img\\ZHUN-BEI.png', 3, False): | ||
break | ||
self.log.writeinfo('Already in battle') | ||
time.sleep(1) | ||
|
||
# 检查狗粮经验 | ||
self.check_exp_full() | ||
|
||
# 点击准备 | ||
self.yys.mouse_click_bg( | ||
TansuoPos.ready_btn.pos, TansuoPos.ready_btn.pos_end) | ||
self.log.writeinfo('Clicked ready') | ||
|
||
# 检查是否打完 | ||
self.check_end() | ||
mood1.moodsleep() | ||
|
||
# 在战斗结算页面 | ||
self.yys.mouse_click_bg(utilities.firstposition()) | ||
start_time = time.time() | ||
while time.time() - start_time <= 10: | ||
if(self.yys.wait_game_img('img\\YING-BING.png', mood2.get1mood()/1000, False)): | ||
break | ||
|
||
# 点击结算 | ||
self.yys.mouse_click_bg(utilities.secondposition()) | ||
|
||
# 如果没有成功结算,切到主界面提醒玩家 | ||
if time.time() - start_time > 10: | ||
self.yys.activate_window() | ||
|
||
def start(self): | ||
'''单人探索主循环''' | ||
mood1 = utilities.Mood(1) | ||
mood2 = utilities.Mood() | ||
while True: | ||
# 点击挑战按钮 | ||
self.yys.wait_game_img('img\\TAN-SUO.png') | ||
self.yys.mouse_click_bg((785, 456), (894, 502)) | ||
self.fight_moster(mood1, mood2) | ||
self.next_scene() | ||
self.fight_moster(mood1, mood2) | ||
while True: | ||
self.yys.mouse_click_bg( | ||
TansuoPos.quit_btn.pos, TansuoPos.quit_btn.pos_end) | ||
if self.yys.wait_game_img('img\\QUE-REN.png', 3, False): | ||
break | ||
self.yys.mouse_click_bg( | ||
TansuoPos.confirm_btn.pos, TansuoPos.confirm_btn.pos_end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import game_ctl | ||
import utilities | ||
import logsystem | ||
|
||
import time | ||
|
||
class Fighter: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class GamePos(): | ||
def __init__(self,pos,pos_end=None): | ||
self.pos=pos | ||
self.pos_end=pos_end | ||
|
||
class TansuoPos(): | ||
last_chapter=GamePos((934,493),(1108,572)) #列表最后一章 | ||
tansuo_btn=GamePos((787,458),(890,500)) #探索按钮 | ||
ready_btn=GamePos((1000,460),(1069,513)) #准备按钮 | ||
fight_quit=GamePos((1055,462),(1121,518)) #退出战斗 | ||
quit_btn=GamePos((32,45),(58,64)) #退出副本 | ||
confirm_btn=GamePos((636,350),(739,370)) #退出确认按钮 | ||
change_monster=GamePos((427,419),(457,452)) #切换狗粮点击区域 | ||
quanbu_btn=GamePos((37,574),(80,604)) #“全部”按钮 | ||
n_tab_btn=GamePos((142,288),(164,312)) #n卡标签 | ||
quit_change_monster=GamePos((19,17),(43,38)) #退出换狗粮界面 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.