feedback7 R23-TOAST: 拟态物质 / 简易通讯机 / 寻呼模块 that grant nothing say why — 「{who}:卡池中已没有{name}」 (拟态物质 with 2 copies owned and the shared pool out: 1 elite + 2 normal 溯光星源 hold all 5 of the Ⅵ阶's copies) or 「{who}:没有可获得的同盟约干员」; the item is still destroyed (装备时销毁). GitHub #401, the owner's OK of 2026-10-09; en / ja / ko / zh-TW; golden: unchanged
This commit is contained in:
1 parent
9bacd9ad45
commit
8c76309796
8 files changed
+72
-6
No files matched your search
@@ -49,7 +49,7 @@ test('50: two 空弦 made 阿戈尔 (变形同构体 + 阿戈尔重刃) in a row
|
||||
}
|
||||
});
|
||||
|
||||
test('45: 寻呼模块 / 简易通讯机 on 缪尔赛思 below shop level 6 — nothing qualifies (调和, tier ≤ shop level), the item is used up', () => {
|
||||
test('45: 寻呼模块 / 简易通讯机 on 缪尔赛思 below shop level 6 — nothing qualifies (调和, tier ≤ shop level), the item is used up with a toast saying why', () => {
|
||||
for (const itemId of ['chess_item_4_01_e_a', 'chess_item_2_06_e_a']) {
|
||||
for (const level of [5, 6]) {
|
||||
const h = makeMatch({ mode: 'solo', difficulty: 'NORMAL', humans: 1, seed: 7, fake: true }).start();
|
||||
@@ -60,11 +60,20 @@ test('45: 寻呼模块 / 简易通讯机 on 缪尔赛思 below shop level 6 —
|
||||
const item = ps.acquireItem(itemId, { source: 'test' });
|
||||
const owned = () => [...ps.board.values(), ...ps.hand, ...ps.temp].filter((p) => p && p.id === 'chess_char_6_11_a').length;
|
||||
const n0 = owned(), offers0 = ps.offers.length;
|
||||
const warns = [];
|
||||
const toast0 = h.m.toast.bind(h.m);
|
||||
h.m.toast = (who, kind, text) => { if (kind === 'warn') warns.push(text?.msgid ?? text); return toast0(who, kind, text); };
|
||||
assert.deepEqual(h.m.handle('p_0', { t: 'g.equip', itemUid: item.uid, targetUid: mly.uid }), { ok: true });
|
||||
assert.equal(ps.find(item.uid), null, `${itemId} @${level}: consumed`);
|
||||
const got = owned() - n0 + (ps.offers.length - offers0);
|
||||
if (level < 6) assert.equal(got, 0, `${itemId} @${level}: nothing (no 调和 operator of tier ≤ ${level})`);
|
||||
else assert.equal(got, 1, `${itemId} @6: 缪尔赛思 (granted, or offered by 寻呼模块)`);
|
||||
// used up with nothing: a toast says why (GitHub #401, the owner's OK of 2026-10-09)
|
||||
if (level < 6) {
|
||||
assert.equal(got, 0, `${itemId} @${level}: nothing (no 调和 operator of tier ≤ ${level})`);
|
||||
assert.deepEqual(warns, ['{who}:没有可获得的同盟约干员'], `${itemId} @${level}: the toast`);
|
||||
} else {
|
||||
assert.equal(got, 1, `${itemId} @6: 缪尔赛思 (granted, or offered by 寻呼模块)`);
|
||||
assert.deepEqual(warns, [], `${itemId} @6: no toast`);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -741,6 +741,16 @@ const plain = (pred = () => true) => Object.values(DATA.chess)
|
||||
.filter((c) => c.visible && !c.isGolden && (c.garrisonIds || []).every((g) => DATA.garrisons[g].eventType === 'IN_BATTLE') && pred(c))
|
||||
.map((c) => c.chessId).sort();
|
||||
/** Record the chess granted by item effects (acquireChess with an `item:` source). */
|
||||
/** The warn toasts sent to the match's players from now on: [{ msgid, who, name }] (server msg() objects). */
|
||||
function spyWarns(m) {
|
||||
const got = [];
|
||||
const orig = m.toast.bind(m);
|
||||
m.toast = (ps, kind, text) => {
|
||||
if (kind === 'warn') got.push({ msgid: text?.msgid ?? text, who: text?.params?.who?.dn ?? null, name: text?.params?.name?.dn ?? null });
|
||||
return orig(ps, kind, text);
|
||||
};
|
||||
return got;
|
||||
}
|
||||
function spyGrants(ps) {
|
||||
const got = [];
|
||||
const orig = ps.acquireChess.bind(ps);
|
||||
@@ -958,11 +968,14 @@ test('拟态物质 with 2 copies owned and none left in the pool gives nothing
|
||||
assert.equal(m.pool.left(cid), 0, 'elite 3 + 2 normal = the pool cap 5');
|
||||
const before = chessIn(ps);
|
||||
const got = spyGrants(ps);
|
||||
const warns = spyWarns(m);
|
||||
const it = giveItem(m, ps, item);
|
||||
assert.deepEqual(equip(it, t), OK, item);
|
||||
assert.deepEqual(got, [], `${item}: nothing granted`);
|
||||
assert.deepEqual(chessIn(ps), before, `${item}: no other operator, no second elite`);
|
||||
assert.ok(!ps.find(it.uid), `${item}: consumed`);
|
||||
// …and says why (GitHub #401, the owner's OK of 2026-10-09)
|
||||
assert.deepEqual(warns, [{ msgid: '{who}:卡池中已没有{name}', who: '拟态物质', name: '溯光星源' }], `${item}: the toast`);
|
||||
}
|
||||
// 2 normal copies, no elite, the pool drained by other players: nothing either
|
||||
{
|
||||
@@ -971,9 +984,11 @@ test('拟态物质 with 2 copies owned and none left in the pool gives nothing
|
||||
give(m, ps, cid, 'hand');
|
||||
m.pool.take(cid, m.pool.left(cid));
|
||||
const got = spyGrants(ps);
|
||||
const warns = spyWarns(m);
|
||||
assert.deepEqual(equip(giveItem(m, ps, A('5_05')), t), OK);
|
||||
assert.deepEqual(got, []);
|
||||
assert.deepEqual(chessIn(ps), [cid, cid]);
|
||||
assert.deepEqual(warns.map((w) => w.msgid), ['{who}:卡池中已没有{name}']);
|
||||
}
|
||||
// 2 normal copies with copies left: the 3rd merges into the elite
|
||||
{
|
||||
@@ -981,12 +996,27 @@ test('拟态物质 with 2 copies owned and none left in the pool gives nothing
|
||||
const t = give(m, ps, cid, 'hand');
|
||||
give(m, ps, cid, 'hand');
|
||||
assert.equal(m.pool.left(cid), 3);
|
||||
const warns = spyWarns(m);
|
||||
assert.deepEqual(equip(giveItem(m, ps, A('5_05')), t), OK);
|
||||
assert.deepEqual(chessIn(ps), [elite]);
|
||||
assert.deepEqual(warns, [], 'a grant: no warn toast');
|
||||
assert.equal(m.pool.left(cid), 2, 'the elite holds 3 copies');
|
||||
}
|
||||
});
|
||||
|
||||
test('拟态物质 with fewer than 2 copies and no same-bond operator left gives nothing and says so (GitHub #401)', () => {
|
||||
// 缪尔赛思's only bond is 调和 and she is its only member: one copy owned, the rest of her pool taken by others
|
||||
const cid = 'chess_char_6_11_a';
|
||||
const { m, ps, equip } = setup({ seed: 9 });
|
||||
const t = give(m, ps, cid, 'hand');
|
||||
m.pool.take(cid, m.pool.left(cid));
|
||||
const got = spyGrants(ps);
|
||||
const warns = spyWarns(m);
|
||||
assert.deepEqual(equip(giveItem(m, ps, A('5_05')), t), OK);
|
||||
assert.deepEqual(got, [], 'nothing granted');
|
||||
assert.deepEqual(warns, [{ msgid: '{who}:没有可获得的同盟约干员', who: '拟态物质', name: null }]);
|
||||
});
|
||||
|
||||
test('博士投影: golden promotes at once; normal stays equipped and promotes at the next round start', () => {
|
||||
const { h, m, ps, equip } = setup();
|
||||
const cid = plain((c) => c.tier === 2)[0];
|
||||
|
||||
Reference in new issue
Block a user