diff --git a/adventures-with-emmy.mjs b/adventures-with-emmy.mjs index e5f2a44..efe690a 100644 --- a/adventures-with-emmy.mjs +++ b/adventures-with-emmy.mjs @@ -7,10 +7,21 @@ import * as applications from "./module/applications/_module.mjs" import { SystemManager } from "./module/applications/hud/system-manager.js" import { MODULE, REQUIRED_CORE_MODULE_VERSION } from "./module/applications/hud/constants.js" -Hooks.once("init", function () { +Hooks.once("init", async function () { console.info("Adventures with Emmy | Initializing System") console.info(SYSTEM.ASCII) + // Load trait tooltip descriptions from external JSON + try { + const resp = await fetch("systems/fvtt-adventures-with-emmy/module/config/trait-descriptions.json") + const data = await resp.json() + // Strip the comment key and populate SYSTEM.TRAIT_DESCRIPTIONS in-place + delete data["_comment"] + Object.assign(SYSTEM.TRAIT_DESCRIPTIONS, data) + } catch (err) { + console.warn("Adventures with Emmy | Failed to load trait-descriptions.json", err) + } + globalThis.adventuresWithEmmy = game.system game.system.CONST = SYSTEM @@ -83,6 +94,10 @@ Hooks.once("init", function () { // Handlebars helpers Handlebars.registerHelper("abs", (value) => Math.abs(value ?? 0)) + Handlebars.registerHelper("traitTooltip", (traitName) => { + const key = (traitName ?? "").toLowerCase() + return SYSTEM.TRAIT_DESCRIPTIONS[key] ?? "" + }) }) Hooks.once("ready", function () { diff --git a/module/applications/sheets/base-item-sheet.mjs b/module/applications/sheets/base-item-sheet.mjs index 6db37bd..8feb1c5 100644 --- a/module/applications/sheets/base-item-sheet.mjs +++ b/module/applications/sheets/base-item-sheet.mjs @@ -21,7 +21,7 @@ export default class AwEItemSheet extends HandlebarsApplicationMixin(foundry.app classes: ["awemmy", "item"], position: { width: 600, - height: 480 + height: 540 }, form: { submitOnChange: true diff --git a/module/config/system.mjs b/module/config/system.mjs index 0dc47ab..183fb1f 100644 --- a/module/config/system.mjs +++ b/module/config/system.mjs @@ -55,6 +55,13 @@ export const ASCII = ` |___/ ` +/** + * Tooltip descriptions for known traits — loaded at runtime from + * module/config/trait-descriptions.json. Populated during the "init" hook; + * starts as an empty object so the helper never throws before load. + */ +export let TRAIT_DESCRIPTIONS = {} + /** Default trait list extracted from the core rulebook. Open-ended: custom traits are always allowed. */ export const TRAITS = [ // Action traits @@ -83,6 +90,7 @@ export const SYSTEM = { ABILITY_COST, ABILITY_TYPE, OUTCOME_LABELS, + TRAIT_DESCRIPTIONS, TRAITS, ASCII } diff --git a/module/config/trait-descriptions.json b/module/config/trait-descriptions.json new file mode 100644 index 0000000..b97127c --- /dev/null +++ b/module/config/trait-descriptions.json @@ -0,0 +1,60 @@ +{ + "_comment": "Tooltip descriptions for known traits. Keys are lowercase trait names. Replace placeholder values with actual rules text.", + + "attack": "This ability or action counts as an attack.", + "discovered": "Placeholder — fill in trait description.", + "flow": "Placeholder — fill in trait description.", + "hypothesis": "Placeholder — fill in trait description.", + "intensive": "This ability requires significant effort or concentration.", + "kit": "This ability or action requires the use of a kit.", + "linguistic": "This ability involves language or communication.", + "manipulate": "This ability requires physical manipulation with your hands.", + "review": "Placeholder — fill in trait description.", + "traversal": "This ability involves movement or repositioning.", + "velocity": "Placeholder — fill in trait description.", + + "acid": "Deals acid damage.", + "bludgeoning": "Deals bludgeoning (blunt impact) damage.", + "cold": "Deals cold damage.", + "electricity": "Deals electricity damage.", + "fire": "Deals fire damage.", + "force": "Deals force damage.", + "mental": "Deals mental damage.", + "piercing": "Deals piercing damage.", + "poison": "Deals poison damage.", + "slashing": "Deals slashing damage.", + "sonic": "Deals sonic damage.", + + "electromagnetic": "Placeholder — fill in trait description.", + "geometry": "Placeholder — fill in trait description.", + "gravity": "Placeholder — fill in trait description.", + "numerical": "Placeholder — fill in trait description.", + "paradox": "Placeholder — fill in trait description.", + "probability": "Placeholder — fill in trait description.", + + "animal": "Affects or involves animals.", + "archetype": "Granted by or related to a character archetype.", + "aura": "This ability projects an aura around the user.", + "auditory": "This ability involves sound and can be perceived by hearing.", + "awarded": "Placeholder — fill in trait description.", + "axiom": "Placeholder — fill in trait description.", + "design": "Placeholder — fill in trait description.", + "extradimensional": "Placeholder — fill in trait description.", + "fabricate": "Placeholder — fill in trait description.", + "gremlin": "Placeholder — fill in trait description.", + "interdisciplinary":"Placeholder — fill in trait description.", + "large": "This ability or creature is large-sized.", + "mishap": "This ability can trigger a mishap on certain outcomes.", + "number": "Placeholder — fill in trait description.", + "plant": "Affects or involves plant life.", + "prototype": "Placeholder — fill in trait description.", + "singular": "This ability can only be used once per encounter or period.", + "small": "This ability or creature is small-sized.", + "teleportation": "This ability involves teleportation.", + + "biologist": "Requires or relates to the Biologist field.", + "chemist": "Requires or relates to the Chemist field.", + "engineer": "Requires or relates to the Engineer field.", + "mathematician": "Requires or relates to the Mathematician field.", + "physicist": "Requires or relates to the Physicist field." +} diff --git a/templates/ability-use.hbs b/templates/ability-use.hbs index d3b3cb5..cb1b707 100644 --- a/templates/ability-use.hbs +++ b/templates/ability-use.hbs @@ -10,7 +10,7 @@ {{#if traits.length}}