48 lines
2.0 KiB
JavaScript
48 lines
2.0 KiB
JavaScript
import { SYSTEM } from "../config/system.mjs"
|
|
|
|
export default class OathHammerMagicItem extends foundry.abstract.TypeDataModel {
|
|
static defineSchema() {
|
|
const fields = foundry.data.fields
|
|
const requiredInteger = { required: true, nullable: false, integer: true }
|
|
const schema = {}
|
|
|
|
// The magical effect / description of the item
|
|
schema.effect = new fields.HTMLField({ required: true, textSearch: true })
|
|
|
|
// Sub-type: Focus (arcane/divine instrument), Talisman (worn item), Trinket (misc object)
|
|
// Note: magic weapons and armor use the weapon/armor item types with isMagic=true instead.
|
|
schema.itemType = new fields.StringField({
|
|
required: true, initial: "talisman", choices: SYSTEM.MAGIC_ITEM_TYPE_CHOICES
|
|
})
|
|
|
|
// Quality: lesser / greater / legendary (determines power and how found, p.136)
|
|
schema.quality = new fields.StringField({
|
|
required: true, initial: "lesser", choices: SYSTEM.MAGIC_QUALITY_CHOICES
|
|
})
|
|
|
|
// Cursed items impose a bane that cannot be removed until the curse is broken
|
|
schema.isCursed = new fields.BooleanField({ initial: false })
|
|
|
|
// Legendary items bond to a single character (cannot be shared, p.136)
|
|
schema.isBonded = new fields.BooleanField({ initial: false })
|
|
|
|
// Class/lineage restriction printed in the item's type line, e.g. "Troubadour Only"
|
|
schema.classRestriction = new fields.StringField({ required: true, nullable: false, initial: "" })
|
|
|
|
// Limited-use items (e.g. "once per day"); none = always active
|
|
schema.usagePeriod = new fields.StringField({
|
|
required: true, initial: "none", choices: SYSTEM.TRAIT_USAGE_PERIOD
|
|
})
|
|
schema.maxUses = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
|
|
|
|
// Item slots occupied when carried; 0 = small item (no slots)
|
|
schema.slots = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
|
|
|
|
schema.equipped = new fields.BooleanField({ initial: false })
|
|
|
|
return schema
|
|
}
|
|
|
|
static LOCALIZATION_PREFIXES = ["OATHHAMMER.MagicItem"]
|
|
}
|