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 -3
View File
@@ -1730,7 +1730,8 @@ function lastPerfect(m, ps) {
* The carrier of an item (null = keep it), by what the item does (itemEffect):
* 信标 (destroys its carrier for a pick of two chess of the same tier): the highest-tier bench single, else the
* weakest normal deployed operator;
* 拟态物质 (a third copy of a pair, else a member of a bond): a pair (highest tier), else a focus member;
* 拟态物质 (a third copy of a pair, else a member of a bond): a pair (highest tier), else a focus member — never one
* of 2 copies whose pool is out (the item gives nothing then);
* 博士投影 (promotes to elite; the normal one at the next round start, the golden one at once): the strongest normal
* deployed operator;
* 突变细胞 (the carrier becomes a random tier + 1 operator after the battle): cellTarget;
@@ -1759,10 +1760,13 @@ export function itemTarget(m, ps, item, ctx = context(m, ps)) {
return bench[0] || byVal(deployed.filter(normal), 1)[0] || null;
}
case 'use_equip_reward_char_chess': {
// with 2 copies owned and none left in the pool the item gives nothing (GitHub #207): such a pair is no carrier
const counts = copyCounts(m, ps);
const pair = owned.filter((p) => normal(p) && (counts.get(gd.baseIdOf(p.id)) || 0) + 1 >= mergeNeed(m, gd.baseIdOf(p.id)))
const live = (base) => { const pool = typeof ps.poolOf === 'function' ? ps.poolOf(base) : m.pool; return pool.left(base) > 0 || !pool.has(base); };
const dead = (p) => (counts.get(gd.baseIdOf(p.id)) || 0) >= 2 && !live(gd.baseIdOf(p.id));
const pair = owned.filter((p) => normal(p) && !dead(p) && (counts.get(gd.baseIdOf(p.id)) || 0) + 1 >= mergeNeed(m, gd.baseIdOf(p.id)))
.sort((a, b) => (chessRec(m, b.id, ps)?.tier || 0) - (chessRec(m, a.id, ps)?.tier || 0) || a.uid - b.uid);
return pair[0] || owned.slice().sort((a, b) => rel(b) - rel(a) || val(b) - val(a) || a.uid - b.uid)[0] || null;
return pair[0] || owned.filter((p) => !dead(p)).sort((a, b) => rel(b) - rel(a) || val(b) - val(a) || a.uid - b.uid)[0] || null;
}
// 博士投影: the normal one promotes at the next round start, the golden one (缪尔赛思's R1 item, item merges) at once;
// both refuse an elite (builtinMeta: BAD_TARGET 'already elite')