fvtt-never-stop-blowing-up/modules/dataModel/playerCharacterModel.mjs
Joscha Maier dd42e5487c
a
2024-11-04 00:47:13 +01:00

48 lines
1.7 KiB
JavaScript

import ActorGeneral from "./baseActorModel.mjs";
import {Wand, Broom} from "./itemModel.mjs"
import KidsOnBroomsItem from "./itemModel.mjs"
/* -------------------------------------------- */
/* PC Model */
/* -------------------------------------------- */
const fields = foundry.data.fields;
export default class PlayerCharacter extends ActorGeneral
{
static defineSchema(){
return {
...super.defineSchema(),
description: new fields.StringField({required: false, intial: "Enter your characters description here."}),
broom: new fields.EmbeddedDataField(Broom, {nullable: true}),
wand: new fields.EmbeddedDataField(Wand, {nullable: true}),
animalFamiliar: new fields.StringField({required: false, initial: "Describe your companion!"}),
schoolbag: new fields.ArrayField({type: KidsOnBroomsItem, default: []}),
strengths: new fields.ArrayField({type: Strength, default: []}),
adversityTokens: new fields.NumberField({required: true, nullable: false, integer: true, initial: 3, min: 0})
}
}
static LOCALISATION_PREFIXES = ["PlayerCharacter"];
prepareBaseData() {
super.prepareBaseData();
let effectsToApply = this.gatherEffects();
effectsToApply.forEach(element => {
console.log(element);
})
}
gatherEffects() {
let effectsToApply = new [];
this.schoolbag.array.forEach(element => {
if(element.effects != []) {
element.effects.forEach(effect => {
effectsToApply.push(effect);
})
}
});
return effectsToApply;
}
}