Fix problem with check target numbers <= 0
The fix has 2 components: 1. The logic for evaluating checks now supports check target numbers<= 0 by still using a single die in this case 2. The CheckFactory sets the check target number to 0 even if it would be < 0. This is necessary because negative numbers would interfer with foundry's math evaluation in rolls and would not be picked up correctly.
This commit is contained in:
parent
ebdc0405d8
commit
ff6427f5a9
3 changed files with 118 additions and 14 deletions
|
@ -113,5 +113,5 @@ function evaluateDiceWithSubChecks(
|
|||
}
|
||||
|
||||
export function getRequiredNumberOfDice(checkTargetNumber: number): number {
|
||||
return Math.ceil(checkTargetNumber / 20);
|
||||
return Math.max(Math.ceil(checkTargetNumber / 20), 1);
|
||||
}
|
||||
|
|
|
@ -45,8 +45,8 @@ class CheckFactory {
|
|||
);
|
||||
}
|
||||
|
||||
createCheckTargetNumberModifier(): string | null {
|
||||
return "v" + (this.checkTargetNumber + this.gmModifier);
|
||||
createCheckTargetNumberModifier(): string {
|
||||
return "v" + Math.max(this.checkTargetNumber + this.gmModifier, 0);
|
||||
}
|
||||
|
||||
createCoupFumbleModifier(): string | null {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue