Files
fvtt-machine-gods-noxian-ex…/module/models/companion.mjs
T
uberwald 1b10a77748
Release Creation / build (release) Successful in 46s
Fix as per CSV sheet tracking + creature explanation
2026-05-17 18:01:35 +02:00

40 lines
1.3 KiB
JavaScript

import { SYSTEM } from "../config/system.mjs"
import { htmlField, numberField, stringField, trackSchema } from "./shared.mjs"
export default class MGNECompanion extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields
return {
hp: trackSchema(1, 1),
morale: numberField(7, 2, 12),
armor: new fields.SchemaField({
die: new fields.StringField({ required: true, nullable: false, initial: "0", choices: SYSTEM.armorDieChoices }),
}),
attack: new fields.SchemaField({
label: stringField("Attack"),
damage: stringField("1d4"),
}),
valueText: stringField(""),
traitText: stringField(""),
specialtyText: stringField(""),
adventuringBehaviorUuid: stringField(""),
combatBehaviorUuid: stringField(""),
upkeep: stringField("3d10c per full rest"),
description: htmlField(""),
notes: htmlField(""),
}
}
/** @override */
static LOCALIZATION_PREFIXES = ["MGNE.Companion"]
/** @override */
static migrateData(source) {
// Remove old html behavior fields if present
if ("adventuringBehavior" in source) delete source.adventuringBehavior
if ("combatBehavior" in source) delete source.combatBehavior
return super.migrateData(source)
}
}