mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-21 18:09:54 +02:00
Fixed so that compoundCombo denomination increases are used for all subsequent results
This commit is contained in:
parent
a285b3f4dc
commit
4a25ffb456
1 changed files with 8 additions and 4 deletions
|
|
@ -112,15 +112,19 @@ export default class BaseDie extends foundry.dice.terms.Die {
|
||||||
async continueCombo(maxIncreasesDiceSize) {
|
async continueCombo(maxIncreasesDiceSize) {
|
||||||
const activeResults = this.results.filter(x => x.active);
|
const activeResults = this.results.filter(x => x.active);
|
||||||
const lastIndex = activeResults.length - 1;
|
const lastIndex = activeResults.length - 1;
|
||||||
|
const lastResult = activeResults[lastIndex];
|
||||||
|
|
||||||
/* The Combo only continues if the latest roll was higher or equal to the previous */
|
/* The Combo only continues if the latest roll was higher or equal to the previous */
|
||||||
if (activeResults[lastIndex].result < activeResults[lastIndex - 1].result) return false;
|
if (lastResult.result < activeResults[lastIndex - 1].result) return false;
|
||||||
|
|
||||||
const lastFaces = activeResults[lastIndex].denomination?.slice(1) ?? this.faces;
|
const lastFaces = lastResult.denomination ?
|
||||||
|
Number(lastResult.denomination.slice(1)) : this.faces;
|
||||||
|
const currentDenomination = `d${lastFaces}`
|
||||||
const increaseDiceSize =
|
const increaseDiceSize =
|
||||||
maxIncreasesDiceSize && lastFaces < 12 &&
|
maxIncreasesDiceSize && lastFaces < 12 &&
|
||||||
activeResults[lastIndex].result === lastFaces;
|
lastResult.result === lastFaces;
|
||||||
const denomination = increaseDiceSize ? adjustDice(this.denomination, false) : this.denomination;
|
|
||||||
|
const denomination = increaseDiceSize ? adjustDice(currentDenomination, false) : currentDenomination;
|
||||||
|
|
||||||
const newRoll = await (new Roll(`1${denomination}`)).evaluate();
|
const newRoll = await (new Roll(`1${denomination}`)).evaluate();
|
||||||
this.results.push({ result: newRoll.total, denomination: denomination, active: true });
|
this.results.push({ result: newRoll.total, denomination: denomination, active: true });
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue