Skip to content

Commit

Permalink
fix encore
Browse files Browse the repository at this point in the history
  • Loading branch information
ok-oldking committed Jul 6, 2024
1 parent 7656ecf commit 3adc253
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
15 changes: 13 additions & 2 deletions src/char/BaseChar.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,22 @@ def get_current_con(self):
return percent

def is_forte_full(self):
box = self.task.box_of_screen(2251 / 3840, 1993 / 2160, 2271 / 3840, 2016 / 2160, name='forte_full')
box = self.task.box_of_screen(2251 / 3840, 1993 / 2160, 2311 / 3840, 2016 / 2160, name='forte_full')
white_percent = self.task.calculate_color_percentage(forte_white_color, box)
# num_labels, stats = get_connected_area_by_color(box.crop_frame(self.task.frame), forte_white_color,
# connectivity=8)
# total_area = 0
# for i in range(1, num_labels):
# # Check if the connected co mponent touches the border
# left, top, width, height, area = stats[i]
# total_area += area
# white_percent = total_area / box.width / box.height
if self.task.debug:
self.task.screenshot(f'{self}_forte_{white_percent}')
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.2
self._is_forte_full = white_percent > 0.08
return self._is_forte_full

def liberation_available(self):
Expand Down
13 changes: 7 additions & 6 deletions src/char/Encore.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ def do_perform(self):
self.sleep(0.4)
self.n4()
self.click_resonance()
if self.is_forte_full():
self.logger.info('Encore is_forte_full cast')
self.sleep(2)
self.heavy_attack()
self.last_heavy = time.time()
# full = self.is_forte_full()
# if full:
# self.logger.info('Encore is_forte_full cast')
# self.sleep(2)
# self.heavy_attack()
# self.last_heavy = time.time()
elif self.resonance_available():
self.click_resonance()
elif self.echo_available():
Expand All @@ -42,4 +43,4 @@ def do_get_switch_priority(self, current_char: BaseChar, has_intro=False):
return super().do_get_switch_priority(current_char, has_intro)

def n4(self):
self.continues_normal_attack(2.5)
self.continues_normal_attack(2.4)

0 comments on commit 3adc253

Please sign in to comment.