fvtt-never-stop-blowing-up/modules/dataModel/itemModel.mjs
2024-10-02 14:45:44 +02:00

46 lines
1.7 KiB
JavaScript

import Effect from "./dataModel.mjs";
/* -------------------------------------------- */
/* 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. */
const fields = foundry.data.fields;
export default class KidsOnBroomsItem extends foundry.abstract.TypeDataModel
{
static defineSchema() {
return {
description: new fields.StringField({ required: true, initial: "An KidsOnBroomsItemDescription" }),
effects: new fields.ArrayField({ required: true, type: Effect, default: []}),
quantity: new fields.NumberField({required: true, nullable: false, integer: true, initial: 1, min: 0}),
price: new fields.NumberField({required: true, nullable: false, integer: true, initial: 0, min: 0}),
};
}
KidsOnBroomsItem(name,description,effects) {
this.name = name;
this.description = description;
this.effects = effects;
}
}
export class Wand extends KidsOnBroomsItem
{
static defineSchema() {
return {
wood: new fields.EmbeddedDataField(KidsOnBroomsItem, { required: true, nullable: true, default: null}), //These are just KidsOnBroomsItems!
core: new fields.EmbeddedDataField(KidsOnBroomsItem, { required: true, nullable: true, default: null}),
};
}
}
export class Broom extends KidsOnBroomsItem
{
static defineSchema(){
return {
look: new fields.StringField({required: true, initial: "A broom"}),
mechanicalBenefit: new fields.EmbeddedDataField(Effect, {required: false})
}
}
}