34 lines
1.3 KiB
JavaScript
34 lines
1.3 KiB
JavaScript
import { SYSTEM } from "../config/system.mjs"
|
|
|
|
export default class OathHammerAbility extends foundry.abstract.TypeDataModel {
|
|
static defineSchema() {
|
|
const fields = foundry.data.fields
|
|
const requiredInteger = { required: true, nullable: false, integer: true }
|
|
const schema = {}
|
|
|
|
schema.description = new fields.HTMLField({ required: true, textSearch: true })
|
|
|
|
// lineage-trait (racial) or class-ability (starting or advancement trait)
|
|
schema.abilityType = new fields.StringField({
|
|
required: true, initial: "class-ability", choices: SYSTEM.ABILITY_TYPE_CHOICES
|
|
})
|
|
|
|
// Which class or lineage this trait belongs to (e.g. "Berserker", "Wood Elf")
|
|
schema.source = new fields.StringField({ required: true, nullable: false, initial: "" })
|
|
|
|
// When uses reset: none = passive (always on), encounter, day
|
|
schema.usagePeriod = new fields.StringField({
|
|
required: true, initial: "none", choices: SYSTEM.ABILITY_USAGE_PERIOD
|
|
})
|
|
|
|
// Maximum uses per period. 0 = passive / unlimited.
|
|
// Use a descriptive string when the limit is formula-based
|
|
// (e.g. "equal to Fate ranks") — store the note in the description.
|
|
schema.maxUses = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
|
|
|
|
return schema
|
|
}
|
|
|
|
static LOCALIZATION_PREFIXES = ["OATHHAMMER.Ability"]
|
|
}
|