mirror of
https://github.com/Kvan7/Exiled-Exchange-2.git
synced 2026-10-09 21:01:30 +00:00
fix accessing parsed roll info, when it's actually a flag stat
This commit is contained in:
1 parent
d4dd07a194
commit
bc4e1d0e7a
1 file changed
+4
-4
@@ -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 }
|
||||
|
||||
Reference in new issue
Block a user