mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-26 18:20:42 +00:00
Fix: Enemy detection
- Log shows 'E' and wrong prediction is_siren, because attributes are kept to the next detection - Fix missing predict also - Fix log show DEFAULT_BUTTON for the entrance of campaign
This commit is contained in:
parent
589419ea91
commit
83508b94d3
@ -66,7 +66,10 @@ class CampaignUI(UI, CampaignOcr):
|
||||
if name not in self.stage_entrance:
|
||||
logger.warning(f'Stage not found: {name}')
|
||||
raise CampaignNameError
|
||||
return self.stage_entrance[name]
|
||||
|
||||
entrance = self.stage_entrance[name]
|
||||
entrance.name = name
|
||||
return entrance
|
||||
|
||||
def ensure_campaign_ui(self, name, mode='normal'):
|
||||
"""
|
||||
|
@ -211,3 +211,16 @@ class GridInfo:
|
||||
self.is_current_fleet = False
|
||||
self.is_submarine = False
|
||||
self.is_cleared = False
|
||||
|
||||
def covered_grid(self):
|
||||
"""Relative coordinate of the covered grid.
|
||||
|
||||
Returns:
|
||||
list[tuple]:
|
||||
"""
|
||||
if self.is_current_fleet:
|
||||
return [(0, -1), (0, -2)]
|
||||
if self.is_fleet or self.is_siren or self.is_mystery:
|
||||
return [(0, -1)]
|
||||
|
||||
return []
|
||||
|
@ -104,6 +104,7 @@ class Grids(Perspective):
|
||||
image = self._image_clear_ui(image)
|
||||
self.image = image
|
||||
for grid in self:
|
||||
grid.reset()
|
||||
grid.image = image
|
||||
|
||||
def _image_clear_ui(self, image):
|
||||
|
@ -408,14 +408,7 @@ class CampaignMap:
|
||||
missing[attr] -= 1
|
||||
|
||||
for grid in self:
|
||||
if not grid.is_fleet and not grid.is_mystery and not grid.is_siren:
|
||||
continue
|
||||
|
||||
cover = [(0, -1)]
|
||||
if grid.is_current_fleet:
|
||||
cover.append((0, -2))
|
||||
|
||||
for upper in cover:
|
||||
for upper in grid.covered_grid():
|
||||
upper = tuple(np.array(grid.location) + upper)
|
||||
if upper in self:
|
||||
upper = self[upper]
|
||||
@ -451,14 +444,7 @@ class CampaignMap:
|
||||
|
||||
# predict
|
||||
for grid in self:
|
||||
if not grid.is_fleet and not grid.is_mystery:
|
||||
continue
|
||||
|
||||
cover = [(0, -1)]
|
||||
if grid.is_current_fleet:
|
||||
cover.append((0, -2))
|
||||
|
||||
for upper in cover:
|
||||
for upper in grid.covered_grid():
|
||||
upper = tuple(np.array(grid.location) + upper)
|
||||
if upper in self:
|
||||
upper = self[upper]
|
||||
|
Loading…
Reference in New Issue
Block a user