From c7e6660d9d1d1e748474e6e57d08c5c8abd28200 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnier Date: Fri, 7 Aug 2026 21:04:24 +0200 Subject: [PATCH] =?UTF-8?q?fix(combat):=20re-render=20tracker=20apr=C3=A8s?= =?UTF-8?q?=20suppression=20+=20initiative=20par=20R=C3=A9action=20+=20lis?= =?UTF-8?q?ibilit=C3=A9=20+=20malus=20PNJ?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - fight.mjs : _onDelete appelle super._onDelete() → le tracker se vide immédiatement après « Terminer » (plus de F5) - fight.mjs : _getInitiativeFormula type-dépendante — PNJ/Créature roulent leur pool de Réaction (computed.reaction + reactionBonus) au lieu de 0D → classement par Réaction correct - dialogs.less : total des dés (.total-value) en blanc au lieu du vert sombre (illisible sur fond foncé) - npc-roll-dialog : champ « Malus temporaires » + logique pool (dés malus dans le dialogue PNJ/Créature) --- less/dialogs.less | 4 ++-- module/system/dialogs/npcRollDialog.mjs | 8 +++++-- module/system/fight.mjs | 30 ++++++++++++++++++------- templates/dialogs/npc-roll-dialog.hbs | 7 ++++++ 4 files changed, 37 insertions(+), 12 deletions(-) diff --git a/less/dialogs.less b/less/dialogs.less index 8360907..848c661 100644 --- a/less/dialogs.less +++ b/less/dialogs.less @@ -694,8 +694,8 @@ iframe { .total-value { font-family: "DistressBlack", sans-serif; font-size: @font-size-28; - color: @color-acid-green; - text-shadow: 0 0 8px fade(@color-acid-green, 40%); + color: @color-text-light-0; + text-shadow: 0 0 8px rgba(0, 0, 0, 0.6); } .totem-selector { diff --git a/module/system/dialogs/npcRollDialog.mjs b/module/system/dialogs/npcRollDialog.mjs index fabd1e8..bab15ec 100644 --- a/module/system/dialogs/npcRollDialog.mjs +++ b/module/system/dialogs/npcRollDialog.mjs @@ -174,11 +174,15 @@ export default class NpcRollDialog extends HandlebarsApplicationMixin(foundry.ap #getGroup() { return parseInt(this.#el.querySelector("#group")?.value, 10) || 0 } + #getTemporaryMalus() { return parseInt(this.#el.querySelector("#temporary-malus")?.value, 10) || 0 } + getPoolBreakdown() { const help = this.#getHelped() const group = this.#getGroup() - const malus = VermineExchange.woundMalus(this.#actor) - return { pool: this.pool, help, group, malus, total: Math.max(0, this.pool + help + group - malus) } + const wound = VermineExchange.woundMalus(this.#actor) + const tempMalus = this.#getTemporaryMalus() + const malus = wound + tempMalus + return { pool: this.pool, help, group, wound, tempMalus, malus, total: Math.max(0, this.pool + help + group - malus) } } #updateUI() { diff --git a/module/system/fight.mjs b/module/system/fight.mjs index 99bbe5b..acaa49e 100644 --- a/module/system/fight.mjs +++ b/module/system/fight.mjs @@ -210,14 +210,16 @@ export class VermineCombat extends Combat { } /************************************************************************************/ - _onDelete() { - /*let combatants = this.combatants.contents - for (let c of combatants) { - let actor = game.actors.get(c.actorId) - actor.clearInitiative() - actor.displayRecuperation() - } - super._onDelete()*/ + /** + * Nettoyage lors de la suppression du combat (bouton « Terminer » / suppression). + * Doit appeler le handler de base : c'est lui qui re-rend le CombatTracker + * (`ui.combat.render({combat: null})`) — sans cela le tracker reste figé sur + * l'ancien ordre de tour jusqu'au rechargement de la page (F5). + * @param {object} options + * @param {string} userId + */ + _onDelete(options, userId) { + super._onDelete(options, userId); } } @@ -376,6 +378,18 @@ export class VermineCombatant extends Combatant { } } _getInitiativeFormula() { + // Personnage : jet de Réaction (Réflexes + Vigilance) contre la + // Difficulté du statut de combat — les Réussites = valeur de Réaction. + // PNJ et Créature : n'ont pas de caractéristiques/compétences — ils + // roulent leur pool de Réaction (computed.reaction) contre la même + // Difficulté, majoré de leur bonus de Réaction. + const actor = this.actor + if ( actor?.type === 'npc' || actor?.type === 'creature' ) { + const reaction = parseInt(actor.system?.computed?.reaction, 10) || 0 + const difficulty = parseInt(actor.system?.combatStatus?.difficulty, 10) || 7 + const bonus = parseInt(actor.system?.computed?.reactionBonus, 10) || 0 + return `${reaction}d10cs>=${difficulty}+${bonus}` + } return String(CONFIG.Combat.initiative.formula || game.system.initiative) } } \ No newline at end of file diff --git a/templates/dialogs/npc-roll-dialog.hbs b/templates/dialogs/npc-roll-dialog.hbs index ed10079..1aff4f3 100644 --- a/templates/dialogs/npc-roll-dialog.hbs +++ b/templates/dialogs/npc-roll-dialog.hbs @@ -79,6 +79,13 @@ D +
+ + + D +
+