Use coups, even if they are higher than the corresponding CTN

This commit is contained in:
Johannes Loher 2021-03-13 20:58:59 +01:00
parent e1d376057c
commit eeb1aa61f4
2 changed files with 10 additions and 0 deletions

View file

@ -258,4 +258,12 @@ describe("evaluateCheck with multiple dice and coup / fumble modification", () =
{ result: 15, checkTargetNumber: 20, active: true, discarded: false }, { 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 },
]);
});
}); });

View file

@ -104,6 +104,8 @@ function evaluateDiceWithSubChecks(
if (result.result <= maximumCoupResult) { if (result.result <= maximumCoupResult) {
result.success = true; result.success = true;
result.count = result.checkTargetNumber; result.count = result.checkTargetNumber;
result.active = true;
result.discarded = false;
} }
if (index === 0 && canFumble && result.result >= minimumFumbleResult) result.failure = true; if (index === 0 && canFumble && result.result >= minimumFumbleResult) result.failure = true;
return result; return result;