Skip to content

Commit

Permalink
Fix a few more term deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
arbron committed Aug 6, 2024
1 parent dbfc70b commit e6458af
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions module/dice/aggregate-damage-rolls.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { OperatorTerm, RollTerm } = foundry.dice.terms;

/**
* Parse the provided rolls, splitting parts based on damage types & properties, taking flavor into account.
* @param {DamageRoll[]} rolls Evaluated damage rolls to aggregate.
Expand Down Expand Up @@ -60,14 +62,14 @@ function chunkTerms(terms, type) {

for ( let term of terms ) {
// Plus or minus operators split chunks
if ( (term instanceof foundry.dice.terms.OperatorTerm) && ["+", "-"].includes(term.operator) ) {
if ( (term instanceof OperatorTerm) && ["+", "-"].includes(term.operator) ) {
if ( currentChunk ) pushChunk();
if ( term.operator === "-" ) negative = !negative;
continue;
}

// All other terms get added to the current chunk
term = foundry.dice.terms.RollTerm.fromData(foundry.utils.deepClone(term.toJSON()));
term = RollTerm.fromData(foundry.utils.deepClone(term.toJSON()));
currentChunk ??= { terms: [], negative, type: null };
currentChunk.terms.push(term);
const flavor = term.flavor?.toLowerCase().trim();
Expand Down
2 changes: 1 addition & 1 deletion module/dice/damage-roll.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { DiceTerm, FunctionTerm, NumericTerm, OperatorTerm, ParentheticalTerm } = foundry.dice.terms;
const { DiceTerm, FunctionTerm, NumericTerm, OperatorTerm, ParentheticalTerm, StringTerm } = foundry.dice.terms;

/**
* A type of Roll specific to a damage (or healing) roll in the 5e system.
Expand Down
2 changes: 1 addition & 1 deletion module/documents/chat-message.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ export default class ChatMessage5e extends ChatMessage {
})));
let multiplier = 1;
let operator = roll.terms[i];
while ( operator instanceof OperatorTerm ) {
while ( operator instanceof foundry.dice.terms.OperatorTerm ) {
if ( operator.operator === "-" ) multiplier *= -1;
operator = roll.terms[--i];
}
Expand Down

0 comments on commit e6458af

Please sign in to comment.