From 0f9b780d112e327dddb6fd0da6c4fe93ea65e305 Mon Sep 17 00:00:00 2001 From: "DESKTOP-64JNFCF\\keyra" Date: Sun, 25 Feb 2024 09:17:39 +0900 Subject: [PATCH] =?UTF-8?q?CoC=E3=81=AE=E3=83=80=E3=82=A4=E3=82=B9?= =?UTF-8?q?=E8=A3=85=E9=A3=BE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/class/cut-in-list.ts | 2 +- src/app/class/dice-bot.ts | 10 ++++++++-- src/app/class/stand-list.ts | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/app/class/cut-in-list.ts b/src/app/class/cut-in-list.ts index 5e515c3c..77f997d7 100644 --- a/src/app/class/cut-in-list.ts +++ b/src/app/class/cut-in-list.ts @@ -68,7 +68,7 @@ export class CutInList extends ObjectNode implements InnerXml { let isMatch = false; for (const postfix of cutIn.postfixes) { if (StringUtil.toHalfWidth(text).toUpperCase().trimRight().endsWith(StringUtil.toHalfWidth(postfix).toUpperCase().trimRight()) - || StringUtil.toHalfWidth(text.replace(/\s>\s/g, ' → ')).toUpperCase().trimRight().endsWith(StringUtil.toHalfWidth(postfix).toUpperCase().trimRight())) { + || StringUtil.toHalfWidth(text.replace(/(\s|^)>\s/g, '$1→ ')).toUpperCase().trimRight().endsWith(StringUtil.toHalfWidth(postfix).toUpperCase().trimRight())) { isMatch = true; if ((postfix.slice(0, 1) == '@' || postfix.slice(0, 1) == '@') && textTagMatch.length < postfix.length) textTagMatch = postfix; } diff --git a/src/app/class/dice-bot.ts b/src/app/class/dice-bot.ts index cc53bcfd..9a587421 100644 --- a/src/app/class/dice-bot.ts +++ b/src/app/class/dice-bot.ts @@ -650,9 +650,15 @@ export class DiceBot extends GameObject { let barabaraDiceInfos = []; let rerollDiceInfos = []; let upperDiceInfos = []; - return resultLine.split(' > ').map((resultFragment, i, a) => { + if (id === 'Cthulhu7th' && /^\d+(:?回目|次|번째): >/.test(resultLine)) resultLine = '🎲' + resultLine; + return resultLine.split(/\s>\s/).map((resultFragment, i, a) => { if (a.length === 1) return resultFragment; if (i == 0) { + if ((id === 'Cthulhu' && /\d\) (?:故障ナンバー|故障率|고장넘버)\[\-?\d+\]/.test(resultFragment)) + || (id === 'Cthulhu7th' && /\d\) (?:ボーナス・ペナルティダイス|獎勵、懲罰骰値|보너스, 패널티 주사위)\[\-?\d+\]/.test(resultFragment)) + ) { + return '🎲' + resultFragment; + } const regExp1 = (DiceBot.apiUrl && DiceBot.apiVersion == 1) ? /^(?:\: )\(([A-Z\d\+\-\*\/=\(\),\[\]\<\>@#\$]+)\)$/i : /^\(([A-Z\d\+\-\*\/=\(\),\[\]\<\>@#\$]+)\)$/i; const regExp2 = (DiceBot.apiUrl && DiceBot.apiVersion == 1) ? /^(?:\: )\((CHOICE(?:\d+)?[\[\( ].+)\)$/i : /^\((CHOICE(?:\d+)?[\[\( ].+)\)$/i; const parentheses = resultFragment.match(regExp1) || resultFragment.match(regExp2); @@ -805,7 +811,7 @@ export class DiceBot extends GameObject { } } return resultFragment; - }).join(' → '); + }).join(' > ').replace(/(\s|^)>\s/g, '$1→ '); }).join("\n"); } diff --git a/src/app/class/stand-list.ts b/src/app/class/stand-list.ts index e97171fd..40041790 100644 --- a/src/app/class/stand-list.ts +++ b/src/app/class/stand-list.ts @@ -94,7 +94,7 @@ export class StandList extends DataElement { for (let postfix of postfixes.split(/[\r\n]+/g)) { if (postfix == null || postfix.trim().length == 0) continue; if (StringUtil.toHalfWidth(text).toUpperCase().trimRight().endsWith(StringUtil.toHalfWidth(postfix).trimRight().toUpperCase()) - || StringUtil.toHalfWidth(text.replace(/\s>\s/g, ' → ')).toUpperCase().trimRight().endsWith(StringUtil.toHalfWidth(postfix).trimRight().toUpperCase())) { + || StringUtil.toHalfWidth(text.replace(/(\s|^)>\s/g, '$1→ ')).toUpperCase().trimRight().endsWith(StringUtil.toHalfWidth(postfix).trimRight().toUpperCase())) { if ((postfix.slice(0, 1) == '@' || postfix.slice(0, 1) == '@') && textTagMatch.length < postfix.length) textTagMatch = postfix; conditionPostfix = true; }