Localize Error Messages.

This commit is contained in:
Oliver Rümpelein 2021-01-08 23:31:42 +01:00
parent 22f53e5420
commit a5e240ab75
2 changed files with 10 additions and 8 deletions

View file

@ -110,5 +110,7 @@
"DS4.ProfileWeight": "Weight",
"DS4.ProfileEyeColor": "Eye Color",
"DS4.ProfileSpecialCharacteristics": "Special Characteristics",
"DS4.WarningManageActiveEffectOnOwnedItem": "Managing Active Effects within an Owned Item is not currently supported and will be added in a subsequent update."
"DS4.WarningManageActiveEffectOnOwnedItem": "Managing Active Effects within an Owned Item is not currently supported and will be added in a subsequent update.",
"DS4.ErrorDiceCritOverlap": "There's an overlap between Fumbles and Coups",
"DS4.ErrorExplodingRecursionLimitExceeded": "Maximum recursion depth for exploding dice roll exceeded"
}

View file

@ -40,7 +40,7 @@ export class DS4Check extends DiceTerm {
? parseInt(parseMinCritFailure)
: DS4Check.DEFAULT_MIN_CRIT_FAILURE;
if (this.minCritFailure <= this.maxCritSuccess)
throw new SyntaxError("There's an overlap between Fumbles and Coups");
throw new SyntaxError(game.i18n.localize("DS4.ErrorDiceCritOverlap"));
}
}
@ -98,23 +98,23 @@ export class DS4Check extends DiceTerm {
this.results = (this.results as Array<RollResult>)
.map((r) => {
const intermedResult = [r];
const intermediateResults = [r];
let checked = 0;
while (checked < intermedResult.length) {
const r = (intermedResult as Array<RollResult>)[checked];
while (checked < intermediateResults.length) {
const r = (intermediateResults as Array<RollResult>)[checked];
checked++;
if (!r.active) continue;
if (r.dice[0] <= this.maxCritSuccess) {
r.exploded = true;
const newRoll = this.rollWithDifferentBorders({}, true);
intermedResult.push(newRoll);
intermediateResults.push(newRoll);
}
if (checked > 1000) throw new Error("Maximum recursion depth for exploding dice roll exceeded");
if (checked > 1000) throw new Error(game.i18n.localize("DS4.ErrorExplodingRecursionLimitExceeded"));
}
return intermedResult;
return intermediateResults;
})
.reduce((acc, cur) => {
return acc.concat(cur);