From 139b8667d1b6d7e6703dc42255c9cf6d38f63a59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Lozano?= Date: Tue, 28 May 2024 09:07:46 +0200 Subject: [PATCH 1/2] Fix hardcoded resilience --- system/src/documents/ACActor.mjs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/system/src/documents/ACActor.mjs b/system/src/documents/ACActor.mjs index 93ac19c..7a8e90f 100644 --- a/system/src/documents/ACActor.mjs +++ b/system/src/documents/ACActor.mjs @@ -75,14 +75,15 @@ export default class ACActor extends Actor { const fatigue = this.system.fatigue ?? 0; const mod = this.system.stress?.mod ?? 0; + const resilienceSkillName = game.i18n.localize("AC2D20.SKILL.RESILIENCE"); const resilienceSkill = this.items.find( - i => i.type === "skill" && i.name === "Resilience" + i => i.type === "skill" && i.name === resilienceSkillName ); if (!resilienceSkill) { return ac2d20.logger.error( - `Unable to locate 'Resilience' skill on character ${this.name}` + `Unable to locate '${resilienceSkillName}' skill on character ${this.name}` ); } From 99a469ef652c96bc041ab2c233684999065a9e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Lozano?= Date: Tue, 28 May 2024 09:43:43 +0200 Subject: [PATCH 2/2] As an option in settings --- i18n/en.yaml | 2 ++ i18n/es.yaml | 2 ++ system/src/documents/ACActor.mjs | 2 +- system/src/settings.mjs | 10 ++++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/i18n/en.yaml b/i18n/en.yaml index 522ee11..53017c1 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -111,6 +111,8 @@ AC2D20.RESISTANCE.fatigue: Fatigue AC2D20.RESISTANCE.resistance: Resistance AC2D20.SETTINGS.compendiumHint: Each time a new character is created it will include this set of skills. AC2D20.SETTINGS.compendiumName: Skills Compendium +AC2D20.SETTINGS.resilienceHint: Name of the Resilience skill in your skill compendium, used for autocalculate stress. +AC2D20.SETTINGS.resilienceName: Resilience skill AC2D20.SETTINGS.ctHint: If enabled the Combat Tracker will decrement the Momentum Pool when a new Combat Round starts, or when Combat ends. AC2D20.SETTINGS.ctName: Combat Tracker Updates Momentum? AC2D20.SETTINGS.debugEnabled.hint: Enable or Disable additional debug features diff --git a/i18n/es.yaml b/i18n/es.yaml index 29b9c27..11db269 100644 --- a/i18n/es.yaml +++ b/i18n/es.yaml @@ -111,6 +111,8 @@ AC2D20.RESISTANCE.fatigue: Fatiga AC2D20.RESISTANCE.resistance: Resistencia AC2D20.SETTINGS.compendiumHint: Cuando se crea un nuevo personaje incluirá las habilidades contenidas en este compendio. AC2D20.SETTINGS.compendiumName: Compendio de habilidades +AC2D20.SETTINGS.resilienceHint: Nombre de la habilidad Fortaleza tal y como aparece en el compendio de habilidades, se usa para calcular automáticamente el estrés. +AC2D20.SETTINGS.resilienceName: Habilidad Fortaleza AC2D20.SETTINGS.ctHint: Si se activa, el asistente de combate reducirá la reserva de momentum cuando empiece un nuevo asalto, o cuando el combate finalice. AC2D20.SETTINGS.ctName: Asistente de combate actualiza el momentum AC2D20.SETTINGS.debugEnabled.hint: Enable or Disable additional debug features diff --git a/system/src/documents/ACActor.mjs b/system/src/documents/ACActor.mjs index 7a8e90f..75b90a9 100644 --- a/system/src/documents/ACActor.mjs +++ b/system/src/documents/ACActor.mjs @@ -75,7 +75,7 @@ export default class ACActor extends Actor { const fatigue = this.system.fatigue ?? 0; const mod = this.system.stress?.mod ?? 0; - const resilienceSkillName = game.i18n.localize("AC2D20.SKILL.RESILIENCE"); + const resilienceSkillName = game.settings.get("ac2d20", "resilience-skill"); const resilienceSkill = this.items.find( i => i.type === "skill" && i.name === resilienceSkillName diff --git a/system/src/settings.mjs b/system/src/settings.mjs index 5e6c895..f9f38fc 100644 --- a/system/src/settings.mjs +++ b/system/src/settings.mjs @@ -108,6 +108,16 @@ export default async function registerSettings() { requiresReload: true, }); + game.settings.register(SYSTEM_ID, "resilience-skill", { + name: game.i18n.localize("AC2D20.SETTINGS.resilienceName"), + hint: game.i18n.localize("AC2D20.SETTINGS.resilienceHint"), + type: String, + default: "Resilience", + scope: "world", + config: true, + requiresReload: true, + }); + game.settings.register(SYSTEM_ID, "hoversJsonLocation", { name: game.i18n.localize("AC2D20.SETTINGS.hoverName"), hint: game.i18n.localize("AC2D20.SETTINGS.hoverHint"),