卡包: 体系分不再把 P 不过去的包抬上来(I-19); 拖拽兜底拆成独立补丁(I-20)

Browse Source
- I-19 用户「老是选择 p 不过去的包」: AALC 表里负分 = Boss 难打/拖时间(绝望骑士、时间杀人魔、卡塞蒂 -5),
  体系分 +6 直接加上去 -5 变 +1, 震颤队每局 3/4 层去打憎恶与绝望/时间杀人时间(3 层 16.7 分钟 vs 同层 8~11)。
  现在卡包在 AALC 的原权重 < THEME_PACK_LIFT_MIN(0) 时体系分只折成 ±0.9 小数, 同档排先后、不跨档;
  0 分及以上照旧加满; 兔子洞路线分不变。权重可能是小数(绝望 -5→-4.4)。
  回放 11-15~11-21 的 61 次选包: 15 次改选(全是 3/4/5 层的憎恶与绝望/时间杀人时间)。
- I-20 fb7a0ec 的拖拽兜底挂在加分补丁里: 加分关掉/没体系时不生效, 且拖完马上截图会把转场中的成功也当失败。
  改成 install_theme_pack_drag_retry 单独装: 3 秒内每 0.5 秒看「刷新」, 消失即确认, 一直在才下移 160(1440 标定)再拖。
- theme_pack_systems.json 说明同步; ISSUES 记 I-19/I-20。

单测: 795 passed(新增 test_theme_pack_drag_retry 9 例, test_theme_pack_systems +3)。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
yws
2026-11-22 09:10:36 +00:00
co-authored by Claude Opus 5.5
parent fb7a0ecfdc
commit 4db3cd2605
6 changed files with 305 additions and 62 deletions
+54 -22
View File
@@ -88,6 +88,17 @@ class ThemePackTableTest(unittest.TestCase):
self.assertEqual(ap.theme_pack_bonus(dict(self.by_name['被遗忘者们'], route=5), None, b), 5) self.assertEqual(ap.theme_pack_bonus(dict(self.by_name['被遗忘者们'], route=5), None, b), 5)
self.assertEqual(ap.theme_pack_bonus(dict(self.by_name['憎恶与绝望'], route=2), 'charge', b), 6) # 取大的 self.assertEqual(ap.theme_pack_bonus(dict(self.by_name['憎恶与绝望'], route=2), 'charge', b), 6) # 取大的
self.assertEqual(ap.theme_pack_bonus(self.by_name['憎恶与绝望'], None, b), 0) self.assertEqual(ap.theme_pack_bonus(self.by_name['憎恶与绝望'], None, b), 0)
# 路线分不看难度档: 兔子洞 4 层就是要去打 -5 的憎恶与绝望
self.assertEqual(ap.theme_pack_bonus(dict(self.by_name['憎恶与绝望'], route=12), None, b, base=-5), 12)
def test_hard_packs_only_get_a_tiebreak(self):
# ISSUES I-19: AALC 负分 = 难打/拖时间, 体系分折成 ±0.9 以内, 不跨 AALC 的整数档
b = self.bonus
self.assertEqual(ap.theme_pack_bonus(self.by_name['憎恶与绝望'], 'tremor', b, base=-5), 0.6)
self.assertEqual(ap.theme_pack_bonus(self.by_name['WARP快车谋杀案'], 'bleed', b, base=-5), 0.1)
self.assertEqual(ap.theme_pack_bonus(self.by_name['自动工厂'], 'charge', b, base=-2), -0.3)
self.assertEqual(ap.theme_pack_bonus(self.by_name['憎恶与绝望'], 'tremor', b, base=0), 6)
self.assertEqual(ap.theme_pack_bonus(self.by_name['憎恶与绝望'], 'bleed', b, base=-5), 0)
def test_bonus_tiers(self): def test_bonus_tiers(self):
self.assertEqual(ap.theme_pack_bonus(self.by_name['电闪雷鸣'], 'charge', self.bonus), 6) self.assertEqual(ap.theme_pack_bonus(self.by_name['电闪雷鸣'], 'charge', self.bonus), 6)
@@ -128,13 +139,15 @@ class BoostTest(unittest.TestCase):
def test_charge_team_in_normal_mode(self): def test_charge_team_in_normal_mode(self):
weights = example_weights('theme_pack_list_cn') weights = example_weights('theme_pack_list_cn')
result, info = self.boost(weights, 'charge') result, info = self.boost(weights, 'charge')
self.assertEqual((result['谋杀'], result['开店']), (1, 1)) # WARP 专属 5 件充能, 开店 2 件 # WARP 专属 5 件充能、开店 2 件、绝望/绞丝社区推荐, 但 AALC 判成难打(负分): 只在同档里往前挪, 到不了 0
self.assertEqual((result['绝望'], result['绞丝']), (1, 1)) # 社区推荐 self.assertEqual((result['谋杀'], result['开店']), (-4.4, -2.6))
self.assertEqual((result['绝望'], result['绞丝']), (-4.4, -4.4))
self.assertEqual(result['赌徒'], 0) self.assertEqual(result['赌徒'], 0)
self.assertEqual((result['遗忘'], result['自动']), (-3, -5)) # 速刷攻略说拖时间 self.assertEqual((result['遗忘'], result['自动']), (-3, -2.3)) # 速刷攻略说拖时间; 自动工厂本来就是 -2
self.assertEqual(result['地狱鸡'], 1) self.assertEqual(result['地狱鸡'], 1)
self.assertEqual(info['谋杀'], {'packs': ['WARP快车谋杀案', 'WARP快车谋杀案 复刻'], 'system': 'charge', self.assertEqual(info['谋杀'], {'packs': ['WARP快车谋杀案', 'WARP快车谋杀案 复刻'], 'system': 'charge',
'from': -5, 'to': 1}) 'from': -5, 'to': -4.4})
self.assertLess(max(v for k, v in result.items() if k in info and info[k]['from'] < 0), 0)
self.assertEqual(set(result), set(weights) | {k for k in info if k not in weights}) self.assertEqual(set(result), set(weights) | {k for k in info if k not in weights})
# 加过分的键排在最前面 # 加过分的键排在最前面
self.assertEqual(list(result)[:len(info)], list(info)) self.assertEqual(list(result)[:len(info)], list(info))
@@ -151,8 +164,8 @@ class BoostTest(unittest.TestCase):
def test_shared_key_takes_the_smaller_bonus_and_the_reprint_gets_its_full_name(self): def test_shared_key_takes_the_smaller_bonus_and_the_reprint_gets_its_full_name(self):
# 「谋杀」同时命中原版(流血 1 件)和复刻(流血 3 件) # 「谋杀」同时命中原版(流血 1 件)和复刻(流血 3 件)
result, info = self.boost(example_weights('theme_pack_list_cn'), 'bleed') result, info = self.boost(example_weights('theme_pack_list_cn'), 'bleed')
self.assertEqual(result['谋杀'], -4) self.assertEqual(result['谋杀'], -4.9)
self.assertEqual(result['WARP快车谋杀案 复刻'], 1) self.assertEqual(result['WARP快车谋杀案 复刻'], -4.4)
order = list(result) order = list(result)
self.assertLess(order.index('WARP快车谋杀案 复刻'), order.index('谋杀')) self.assertLess(order.index('WARP快车谋杀案 复刻'), order.index('谋杀'))
@@ -165,25 +178,28 @@ class BoostTest(unittest.TestCase):
self.assertNotIn('区的奇', info) self.assertNotIn('区的奇', info)
def test_pack_unknown_to_aalc_starts_from_the_unknown_weight(self): def test_pack_unknown_to_aalc_starts_from_the_unknown_weight(self):
# AALC 没收录的卡包按「未知」算, 也就是当成难打的: 只比别的 -5 包靠前
packs = [pack('黎明后贯穿而来之楔', pierce=3)] packs = [pack('黎明后贯穿而来之楔', pierce=3)]
result, info = self.boost({'遗忘': 0, '未知': -5}, 'pierce', packs=packs) result, info = self.boost({'遗忘': 0, '未知': -5}, 'pierce', packs=packs)
self.assertEqual(result['黎明后贯穿而来之楔'], 1) self.assertEqual(result['黎明后贯穿而来之楔'], -4.4)
self.assertEqual(result['未知'], -5) self.assertEqual(result['未知'], -5)
result, info = self.boost({'遗忘': 0, '未知': 0}, 'pierce', packs=packs)
self.assertEqual(result['黎明后贯穿而来之楔'], 6)
def test_english_keys(self): def test_english_keys(self):
packs = [pack('WARP快车谋杀案', 'Murder on the WARP Express', charge=5), packs = [pack('WARP快车谋杀案', 'Murder on the WARP Express', charge=5),
pack('电闪雷鸣', 'Thunder and Lightning', featured=['charge']), pack('电闪雷鸣', 'Thunder and Lightning', featured=['charge']),
pack('被遗忘者们', 'The Forgotten')] pack('被遗忘者们', 'The Forgotten')]
result, _ = self.boost({'forgot': 0, 'warp': -5, 'thunder': 0, 'unknown': -5}, 'charge', 'en', packs) result, _ = self.boost({'forgot': 0, 'warp': -5, 'thunder': 0, 'unknown': -5}, 'charge', 'en', packs)
self.assertEqual(result, {'thunder': 6, 'warp': 1, 'forgot': 0, 'unknown': -5}) self.assertEqual(result, {'thunder': 6, 'warp': -4.4, 'forgot': 0, 'unknown': -5})
def test_unrelated_keys_keep_their_weight(self): def test_unrelated_keys_keep_their_weight(self):
weights = {'信仰': 0, '赌徒': -1} weights = {'信仰': 0, '赌徒': -1}
result, info = self.boost(weights, 'charge') result, info = self.boost(weights, 'charge')
self.assertEqual((result['信仰'], result['赌徒']), (0, -1)) self.assertEqual((result['信仰'], result['赌徒']), (0, -1))
self.assertNotIn('信仰', info) self.assertNotIn('信仰', info)
# 表里没有的充能卡包补全名键, 从「未知」(表里也没有就 -5)起算 # 表里没有的充能卡包补全名键, 从「未知」(表里也没有就 -5)起算, 按难打的算
self.assertEqual(result['电闪雷鸣'], 1) self.assertEqual(result['电闪雷鸣'], -4.4)
@unittest.skipUnless(EXAMPLE.is_file(), 'vendor/aalc 子模块未检出') @unittest.skipUnless(EXAMPLE.is_file(), 'vendor/aalc 子模块未检出')
def test_packs_missing_from_the_difficulty_do_not_block_a_key(self): def test_packs_missing_from_the_difficulty_do_not_block_a_key(self):
@@ -203,7 +219,7 @@ class BoostTest(unittest.TestCase):
self.assertEqual(result['遗忘'], 0) # 遗忘的工厂 不减分, 有加有不加就不动短键 self.assertEqual(result['遗忘'], 0) # 遗忘的工厂 不减分, 有加有不加就不动短键
self.assertEqual(result['被遗忘者们'], -3) # 改用全名 self.assertEqual(result['被遗忘者们'], -3) # 改用全名
self.assertEqual(result['工厂'], -2) self.assertEqual(result['工厂'], -2)
self.assertEqual(result['自动工厂'], -5) self.assertEqual(result['自动工厂'], -2.3) # AALC 已经是 -2, 「拖时间」只在同档里往后排
def test_system_without_any_pack_changes_nothing(self): def test_system_without_any_pack_changes_nothing(self):
packs = [pack('被遗忘者们'), pack('电闪雷鸣', featured=['charge'])] packs = [pack('被遗忘者们'), pack('电闪雷鸣', featured=['charge'])]
@@ -299,12 +315,24 @@ class UpstreamSelectThemePackTest(unittest.TestCase):
def test_upstream_takes_the_leftmost_of_equal_weights(self): def test_upstream_takes_the_leftmost_of_equal_weights(self):
self.assertEqual(self.play(self.FLOOR4, 'charge', patched=False)[0], '落泪者们') self.assertEqual(self.play(self.FLOOR4, 'charge', patched=False)[0], '落泪者们')
def test_charge_team_takes_the_charge_pack(self): def test_charge_team_does_not_fight_a_hard_boss_for_its_gifts(self):
# ISSUES I-19: 原来 WARP(-5, 卡塞蒂)对充能队加到 1, 压过 0 分的落泪者们
picked, _, _ = self.play(self.FLOOR4, 'charge') picked, _, _ = self.play(self.FLOOR4, 'charge')
self.assertEqual(picked, 'WARP快车谋杀案') self.assertEqual(picked, '落泪者们')
self.assertIn('patch: 镜牢卡包按体系加分(theme_pack_systems.json', self.log) self.assertIn('patch: 镜牢卡包按体系加分(theme_pack_systems.json', self.log)
self.assertIn('卡包按体系 charge 加分: ', self.log) self.assertIn('卡包按体系 charge 加分: ', self.log)
self.assertIn('谋杀 -5→1', self.log) self.assertIn('谋杀 -5→-4.4', self.log)
self.assertEqual(len(self.refreshes), 4) # 没有打得过的本体系卡包: 先刷新
def test_tremor_team_skips_the_despair_knight(self):
# 11-16~11-21 实机: 震颤队每局 3 层都选憎恶与绝望(绝望 -5 → 1), 那层平均 18 分钟
self.assertEqual(self.play(['憎恶与绝望', '受情感压迫者', '宅邸的副产物'], 'tremor')[0], '受情感压迫者')
self.assertEqual(self.play(['时间杀人时间', '某个世界'], 'tremor')[0], '某个世界')
def test_among_hard_packs_the_system_still_decides(self):
# 5 层常见全是 -5: 这时还是挑本体系的
self.assertEqual(self.play(['伏行深渊', 'WARP快车谋杀案', '压抑的暴怒'], 'charge')[0], 'WARP快车谋杀案')
self.assertEqual(self.play(['伏行深渊', 'WARP快车谋杀案'], 'unknown_system')[0], '伏行深渊')
FLOOR1 = ['被遗忘者们', '身无分文的赌徒', '钉与锤'] FLOOR1 = ['被遗忘者们', '身无分文的赌徒', '钉与锤']
@@ -318,18 +346,22 @@ class UpstreamSelectThemePackTest(unittest.TestCase):
self.assertEqual(self.play(self.FLOOR4, 'bleed')[0], '落泪者们') self.assertEqual(self.play(self.FLOOR4, 'bleed')[0], '落泪者们')
def test_audit_records_the_system_bonus(self): def test_audit_records_the_system_bonus(self):
picked, record, _ = self.play(self.FLOOR4, 'charge', audit=True) picked, record, _ = self.play(['钉与锤', '身无分文的赌徒'], 'pierce', audit=True)
args, kwargs = record.call_args args, kwargs = record.call_args
self.assertEqual(args, ('theme_pack', '谋杀', 'preferred')) self.assertEqual(args, ('theme_pack', '赌徒', 'preferred'))
self.assertEqual(kwargs['system_bonus'], {'packs': ['身无分文的赌徒'], 'system': 'pierce', 'from': 0, 'to': 6})
# 普通模式: 复刻只在困难出现, 不算进「谋杀」这个键 # 普通模式: 复刻只在困难出现, 不算进「谋杀」这个键
self.assertEqual(kwargs['system_bonus'], {'packs': ['WARP快车谋杀案'], 'system': 'charge', 'from': -5, 'to': 1}) picked, record, _ = self.play(['伏行深渊', 'WARP快车谋杀案'], 'charge', audit=True)
self.assertEqual(record.call_args[0], ('theme_pack', '谋杀', 'highest_weight'))
self.assertEqual(record.call_args[1]['system_bonus'],
{'packs': ['WARP快车谋杀案'], 'system': 'charge', 'from': -5, 'to': -4.4})
def test_audit_keeps_a_key_with_a_space(self): def test_audit_keeps_a_key_with_a_space(self):
# 困难模式流血队: 复刻 WARP 专属流血 3 件, 用全名键「WARP快车谋杀案 复刻」; 审计不能截在空格前 # 困难模式震颤队: 只有复刻 20区的奇迹 有震颤专属饰品, 用全名键「20区的奇迹 复刻」; 审计不能截在空格前
picked, record, _ = self.play(['钉与锤', 'WARP快车谋杀案 复刻'], 'bleed', audit=True, hard=True) picked, record, _ = self.play(['钉与锤', '20区的奇迹 复刻'], 'tremor', audit=True, hard=True)
self.assertEqual(picked, 'WARP快车谋杀案 复刻') self.assertEqual(picked, '20区的奇迹 复刻')
args, kwargs = record.call_args args, kwargs = record.call_args
self.assertEqual(args, ('theme_pack', 'WARP快车谋杀案 复刻', 'preferred')) self.assertEqual(args, ('theme_pack', '20区的奇迹 复刻', 'preferred'))
self.assertEqual(kwargs['system_bonus']['to'], 1) self.assertEqual(kwargs['system_bonus']['to'], 1)
def test_audit_without_bonus_has_no_system_field(self): def test_audit_without_bonus_has_no_system_field(self):
@@ -354,7 +386,7 @@ class UpstreamSelectThemePackTest(unittest.TestCase):
self.assertNotIn('卡包优选阈值', self.log) self.assertNotIn('卡包优选阈值', self.log)
def test_system_pack_is_taken_without_refreshing(self): def test_system_pack_is_taken_without_refreshing(self):
self.assertEqual(self.play(self.FLOOR4, 'charge')[0], 'WARP快车谋杀案') self.assertEqual(self.play(['钉与锤', '身无分文的赌徒'], 'pierce')[0], '身无分文的赌徒')
self.assertEqual(self.refreshes, []) self.assertEqual(self.refreshes, [])
def test_rabbit_hole_route_without_a_system(self): def test_rabbit_hole_route_without_a_system(self):