Fixed reroll

This commit is contained in:
WBHarry 2026-03-03 21:31:43 +01:00
parent a0fa743b8e
commit fa277d2888
8 changed files with 83 additions and 45 deletions

View file

@ -3,26 +3,30 @@ export default class TagTeamData extends foundry.abstract.DataModel {
const fields = foundry.data.fields;
return {
members: new fields.TypedObjectField(
new fields.SchemaField({
name: new fields.StringField({ required: true }),
img: new fields.StringField({ required: true }),
rollType: new fields.StringField({
required: true,
choices: CONFIG.DH.GENERAL.tagTeamRollTypes,
initial: CONFIG.DH.GENERAL.tagTeamRollTypes.trait.id,
label: 'Roll Type'
}),
rollChoice: new fields.StringField({ nullable: true, initial: null }),
rollData: new fields.JSONField({ nullable: true, initial: null })
})
)
members: new fields.TypedObjectField(new fields.EmbeddedDataField(MemberData))
};
}
}
class MemberData extends foundry.abstract.DataModel {
static defineSchema() {
const fields = foundry.data.fields;
return {
name: new fields.StringField({ required: true }),
img: new fields.StringField({ required: true }),
rollType: new fields.StringField({
required: true,
choices: CONFIG.DH.GENERAL.tagTeamRollTypes,
initial: CONFIG.DH.GENERAL.tagTeamRollTypes.trait.id,
label: 'Roll Type'
}),
rollChoice: new fields.StringField({ nullable: true, initial: null }),
rollData: new fields.JSONField({ nullable: true, initial: null })
};
}
get roll() {
const roll = CONFIG.Dice.daggerheart.DualityRoll(JSON.parse(this.rollData));
return this.rollData ? CONFIG.Dice.daggerheart.DualityRoll(JSON.parse(this.rollData)) : null;
return this.rollData ? CONFIG.Dice.daggerheart.DualityRoll.fromData(this.rollData) : null;
}
}