Some tests

This commit is contained in:
Dapoolp 2025-07-28 15:03:19 +02:00
parent 6d7401c874
commit 86cb466f6e
2 changed files with 16 additions and 2 deletions

View file

@ -37,7 +37,11 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
this.extraSchemas.forEach(s => {
let clsField;
if ((clsField = this.getActionField(s))) schemaFields[s] = new clsField();
if ((clsField = this.getActionField(s))) schemaFields[s] = new clsField(
{
type: this
}
);
});
return schemaFields;

View file

@ -4,7 +4,7 @@ export class DHActionRollData extends foundry.abstract.DataModel {
/** @override */
static defineSchema() {
return {
type: new fields.StringField({ nullable: true, initial: null, choices: CONFIG.DH.GENERAL.rollTypes }),
type: new fields.StringField({ nullable: true, initial: null, choices: this.getRollTypes() }),
trait: new fields.StringField({ nullable: true, initial: null, choices: CONFIG.DH.ACTOR.abilities }),
difficulty: new fields.NumberField({ nullable: true, initial: null, integer: true, min: 0 }),
bonus: new fields.NumberField({ nullable: true, initial: null, integer: true }),
@ -45,6 +45,15 @@ export class DHActionRollData extends foundry.abstract.DataModel {
};
}
static getRollTypes() {
console.log(this.parent, this._source)
return CONFIG.DH.GENERAL.rollTypes;
}
_configure() {
console.log(this)
}
getFormula() {
if (!this.type) return;
let formula = '';
@ -71,5 +80,6 @@ export class DHActionRollData extends foundry.abstract.DataModel {
export default class RollField extends fields.EmbeddedDataField {
constructor(options, context = {}) {
super(DHActionRollData, options, context);
console.log(this)
}
}