From 305b524df261808374049a26b7d92a2ba91df0cf Mon Sep 17 00:00:00 2001 From: sganggs Date: Mon, 5 Oct 2026 14:37:23 +0800 Subject: [PATCH] =?UTF-8?q?feedback4:=20a=20bond=20card's=20layer-scaled?= =?UTF-8?q?=20chance=20(=E4=B8=8D=E5=B1=88,=20=E8=BF=85=E6=8D=B7,=20?= =?UTF-8?q?=E5=A5=87=E8=BF=B9)=20stops=20at=20100=20%=20like=20the=20sim's?= =?UTF-8?q?=20(GitHub=20#108:=20124=20%=20at=20266=20layers)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/ui/richText.js | 5 ++++- test/ui/richText.test.js | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/public/js/ui/richText.js b/public/js/ui/richText.js index 51212b1f..46cb9d53 100644 --- a/public/js/ui/richText.js +++ b/public/js/ui/richText.js @@ -175,7 +175,10 @@ export function formatBondEffect(bond, layers = 0) { if (!p || !Number.isInteger(p.index)) continue; const base = Number(bb[p.base]) || 0; const per = Number(bb[p.perStack]) || 0; - values[p.index] = base + per * L; + // a layer-scaled chance (迅捷 / 不屈 base_prob + prob_per_stack, 奇迹 baseprob + prob) stops at 100 % like the sim's + // min(1, …) (bonds/addon procChance, meta.js 奇迹) — the card read 124 % at 266 layers (GitHub #108) + const chance = /prob/i.test(`${p.base}|${p.perStack}`); + values[p.index] = chance ? Math.max(0, Math.min(1, base + per * L)) : base + per * L; formats[p.index] = p.format || '0'; } return fillPlaceholders(src, values, formats); diff --git a/test/ui/richText.test.js b/test/ui/richText.test.js index 19170fc6..9e17084c 100644 --- a/test/ui/richText.test.js +++ b/test/ui/richText.test.js @@ -89,6 +89,11 @@ describe('placeholders', () => { const out = richTextPlain(formatBondEffect(b, 25)); assert.ok(!/\{\d+(:[^}]*)?\}/.test(out), `${b.bondId} leaves a placeholder: ${out}`); } + // a chance stops at 100 % (GitHub #108: 不屈 read 124 % at 266 layers; the sim caps it with min(1, …)) + for (const id of ['indomShip', 'swiftShip', 'miraShip']) { + const pct = richTextPlain(formatBondEffect(bonds[id], 500)).match(/(\d+)%/); + assert.ok(pct && Number(pct[1]) === 100, `${id} at 500 layers: ${pct && pct[0]}`); + } assert.equal(formatBondEffect(null, 3), ''); assert.equal(formatBondEffect({ effectDesc: 'x{0:0}', effectDescParams: [{ index: 0, format: '0', base: 'a', perStack: 'b' }], bb: { a: 1, b: 2 } }, 'bad'), 'x1'); });