You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wanderhome-foundry-system/module/data/actor-npc.mjs

19 lines
572 B
JavaScript

import WanderhomeActorBase from "./base-actor.mjs";
export default class WanderhomeNPC extends WanderhomeActorBase {
static defineSchema() {
const fields = foundry.data.fields;
const requiredInteger = { required: true, nullable: false, integer: true };
const schema = super.defineSchema();
schema.cr = new fields.NumberField({ ...requiredInteger, initial: 1, min: 0 });
schema.xp = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 });
return schema
}
prepareDerivedData() {
this.xp = this.cr * this.cr * 100;
}
}