From ebed4c3622110df6a5d26d36a2091865748c604f Mon Sep 17 00:00:00 2001 From: Joscha Maier Date: Mon, 30 Sep 2024 16:09:02 +0200 Subject: [PATCH] The documentation for this shit is non existent holy fuck how are you supposed to know how to do this? they do not know themselves I bet --- .../{kidsonbrooms.mjs => _system.mjs} | 0 modules/dataModel/dataModel.js | 51 ++++++++- modules/kidsonbrooms.mjs | 0 scripts/dataModel/dataModel.js | 108 ------------------ template.json | 51 --------- 5 files changed, 47 insertions(+), 163 deletions(-) rename modules/dataModel/{kidsonbrooms.mjs => _system.mjs} (100%) create mode 100644 modules/kidsonbrooms.mjs delete mode 100644 scripts/dataModel/dataModel.js delete mode 100644 template.json diff --git a/modules/dataModel/kidsonbrooms.mjs b/modules/dataModel/_system.mjs similarity index 100% rename from modules/dataModel/kidsonbrooms.mjs rename to modules/dataModel/_system.mjs diff --git a/modules/dataModel/dataModel.js b/modules/dataModel/dataModel.js index 0f09ca2..354ba20 100644 --- a/modules/dataModel/dataModel.js +++ b/modules/dataModel/dataModel.js @@ -14,6 +14,7 @@ class Stat extends foundry.abstract.DataModel modifiers: new ArrayField({ required: true, type: Modifier, default: []}), }; } + } class Modifier extends foundry.abstract.DataModel @@ -37,7 +38,7 @@ class Modifier extends foundry.abstract.DataModel /* Effect Models */ /* -------------------------------------------- */ -class EffectDataModel extends foundry.abstract.DataModel +class Effect extends foundry.abstract.DataModel { static defineSchema() { return { @@ -57,7 +58,7 @@ class Flaw extends foundry.abstract.DataModel } } -class Strength extends EffectDataModel +class Strength extends Effect { static defineSchema() { return { @@ -78,7 +79,7 @@ class Item extends foundry.abstract.TypeDataModel return { name: new StringField({ required: true, initial: "Item"}), description: new StringField({ required: true, initial: "An ItemDescription" }), - effects: new ArrayField({ required: true, type: EffectDataModel, default: []}), + effects: new ArrayField({ required: true, type: Effect, default: []}), }; } @@ -89,7 +90,7 @@ class Item extends foundry.abstract.TypeDataModel } } -class Wand extends Item +class Wand extends foundry.abstract.DataModel { static defineSchema() { return { @@ -100,7 +101,49 @@ class Wand extends Item } } +class Broom extends foundry.abstact.DataModel +{ + static defineSchema(){ + return { + name: new StringField({required: true, initial: "Broom"}), + look: new StringField({requird: true, intial: "A broom"}), + mechanicalBenefit: new EmbeddedDataField(effect, {required: false}) + } + } +} + /* -------------------------------------------- */ /* Actor Models */ /* -------------------------------------------- */ + +class ActorGeneral extends foundry.abstract.TypeDataModel +{ + static defineSchema(){ + return { + name: new StringField({required: true, initial: "Actor"}), + age: new StringField({required: false}), + pronouns: new StringField({required: false}), + fear: new StringField({required: false}), + grade: new StringField({required: false}), + stats: new SchemaField({ + fight: new EmbeddedDataField(Stat, {required: true, nullable: false, default: new Stat()}), + brains: new EmbeddedDataField(Stat, {required: true, nullable: false, default: new Stat()}), + charm: new EmbeddedDataField(Stat, {required: true, nullable: false, default: new Stat()}), + flight: new EmbeddedDataField(Stat, {required: true, nullable: false, default: new Stat()}), + brawn: new EmbeddedDataField(Stat, {required: true, nullable: false, default: new Stat()}), + grit: new EmbeddedDataField(Stat, {required: true, nullable: false, default: new Stat()}), + }), + } + } +} + +class PlayerCharacter extends ActorGeneral +{ + static defineSchema(){ + return { + ...super.defineSchema(), + + } + } +} \ No newline at end of file diff --git a/modules/kidsonbrooms.mjs b/modules/kidsonbrooms.mjs new file mode 100644 index 0000000..e69de29 diff --git a/scripts/dataModel/dataModel.js b/scripts/dataModel/dataModel.js deleted file mode 100644 index 1c636c6..0000000 --- a/scripts/dataModel/dataModel.js +++ /dev/null @@ -1,108 +0,0 @@ -const { - HTMLField, SchemaField, NumberField, StringField, FilePathField, ArrayField - } = foundry.data.fields; - -/* -------------------------------------------- */ -/* Base Models */ -/* -------------------------------------------- */ - -class Stat extends foundry.abstract.TypeDataModel -{ - static defineSchema() { - return { - id: new StringField({ required: true, initial: "statID"}), - name: new StringField({ required: true, intial: "Stat"}), - die: new NumberField({ required: true, integer: true, min: 0, max: 20, initial: 4}), - modifiers: new ArrayField({ required: true, type: Modifier, default: []}), - }; - } -} - -class Modifier extends foundry.abstract.TypeDataModel -{ - static defineSchema() { - return { - statID: new StringField({ required: true, initial: "statID"}), - name: new StringField({ required: true, initial: "Modifier"}), - value: new NumberField({ required: true, integer: true, initial: 0}), - }; - } - - Modifier(statID,name,value) { - this.statID = statID; - this.name = name; - this.value = value; - }; -} - -/* -------------------------------------------- */ -/* Effect Models */ -/* -------------------------------------------- */ - -class EffectDataModel extends foundry.abstract.TypeDataModel -{ - static defineSchema() { - return { - description: new StringField({ required: true, initial: "A EffectDescription" }), - modifier: new Modifier({ required: true, nullable: true, default: null}), - }; - } -} - -class Flaw extends foundry.abstract.TypeDataModel -{ - static defineSchema() { - return { - name: new StringField({ required: true, initial: "Flaw"}), - description: new StringField({ required: true, initial: "A FlawDescription" }) - }; - } -} - -class Strength extends EffectDataModel -{ - static defineSchema() { - return { - ...super.defineSchema(), - name: new StringField({ required: true, initial: "Strength"}) - }; - } -} - -/* -------------------------------------------- */ -/* Item Models */ -/* -------------------------------------------- */ -/* How this will work is when we first load a sheet we load all the items we have and take their effects and apply them to our stats. */ - -class Item extends foundry.abstract.TypeDataModel -{ - static defineSchema() { - return { - name: new StringField({ required: true, initial: "Item"}), - description: new StringField({ required: true, initial: "An ItemDescription" }), - effects: new ArrayField({ required: true, type: EffectDataModel, default: []}), - }; - } - - Item(name,description,effects) { - this.name = name; - this.description = description; - this.effects = effects; - } -} - -class Wand extends Item -{ - static defineSchema() { - return { - name: new StringField({ required: true, initial: "Wand"}), - wood: new Item({ required: true, initial: new Item()}), - core: new Item({ required: true, initial: new Item()}), - }; - } -} - - -/* -------------------------------------------- */ -/* Actor Models */ -/* -------------------------------------------- */ diff --git a/template.json b/template.json deleted file mode 100644 index 1f39af7..0000000 --- a/template.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "Actor":{}, - "Item":{ - "types":[ - "broom", - "wandCore", - "wandWood", - "flaw", - "strength", - "wandCoreEffect", - "wandWoodEffect", - "broomEffect" - ], - "broom":{ - "name":"Broom", - "riderDescription": "The rider of the broom.", - "mechanicalBenefit": "The mechanical benefit of the broom." - }, - "wandCore":{ - "name": "Wand Core", - "stat": "The stat that the wand core affects." - }, - "wandWood":{ - "name": "Wand Wood", - "stat": "The stat that the wand wood affects." - }, - "flaw":{ - "name": "Flaw" - }, - "strength": { - "name": "Strength", - "mechanicalBenefit": "The mechanical benefit of the strength." - }, - "wandCoreEffect": { - "name": "Wand Core Effect", - "stat": "The stat that the wand core effect affects." - }, - "wandWoodEffect": { - "name": "Wand Wood Effect", - "stat": "The stat that the wand wood effect affects." - }, - "broomEffect": { - "name": "Broom Effect", - "stat": "The stat that the broom effect affects.", - "strength": { - "name": "Strength", - "mechanicalBenefit": "The mechanical benefit of the strength." - } - } - } -} \ No newline at end of file