mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-05 20:34:15 +02:00
Fixed so that advantage dice do not get duplicated (#1929)
Some checks are pending
Project CI / build (24.x) (push) Waiting to run
Some checks are pending
Project CI / build (24.x) (push) Waiting to run
This commit is contained in:
parent
0e8c3dc74a
commit
e529dd0f88
2 changed files with 23 additions and 15 deletions
|
|
@ -148,14 +148,22 @@ export default class DualityRoll extends D20Roll {
|
|||
}
|
||||
|
||||
applyAdvantage() {
|
||||
if (this.hasAdvantage || this.hasDisadvantage) {
|
||||
const dieFaces = this.advantageFaces,
|
||||
advDie = new foundry.dice.terms.Die({ faces: dieFaces, number: this.advantageNumber });
|
||||
if (this.advantageNumber > 1) advDie.modifiers = ['kh'];
|
||||
this.terms.push(
|
||||
new foundry.dice.terms.OperatorTerm({ operator: this.hasDisadvantage ? '-' : '+' }),
|
||||
advDie
|
||||
);
|
||||
const advDieClass = this.hasAdvantage
|
||||
? game.system.api.dice.diceTypes.AdvantageDie
|
||||
: this.hasDisadvantage
|
||||
? game.system.api.dice.diceTypes.DisadvantageDie
|
||||
: null;
|
||||
if (advDieClass) {
|
||||
const advDie = new advDieClass({ faces: this.advantageFaces, number: this.advantageNumber });
|
||||
if (this.terms.length < 4) {
|
||||
if (this.advantageNumber > 1) advDie.modifiers = ['kh'];
|
||||
this.terms.push(
|
||||
new foundry.dice.terms.OperatorTerm({ operator: this.hasDisadvantage ? '-' : '+' }),
|
||||
advDie
|
||||
);
|
||||
} else {
|
||||
this.terms[4] = advDie;
|
||||
}
|
||||
}
|
||||
if (this.rallyFaces)
|
||||
this.terms.push(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue