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,20 +78,37 @@ 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):
|
||||||
descending = np.sort(hp)[::-1]
|
count = np.count_nonzero(hp)
|
||||||
sort = np.argsort(hp)[::-1]
|
threshold = self.config.SCOUT_HP_DIFFERENCE_THRESHOLD
|
||||||
|
|
||||||
if descending[0] - descending[2] > self.config.SCOUT_HP_DIFFERENCE_THRESHOLD:
|
if count == 3:
|
||||||
if descending[1] - descending[2] > self.config.SCOUT_HP_DIFFERENCE_THRESHOLD:
|
descending = np.sort(hp)[::-1]
|
||||||
# 100% 70% 40%
|
sort = np.argsort(hp)[::-1]
|
||||||
order = [sort[0], sort[2], sort[1]]
|
if descending[0] - descending[2] > threshold:
|
||||||
|
if descending[1] - descending[2] > threshold:
|
||||||
|
# 100% 70% 40%
|
||||||
|
order = [sort[0], sort[2], sort[1]]
|
||||||
|
else:
|
||||||
|
# 100% 70% 60%
|
||||||
|
order = [sort[0], 1, 2]
|
||||||
|
order[sort[0]] = 0
|
||||||
else:
|
else:
|
||||||
# 100% 70% 60%
|
# 80% 80% 80%
|
||||||
order = [sort[0], 1, 2]
|
order = [0, 1, 2]
|
||||||
order[sort[0]] = 0
|
elif count == 2:
|
||||||
else:
|
if hp[1] - hp[0] > threshold:
|
||||||
# 80% 80% 80%
|
# 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]
|
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