import { SYSTEM } from "../config/system.mjs" export default class OathHammerBuilding extends foundry.abstract.TypeDataModel { static defineSchema() { const fields = foundry.data.fields const requiredInteger = { required: true, nullable: false, integer: true } const schema = {} // Narrative description and special effects schema.description = new fields.HTMLField({ required: true, textSearch: true }) // Skill required to build (Carpentry or Masonry) schema.skillCheck = new fields.StringField({ required: true, initial: "carpentry", choices: SYSTEM.BUILDING_SKILL_CHOICES }) // Cost in gold pieces (after skill check SV negotiation) schema.cost = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }) // Construction duration (free text: "3 weeks", "6 months", etc.) schema.buildTime = new fields.StringField({ required: true, nullable: false, initial: "" }) // Monthly tax revenue formula ("3d6", "2d6", "1d3", "" = none) schema.taxRevenue = new fields.StringField({ required: true, nullable: false, initial: "" }) // Is this building currently constructed? schema.constructed = new fields.BooleanField({ required: true, initial: false }) // Additional GM notes (special conditions, upgrades, damage, etc.) schema.notes = new fields.HTMLField({ required: false, textSearch: true }) return schema } static LOCALIZATION_PREFIXES = ["OATHHAMMER.Building"] /** Returns true if this building generates tax income */ get hasTaxRevenue() { return this.taxRevenue.trim().length > 0 } }