Fixed so that party.tagTeam now uses a declared damageRollData(ChatDamageData) field. rollData.options.damage is retired.

This commit is contained in:
WBHarry 2026-07-17 17:41:32 +02:00
parent e087b379fc
commit ab1772264a
6 changed files with 25 additions and 68 deletions

View file

@ -3,7 +3,6 @@ import ForeignDocumentUUIDArrayField from '../fields/foreignDocumentUUIDArrayFie
import TagTeamData from '../tagTeamData.mjs';
import GroupRollData from '../groupRollData.mjs';
import { GoldField } from '../fields/actorField.mjs';
import { ChatDamageData } from '../chat-message/chatDamageData.mjs';
export default class DhParty extends BaseDataActor {
/** @inheritdoc */
@ -49,14 +48,6 @@ export default class DhParty extends BaseDataActor {
}
}
prepareDerivedData() {
for (const memberKey in this.tagTeam.members) {
const member = this.tagTeam.members[memberKey];
member.damageRollData = member.rollData?.options.damage ?
ChatDamageData.fromJSON(JSON.stringify(member.rollData.options.damage)) : null;
}
}
_onCreate(data, options, userId) {
super._onCreate(data, options, userId);

View file

@ -1,3 +1,5 @@
import { ChatDamageData } from './chat-message/chatDamageData.mjs';
export default class TagTeamData extends foundry.abstract.DataModel {
static defineSchema() {
const fields = foundry.data.fields;
@ -37,6 +39,7 @@ export class MemberData extends foundry.abstract.DataModel {
}),
rollChoice: new fields.StringField({ nullable: true, initial: null }),
rollData: new fields.JSONField({ nullable: true, initial: null }),
damageRollData: new fields.EmbeddedDataField(ChatDamageData),
selected: new fields.BooleanField({ initial: false })
};
}