Localize Error Messages.
This commit is contained in:
parent
22f53e5420
commit
a5e240ab75
2 changed files with 10 additions and 8 deletions
|
@ -110,5 +110,7 @@
|
||||||
"DS4.ProfileWeight": "Weight",
|
"DS4.ProfileWeight": "Weight",
|
||||||
"DS4.ProfileEyeColor": "Eye Color",
|
"DS4.ProfileEyeColor": "Eye Color",
|
||||||
"DS4.ProfileSpecialCharacteristics": "Special Characteristics",
|
"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"
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ export class DS4Check extends DiceTerm {
|
||||||
? parseInt(parseMinCritFailure)
|
? parseInt(parseMinCritFailure)
|
||||||
: DS4Check.DEFAULT_MIN_CRIT_FAILURE;
|
: DS4Check.DEFAULT_MIN_CRIT_FAILURE;
|
||||||
if (this.minCritFailure <= this.maxCritSuccess)
|
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>)
|
this.results = (this.results as Array<RollResult>)
|
||||||
.map((r) => {
|
.map((r) => {
|
||||||
const intermedResult = [r];
|
const intermediateResults = [r];
|
||||||
|
|
||||||
let checked = 0;
|
let checked = 0;
|
||||||
while (checked < intermedResult.length) {
|
while (checked < intermediateResults.length) {
|
||||||
const r = (intermedResult as Array<RollResult>)[checked];
|
const r = (intermediateResults as Array<RollResult>)[checked];
|
||||||
checked++;
|
checked++;
|
||||||
if (!r.active) continue;
|
if (!r.active) continue;
|
||||||
|
|
||||||
if (r.dice[0] <= this.maxCritSuccess) {
|
if (r.dice[0] <= this.maxCritSuccess) {
|
||||||
r.exploded = true;
|
r.exploded = true;
|
||||||
const newRoll = this.rollWithDifferentBorders({}, 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) => {
|
.reduce((acc, cur) => {
|
||||||
return acc.concat(cur);
|
return acc.concat(cur);
|
||||||
|
|
Loading…
Reference in a new issue