From 76ed974352016c1f01e4b7d6f1f94a516cffe7ed Mon Sep 17 00:00:00 2001 From: LeRatierBretonnier Date: Sat, 6 Jun 2026 18:32:10 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20Correction=20du=20libell=C3=A9=20Co?= =?UTF-8?q?=C3=BBt=20en=20=C3=82me=20et=20ajout=20de=20la=20cat=C3=A9gorie?= =?UTF-8?q?=20Balance?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Correction du libellé 'Coût en Âme' en 'Coût en points de pouvoir' pour les runes - Fix: Ajout des gestionnaires d'événements pour les automatisations des Talents - Ajout des actions addAutomation et deleteAutomation dans base-item-sheet.mjs - Ajout des attributs data-action sur les boutons du template partial-automation.hbs - Ajout des attributs name sur les champs d'automatisation pour la sauvegarde - Ajout de la catégorie 'Balance' dans les options d'allégeance pour Dons et Tendances Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe --- lang/fr.json | 1 + .../applications/sheets/base-item-sheet.mjs | 32 +++++++++++++++++++ modules/mournblade-cyd2-config.js | 1 + templates/partial-automation.hbs | 20 ++++++------ 4 files changed, 44 insertions(+), 10 deletions(-) diff --git a/lang/fr.json b/lang/fr.json index eddde56..5ad81fd 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -32,6 +32,7 @@ "MNBL": { "all": "Tous", "allegiance": "Allégeance", + "balance": "Balance", "beastslords": "Seigneurs des Bêtes", "chaos": "Chaos", "difficulty": "Difficulté", diff --git a/modules/applications/sheets/base-item-sheet.mjs b/modules/applications/sheets/base-item-sheet.mjs index 6a4b705..7abcdaa 100644 --- a/modules/applications/sheets/base-item-sheet.mjs +++ b/modules/applications/sheets/base-item-sheet.mjs @@ -37,6 +37,8 @@ export default class MournbladeCYD2ItemSheetV2 extends HandlebarsApplicationMixi postItem: MournbladeCYD2ItemSheetV2.#onPostItem, addPredilection: MournbladeCYD2ItemSheetV2.#onAddPredilection, deletePredilection: MournbladeCYD2ItemSheetV2.#onDeletePredilection, + addAutomation: MournbladeCYD2ItemSheetV2.#onAddAutomation, + deleteAutomation: MournbladeCYD2ItemSheetV2.#onDeleteAutomation, }, }; @@ -139,4 +141,34 @@ export default class MournbladeCYD2ItemSheetV2 extends HandlebarsApplicationMixi preds.splice(idx, 1); await this.document.update({ "system.predilections": preds }); } + + /* -------------------------------------------- */ + static async #onAddAutomation(event) { + const automations = foundry.utils.duplicate(this.document.system.automations || []); + automations.push({ + id: foundry.utils.randomID(), + eventtype: "on-drop", + name: "", + bonusname: "vigueur", + bonus: 0, + competence: "", + minLevel: 0, + baCost: 0 + }); + await this.document.update({ + "system.automations": automations, + "system.isautomated": true + }); + } + + /* -------------------------------------------- */ + static async #onDeleteAutomation(event, target) { + const idx = Number(target.dataset.automationIndex); + const automations = foundry.utils.duplicate(this.document.system.automations || []); + automations.splice(idx, 1); + await this.document.update({ "system.automations": automations }); + if (automations.length === 0) { + await this.document.update({ "system.isautomated": false }); + } + } } diff --git a/modules/mournblade-cyd2-config.js b/modules/mournblade-cyd2-config.js index 88328a7..0ce4fc6 100644 --- a/modules/mournblade-cyd2-config.js +++ b/modules/mournblade-cyd2-config.js @@ -12,6 +12,7 @@ export const MOURNBLADECYD2_CONFIG = { tous: localizeOrFallback("MNBL.all", "Tous"), chaos: localizeOrFallback("MNBL.chaos", "Chaos"), loi: localizeOrFallback("MNBL.law", "Loi"), + balance: localizeOrFallback("MNBL.balance", "Balance"), betes: localizeOrFallback("MNBL.beastslords", "Seigneurs des Bêtes"), elementaires: localizeOrFallback("MNBL.elementslords", "Seigneurs des Éléments") }, diff --git a/templates/partial-automation.hbs b/templates/partial-automation.hbs index c2190eb..983579e 100644 --- a/templates/partial-automation.hbs +++ b/templates/partial-automation.hbs @@ -13,13 +13,13 @@
  • -
  • @@ -27,11 +27,11 @@ {{#if (eq automation.eventtype "on-drop")}}
  • - +
  • - +
  • {{/if}} @@ -39,28 +39,28 @@
  • - +
  • {{/if}} {{#if (eq automation.eventtype "prepare-roll")}}
  • - +
  • - +
  • - +
  • {{/if}} @@ -69,6 +69,6 @@
  • - +
  • {{/if}} \ No newline at end of file