import BaseItem from "./base-item.mjs"; const {ArrayField, BooleanField, NumberField, AnyField, StringField, HTMLField} = foundry.data.fields; export class ActiveEffectDataModel extends BaseItem { static defineSchema() { return { name: new StringField({required: true}), notes: new HTMLField(), unique: new BooleanField({initial: false}), effects: new AnyField() } /* name: String, // Name of Vornachteil will be used for rendering and referencing by other Items description: HTMLString, // only used for rendering variant: [String]?, // variant name of Vornachteil e.g. "Mut" in the case of "Herausragende Eigenschaft" levels: [Number]?, // available levels e.g. 1, 2 in the case of "Flink" mods: [ { level: Number?, // in reference to level of the Vornachteil, is null when it does not have any levels or is the only modification field: String, // Reference to Actor Data e.g. "FF" maps to "FF.mod" value: Number, // value of the Modification e.g. "+2" maps to 2 requirement: { field: String // Reference to Actor Data e.g. "BE" maps "be.aktuell" operation: String // Supported: "<=", ">" value: Number // Target Value the referenced field has to compare against }? // optional when the mod does not have an active requirement } ] */ } _onCreate(data, options, userId) { super._onCreate(data, options, userId); console.log(data); if (this.parent.getEmbeddedCollection("ActiveEffect").contents.length === 0) { this.parent.createEmbeddedDocuments("ActiveEffect", [{ name: data.name, changes: data.system.effects, duration: {}, icon: this.img, }]); console.log("added default activeffect"); } } }