vagabond-rpg-foundryvtt/module/data/item/ancestry.mjs
Cal Corum 51f0472d99 Implement Phase 1: Complete data model system for actors and items
Actor Data Models:
- VagabondActorBase: Shared base class with biography field
- CharacterData: Full PC schema with stats, skills, saves, resources,
  custom crit thresholds, dynamic resources, item slots, wealth tracking
- NPCData: Monster stat block with HD, HP, TL, zone, morale, actions,
  abilities, immunities/weaknesses

Item Data Models:
- VagabondItemBase: Shared base with description field
- AncestryData: Being type, size, racial traits
- ClassData: Progression tables, features, mana/casting, trained skills
- SpellData: Dynamic mana cost calculation, delivery/duration types
- PerkData: Prerequisites system, stat/skill/spell requirements
- WeaponData: Damage, grip, properties, attack types, crit thresholds
- ArmorData: Armor value, type, dodge penalty
- EquipmentData: Quantity, slots, consumables
- FeatureData: Class features with Active Effect changes

Active Effects Integration:
- Helper module for creating and managing Active Effects
- Effect key mapping for stats, saves, skills, crit thresholds
- Utilities for applying/removing item effects

Derived Value Calculations (CharacterData):
- Max HP = Might × Level
- Speed by Dexterity lookup
- Item Slots = 8 + Might - Fatigue
- Save difficulties from stat pairs
- Skill difficulties (trained doubles stat contribution)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-12 15:22:09 -06:00

67 lines
1.5 KiB
JavaScript

/**
* Ancestry Item Data Model
*
* Defines the data schema for character ancestries (races) in Vagabond RPG.
* Examples: Human, Dwarf, Elf, Halfling, Draken, Goblin, Orc
*
* Ancestries provide:
* - Being type classification
* - Size category
* - Racial traits (abilities/features)
*
* @extends VagabondItemBase
*/
import VagabondItemBase from "./base-item.mjs";
export default class AncestryData extends VagabondItemBase {
/**
* Define the schema for ancestry items.
*
* @returns {Object} The schema definition
*/
static defineSchema() {
const fields = foundry.data.fields;
const baseSchema = super.defineSchema();
return {
...baseSchema,
// Being type (Humanlike, Fae, Cryptid, etc.)
beingType: new fields.StringField({
required: true,
initial: "humanlike",
}),
// Size category
size: new fields.StringField({
required: true,
initial: "medium",
}),
// Racial traits - abilities granted by this ancestry
traits: new fields.ArrayField(
new fields.SchemaField({
name: new fields.StringField({ required: true }),
description: new fields.HTMLField({ required: true }),
}),
{ initial: [] }
),
};
}
/**
* Get chat card data for displaying ancestry information.
*
* @returns {Object} Chat card data
*/
getChatData() {
const data = super.getChatData();
data.beingType = this.beingType;
data.size = this.size;
data.traits = this.traits;
return data;
}
}