From 15e6127e02db11b843a96dc707ae9e7c9a56adb1 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 12 Sep 2025 16:21:18 +0200 Subject: [PATCH] Fix effets TMR A0 --- changelog.md | 1 + module/rdd-tmr-dialog.js | 6 +++++- module/tmr-utility.js | 9 +++++++-- module/tmr/conquete.js | 2 +- module/tmr/draconique.js | 10 +++++----- module/tmr/quete-eaux.js | 8 +++++--- module/tmr/terre-attache.js | 3 ++- 7 files changed, 26 insertions(+), 13 deletions(-) diff --git a/changelog.md b/changelog.md index f560cb5a..01272187 100644 --- a/changelog.md +++ b/changelog.md @@ -7,6 +7,7 @@ - en cas d'appel au moral lorsqu'une double significative est requise, le moral est perdu si la réussite est insuffisante - transformation du niveau des musiques/danses/chants/recettes de cuisine en valeur numérique +- les effets draconiques sur une case inconnue (A0) ne causent plus de problèmes dans les TMRs ## 13.0.6 - Le bandage d'Illysis diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index c94d1f65..dbf635f5 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -1,7 +1,7 @@ import { SHOW_DICE, SYSTEM_RDD } from "./constants.js"; import { RollDataAjustements } from "./rolldata-ajustements.js"; import { RdDUtility } from "./rdd-utility.js"; -import { TMRUtility } from "./tmr-utility.js"; +import { COORD_TMR_INCONNU, TMRUtility } from "./tmr-utility.js"; import { RdDResolutionTable } from "./rdd-resolution-table.js"; import { RdDTMRRencontreDialog } from "./rdd-tmr-rencontre-dialog.js"; import { ChatUtility } from "./chat-utility.js"; @@ -996,6 +996,10 @@ export class RdDTMRDialog extends Dialog { const targetOddq = this.pixiTMR.computeEventOddq(event) const targetCoord = TMRUtility.oddqToCoordTMR(targetOddq) + if (targetCoord == COORD_TMR_INCONNU){ + ui.notifications.error("Vous ne pouvez pas vous déplacer ici"); + return + } // Validation de la case de destination (gestion du cas des rencontres qui peuvent téléporter) const typeDeplacement = this._calculDeplacement(targetCoord, currentCoord, currentOddq, targetOddq); diff --git a/module/tmr-utility.js b/module/tmr-utility.js index 37fdc623..b266f296 100644 --- a/module/tmr-utility.js +++ b/module/tmr-utility.js @@ -2,6 +2,9 @@ import { Misc } from "./misc.js"; import { Grammar } from "./grammar.js"; import { RdDDice } from "./rdd-dice.js"; +const TMR_INCONNU = "inconnu" +export const COORD_TMR_INCONNU = "A0" + export const TMRType = { cite: { type: 'cite', name: "cité", genre: "f" }, sanctuaire: { type: 'sanctuaire', name: "sanctuaire", genre: 'm' }, @@ -16,13 +19,15 @@ export const TMRType = { marais: { type: 'marais', name: "marais", genre: "m" }, gouffre: { type: 'gouffre', name: "gouffre", genre: "m" }, necropole: { type: 'necropole', name: "nécropole", genre: "f" }, - desolation: { type: 'desolation', name: "désolation", genre: "f" } + desolation: { type: 'desolation', name: "désolation", genre: "f" }, + [TMR_INCONNU]: { type: TMR_INCONNU, name: TMR_INCONNU, genre: "m" } } export const FLEUVE_COORD = 'Fleuve' const TMRMapping = { Fleuve: { type: TMRType.fleuve.type, label: "Fleuve de l'Oubli", generique: 'fleuve' }, + [COORD_TMR_INCONNU]: { type: TMR_INCONNU, label: TMR_INCONNU }, A1: { type: TMRType.cite.type, label: "Cité Vide" }, B1: { type: TMRType.plaines.type, label: "Plaines d’Assorh" }, C1: { type: TMRType.necropole.type, label: "Nécropole de Kroak" }, @@ -272,7 +277,7 @@ export class TMRUtility { } static getTMRType(coord) { - const tmr = TMRUtility.getTMR(coord); + const tmr = TMRUtility.getTMR(coord) return Misc.upperFirst(TMRType[tmr.type].name); } diff --git a/module/tmr/conquete.js b/module/tmr/conquete.js index 16ae3c1a..524e6f6b 100644 --- a/module/tmr/conquete.js +++ b/module/tmr/conquete.js @@ -13,7 +13,7 @@ export class Conquete extends Draconique { async onActorCreateOwned(actor, item) { await this._creerConquete(actor, item); } code() { return 'conquete' } - tooltip(linkData) { return `Doit être conquis` } + tooltip(linkData) { return 'Doit être conquis' } img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/conquete.svg' } createSprite(pixiTMR) { diff --git a/module/tmr/draconique.js b/module/tmr/draconique.js index 74db8bb7..1a157fb3 100644 --- a/module/tmr/draconique.js +++ b/module/tmr/draconique.js @@ -1,5 +1,5 @@ import { ITEM_TYPES } from "../constants.js"; -import { TMRUtility } from "../tmr-utility.js"; +import { COORD_TMR_INCONNU, TMRUtility } from "../tmr-utility.js"; import { PixiTMR } from "./pixi-tmr.js"; const registeredEffects = [ @@ -12,7 +12,7 @@ export class Draconique { static init() { } - static isCaseTMR(item) { return item.type == ITEM_TYPES.casetmr; } + static isCaseTMR(item) { return item.type == ITEM_TYPES.casetmr } static isQueueDragon(item) { return item.isQueueDragon(); } static isSouffleDragon(item) { return item.type == ITEM_TYPES.souffle; } static isTeteDragon(item) { return item.type == ITEM_TYPES.tete; } @@ -92,7 +92,7 @@ export class Draconique { const tooltip = this.tooltip(linkData); return this._createToken(pixiTMR, linkData, coordTMR, type, tooltip); } - + tokens(pixiTMR, linkData, coordTMR, type = undefined) { const tooltip = this.tooltip(linkData); return [this._createToken(pixiTMR, linkData, coordTMR, type, tooltip)]; @@ -127,7 +127,7 @@ export class Draconique { * @param {*} coord les coordonnées d'une case. Si undefined toute case du type correspondra, */ isCase(item, coord = undefined) { - return Draconique.isCaseTMR(item) && item.system.specific == this.code() && (coord ? item.system.coord == coord : true); + return Draconique.isCaseTMR(item) && item.system.specific == this.code() && (coord ? (coord != COORD_TMR_INCONNU && item.system.coord == coord) : true); } find(list, coord = undefined) { @@ -150,7 +150,7 @@ export class Draconique { } isCaseForSource(item, draconique) { - return Draconique.isCaseTMR(item) && item.system.specific == this.code() && item.system.sourceid == draconique.id; + return Draconique.isCaseTMR(item) && item.system.specific == this.code() && item.system.sourceid == draconique.id } async onVisiteSupprimer(actor, tmr, onRemoveToken) { diff --git a/module/tmr/quete-eaux.js b/module/tmr/quete-eaux.js index fc8f6252..7e469c79 100644 --- a/module/tmr/quete-eaux.js +++ b/module/tmr/quete-eaux.js @@ -1,6 +1,6 @@ import { Grammar } from "../grammar.js"; import { tmrTokenZIndex } from "../tmr-constants.js"; -import { TMRUtility } from "../tmr-utility.js"; +import { COORD_TMR_INCONNU, TMRUtility } from "../tmr-utility.js"; import { Draconique } from "./draconique.js"; export class QueteEaux extends Draconique { @@ -9,11 +9,13 @@ export class QueteEaux extends Draconique { match(item) { return Draconique.isTeteDragon(item) && Grammar.toLowerCaseNoAccent(item.name).includes("quete des eaux"); } manualMessage() { return "Vous devrez re-configurer votre Nouvelle Quête des Eaux une fois un lac ou marais vaincu" } async onActorCreateOwned(actor, tete) { - await this.createCaseTmr(actor, "Nouvelle Quête des Eaux", { coord: 'A0' }, tete.id); + await this.createCaseTmr(actor, "Nouvelle Quête des Eaux", { coord: COORD_TMR_INCONNU }, tete.id); } code() { return 'maitrisee' } - tooltip(linkData) { return `Quête des eaux, ${TMRUtility.getTMRType(linkData.system.coord)} maîtrisé` } + tooltip(linkData) { + return linkData.system.coord == COORD_TMR_INCONNU ? 'Nouvelle Quête des eaux en cours' : `Quête des eaux, ${TMRUtility.getTMRType(linkData.system.coord)} maîtrisé` + } img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/maitrisee.svg' } createSprite(pixiTMR) { diff --git a/module/tmr/terre-attache.js b/module/tmr/terre-attache.js index 220a6194..1d57a389 100644 --- a/module/tmr/terre-attache.js +++ b/module/tmr/terre-attache.js @@ -1,5 +1,6 @@ import { Grammar } from "../grammar.js"; import { tmrTokenZIndex } from "../tmr-constants.js"; +import { COORD_TMR_INCONNU } from "../tmr-utility.js"; import { Draconique } from "./draconique.js"; export class TerreAttache extends Draconique { @@ -9,7 +10,7 @@ export class TerreAttache extends Draconique { manualMessage() { return "Vous pouvez re-configurer votre Nouvelle Terre d'attache" } async onActorCreateOwned(actor, tete) { - await this.createCaseTmr(actor, "Nouvelle Terre d'attache", { coord: 'A0' }, tete.id); + await this.createCaseTmr(actor, "Nouvelle Terre d'attache", { coord: COORD_TMR_INCONNU }, tete.id); } code() { return 'attache' }