mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-27 02:27:12 +00:00
Add: 增加使用紧急维修
This commit is contained in:
parent
239590b2de
commit
db8c01431e
BIN
assets/combat/EMERGENCY_REPAIR_AVAILABLE.BUTTON.png
Normal file
BIN
assets/combat/EMERGENCY_REPAIR_AVAILABLE.BUTTON.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.0 KiB |
BIN
assets/combat/EMERGENCY_REPAIR_AVAILABLE.png
Normal file
BIN
assets/combat/EMERGENCY_REPAIR_AVAILABLE.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.4 KiB |
BIN
assets/combat/EMERGENCY_REPAIR_CONFIRM.png
Normal file
BIN
assets/combat/EMERGENCY_REPAIR_CONFIRM.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
@ -37,6 +37,8 @@ hole_fleet_married_3 = no
|
|||||||
enable_hp_balance = no
|
enable_hp_balance = no
|
||||||
enable_low_hp_withdraw = no
|
enable_low_hp_withdraw = no
|
||||||
scout_hp_difference_threshold = 0.2
|
scout_hp_difference_threshold = 0.2
|
||||||
|
emergency_repair_single_threshold = 0.3
|
||||||
|
emergency_repair_hole_threshold = 0.6
|
||||||
scout_hp_weights = 1000,1000,1000
|
scout_hp_weights = 1000,1000,1000
|
||||||
low_hp_withdraw_threshold = 0.2
|
low_hp_withdraw_threshold = 0.2
|
||||||
enable_retirement = yes
|
enable_retirement = yes
|
||||||
|
@ -15,6 +15,8 @@ BATTLE_STATUS_A = Button(area=(622, 266, 732, 288), color=(235, 227, 111), butto
|
|||||||
BATTLE_STATUS_S = Button(area=(633, 297, 722, 320), color=(233, 241, 127), button=(1000, 631, 1055, 689), file='./assets/combat/BATTLE_STATUS_S.png')
|
BATTLE_STATUS_S = Button(area=(633, 297, 722, 320), color=(233, 241, 127), button=(1000, 631, 1055, 689), file='./assets/combat/BATTLE_STATUS_S.png')
|
||||||
COMBAT_AUTO = Button(area=(136, 573, 167, 604), color=(229, 242, 255), button=(136, 573, 167, 604), file='./assets/combat/COMBAT_AUTO.png')
|
COMBAT_AUTO = Button(area=(136, 573, 167, 604), color=(229, 242, 255), button=(136, 573, 167, 604), file='./assets/combat/COMBAT_AUTO.png')
|
||||||
COMBAT_AUTO_SWITCH = Button(area=(18, 38, 36, 56), color=(179, 198, 235), button=(18, 38, 36, 56), file='./assets/combat/COMBAT_AUTO_SWITCH.png')
|
COMBAT_AUTO_SWITCH = Button(area=(18, 38, 36, 56), color=(179, 198, 235), button=(18, 38, 36, 56), file='./assets/combat/COMBAT_AUTO_SWITCH.png')
|
||||||
|
EMERGENCY_REPAIR_AVAILABLE = Button(area=(106, 533, 119, 540), color=(255, 255, 255), button=(97, 512, 141, 557), file='./assets/combat/EMERGENCY_REPAIR_AVAILABLE.png')
|
||||||
|
EMERGENCY_REPAIR_CONFIRM = Button(area=(669, 418, 842, 475), color=(94, 143, 204), button=(669, 418, 842, 475), file='./assets/combat/EMERGENCY_REPAIR_CONFIRM.png')
|
||||||
EXP_INFO_A = Button(area=(389, 100, 444, 116), color=(236, 231, 116), button=(1000, 631, 1055, 689), file='./assets/combat/EXP_INFO_A.png')
|
EXP_INFO_A = Button(area=(389, 100, 444, 116), color=(236, 231, 116), button=(1000, 631, 1055, 689), file='./assets/combat/EXP_INFO_A.png')
|
||||||
EXP_INFO_S = Button(area=(396, 122, 457, 137), color=(233, 241, 127), button=(1000, 631, 1055, 689), file='./assets/combat/EXP_INFO_S.png')
|
EXP_INFO_S = Button(area=(396, 122, 457, 137), color=(233, 241, 127), button=(1000, 631, 1055, 689), file='./assets/combat/EXP_INFO_S.png')
|
||||||
GET_ITEMS_1 = Button(area=(538, 217, 741, 253), color=(160, 192, 248), button=(1000, 631, 1055, 689), file='./assets/combat/GET_ITEMS_1.png')
|
GET_ITEMS_1 = Button(area=(538, 217, 741, 253), color=(160, 192, 248), button=(1000, 631, 1055, 689), file='./assets/combat/GET_ITEMS_1.png')
|
||||||
|
@ -101,28 +101,19 @@ class Combat(HPBalancer, EnemySearchingHandler, Retirement, SubmarineCall, Comba
|
|||||||
while 1:
|
while 1:
|
||||||
self.device.screenshot()
|
self.device.screenshot()
|
||||||
|
|
||||||
# Automation.
|
|
||||||
if self.appear(BATTLE_PREPARATION):
|
if self.appear(BATTLE_PREPARATION):
|
||||||
# if self.handle_combat_automation_confirm():
|
|
||||||
# continue
|
|
||||||
if self.handle_combat_automation_set(auto=auto):
|
if self.handle_combat_automation_set(auto=auto):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Retirement
|
|
||||||
if self.handle_retirement():
|
if self.handle_retirement():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Emotion
|
|
||||||
if self.handle_combat_low_emotion():
|
if self.handle_combat_low_emotion():
|
||||||
continue
|
continue
|
||||||
|
if self.handle_emergency_repair_use():
|
||||||
# Combat start
|
continue
|
||||||
if self.appear_then_click(BATTLE_PREPARATION, interval=2):
|
if self.appear_then_click(BATTLE_PREPARATION, interval=2):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if self.handle_combat_automation_confirm():
|
if self.handle_combat_automation_confirm():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if self.handle_story_skip():
|
if self.handle_story_skip():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -165,6 +156,21 @@ class Combat(HPBalancer, EnemySearchingHandler, Retirement, SubmarineCall, Comba
|
|||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def handle_emergency_repair_use(self):
|
||||||
|
if self.appear_then_click(EMERGENCY_REPAIR_CONFIRM, offset=True):
|
||||||
|
self.device.sleep(0.5) # Animation: hp increase and emergency_repair amount decrease.
|
||||||
|
return True
|
||||||
|
if self.appear(EMERGENCY_REPAIR_AVAILABLE):
|
||||||
|
logger.info('EMERGENCY_REPAIR_AVAILABLE')
|
||||||
|
if np.min(np.array(self.hp)[np.array(self.hp) > 0.001]) < self.config.EMERGENCY_REPAIR_SINGLE_THRESHOLD \
|
||||||
|
or np.max(self.hp[:3]) < self.config.EMERGENCY_REPAIR_HOLE_THRESHOLD \
|
||||||
|
or np.max(self.hp[3:]) < self.config.EMERGENCY_REPAIR_HOLE_THRESHOLD:
|
||||||
|
logger.info('Use emergency repair')
|
||||||
|
self.device.click(EMERGENCY_REPAIR_AVAILABLE)
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
def combat_execute(self, func=None, call_submarine_at_boss=False, save_get_items=False):
|
def combat_execute(self, func=None, call_submarine_at_boss=False, save_get_items=False):
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
|
@ -185,6 +185,9 @@ def main(ini_name=''):
|
|||||||
hp_balance = hp.add_argument_group('血量平衡', '')
|
hp_balance = hp.add_argument_group('血量平衡', '')
|
||||||
hp_balance.add_argument('--先锋血量平衡阈值', default=default('--先锋血量平衡阈值'), help='血量差值大于阈值时, 换位')
|
hp_balance.add_argument('--先锋血量平衡阈值', default=default('--先锋血量平衡阈值'), help='血量差值大于阈值时, 换位')
|
||||||
hp_balance.add_argument('--先锋血量权重', default=default('--先锋血量权重'), help='先锋肉度有差别时应修改, 格式 1000,1000,1000')
|
hp_balance.add_argument('--先锋血量权重', default=default('--先锋血量权重'), help='先锋肉度有差别时应修改, 格式 1000,1000,1000')
|
||||||
|
hp_add = hp.add_argument_group('紧急维修', '')
|
||||||
|
hp_add.add_argument('--紧急维修单人阈值', default=default('--紧急维修单人阈值'), help='单人低于阈值时使用')
|
||||||
|
hp_add.add_argument('--紧急维修全队阈值', default=default('--紧急维修全队阈值'), help='前排全部或后排全部低于阈值时使用')
|
||||||
hp_withdraw = hp.add_argument_group('低血量撤退', '')
|
hp_withdraw = hp.add_argument_group('低血量撤退', '')
|
||||||
hp_withdraw.add_argument('--低血量撤退阈值', default=default('--低血量撤退阈值'), help='任意一人血量低于阈值时, 撤退')
|
hp_withdraw.add_argument('--低血量撤退阈值', default=default('--低血量撤退阈值'), help='任意一人血量低于阈值时, 撤退')
|
||||||
|
|
||||||
|
@ -95,6 +95,8 @@ class AzurLaneConfig:
|
|||||||
ENABLE_LOW_HP_WITHDRAW = True
|
ENABLE_LOW_HP_WITHDRAW = True
|
||||||
SCOUT_HP_DIFFERENCE_THRESHOLD = 0.2
|
SCOUT_HP_DIFFERENCE_THRESHOLD = 0.2
|
||||||
SCOUT_HP_WEIGHTS = [1000, 1000, 1000]
|
SCOUT_HP_WEIGHTS = [1000, 1000, 1000]
|
||||||
|
EMERGENCY_REPAIR_SINGLE_THRESHOLD = 0.3
|
||||||
|
EMERGENCY_REPAIR_HOLE_THRESHOLD = 0.6
|
||||||
LOW_HP_WITHDRAW_THRESHOLD = 0.2
|
LOW_HP_WITHDRAW_THRESHOLD = 0.2
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -416,6 +418,8 @@ class AzurLaneConfig:
|
|||||||
self.ENABLE_LOW_HP_WITHDRAW = to_bool(option['enable_low_hp_withdraw'])
|
self.ENABLE_LOW_HP_WITHDRAW = to_bool(option['enable_low_hp_withdraw'])
|
||||||
self.SCOUT_HP_DIFFERENCE_THRESHOLD = float(option['scout_hp_difference_threshold'])
|
self.SCOUT_HP_DIFFERENCE_THRESHOLD = float(option['scout_hp_difference_threshold'])
|
||||||
self.SCOUT_HP_WEIGHTS = to_list(option['scout_hp_weights'])
|
self.SCOUT_HP_WEIGHTS = to_list(option['scout_hp_weights'])
|
||||||
|
self.EMERGENCY_REPAIR_SINGLE_THRESHOLD = float(option['emergency_repair_single_threshold'])
|
||||||
|
self.EMERGENCY_REPAIR_HOLE_THRESHOLD = float(option['emergency_repair_hole_threshold'])
|
||||||
self.LOW_HP_WITHDRAW_THRESHOLD = float(option['low_hp_withdraw_threshold'])
|
self.LOW_HP_WITHDRAW_THRESHOLD = float(option['low_hp_withdraw_threshold'])
|
||||||
self.ENABLE_SAVE_GET_ITEMS = to_bool(option['enable_drop_screenshot'])
|
self.ENABLE_SAVE_GET_ITEMS = to_bool(option['enable_drop_screenshot'])
|
||||||
self.SCREEN_SHOT_SAVE_FOLDER_BASE = option['drop_screenshot_folder']
|
self.SCREEN_SHOT_SAVE_FOLDER_BASE = option['drop_screenshot_folder']
|
||||||
|
@ -73,6 +73,8 @@ dic_chi_to_eng = {
|
|||||||
'启用低血量撤退': 'enable_low_hp_withdraw',
|
'启用低血量撤退': 'enable_low_hp_withdraw',
|
||||||
'先锋血量平衡阈值': 'scout_hp_difference_threshold',
|
'先锋血量平衡阈值': 'scout_hp_difference_threshold',
|
||||||
'先锋血量权重': 'scout_hp_weights',
|
'先锋血量权重': 'scout_hp_weights',
|
||||||
|
'紧急维修单人阈值': 'emergency_repair_single_threshold',
|
||||||
|
'紧急维修全队阈值': 'emergency_repair_hole_threshold',
|
||||||
'低血量撤退阈值': 'low_hp_withdraw_threshold',
|
'低血量撤退阈值': 'low_hp_withdraw_threshold',
|
||||||
'启用退役': 'enable_retirement',
|
'启用退役': 'enable_retirement',
|
||||||
'使用一键退役': 'use_one_click_retirement',
|
'使用一键退役': 'use_one_click_retirement',
|
||||||
|
Loading…
Reference in New Issue
Block a user