mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-26 18:20:42 +00:00
Add: 增加先锋血量权重
- 修复12-4打大型练级不挑敌人时, 会开局撤退的问题
This commit is contained in:
parent
3eaa5c9bd8
commit
239590b2de
@ -65,7 +65,6 @@ class Campaign(CampaignBase):
|
||||
s3_enemy_count = 0
|
||||
non_s3_enemy_count = 0
|
||||
|
||||
|
||||
def check_s3_enemy(self):
|
||||
if self.battle_count == 0:
|
||||
self.s3_enemy_count = 0
|
||||
@ -74,7 +73,8 @@ class Campaign(CampaignBase):
|
||||
current = self.map.select(is_enemy=True, enemy_scale=3).count
|
||||
logger.attr('S3_enemy', current)
|
||||
|
||||
if self.battle_count == self.config.C124_NON_S3_ENTER_TOLERANCE:
|
||||
if self.battle_count == self.config.C124_NON_S3_ENTER_TOLERANCE \
|
||||
and self.config.C124_NON_S3_WITHDRAW_TOLERANCE < 10:
|
||||
if self.s3_enemy_count + current == 0:
|
||||
self.withdraw()
|
||||
elif self.battle_count > self.config.C124_NON_S3_ENTER_TOLERANCE:
|
||||
@ -94,5 +94,8 @@ class Campaign(CampaignBase):
|
||||
if self.clear_enemy(scale=(2,)):
|
||||
self.non_s3_enemy_count += 1
|
||||
return True
|
||||
if not self.map.select(is_enemy=True, may_boss=False):
|
||||
logger.info('No more enemies.')
|
||||
self.withdraw()
|
||||
|
||||
return self.battle_default()
|
||||
|
@ -37,6 +37,7 @@ hole_fleet_married_3 = no
|
||||
enable_hp_balance = no
|
||||
enable_low_hp_withdraw = no
|
||||
scout_hp_difference_threshold = 0.2
|
||||
scout_hp_weights = 1000,1000,1000
|
||||
low_hp_withdraw_threshold = 0.2
|
||||
enable_retirement = yes
|
||||
use_one_click_retirement = no
|
||||
|
@ -55,10 +55,12 @@ class HPBalancer(ModuleBase):
|
||||
Returns:
|
||||
list: HP(float) of 6 ship.
|
||||
"""
|
||||
self.hp = [self._calculate_hp(loca, SIZE) for loca in LOCATION]
|
||||
logger.attr(
|
||||
'HP', ' '.join([str(int(data*100)).rjust(3)+'%' for data in self.hp])
|
||||
)
|
||||
hp = [self._calculate_hp(loca, SIZE) for loca in LOCATION]
|
||||
scout = np.array(hp[3:]) * np.array(self.config.SCOUT_HP_WEIGHTS) / np.max(self.config.SCOUT_HP_WEIGHTS)
|
||||
self.hp = hp[:3] + scout.tolist()
|
||||
logger.attr('HP', ' '.join([str(int(data * 100)).rjust(3) + '%' for data in hp]))
|
||||
if np.sum(np.abs(np.diff(self.config.SCOUT_HP_WEIGHTS))) > 0:
|
||||
logger.attr('HP_weight', ' '.join([str(int(data * 100)).rjust(3) + '%' for data in self.hp]))
|
||||
return self.hp
|
||||
|
||||
def hp_init(self):
|
||||
|
@ -179,11 +179,14 @@ def main(ini_name=''):
|
||||
e3.add_argument('--全员已婚3', default=default('--全员已婚3'), choices=['是', '否'])
|
||||
|
||||
# 血量平衡
|
||||
balance = setting_parser.add_argument_group('血量平衡', '需关闭舰队锁定才能生效')
|
||||
balance.add_argument('--启用血量平衡', default=default('--启用血量平衡'), choices=['是', '否'])
|
||||
balance.add_argument('--启用低血量撤退', default=default('--启用低血量撤退'), choices=['是', '否'])
|
||||
balance.add_argument('--先锋血量平衡阈值', default=default('--先锋血量平衡阈值'), help='血量差值大于阈值时, 换位')
|
||||
balance.add_argument('--低血量撤退阈值', default=default('--低血量撤退阈值'), help='任意一人血量低于阈值时, 撤退')
|
||||
hp = setting_parser.add_argument_group('血量控制', '需关闭舰队锁定才能生效')
|
||||
hp.add_argument('--启用血量平衡', default=default('--启用血量平衡'), choices=['是', '否'])
|
||||
hp.add_argument('--启用低血量撤退', default=default('--启用低血量撤退'), choices=['是', '否'])
|
||||
hp_balance = hp.add_argument_group('血量平衡', '')
|
||||
hp_balance.add_argument('--先锋血量平衡阈值', default=default('--先锋血量平衡阈值'), help='血量差值大于阈值时, 换位')
|
||||
hp_balance.add_argument('--先锋血量权重', default=default('--先锋血量权重'), help='先锋肉度有差别时应修改, 格式 1000,1000,1000')
|
||||
hp_withdraw = hp.add_argument_group('低血量撤退', '')
|
||||
hp_withdraw.add_argument('--低血量撤退阈值', default=default('--低血量撤退阈值'), help='任意一人血量低于阈值时, 撤退')
|
||||
|
||||
# 退役选项
|
||||
retire = setting_parser.add_argument_group('退役设置', '')
|
||||
|
@ -94,6 +94,7 @@ class AzurLaneConfig:
|
||||
ENABLE_HP_BALANCE = False
|
||||
ENABLE_LOW_HP_WITHDRAW = True
|
||||
SCOUT_HP_DIFFERENCE_THRESHOLD = 0.2
|
||||
SCOUT_HP_WEIGHTS = [1000, 1000, 1000]
|
||||
LOW_HP_WITHDRAW_THRESHOLD = 0.2
|
||||
|
||||
"""
|
||||
@ -414,6 +415,7 @@ class AzurLaneConfig:
|
||||
self.ENABLE_HP_BALANCE = to_bool(option['enable_hp_balance'])
|
||||
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_WEIGHTS = to_list(option['scout_hp_weights'])
|
||||
self.LOW_HP_WITHDRAW_THRESHOLD = float(option['low_hp_withdraw_threshold'])
|
||||
self.ENABLE_SAVE_GET_ITEMS = to_bool(option['enable_drop_screenshot'])
|
||||
self.SCREEN_SHOT_SAVE_FOLDER_BASE = option['drop_screenshot_folder']
|
||||
|
@ -72,6 +72,7 @@ dic_chi_to_eng = {
|
||||
'启用血量平衡': 'enable_hp_balance',
|
||||
'启用低血量撤退': 'enable_low_hp_withdraw',
|
||||
'先锋血量平衡阈值': 'scout_hp_difference_threshold',
|
||||
'先锋血量权重': 'scout_hp_weights',
|
||||
'低血量撤退阈值': 'low_hp_withdraw_threshold',
|
||||
'启用退役': 'enable_retirement',
|
||||
'使用一键退役': 'use_one_click_retirement',
|
||||
|
Loading…
Reference in New Issue
Block a user