mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-22 23:43:37 +02:00
* Initial * . * Improvements * . * Renamed 'Main Charater' to 'Leader' * Localization fixes * . * Fixed roll sound coming when canceling a roll. Fixed the leader PART not being disabled when the player isn't the leader
40 lines
1.4 KiB
JavaScript
40 lines
1.4 KiB
JavaScript
export default class GroupRollData extends foundry.abstract.DataModel {
|
|
static defineSchema() {
|
|
const fields = foundry.data.fields;
|
|
|
|
return {
|
|
leader: new fields.EmbeddedDataField(CharacterData, { nullable: true, initial: null }),
|
|
aidingCharacters: new fields.TypedObjectField(new fields.EmbeddedDataField(CharacterData))
|
|
};
|
|
}
|
|
|
|
get participants() {
|
|
return {
|
|
...(this.leader ? { [this.leader.id]: this.leader } : {}),
|
|
...this.aidingCharacters
|
|
};
|
|
}
|
|
}
|
|
|
|
export class CharacterData extends foundry.abstract.DataModel {
|
|
static defineSchema() {
|
|
const fields = foundry.data.fields;
|
|
|
|
return {
|
|
id: new fields.StringField({ required: true }),
|
|
name: new fields.StringField({ required: true }),
|
|
img: new fields.StringField({ required: true }),
|
|
rollChoice: new fields.StringField({
|
|
choices: CONFIG.DH.ACTOR.abilities,
|
|
initial: CONFIG.DH.ACTOR.abilities.agility.id
|
|
}),
|
|
rollData: new fields.JSONField({ nullable: true, initial: null }),
|
|
selected: new fields.BooleanField({ initial: false }),
|
|
successfull: new fields.BooleanField({ nullable: true, initial: null })
|
|
};
|
|
}
|
|
|
|
get roll() {
|
|
return this.rollData ? CONFIG.Dice.daggerheart.DualityRoll.fromData(this.rollData) : null;
|
|
}
|
|
}
|