mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-22 02:19:54 +02:00
Added overrides to modifierTotal and total getters in DamageRoll to addin critical damage when applicable
This commit is contained in:
parent
14edc7f4ca
commit
c0fe127df4
3 changed files with 13 additions and 3 deletions
|
|
@ -7,6 +7,11 @@ export class ChatDamageData extends foundry.abstract.DataModel {
|
|||
this._prepareRolls();
|
||||
}
|
||||
|
||||
get isCritical() {
|
||||
const roll = Roll.fromJSON(this.parent.parent._source.rolls[0]);
|
||||
return roll.isCritical;
|
||||
}
|
||||
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
|
||||
|
|
@ -28,7 +33,7 @@ export class ChatDamageData extends foundry.abstract.DataModel {
|
|||
}
|
||||
|
||||
_prepareRolls() {
|
||||
this.main &&= Roll.fromData(this.main);
|
||||
this.main &&= Roll.fromData({ ...this.main, options: { ...this.main.options, isCritical: this.isCritical } });
|
||||
for (const key of Object.keys(this.resources)) {
|
||||
this.resources[key] = Roll.fromData(this.resources[key]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue