feedback5 WY: 拟态物质 with 2 copies owned and none left in the pool gives nothing instead of a random same-bond operator (GitHub #207)

The item text 「若已拥有至少2名该初始干员,则再获得1名该初始干员;否则随机获得1名同盟约初始干员」: the 否则 is the
case of fewer than 2 owned. builtinMeta's use_equip_reward_char_chess returned only when grantChess(base) gave a piece,
so an elite 溯光星源 plus 2 normal copies (all 5 Ⅵ阶 copies) fell through to the same-bond roll (白面鸮 in the report's
seed). Now with 2 owned it asks for the 3rd and stops; the item is still consumed. The bots' carrier choice
(itemTarget) skips 2 copies whose pool is out.

Tests: test/content/items.test.js (the report with the normal and golden item; 2 copies with the pool drained; 2 copies
with copies left still merge), test/match/bot-smarter.test.js (no carrier on a pair whose pool is out); both fail
without the fix. Docs: META built-ins and bot items, research 04 / 06, DESIGN §25.13.1.
Golden unchanged.
This commit is contained in:
sganggs committed 2026-10-06 20:55:49 +08:00
1 parent e1ffcd1b07
commit 463352d9bc
8 files changed
+92 -11

No files matched your search

+7 -2
View File
@@ -12,7 +12,8 @@
// use_equip_gain_coin_when_next_round_start {count} 见钱眼开玩偶 +count funds next round
// equip_destory_deployment_cnt_change {count} 人事部文档 deploy cap = count
// use_equip_upgrade_char / equip_round_start_upgrade_char 博士投影 promote (golden: now, normal: next round)
// use_equip_reward_char_chess 拟态物质 3rd copy or a same-bond chess
// use_equip_reward_char_chess 拟态物质 3rd copy (none when the pool is
// out), or with < 2 a same-bond chess
// use_equip_reward_special_goods_char_chess {refresh_cnt} 寻呼模块 offer N same-bond chess (≤ shop level)
// use_equip_recruit_new_char_and_give_char_to_player_most_bond {refresh_cnt} 信标 destroy target, offer N same-tier
// chess, gift the original (an elite stays
@@ -130,11 +131,15 @@ const ITEM_HANDLERS = {
ctx.promote(holder.uid);
},
},
// 拟态物质 「若已拥有至少2名该初始干员,则再获得1名该初始干员;否则随机获得1名同盟约初始干员」: the 否则 is the owned < 2
// case only. With 2 copies owned and none left in the pool (an elite holds 3 of a Ⅵ阶's 5) the grant fails and the
// item gives nothing (research 06 §7: some effects fail at the copy cap) — it never falls back to a same-bond operator
// (GitHub #207).
use_equip_reward_char_chess: {
onEquip(ctx, ev) {
const base = ctx.gd.baseIdOf(ev.target.id);
const owned = [...ctx.board(), ...ctx.hand(), ...ctx.temp()].filter((p) => p && p.kind === 'chess' && !p.golden && ctx.gd.baseIdOf(p.id) === base).length;
if (owned >= 2) { if (ctx.grantChess(base)) return; }
if (owned >= 2) { ctx.grantChess(base); return; }
const id = rollSameBond(ctx, ctx.pieceBonds(ev.target.uid), 6);
if (id) ctx.grantChess(id);
},