// character types type Proficiency = enum { untrained = -2 trained = 0 expert = 1 master = 2 legendary = 3 } type Character { var name : string var gender : enum { M, F, other } // abilities var abilityScores : { strength : int dexterity : int constitution : int intelligence : int wisdom : int charisma : int } def abilityModifiers : array[string : int] = abilityScores.map { score => floor( (score - 10) / 2 ) } // primary character selections var ancestry : Ancestry var background: Background var classLevels : array[CharacterClassLevels] def characterLevel : int = sum( classLevels.map { level) } ) // feats var feats : array[Feat] def ancestryFeats : array[Feat] = feats.where { featType is AncestryFeat } def backgroundFeats : array[Feat] = feats.where { featType is BackgroundFeat } def classFeats : array[Feat] = feats.where { featType is ClassFeat } def skillFeats : array[Feat] = feats.where { featType is SkillFeat } def generalFeats : array[Feat] = feats.where { featType is GeneralFeat } def dedicationFeats : array[Feat] = feats.where { featType is DedicationFeat } def archetypeFeats : array[Feat] = feats.where { featType is ArchetypeFeat } def getClassFeats(c : Class) : array[Feat] = feats.where { featType is ClassFeat and class = c} def getSkillFeats(s : Skill) : array[Feat] = feats.where { featType is SkillFeat and skill = s} // skills def signatureSkills : array[Skill] = union( classLevels.map { class.signatureSkills} ) var skillProficiencies : array[Skill : Proficiency] def skillBonus(skill : Skill) : int = skillProficiencies[skill] + abilityModifers(skill.ability) + characterLevel + ... // saving throws def fortitudeProficiency = max(ancestry.fortitudeProficiency, background.fortitudeProficiency, classLevels.map { cl => cl.fortitudeProficiency } ) def fortitudeBonus = fortitudeProficiency + characterLevel + ... def reflexProficiency = max(ancestry.reflexProficiency, background.reflexProficiency, classLevels.map { cl => cl.reflexProficiency } ) def reflexBonus = reflexProficiency + characterLevel + ... def willProficiency = max(ancestry.willProficiency, background.willProficiency, classLevels.map { cl => cl.willProficiency } ) def willBonus = willProficiency + characterLevel + ... // inventory var inventory : array[InventoryItem] var armor : ArmorItem var shield : ShieldItem var wornItems : InventoryItem // weapons def weaponProficiency : array[string : Proficiency] = ... // armor def armorProficiency : array[string : Proficiency] = ... // health def hp : int = sum( classLevels.map { cl => cl.class.hpPerLevel * cl.level } ) def ac : int = 10 + abilityModifers.dexterity + proficiencyBonus(armor) + armor.acBonus + armorProficiency def tac : int = 10 + abilityModifiers.dexterity + proficiencyBonus(armor) } abstract type CharacterClassLevels { var class : Class var level : int def fortitudeProficiency : Proficiency = class.fortitudeProficiency(level) def reflexProficiency : Proficiency = class.reflexProficiency(level) def willProficiency : Proficiency = class.willProficiency(level) } type FighterClassLevels extends CharacterClassLevels { var stances : array[ ... ] var combos : array[ ... ] } type WizardClassLevels extends CharacterClassLevels { var preferredSchool : SpellSchool var knownSpells : array[int : array[Spell]] } // ... other classes ... // build-in objects type Ancestry { var name : string var availableFeats: array[Feat] } type Background { var name : string var availableFeats: array[Feat] } abstract type Class { var name : string var hpPerLevel : int var signatureSkills : array[Skill] var availableFeats : array[Feat] def fortitudeProficiency(level : int) : Proficiency def reflexProficiency(level : int) : Proficiency def willProficiency(level : int) : Proficiency } type Feat { var name: string var featType : enum { BackgroundFeat, AncestryFeat, ClassFeat, SkillFeat, GeneralFeat, DedicationFeat, ArchetypeFeat } var requireLevel : int var requireFeats : array[Feat] } type Skill { var name : string var ability : string var takesArmorCheckPenalty : bool } type InventoryItem { var name : string var level : int var weight : Bulk var value : Currency } type ArmorItem extends InventoryItem { var acBonus : int var armorCheckPenalty : int var maxDex : int } type ShieldItem extends InventoryItem { } type Spell { var name : string var level : int }