Skip to content

Commit

Permalink
fix to multiplier for extract term
Browse files Browse the repository at this point in the history
  • Loading branch information
ChasarooniZ committed Aug 8, 2023
1 parent 116b4d9 commit 265d69b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions scripts/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,13 @@ export function extractTerm(term, flavor = '') {
result = result.concat(extractTerm(term.operands[0], term.flavor || flavor));
result = result.concat(extractTerm(term.operands[1], term.flavor || flavor)).map(t => { return { value: -t.value, type: t.type } });
case '*':
if (['NumericTerm', 'Die'].includes(term.operands[0].class)) {
if (['NumericTerm', 'Die'].includes(term.operands[0].constructor.name)) {
result = result.concat(extractTerm(term.operands[1], term.flavor || flavor).flatMap(i => [i, i]));
} else if (['NumericTerm', 'Die'].includes(term.operands[1].class)) {
} else if (['NumericTerm', 'Die'].includes(term.operands[1].constructor.name)) {
result = result.concat(extractTerm(term.operands[0], term.flavor || flavor).flatMap(i => [i, i]));
} else {
result.push({ value: term.total, type: term.flavor || flavor })
}

break;
default:
break;
Expand Down

0 comments on commit 265d69b

Please sign in to comment.