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:
sganggs committed 2026-10-09 01:05:07 +08:00
1 parent 9bacd9ad45
commit 8c76309796
8 files changed
+72 -6

No files matched your search

+19 -3
View File
@@ -29,6 +29,7 @@
import { getData } from '../data.js';
import { itemKey } from './gamedata.js';
import { msg, dn } from '../../shared/i18n.js';
const int = (v, d = 0) => (Number.isFinite(v) ? Math.trunc(v) : d);
@@ -38,6 +39,15 @@ const paramsOf = (ctx, item) => {
return rec && rec.params && typeof rec.params === 'object' ? rec.params : {};
};
/**
* The item gave nothing — the copies are all owned (the shared pool, research 06 §7) or no operator shares the bond — but
* it is still destroyed ("装备时销毁"): say why instead of swallowing it (GitHub #401, the owner's OK of 2026-10-09).
*/
function toastNothing(ctx, ev, chessName = null) {
const who = ctx.gd.item(ev.item?.id)?.name || '';
ctx.toast(chessName ? msg('{who}:卡池中已没有{name}', { who: dn(who), name: dn(chessName) }) : msg('{who}:没有可获得的同盟约干员', { who: dn(who) }), 'warn');
}
/** random chess sharing at least one bond with `bonds`, tier ≤ maxTier */
function rollSameBond(ctx, bonds, maxTier, exclude = null) {
const set = new Set(bonds);
@@ -100,10 +110,12 @@ const ITEM_HANDLERS = {
onEquip(ctx, ev) {
const n = Math.max(1, int(paramsOf(ctx, ev.item).count, 1));
const bonds = ctx.pieceBonds(ev.target.uid);
let got = 0;
for (let k = 0; k < n; k++) {
const id = rollSameBond(ctx, bonds, ctx.shopLevel());
if (id) ctx.grantChess(id);
if (id && ctx.grantChess(id)) got++;
}
if (!got) toastNothing(ctx, ev);
},
},
use_equip_gain_coin_when_next_round_start: {
@@ -138,9 +150,12 @@ const ITEM_HANDLERS = {
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) { ctx.grantChess(base); return; }
if (owned >= 2) {
if (!ctx.grantChess(base)) toastNothing(ctx, ev, ctx.gd.chess(base)?.name || null);
return;
}
const id = rollSameBond(ctx, ctx.pieceBonds(ev.target.uid), 6);
if (id) ctx.grantChess(id);
if (!id || !ctx.grantChess(id)) toastNothing(ctx, ev);
},
},
use_equip_reward_special_goods_char_chess: {
@@ -151,6 +166,7 @@ const ITEM_HANDLERS = {
// a pick-one offer never shows one operator twice (user playtest #6 item 19); fewer cards when the pool runs out
for (let k = 0; k < n; k++) { const id = rollSameBond(ctx, bonds, ctx.shopLevel(), ids); if (id) ids.push(id); }
if (ids.length) ctx.offerChess(ids, { source: 'item' });
else toastNothing(ctx, ev);
},
},
// 信标 (act2autochess eff_acarm109 / eff_acgarm109 "装备时,目标干员和本装备销毁并进行一次特殊刷新,出现两名与携带者同等阶的
+3
View File
@@ -33,6 +33,7 @@
import { itemKeyOf, isCoreBond } from '../support/index.js';
import { metaBonds } from '../support/meta.js';
import { msg, dn } from '../../../../shared/i18n.js';
const int = (v, d = 0) => (Number.isFinite(v) ? Math.trunc(v) : d);
@@ -102,6 +103,8 @@ export function registerMeta(registry) {
if (id) ids.push(id);
}
if (ids.length) ctx.offerChess(ids, { source: 'item' });
// nothing to offer (e.g. 缪尔赛思's 调和 below shop level 6): still destroyed — say why (GitHub #401, builtinMeta toastNothing)
else ctx.toast(msg('{who}:没有可获得的同盟约干员', { who: dn(ctx.gd.item(ev.item?.id)?.name || '') }), 'warn');
},
}));