diff --git a/renderer/src/parser/modifiers.ts b/renderer/src/parser/modifiers.ts index f9e7e626..6ac4e36d 100644 --- a/renderer/src/parser/modifiers.ts +++ b/renderer/src/parser/modifiers.ts @@ -72,6 +72,7 @@ export function statSourcesTotal ( return (sources.length === 1) ? (sources[0].contributes) : (sources.reduce((sum, { contributes }) => { + // NOTE: this also sums up stats that have "flag" semantics contributes = contributes ?? { value: 1, min: 1, max: 1 } sum.value = fn(sum.value, contributes.value) sum.min = fn(sum.min, contributes.min) @@ -98,15 +99,14 @@ export function translateStatWithRoll ( : matchers.find(m => m.value == null && !m.negate) } if (!translation) { - translation = - matchers.find(m => m.value == null) ?? - { string: `BUG_STAT_ID: ${calc.stat.ref}` } + translation = matchers.find(m => m.value == null) + if (!translation) throw new Error('never') } } const dp = (roll) ? calc.stat.dp || - calc.sources.some(s => s.stat.stat.ref === calc.stat.ref && s.stat.roll!.dp) + calc.sources.some(s => s.stat.stat.ref === calc.stat.ref && s.stat.roll?.dp) : undefined return { string: translation.string, negate: translation.negate || false, dp: dp }