mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-21 18:09:54 +02:00
Internalised ChatDamageData.prepareRolls to its own constructor
This commit is contained in:
parent
f1599bf566
commit
124c4749db
3 changed files with 7 additions and 4 deletions
|
|
@ -54,7 +54,6 @@ export default class DhParty extends BaseDataActor {
|
|||
const member = this.tagTeam.members[memberKey];
|
||||
member.damageRollData = member.rollData?.options.damage ?
|
||||
ChatDamageData.fromJSON(JSON.stringify(member.rollData.options.damage)) : null;
|
||||
member.damageRollData?.prepareRolls();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -164,8 +164,6 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
|
|||
}
|
||||
|
||||
prepareDerivedData() {
|
||||
this.damage.prepareRolls();
|
||||
|
||||
if (this.hasTarget) {
|
||||
this.hasHitTarget = this.targets.filter(t => t.hit === true).length > 0;
|
||||
this.currentTargets = this.getTargetList();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,12 @@
|
|||
import { triggerChatRollFx } from '../../helpers/utils.mjs';
|
||||
|
||||
export class ChatDamageData extends foundry.abstract.DataModel {
|
||||
constructor(data = {}, options = {}) {
|
||||
super(data, options);
|
||||
|
||||
this._prepareRolls();
|
||||
}
|
||||
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
|
||||
|
|
@ -21,7 +27,7 @@ export class ChatDamageData extends foundry.abstract.DataModel {
|
|||
if (!roll.evaluated) throw new Error('Roll objects added to ChatMessage documents must be evaluated');
|
||||
}
|
||||
|
||||
prepareRolls() {
|
||||
_prepareRolls() {
|
||||
for (const key of Object.keys(this.types)) {
|
||||
const type = this.types[key];
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue