From 6820ce7c00c6e6daeea876b2141d82de0ee7d278 Mon Sep 17 00:00:00 2001 From: Johannes Loher Date: Sat, 9 Jan 2021 22:51:46 +0100 Subject: [PATCH] Add creature actor to config, i18n, template.json, types --- src/lang/de.json | 53 ++++-- src/lang/en.json | 53 ++++-- src/module/actor/actor-data.ts | 70 +++++--- src/module/config.ts | 78 +++++--- src/module/ds4.ts | 8 +- src/template.json | 169 ++++++++++-------- src/templates/actor/actor-sheet.hbs | 12 +- .../actor/partials/character-progression.hbs | 4 +- src/templates/actor/partials/profile.hbs | 4 +- 9 files changed, 271 insertions(+), 180 deletions(-) diff --git a/src/lang/de.json b/src/lang/de.json index d5e4d4f7..238ab636 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -89,30 +89,47 @@ "DS4.CombatValuesRangedAttack": "Schießen", "DS4.CombatValuesSpellcasting": "Zaubern", "DS4.CombatValuesTargetedSpellcasting": "Zielzaubern", - "DS4.BaseInfoRace": "Volk", - "DS4.BaseInfoClass": "Klasse", - "DS4.BaseInfoHeroClass": "Helden Klasse", - "DS4.BaseInfoCulture": "Kultur", - "DS4.ProgressionLevel": "Stufe", - "DS4.ProgressionExperiencePoints": "Erfahrungspunkte", - "DS4.ProgressionTalentPoints": "Talentpunkte", - "DS4.ProgressionProgressPoints": "Lernpunkte", + "DS4.CharacterBaseInfoRace": "Volk", + "DS4.CharacterBaseInfoClass": "Klasse", + "DS4.CharacterBaseInfoHeroClass": "Helden Klasse", + "DS4.CharacterBaseInfoCulture": "Kultur", + "DS4.CharacterProgressionLevel": "Stufe", + "DS4.CharacterProgressionExperiencePoints": "Erfahrungspunkte", + "DS4.CharacterProgressionTalentPoints": "Talentpunkte", + "DS4.CharacterProgressionProgressPoints": "Lernpunkte", "DS4.TalentRank": "Rang", "DS4.TalentRankBase": "Erworbener Rang", "DS4.TalentRankMax": "Maximaler Rang", "DS4.TalentRankMod": "Zusätzlicher Rang", "DS4.TalentRankTotal": "Gesamter Rang", - "DS4.LanguageLanguages": "Sprachen", - "DS4.LanguageAlphabets": "Schriftzeichen", - "DS4.ProfileGender": "Geschlecht", - "DS4.ProfileBirthday": "Geburtstag", - "DS4.ProfileBirthplace": "Geburtsort", - "DS4.ProfileAge": "Alter", - "DS4.ProfileHeight": "Größe", + "DS4.CharacterLanguageLanguages": "Sprachen", + "DS4.CharacterLanguageAlphabets": "Schriftzeichen", + "DS4.CharacterProfileGender": "Geschlecht", + "DS4.CharacterProfileBirthday": "Geburtstag", + "DS4.CharacterProfileBirthplace": "Geburtsort", + "DS4.CharacterProfileAge": "Alter", + "DS4.CharacterProfileHeight": "Größe", "DS4.ProfilHairColor": "Haarfarbe", - "DS4.ProfileWeight": "Gewicht", - "DS4.ProfileEyeColor": "Augenfarbe", - "DS4.ProfileSpecialCharacteristics": "Besondere Eigenschaften", + "DS4.CharacterProfileWeight": "Gewicht", + "DS4.CharacterProfileEyeColor": "Augenfarbe", + "DS4.CharacterProfileSpecialCharacteristics": "Besondere Eigenschaften", + "DS4.CreatureTypeAnimal": "Tier", + "DS4.CreatureTypeConstruct": "Konstrukt", + "DS4.CreatureTypeHumanoid": "Humanoid", + "DS4.CreatureTypeMagicalEntity": "Magisches Wesen", + "DS4.CreatureTypePlantBeing": "Pflanzenwesen", + "DS4.CreatureTypeUndead": "Untot", + "DS4.CreatureSizeCategoryTiny": "Winzig", + "DS4.CreatureSizeCategorySmall": "Klein", + "DS4.CreatureSizeCategoryNormal": "Normal", + "DS4.CreatureSizeCategoryLarge": "Groß", + "DS4.CreatureSizeCategoryHuge": "Riesig", + "DS4.CreatureSizeCategoryColossal": "Gewaltig", + "DS4.CreatureBaseInfoLoot": "Beute", + "DS4.CreatureBaseInfoFoeFactor": "Gegnerhärte", + "DS4.CreatureBaseInfoCreatureType": "Kreaturengruppe", + "DS4.CreatureBaseInfoSizeCategory": "Größenkategorie", + "DS4.CreatureBaseInfoExperiencePoints": "Erfahrungspunkte", "DS4.WarningManageActiveEffectOnOwnedItem": "Das Verwalten von aktiven Effekten innerhalb eines besessen Items wird derzeit nicht unterstützt und wird in einem nachfolgenden Update hinzugefügt.", "DS4.ErrorDiceCritOverlap": "Es gibt eine Überlappung zwischen Patzern und Immersiegen.", "DS4.ErrorExplodingRecursionLimitExceeded": "Die maximale Rekursionstiefe für slayende Würfelwürfe wurde überschritten." diff --git a/src/lang/en.json b/src/lang/en.json index 4f79f7ef..3ad1cabc 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -89,30 +89,47 @@ "DS4.CombatValuesRangedAttack": "Ranged Attack", "DS4.CombatValuesSpellcasting": "Spellcasting", "DS4.CombatValuesTargetedSpellcasting": "Targeted Spellcasting", - "DS4.BaseInfoRace": "Race", - "DS4.BaseInfoClass": "Class", - "DS4.BaseInfoHeroClass": "Hero Class", - "DS4.BaseInfoCulture": "Culture", - "DS4.ProgressionLevel": "Level", - "DS4.ProgressionExperiencePoints": "Experience Points", - "DS4.ProgressionTalentPoints": "Talent Points", - "DS4.ProgressionProgressPoints": "Progress Points", + "DS4.CharacterBaseInfoRace": "Race", + "DS4.CharacterBaseInfoClass": "Class", + "DS4.CharacterBaseInfoHeroClass": "Hero Class", + "DS4.CharacterBaseInfoCulture": "Culture", + "DS4.CharacterProgressionLevel": "Level", + "DS4.CharacterProgressionExperiencePoints": "Experience Points", + "DS4.CharacterProgressionTalentPoints": "Talent Points", + "DS4.CharacterProgressionProgressPoints": "Progress Points", "DS4.TalentRank": "Rank", "DS4.TalentRankBase": "Acquired Ranks", "DS4.TalentRankMax": "Maximum Ranks", "DS4.TalentRankMod": "Additional Ranks", "DS4.TalentRankTotal": "Total Ranks", - "DS4.LanguageLanguages": "Languages", - "DS4.LanguageAlphabets": "Alphabets", - "DS4.ProfileGender": "Gender", - "DS4.ProfileBirthday": "Birthday", - "DS4.ProfileBirthplace": "Birthplace", - "DS4.ProfileAge": "Age", - "DS4.ProfileHeight": "Height", + "DS4.CharacterLanguageLanguages": "Languages", + "DS4.CharacterLanguageAlphabets": "Alphabets", + "DS4.CharacterProfileGender": "Gender", + "DS4.CharacterProfileBirthday": "Birthday", + "DS4.CharacterProfileBirthplace": "Birthplace", + "DS4.CharacterProfileAge": "Age", + "DS4.CharacterProfileHeight": "Height", "DS4.ProfilHairColor": "Hair Color", - "DS4.ProfileWeight": "Weight", - "DS4.ProfileEyeColor": "Eye Color", - "DS4.ProfileSpecialCharacteristics": "Special Characteristics", + "DS4.CharacterProfileWeight": "Weight", + "DS4.CharacterProfileEyeColor": "Eye Color", + "DS4.CharacterProfileSpecialCharacteristics": "Special Characteristics", + "DS4.CreatureTypeAnimal": "Animal", + "DS4.CreatureTypeConstruct": "Construct", + "DS4.CreatureTypeHumanoid": "Humanoid", + "DS4.CreatureTypeMagicalEntity": "Magical Entity", + "DS4.CreatureTypePlantBeing": "Plant Being", + "DS4.CreatureTypeUndead": "Undead", + "DS4.CreatureSizeCategoryTiny": "Tiny", + "DS4.CreatureSizeCategorySmall": "Small", + "DS4.CreatureSizeCategoryNormal": "Normal", + "DS4.CreatureSizeCategoryLarge": "Large", + "DS4.CreatureSizeCategoryHuge": "Huge", + "DS4.CreatureSizeCategoryColossal": "Colossal", + "DS4.CreatureBaseInfoLoot": "Loot", + "DS4.CreatureBaseInfoFoeFactor": "Foe Factor", + "DS4.CreatureBaseInfoCreatureType": "Creature Type", + "DS4.CreatureBaseInfoSizeCategory": "Size Category", + "DS4.CreatureBaseInfoExperiencePoints": "Experience Points", "DS4.WarningManageActiveEffectOnOwnedItem": "Managing Active Effects within an Owned Item is not currently supported and will be added in a subsequent update.", "DS4.ErrorDiceCritOverlap": "There's an overlap between Fumbles and Coups", "DS4.ErrorExplodingRecursionLimitExceeded": "Maximum recursion depth for exploding dice roll exceeded" diff --git a/src/module/actor/actor-data.ts b/src/module/actor/actor-data.ts index a3ac75b9..1a935841 100644 --- a/src/module/actor/actor-data.ts +++ b/src/module/actor/actor-data.ts @@ -1,18 +1,4 @@ -export interface DS4ActorDataType { - attributes: DS4ActorDataAttributes; - traits: DS4ActorDataTraits; - combatValues: DS4ActorDataCombatValues; - baseInfo: DS4ActorDataBaseInfo; - progression: DS4ActorDataProgression; - language: DS4ActorDataLanguage; - profile: DS4ActorDataProfile; -} - -interface DS4ActorDataAttributes { - body: BodyAttribute; - mobility: ModifiableData; - mind: ModifiableData; -} +export type DS4ActorDataType = DS4ActorDataCharacter | DS4ActorDataCreature; export interface ModifiableData { base: T; @@ -20,18 +6,27 @@ export interface ModifiableData { total?: T; } -interface UsableResource { - total: T; - used: T; -} - interface ResourceData extends ModifiableData { value: T; max?: T; } -// Blueprint in case we need more detailed differentiation -type BodyAttribute = ModifiableData; +interface UsableResource { + total: T; + used: T; +} + +interface DS4ActorDataBase { + attributes: DS4ActorDataAttributes; + traits: DS4ActorDataTraits; + combatValues: DS4ActorDataCombatValues; +} + +interface DS4ActorDataAttributes { + body: ModifiableData; + mobility: ModifiableData; + mind: ModifiableData; +} interface DS4ActorDataTraits { strength: ModifiableData; @@ -53,26 +48,33 @@ interface DS4ActorDataCombatValues { targetedSpellcasting: ModifiableData; } -interface DS4ActorDataBaseInfo { +interface DS4ActorDataCharacter extends DS4ActorDataBase { + baseInfo: DS4ActorDataCharacterBaseInfo; + progression: DS4ActorDataCharacterProgression; + language: DS4ActorDataCharacterLanguage; + profile: DS4ActorDataCharacterProfile; +} + +interface DS4ActorDataCharacterBaseInfo { race: string; class: string; heroClass: string; culture: string; } -interface DS4ActorDataProgression { +interface DS4ActorDataCharacterProgression { level: number; experiencePoints: number; talentPoints: UsableResource; progressPoints: UsableResource; } -interface DS4ActorDataLanguage { +interface DS4ActorDataCharacterLanguage { languages: string; alphabets: string; } -interface DS4ActorDataProfile { +interface DS4ActorDataCharacterProfile { gender: string; birthday: string; birthplace: string; @@ -83,3 +85,19 @@ interface DS4ActorDataProfile { eyeColor: string; specialCharacteristics: string; } + +interface DS4ActorDataCreature extends DS4ActorDataBase { + baseInfo: DS4ActorDataCreatureBaseInfo; +} + +type CreatureType = "animal" | "construct" | "humanoid" | "magicalEntity" | "plantBeing" | "undead"; + +type SizeCategory = "tiny" | "small" | "normal" | "large" | "huge" | "colossal"; + +interface DS4ActorDataCreatureBaseInfo { + loot: string; + foeFactor: number; + creatureType: CreatureType; + sizeCategory: SizeCategory; + experiencePoints: number; +} diff --git a/src/module/config.ts b/src/module/config.ts index 03b2c9d5..86f82d6e 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -97,7 +97,7 @@ export const DS4 = { }, /** - * Define the set of attributes a character has + * Define the set of attributes an actor has */ attributes: { body: "DS4.AttributeBody", @@ -106,7 +106,7 @@ export const DS4 = { }, /** - * Define the set of traits a character has + * Define the set of traits an actor has */ traits: { strength: "DS4.TraitStrength", @@ -118,7 +118,7 @@ export const DS4 = { }, /** - * Define the set of combat values a character has + * Define the set of combat values an actor has */ combatValues: { hitPoints: "DS4.CombatValuesHitPoints", @@ -134,50 +134,50 @@ export const DS4 = { /** * Define the base info of a character */ - baseInfo: { - race: "DS4.BaseInfoRace", - class: "DS4.BaseInfoClass", - heroClass: "DS4.BaseInfoHeroClass", - culture: "DS4.BaseInfoCulture", + characterBaseInfo: { + race: "DS4.CharacterBaseInfoRace", + class: "DS4.CharacterBaseInfoClass", + heroClass: "DS4.CharacterBaseInfoHeroClass", + culture: "DS4.CharacterBaseInfoCulture", }, /** * Define the progression info of a character */ - progression: { - level: "DS4.ProgressionLevel", - experiencePoints: "DS4.ProgressionExperiencePoints", - talentPoints: "DS4.ProgressionTalentPoints", - progressPoints: "DS4.ProgressionProgressPoints", + characterProgression: { + level: "DS4.CharacterProgressionLevel", + experiencePoints: "DS4.CharacterProgressionExperiencePoints", + talentPoints: "DS4.CharacterProgressionTalentPoints", + progressPoints: "DS4.CharacterProgressionProgressPoints", }, /** * Define the language info of a character */ - language: { - languages: "DS4.LanguageLanguages", - alphabets: "DS4.LanguageAlphabets", + characterLanguage: { + languages: "DS4.CharacterLanguageLanguages", + alphabets: "DS4.CharacterLanguageAlphabets", }, /** * Define the profile info of a character */ - profile: { - gender: "DS4.ProfileGender", - birthday: "DS4.ProfileBirthday", - birthplace: "DS4.ProfileBirthplace", - age: "DS4.ProfileAge", - height: "DS4.ProfileHeight", + characterProfile: { + gender: "DS4.CharacterProfileGender", + birthday: "DS4.CharacterProfileBirthday", + birthplace: "DS4.CharacterProfileBirthplace", + age: "DS4.CharacterProfileAge", + height: "DS4.CharacterProfileHeight", hairColor: "DS4.ProfilHairColor", - weight: "DS4.ProfileWeight", - eyeColor: "DS4.ProfileEyeColor", - specialCharacteristics: "DS4.ProfileSpecialCharacteristics", + weight: "DS4.CharacterProfileWeight", + eyeColor: "DS4.CharacterProfileEyeColor", + specialCharacteristics: "DS4.CharacterProfileSpecialCharacteristics", }, /** * Define the profile info types for hanndlebars of a character */ - profileDTypes: { + characterProfileDTypes: { gender: "String", birthday: "String", birthplace: "String", @@ -188,4 +188,30 @@ export const DS4 = { eyeColor: "String", specialCharacteristics: "String", }, + + creatureTypes: { + animal: "DS4.CreatureTypeAnimal", + construct: "DS4.CreatureTypeConstruct", + humanoid: "DS4.CreatureTypeHumanoid", + magicalEntity: "DS4.CreatureTypeMagicalEntity", + plantBeing: "DS4.CreatureTypePlantBeing", + undead: "DS4.CreatureTypeUndead", + }, + + creatureSizeCategories: { + tiny: "DS4.CreatureSizeCategoryTiny", + small: "DS4.CreatureSizeCategorySmall", + normal: "DS4.CreatureSizeCategoryNormal", + large: "DS4.CreatureSizeCategoryLarge", + huge: "DS4.CreatureSizeCategoryHuge", + colossal: "DS4.CreatureSizeCategoryColossal", + }, + + creatureBaseInfo: { + loot: "DS4.CreatureBaseInfoLoot", + foeFactor: "DS4.CreatureBaseInfoFoeFactor", + creatureType: "DS4.CreatureBaseInfoCreatureType", + sizeCategory: "DS4.CreatureBaseInfoSizeCategory", + experiencePoints: "DS4.CreatureBaseInfoExperiencePoints", + }, }; diff --git a/src/module/ds4.ts b/src/module/ds4.ts index a9d46ac2..70eae0cc 100644 --- a/src/module/ds4.ts +++ b/src/module/ds4.ts @@ -79,10 +79,10 @@ Hooks.once("setup", function () { "attributes", "traits", "combatValues", - "baseInfo", - "progression", - "language", - "profile", + "characterBaseInfo", + "characterProgression", + "characterLanguage", + "characterProfile", ]; // Exclude some from sorting where the default order matters diff --git a/src/template.json b/src/template.json index eee8acee..d13f154d 100644 --- a/src/template.json +++ b/src/template.json @@ -1,84 +1,97 @@ { "Actor": { - "types": ["character"], - "templates": {}, + "types": ["character", "creature"], + "templates": { + "base": { + "attributes": { + "body": { + "base": 0, + "mod": 0 + }, + "mobility": { + "base": 0, + "mod": 0 + }, + "mind": { + "base": 0, + "mod": 0 + } + }, + "traits": { + "strength": { + "base": 0, + "mod": 0 + }, + "constitution": { + "base": 0, + "mod": 0 + }, + "agility": { + "base": 0, + "mod": 0 + }, + "dexterity": { + "base": 0, + "mod": 0 + }, + "intellect": { + "base": 0, + "mod": 0 + }, + "aura": { + "base": 0, + "mod": 0 + } + }, + "combatValues": { + "hitPoints": { + "base": 0, + "mod": 0, + "value": 0 + }, + "defense": { + "base": 0, + "mod": 0 + }, + "initiative": { + "base": 0, + "mod": 0 + }, + "movement": { + "base": 0, + "mod": 0 + }, + "meleeAttack": { + "base": 0, + "mod": 0 + }, + "rangedAttack": { + "base": 0, + "mod": 0 + }, + "spellcasting": { + "base": 0, + "mod": 0 + }, + "targetedSpellcasting": { + "base": 0, + "mod": 0 + } + } + } + }, + "creature": { + "templates": ["base"], + "baseInfo": { + "loot": "", + "foeFactor": 1, + "creatureType": "humanoid", + "sizeCategory": "normal", + "experiencePoints": 0 + } + }, "character": { - "templates": [], - "attributes": { - "body": { - "base": 0, - "mod": 0 - }, - "mobility": { - "base": 0, - "mod": 0 - }, - "mind": { - "base": 0, - "mod": 0 - } - }, - "traits": { - "strength": { - "base": 0, - "mod": 0 - }, - "constitution": { - "base": 0, - "mod": 0 - }, - "agility": { - "base": 0, - "mod": 0 - }, - "dexterity": { - "base": 0, - "mod": 0 - }, - "intellect": { - "base": 0, - "mod": 0 - }, - "aura": { - "base": 0, - "mod": 0 - } - }, - "combatValues": { - "hitPoints": { - "base": 0, - "mod": 0, - "value": 0 - }, - "defense": { - "base": 0, - "mod": 0 - }, - "initiative": { - "base": 0, - "mod": 0 - }, - "movement": { - "base": 0, - "mod": 0 - }, - "meleeAttack": { - "base": 0, - "mod": 0 - }, - "rangedAttack": { - "base": 0, - "mod": 0 - }, - "spellcasting": { - "base": 0, - "mod": 0 - }, - "targetedSpellcasting": { - "base": 0, - "mod": 0 - } - }, + "templates": ["base"], "baseInfo": { "race": "", "class": "", diff --git a/src/templates/actor/actor-sheet.hbs b/src/templates/actor/actor-sheet.hbs index 8e3e5f54..2dec0fb8 100644 --- a/src/templates/actor/actor-sheet.hbs +++ b/src/templates/actor/actor-sheet.hbs @@ -8,17 +8,17 @@
- +
- +
+ for="data.progression.progressPoints.used">{{config.characterProgression.progressPoints}}
+ for="data.progression.talentPoints.used">{{config.characterProgression.talentPoints}}
- +
+ for="data.baseInfo.heroClass">{{config.characterBaseInfo.heroClass}}
diff --git a/src/templates/actor/partials/character-progression.hbs b/src/templates/actor/partials/character-progression.hbs index f22376f0..8990656c 100644 --- a/src/templates/actor/partials/character-progression.hbs +++ b/src/templates/actor/partials/character-progression.hbs @@ -1,13 +1,13 @@
-

+

+ for="data.progression.experiencePoints">{{config.characterProgression.experiencePoints}}

diff --git a/src/templates/actor/partials/profile.hbs b/src/templates/actor/partials/profile.hbs index b0034128..05d51146 100644 --- a/src/templates/actor/partials/profile.hbs +++ b/src/templates/actor/partials/profile.hbs @@ -3,10 +3,10 @@ {{#each data.profile as |profile-data-value profile-data-key|}}
+ data-dtype="{{lookup ../config/characterProfileDTypes profile-data-key}}" />
{{/each}}