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

This commit is contained in:
Joscha Maier 2024-09-30 16:09:02 +02:00
parent bcf1d8827d
commit ebed4c3622
No known key found for this signature in database
GPG Key ID: 8C4D045D84A30ABA
5 changed files with 47 additions and 163 deletions

View File

@ -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(),
}
}
}

0
modules/kidsonbrooms.mjs Normal file
View File

View File

@ -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 */
/* -------------------------------------------- */

View File

@ -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."
}
}
}
}