mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-22 18:39:55 +02:00
Merge 76aabb235d into 26bcc2dddc
This commit is contained in:
commit
a1f40ead36
11 changed files with 104 additions and 60 deletions
|
|
@ -204,7 +204,7 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
|
|||
const oldRoll = damageData.parts[0]?.roll;
|
||||
return oldRoll ? JSON.stringify({
|
||||
...oldRoll,
|
||||
class: 'BaseRoll',
|
||||
class: 'DamageRoll',
|
||||
options: {
|
||||
...oldRoll.options,
|
||||
damageTypes: damageData.parts[0].damageTypes ?? []
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
import { triggerChatRollFx } from '../../helpers/utils.mjs';
|
||||
import { MemberData } from '../tagTeamData.mjs';
|
||||
import DHActorRoll from './actorRoll.mjs';
|
||||
|
||||
export class ChatDamageData extends foundry.abstract.DataModel {
|
||||
constructor(data = {}, options = {}) {
|
||||
|
|
@ -7,6 +9,17 @@ export class ChatDamageData extends foundry.abstract.DataModel {
|
|||
this._prepareRolls();
|
||||
}
|
||||
|
||||
get isCritical() {
|
||||
if (this.parent && this.parent instanceof MemberData) {
|
||||
return this.parent.roll.isCritical;
|
||||
}
|
||||
if (this.parent && this.parent instanceof DHActorRoll && this.parent.parent) {
|
||||
return Roll.fromJSON(this.parent.parent._source.rolls[0]).isCritical;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
|
||||
|
|
@ -28,7 +41,15 @@ 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.main.options.isCritical === false ? false : (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