mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-27 02:27:12 +00:00
Fix: 修复先锋未上满时血量平衡出错的问题
This commit is contained in:
parent
75254b6599
commit
39ab5776c8
@ -78,11 +78,14 @@ class HPBalancer(ModuleBase):
|
|||||||
self.device.drag(p1=SCOUT_POSITION[p1], p2=SCOUT_POSITION[p2], segments=3)
|
self.device.drag(p1=SCOUT_POSITION[p1], p2=SCOUT_POSITION[p2], segments=3)
|
||||||
|
|
||||||
def _expected_scout_order(self, hp):
|
def _expected_scout_order(self, hp):
|
||||||
|
count = np.count_nonzero(hp)
|
||||||
|
threshold = self.config.SCOUT_HP_DIFFERENCE_THRESHOLD
|
||||||
|
|
||||||
|
if count == 3:
|
||||||
descending = np.sort(hp)[::-1]
|
descending = np.sort(hp)[::-1]
|
||||||
sort = np.argsort(hp)[::-1]
|
sort = np.argsort(hp)[::-1]
|
||||||
|
if descending[0] - descending[2] > threshold:
|
||||||
if descending[0] - descending[2] > self.config.SCOUT_HP_DIFFERENCE_THRESHOLD:
|
if descending[1] - descending[2] > threshold:
|
||||||
if descending[1] - descending[2] > self.config.SCOUT_HP_DIFFERENCE_THRESHOLD:
|
|
||||||
# 100% 70% 40%
|
# 100% 70% 40%
|
||||||
order = [sort[0], sort[2], sort[1]]
|
order = [sort[0], sort[2], sort[1]]
|
||||||
else:
|
else:
|
||||||
@ -92,6 +95,20 @@ class HPBalancer(ModuleBase):
|
|||||||
else:
|
else:
|
||||||
# 80% 80% 80%
|
# 80% 80% 80%
|
||||||
order = [0, 1, 2]
|
order = [0, 1, 2]
|
||||||
|
elif count == 2:
|
||||||
|
if hp[1] - hp[0] > threshold:
|
||||||
|
# 70% 100% 0%
|
||||||
|
order = [1, 0, 2]
|
||||||
|
else:
|
||||||
|
# 100% 70% 0%
|
||||||
|
order = [0, 1, 2]
|
||||||
|
elif count == 1:
|
||||||
|
# 80% 0% 0%
|
||||||
|
order = [0, 1, 2]
|
||||||
|
else:
|
||||||
|
logger.warning(f'HP invalid: {hp}')
|
||||||
|
order = [0, 1, 2]
|
||||||
|
|
||||||
return order
|
return order
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
Loading…
Reference in New Issue
Block a user