From eeb1aa61f4baf784a08d246ac516f1045ea5e388 Mon Sep 17 00:00:00 2001 From: Johannes Loher Date: Sat, 13 Mar 2021 20:58:59 +0100 Subject: [PATCH] Use coups, even if they are higher than the corresponding CTN --- spec/rolls/check-evaluation.spec.ts | 8 ++++++++ src/module/rolls/check-evaluation.ts | 2 ++ 2 files changed, 10 insertions(+) diff --git a/spec/rolls/check-evaluation.spec.ts b/spec/rolls/check-evaluation.spec.ts index f240b1f9..4df65e2c 100644 --- a/spec/rolls/check-evaluation.spec.ts +++ b/spec/rolls/check-evaluation.spec.ts @@ -258,4 +258,12 @@ describe("evaluateCheck with multiple dice and coup / fumble modification", () = { result: 15, checkTargetNumber: 20, active: true, discarded: false }, ]); }); + + it("should use all the dice if they are coups, even if they are higher than the checkTargetNumber", () => { + expect(evaluateCheck([18, 19, 17], 48, { maximumCoupResult: 19 })).toEqual([ + { result: 18, checkTargetNumber: 8, active: true, discarded: false, success: true, count: 8 }, + { result: 19, checkTargetNumber: 20, active: true, discarded: false, success: true, count: 20 }, + { result: 17, checkTargetNumber: 20, active: true, discarded: false, success: true, count: 20 }, + ]); + }); }); diff --git a/src/module/rolls/check-evaluation.ts b/src/module/rolls/check-evaluation.ts index 8ad4d92f..fa97e822 100644 --- a/src/module/rolls/check-evaluation.ts +++ b/src/module/rolls/check-evaluation.ts @@ -104,6 +104,8 @@ function evaluateDiceWithSubChecks( if (result.result <= maximumCoupResult) { result.success = true; result.count = result.checkTargetNumber; + result.active = true; + result.discarded = false; } if (index === 0 && canFumble && result.result >= minimumFumbleResult) result.failure = true; return result;