mirror of
https://github.com/ok-oldking/ok-wuthering-waves.git
synced 2025-04-24 08:25:16 +00:00
修复某些游戏分辨率无法领取无音区奖励
修复某些角色读取共鸣回路条不正确
This commit is contained in:
parent
bfae94e1b0
commit
aac5473f18
@ -56,7 +56,7 @@ numpy==2.2.4
|
||||
# shapely
|
||||
rapidocr==2.0.6
|
||||
# via -r .\requirements.in
|
||||
ok-script==0.0.517
|
||||
ok-script==0.0.519
|
||||
# via -r .\requirements.in
|
||||
omegaconf==2.3.0
|
||||
# via ok-rapidocr-dml
|
||||
|
@ -53,7 +53,6 @@ class BaseChar:
|
||||
self.full_ring_area = 0
|
||||
self.freeze_durations = []
|
||||
self.last_perform = 0
|
||||
self._is_forte_full = False
|
||||
self.config = {"_full_ring_area": 0, "_ring_color_index": -1}
|
||||
if type(self) is not BaseChar:
|
||||
self.config = Config(self.name, self.config)
|
||||
@ -374,7 +373,7 @@ class BaseChar:
|
||||
priority += self.count_liberation_priority()
|
||||
if self.count_resonance_priority() and self.resonance_available():
|
||||
priority += self.count_resonance_priority()
|
||||
if self.count_forte_priority() and self._is_forte_full:
|
||||
if self.count_forte_priority():
|
||||
priority += self.count_forte_priority()
|
||||
if self.echo_available():
|
||||
priority += self.count_echo_priority()
|
||||
@ -448,8 +447,7 @@ class BaseChar:
|
||||
self.logger.debug(f'is_forte_full {white_percent}')
|
||||
box.confidence = white_percent
|
||||
self.task.draw_boxes('forte_full', box)
|
||||
self._is_forte_full = white_percent > 0.08
|
||||
return self._is_forte_full
|
||||
return white_percent > 0.08
|
||||
|
||||
def liberation_available(self):
|
||||
if self._liberation_available:
|
||||
|
@ -27,9 +27,7 @@ from src.char.Youhu import Youhu
|
||||
from src.char.Yuanwu import Yuanwu
|
||||
from src.char.Zhezhi import Zhezhi
|
||||
|
||||
|
||||
def get_char_by_pos(task, box, index, old_char):
|
||||
char_dict = {
|
||||
char_dict = {
|
||||
'char_yinlin': {'cls': Yinlin, 'res_cd': 12, 'echo_cd': 25},
|
||||
'char_verina': {'cls': Verina, 'res_cd': 12, 'echo_cd': 25},
|
||||
'char_shorekeeper': {'cls': ShoreKeeper, 'res_cd': 15, 'echo_cd': 25},
|
||||
@ -60,21 +58,24 @@ def get_char_by_pos(task, box, index, old_char):
|
||||
'char_brant': {'cls': Brant, 'res_cd': 4, 'echo_cd': 25, 'liberation_cd': 24},
|
||||
'char_cantarella': {'cls': Cantarella, 'res_cd': 10, 'echo_cd': 25, 'liberation_cd': 25},
|
||||
}
|
||||
|
||||
char_names = char_dict.keys()
|
||||
|
||||
def get_char_by_pos(task, box, index, old_char):
|
||||
highest_confidence = 0
|
||||
info = None
|
||||
name = "unknown"
|
||||
for char_name, char_info in char_dict.items():
|
||||
feature = task.find_one(char_name, box=box, threshold=0.6)
|
||||
# if feature:
|
||||
# task.log_info(f'found char {char_name} {feature.confidence} {highest_confidence}')
|
||||
if feature and feature.confidence > highest_confidence:
|
||||
highest_confidence = feature.confidence
|
||||
info = char_info
|
||||
name = char_name
|
||||
if info is not None:
|
||||
if old_char and old_char.char_name == name:
|
||||
char = None
|
||||
if old_char:
|
||||
char = task.find_one(old_char.char_name, box=box, threshold=0.6)
|
||||
if char:
|
||||
return old_char
|
||||
else:
|
||||
|
||||
if not char:
|
||||
char = task.find_best_match_in_box(box, char_names, threshold=0.6)
|
||||
if char:
|
||||
info = char_dict.get(char.name)
|
||||
name = char.name
|
||||
cls = info.get('cls')
|
||||
return cls(task, index, info.get('res_cd'), info.get('echo_cd'), info.get('liberation_cd') or 25,
|
||||
char_name=name)
|
||||
|
@ -25,12 +25,13 @@ class Roccia(BaseChar):
|
||||
self.last_intro = time.time()
|
||||
self.can_plunge = True
|
||||
return self.switch_next_char()
|
||||
self.click_liberation()
|
||||
liberated = self.click_liberation()
|
||||
if self.click_resonance()[0]:
|
||||
self.last_e = time.time()
|
||||
self.can_plunge = True
|
||||
return self.switch_next_char()
|
||||
self.plunge()
|
||||
if not liberated:
|
||||
self.plunge()
|
||||
if not self.click_resonance()[0]:
|
||||
self.click_echo()
|
||||
self.switch_next_char()
|
||||
@ -70,7 +71,7 @@ class Roccia(BaseChar):
|
||||
def plunge(self):
|
||||
start = time.time()
|
||||
starting_count = 0
|
||||
while (self.is_forte_full() and time.time() - start < 0.6) or (starting_count > 0 and time.time() - start < 5):
|
||||
while (self.is_forte_full() and time.time() - start < 1.1) or (starting_count > 0 and time.time() - start < 5):
|
||||
self.click(interval=0.1)
|
||||
if starting_count == 0:
|
||||
starting_count = self.get_plunge_count()
|
||||
|
@ -220,7 +220,7 @@ class BaseWWTask(BaseTask):
|
||||
return "s"
|
||||
|
||||
def find_treasure_icon(self):
|
||||
return self.find_one('treasure_icon', box=self.box_of_screen(0.1, 0.2, 0.9, 0.8))
|
||||
return self.find_one('treasure_icon', box=self.box_of_screen(0.1, 0.2, 0.9, 0.8), threshold=0.7)
|
||||
|
||||
def click(self, x=-1, y=-1, move_back=False, name=None, interval=-1, move=True, down_time=0.01, after_sleep=0, key="left"):
|
||||
if x == -1 and y == -1:
|
||||
|
@ -1,14 +1,14 @@
|
||||
import re
|
||||
import time
|
||||
|
||||
from ok import FindFeature, Logger
|
||||
from ok import OCR
|
||||
from ok import Logger
|
||||
|
||||
from src.task.BaseWWTask import BaseWWTask
|
||||
|
||||
logger = Logger.get_logger(__name__)
|
||||
|
||||
|
||||
class SkipBaseTask(BaseWWTask, FindFeature, OCR):
|
||||
class SkipBaseTask(BaseWWTask):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
20
tests/TestTacet.py
Normal file
20
tests/TestTacet.py
Normal file
@ -0,0 +1,20 @@
|
||||
import unittest
|
||||
from config import config
|
||||
from ok.test.TaskTestCase import TaskTestCase
|
||||
from src.task.TacetTask import TacetTask
|
||||
|
||||
config['debug'] = True
|
||||
|
||||
|
||||
class TestTacet(TaskTestCase):
|
||||
task_class = TacetTask
|
||||
config = config
|
||||
|
||||
def test_find_treasure_icon(self):
|
||||
self.set_image('tests/images/treasure.png')
|
||||
treasure = self.task.find_treasure_icon()
|
||||
self.logger.info(f'find_treasure_icon {treasure}')
|
||||
self.assertIsNotNone(treasure)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
BIN
tests/images/treasure.png
Normal file
BIN
tests/images/treasure.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 MiB |
Loading…
x
Reference in New Issue
Block a user