Fix: 修复长时间运行时, 游戏内心情值计算bug导致的出错

- 未开启红脸出击时, 会每隔两个半小时重启游戏
This commit is contained in:
LmeSzinc 2020-05-19 22:58:25 +08:00
parent 47c4afdaae
commit 9c77cdd058
3 changed files with 31 additions and 5 deletions

View File

@ -136,7 +136,7 @@ python -m uiautomator2 init
- **GUI启动慢, uiautomator2启动慢**
- **无法处理网络波动** 重连弹窗, 跳小黄鸡
- **会显示绿脸黄脸红脸, 红脸出击确认** 这个是瓜游心情值更新BUG的锅了, 只要填对了`RECOVER_PER_HOUR` 和 `EMOTION_LIMIT` 就不会红脸出击, 或者保证一直处于经验加成状态.
- **会显示绿脸黄脸红脸** 这个是瓜游心情值更新BUG, Alas会每隔2.5小时重启游戏来更新心情.
- **演习可能SL失败** 演习看的是屏幕上方的血槽, 血槽可能被立绘遮挡, 因此需要一定时间(默认1s)血量低于一定值(默认40%)才会触发SL. 一个血皮后排就有30%左右的血槽, 所以别以为在1s内被打掉40%是不可能的. 另外如果后排立绘过大且CD重叠严重, 建议增大确认时间(比如3s), 或者换皮肤, 这样可以减少误判.
- **极少数情况下ADB和uiautomator2会抽风**
- **拖动操作在极少数情况下无效**

View File

@ -112,11 +112,8 @@ class CampaignRun(CampaignUI, Reward, LoginHandler):
"""
self.load_campaign(name, folder=folder)
self.run_count = 0
start_date = datetime.now().date()
while 1:
if datetime.now().date() != start_date:
start_date = datetime.now().date()
self.app_restart()
if self.handle_app_restart():
self.campaign.fleet_checked_reset()
if self.handle_reward():
self.campaign.fleet_checked_reset()

View File

@ -2,10 +2,13 @@ from module.base.timer import Timer
from module.combat.combat import Combat
from module.handler.assets import *
from module.logger import logger
from datetime import datetime, timedelta
from module.ui.ui import MAIN_CHECK, EVENT_LIST_CHECK, BACK_ARROW
class LoginHandler(Combat):
start_time = datetime.now()
def handle_app_login(self):
logger.hr('App login')
@ -51,3 +54,29 @@ class LoginHandler(Combat):
return True
return False
def _triggered_app_restart(self):
"""
Returns:
bool: If triggered a restart condition.
"""
now = datetime.now()
if now.date() != self.start_time.date():
logger.hr('Triggered restart new day')
return True
if not self.config.IGNORE_LOW_EMOTION_WARN:
# The game does not calculate emotion correctly, which is a bug in AzurLane.
# After a long run, we have to restart the game to update it.
if now - self.start_time > timedelta(hours=2, minutes=30):
logger.hr('Triggered restart avoid emotion bug')
return True
return False
def handle_app_restart(self):
if self._triggered_app_restart():
self.app_restart()
self.start_time = datetime.now()
return True
return False