From 090aeab75f7385b5df1ec48b78b3b70465cab5b6 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Sat, 9 Jan 2021 14:09:21 +0100 Subject: [PATCH] added type definitions and translations for spells --- src/lang/en.json | 29 ++++++++++++++++++++++++- src/module/config.ts | 42 ++++++++++++++++++++++++++++++++++++ src/module/item/item-data.ts | 27 +++++++++++++++++++++++ src/template.json | 20 +++++++++++++++++ 4 files changed, 117 insertions(+), 1 deletion(-) diff --git a/src/lang/en.json b/src/lang/en.json index 4f79f7ef..c0235a56 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -36,6 +36,8 @@ "DS4.ItemTypeArmorPlural": "Armor", "DS4.ItemTypeShield": "Shield", "DS4.ItemTypeShieldPlural": "Shields", + "DS4.ItemTypeSpell": "Spell", + "DS4.ItemTypeSpellPlural": "Spells", "DS4.ItemTypeTrinket": "Trinket", "DS4.ItemTypeTrinketPlural": "Trinkets", "DS4.ItemTypeEquipment": "Equipment", @@ -72,6 +74,17 @@ "DS4.ArmorMaterialTypeChainAbbr": "Chain", "DS4.ArmorMaterialTypePlate": "Plate", "DS4.ArmorMaterialTypePlateAbbr": "Plate", + "DS4.SpellType": "Spell Type", + "DS4.SpellTypeSpellcasting": "Spellcasting", + "DS4.SpellTypeTargetedSpell": "Targeted Spell", + "DS4.SpellCategory": "Spell Category", + "DS4.SpellCategoryHealing": "Healing", + "DS4.SpellCategoryFire": "Fire", + "DS4.SpellCategoryIce": "Ice", + "DS4.SpellCategoryLight": "Light", + "DS4.SpellCategoryDarkness": "Darkness", + "DS4.SpellCategoryMindAffecting": "Mind Affecting", + "DS4.SpellCategoryElectricity": "Electricity", "DS4.AttributeBody": "Body", "DS4.AttributeMobility": "Mobility", "DS4.AttributeMind": "Mind", @@ -115,5 +128,19 @@ "DS4.ProfileSpecialCharacteristics": "Special Characteristics", "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" + "DS4.ErrorExplodingRecursionLimitExceeded": "Maximum recursion depth for exploding dice roll exceeded", + "DS4.UnitRounds": "Rounds", + "DS4.UnitRoundsAbbr": "rnd", + "DS4.UnitMinutes": "Minutes", + "DS4.UnitMinutesAbbr": "min", + "DS4.UnitHours": "Hours", + "DS4.UnitHoursAbbr": "h", + "DS4.UnitDays": "Days", + "DS4.UnitDaysAbbr": "d", + "DS4.UnitMeters": "Meters", + "DS4.UnitMetersAbbr": "m", + "DS4.UnitKilometers": "Kilometers", + "DS4.UnitKilometersAbbr": "km", + "DS4.UnitCustom": "Custom", + "DS4.UnitCustomAbbr": "-" } diff --git a/src/module/config.ts b/src/module/config.ts index 03b2c9d5..88053370 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -46,6 +46,7 @@ export const DS4 = { weapon: "DS4.ItemTypeWeapon", armor: "DS4.ItemTypeArmor", shield: "DS4.ItemTypeShield", + spell: "DS4.ItemTypeSpell", trinket: "DS4.ItemTypeTrinket", equipment: "DS4.ItemTypeEquipment", talent: "DS4.ItemTypeTalent", @@ -96,6 +97,21 @@ export const DS4 = { plate: "DS4.ArmorMaterialTypePlateAbbr", }, + spellType: { + spellcasting: "DS4.SpellTypeSpellcasting", + targetedSpell: "DS4.SpellTypeTargetedSpell", + }, + + spellCategory: { + healing: "DS4.SpellCategoryHealing", + fire: "DS4.SpellCategoryFire", + ice: "DS4.SpellCategoryIce", + light: "DS4.SpellCategoryLight", + darkness: "DS4.SpellCategoryDarkness", + mindAffecting: "DS4.SpellCategoryMindAffecting", + electricity: "DS4.SpellCategoryElectricity", + }, + /** * Define the set of attributes a character has */ @@ -188,4 +204,30 @@ export const DS4 = { eyeColor: "String", specialCharacteristics: "String", }, + + /** + * Define translations for available units + */ + units: { + rounds: "DS4.UnitRounds", + minutes: "DS4.UnitMinutes", + hours: "DS4.UnitHours", + days: "DS4.UnitHours", + meter: "DS4.UnitMeters", + kilometer: "DS4.UnitKilometers", + custom: "DS4.UnitCustom", + }, + + /** + * Define abbreviations for available units + */ + unitsAbbr: { + rounds: "DS4.UnitRoundsAbbr", + minutes: "DS4.UnitMinutesAbbr", + hours: "DS4.UnitHoursAbbr", + days: "DS4.UnitHoursAbbr", + meter: "DS4.UnitMetersAbbr", + kilometer: "DS4.UnitKilometersAbbr", + custom: "DS4.UnitCustomAbbr", + }, }; diff --git a/src/module/item/item-data.ts b/src/module/item/item-data.ts index 23105eb6..e5be9081 100644 --- a/src/module/item/item-data.ts +++ b/src/module/item/item-data.ts @@ -4,6 +4,7 @@ export type DS4ItemDataType = | DS4Weapon | DS4Armor | DS4Shield + | DS4Spell | DS4Trinket | DS4Equipment | DS4Talent @@ -32,6 +33,25 @@ interface DS4TalentRank extends ModifiableData { max: number; } +interface DS4Spell extends DS4ItemBase, DS4ItemEquipable { + spellType: "spellcasting" | "targetedSpell"; + bonus: string; + spellCategory: + | "healing" + | "fire" + | "ice" + | "light" + | "darkness" + | "mindAffecting" + | "electricity" + | "none" + | "unset"; + maxDistance: UnitData; + effectRadius: UnitData; + duration: UnitData; + scrollPrice: number; +} + interface DS4Shield extends DS4ItemBase, DS4ItemPhysical, DS4ItemEquipable, DS4ItemProtective {} interface DS4Trinket extends DS4ItemBase, DS4ItemPhysical, DS4ItemEquipable {} interface DS4Equipment extends DS4ItemBase, DS4ItemPhysical {} @@ -62,3 +82,10 @@ interface DS4ItemEquipable { interface DS4ItemProtective { armorValue: number; } + +interface UnitData { + value: string; + unit: UnitType; +} +type TemporalUnit = "rounds" | "minutes" | "hours" | "days" | "custom"; +type DistanceUnit = "meter" | "kilometer" | "custom"; diff --git a/src/template.json b/src/template.json index eee8acee..17d2ceca 100644 --- a/src/template.json +++ b/src/template.json @@ -115,6 +115,7 @@ "weapon", "armor", "shield", + "spell", "trinket", "equipment", "talent", @@ -175,6 +176,25 @@ }, "alphabet": { "templates": ["base"] + }, + "spell": { + "templates": ["base", "equipable"], + "spellType": "spellcasting", + "bonus": "", + "spellCategory": "unset", + "maxDistance": { + "value": "", + "unit": "meter" + }, + "effectRadius": { + "value": "", + "unit": "meter" + }, + "duration": { + "value": "", + "unit": "custom" + }, + "scrollPrice": 0 } } }