StarRailCopilot/tasks/combat/prepare.py

34 lines
875 B
Python
Raw Normal View History

from module.ocr.ocr import Digit, DigitCounter
2023-06-15 14:12:47 +00:00
from tasks.base.ui import UI
from tasks.combat.assets.assets_combat_prepare import (
OCR_TRAILBLAZE_POWER,
OCR_WAVE_COUNT,
WAVE_MINUS,
WAVE_PLUS
)
2023-06-15 14:12:47 +00:00
class CombatPrepare(UI):
def combat_set_wave(self, count=6):
"""
Args:
count: 1 to 6
Pages:
in: COMBAT_PREPARE
2023-06-15 14:12:47 +00:00
"""
self.ui_ensure_index(
count, letter=Digit(OCR_WAVE_COUNT),
2023-06-15 14:12:47 +00:00
next_button=WAVE_PLUS, prev_button=WAVE_MINUS,
skip_first_screenshot=True
)
def combat_get_trailblaze_power(self) -> int:
"""
Pages:
in: COMBAT_PREPARE or COMBAT_REPEAT
"""
current, _, _ = DigitCounter(OCR_TRAILBLAZE_POWER).ocr_single_line(self.device.image)
self.state.TrailblazePower = current
return current