fvtt-never-stop-blowing-up/modules/dataModel/itemModel.mjs

46 lines
1.7 KiB
JavaScript
Raw Normal View History

2024-10-02 00:14:03 +02:00
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;
2024-10-02 14:45:44 +02:00
export default class KidsOnBroomsItem extends foundry.abstract.TypeDataModel
2024-10-02 00:14:03 +02:00
{
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;
}
}
2024-10-02 14:45:44 +02:00
export class Wand extends KidsOnBroomsItem
2024-10-02 00:14:03 +02:00
{
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}),
};
}
}
2024-10-02 14:45:44 +02:00
export class Broom extends KidsOnBroomsItem
2024-10-02 00:14:03 +02:00
{
static defineSchema(){
return {
2024-10-02 14:45:44 +02:00
look: new fields.StringField({required: true, initial: "A broom"}),
2024-10-02 00:14:03 +02:00
mechanicalBenefit: new fields.EmbeddedDataField(Effect, {required: false})
}
}
}