mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-24 03:19:55 +02:00
Added aseDie.rerollResult method to specifically reroll a specific result die in a grouping
This commit is contained in:
parent
1274639ba8
commit
221b84726d
7 changed files with 25 additions and 5 deletions
12
module/dice/die/baseDie.mjs
Normal file
12
module/dice/die/baseDie.mjs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
export default class BaseDie extends foundry.dice.terms.Die {
|
||||
async rerollResult(resultIndex) {
|
||||
const result = this.results[resultIndex];
|
||||
result.rerolled = true;
|
||||
result.active = false;
|
||||
await this.roll({ reroll: true });
|
||||
|
||||
const rerolledResult = this.results[this.results.length - 1];
|
||||
this.results.splice(this.results.length - 1, 1);
|
||||
this.results.splice(resultIndex, 0, rerolledResult);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue