From 414bab3a0df0d86222343b6176032142eb13cfeb Mon Sep 17 00:00:00 2001 From: Ean Milligan Date: Thu, 26 Jun 2025 03:27:33 -0400 Subject: [PATCH] fix plurality of success and fail on cwod dice --- src/artigen/dice/generateFormattedRoll.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/artigen/dice/generateFormattedRoll.ts b/src/artigen/dice/generateFormattedRoll.ts index 74432fa..eb75bd1 100644 --- a/src/artigen/dice/generateFormattedRoll.ts +++ b/src/artigen/dice/generateFormattedRoll.ts @@ -78,7 +78,9 @@ export const generateFormattedRoll = (rollConf: string, modifiers: RollModifiers // After the looping is done, remove the extra " + " from the details and cap it with the closing ] tempDetails = tempDetails.substring(0, tempDetails.length - 3); if (tempRollSet[0]?.type === 'cwod') { - tempDetails += `, ${tempRollSet.filter((e) => e.critHit).length} Successes, ${tempRollSet.filter((e) => e.critFail).length} Fails`; + const successCnt = tempRollSet.filter((e) => e.critHit).length; + const failCnt = tempRollSet.filter((e) => e.critFail).length; + tempDetails += `, ${successCnt} Success${successCnt !== 1 ? 'es' : ''}, ${failCnt} Fail${failCnt !== 1 ? 's' : ''}`; } tempDetails += ']';