diff --git a/changelog.md b/changelog.md index 4dea6baa..01272187 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,14 @@ # 13.0 +## 13.0.7 - Sous le signe d'Illysis +- Fix Foundry V13 + - les tooltips des ajustements sont correctement visible + - correction des affichages des signes d'heures dans la fenêtre d'astrologie + +- 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 - Les soins sont de nouveau disponibles depuis les tokens diff --git a/css/foundryvtt-reve-de-dragon.css b/css/foundryvtt-reve-de-dragon.css index 75abb883..bdbf15df 100644 --- a/css/foundryvtt-reve-de-dragon.css +++ b/css/foundryvtt-reve-de-dragon.css @@ -132,8 +132,8 @@ select, /*--------------------------------------------------------------------------*/ /* Control, Tool, hotbar & navigation */ /* Tooltip container */ - /* Tooltip text */ /* Show the tooltip text when you mouse over the tooltip container */ + /* html Tooltips html*/ /* Dropdown Content (Hidden by Default) */ /* Change the background color of the dropdown button when the dropdown content is shown */ /* Show the dropdown menu on hover */ @@ -420,8 +420,9 @@ select, .system-foundryvtt-reve-de-dragon .window-header { background: rgba(0, 0, 0, 0.75); } +.system-foundryvtt-reve-de-dragon .application .window-content, .system-foundryvtt-reve-de-dragon .window-app.sheet .window-content { - margin: 0; + margin: 0.2rem; padding: 0; } .system-foundryvtt-reve-de-dragon section.window-content div.dialog-buttons { @@ -856,6 +857,7 @@ select, max-width: 1.5em; max-height: 1.5em; border-width: 0; + display: inline; } .system-foundryvtt-reve-de-dragon .dimmed { opacity: 50%; @@ -1183,7 +1185,7 @@ select, font-weight: bold; background-color: lightblue; } -.system-foundryvtt-reve-de-dragon div.placeholder-resolution span.table-proba-reussite { +.system-foundryvtt-reve-de-dragon span.table-proba-reussite { font-size: 0.8rem; padding: 5px; } @@ -1360,7 +1362,7 @@ select, width: 100%; max-width: 90%; } -.system-foundryvtt-reve-de-dragon .window-app.sheet .window-content .tooltip:hover .tooltiptext { +.system-foundryvtt-reve-de-dragon .window-app.sheet .window-content :is(.tooltip, .tooltip-overflow):hover .tooltiptext { top: 2rem; left: 2rem; margin: 0; @@ -1804,6 +1806,13 @@ select, padding: 1px; vertical-align: text-top; } +.system-foundryvtt-reve-de-dragon .actor-img-small { + max-width: 1.5rem; + max-height: 1.5rem; + flex-grow: 0; + margin-right: 0.2rem; + vertical-align: bottom; +} .system-foundryvtt-reve-de-dragon #sidebar-tabs { flex: 0 0 28px; box-sizing: border-box; @@ -2280,11 +2289,26 @@ select, position: relative; display: inline-block; } +.system-foundryvtt-reve-de-dragon .tooltip-overflow { + display: inline-block; +} .system-foundryvtt-reve-de-dragon .tooltip-dotted { border-bottom: 1px dotted black; /* If you want dots under the hoverable text */ } -.system-foundryvtt-reve-de-dragon .tooltip .tooltiptext { +.system-foundryvtt-reve-de-dragon div.message-content span .tooltip-overflow { + overflow: visible; + position: absolute; +} +.system-foundryvtt-reve-de-dragon div.message-content span .tooltip-overflow span { + overflow: visible; + position: relative; +} +.system-foundryvtt-reve-de-dragon :is(.tooltip, .tooltip-overflow):hover .tooltiptext { + visibility: visible; + opacity: 1; +} +.system-foundryvtt-reve-de-dragon :is(.tooltip, .tooltip-overflow) .tooltiptext { text-align: center; /* Position the tooltip text */ position: absolute; @@ -2294,10 +2318,7 @@ select, opacity: 0; transition: opacity 0.3s; } -.system-foundryvtt-reve-de-dragon .tooltip .left-competence { - transform: translate(-100%, 0%); -} -.system-foundryvtt-reve-de-dragon .tooltip .ttt-fatigue { +.system-foundryvtt-reve-de-dragon :is(.tooltip, .tooltip-overflow) .ttt-fatigue { width: 360px; background: rgba(30, 25, 20, 0.9); border-image: url(../assets/ui/bg_control.webp) 21 repeat; @@ -2308,29 +2329,24 @@ select, font-size: 0.8rem; padding: 3px 0; } -.system-foundryvtt-reve-de-dragon .tooltip .ttt-ajustements { - width: 150px; +.system-foundryvtt-reve-de-dragon :is(.tooltip, .tooltip-overflow) .ttt-ajustements { + width: 10rem; background: var(--background-tooltip); border-radius: 6px; font-size: 0.9rem; padding: 3px 0; } -.system-foundryvtt-reve-de-dragon .tooltip .ttt-titre { - text-align: justify; - width: 100%; - top: 30px; - background: var(--background-tooltip); - border-radius: 6px; - font-size: 0.9rem; - padding: 3px; +.system-foundryvtt-reve-de-dragon :is(.tooltip, .tooltip-overflow) .ttt-ajustements div:nth-child(odd) { + background: var(--background-tooltip-alt); } .system-foundryvtt-reve-de-dragon aside#tooltip { + max-width: 15rem; background: var(--background-tooltip); - /*color: var(--color-text-dark-primary);*/ color: rgba(100, 100, 50, 0.85); - font-size: 1rem; + font-size: 0.9rem; border-radius: 0.2rem; - padding: 0.4rem; + padding: 0.3rem; + font-family: "CaslonAntique"; } .system-foundryvtt-reve-de-dragon aside#tooltip span.reference { color: var(--color-tooltip); @@ -2339,17 +2355,6 @@ select, .system-foundryvtt-reve-de-dragon aside#tooltip .toolclip p.faint { color: var(--color-tooltip-faint); } -.system-foundryvtt-reve-de-dragon .tooltip :is(.ttt-xp,.ttt-levelup) { - width: 250px; - background: var(--background-tooltip) !important; - border-radius: 6px; - font-size: 0.9rem; - padding: 3px 0; -} -.system-foundryvtt-reve-de-dragon .tooltip:hover .tooltiptext { - visibility: visible; - opacity: 1; -} .system-foundryvtt-reve-de-dragon .chat-card-button, .system-foundryvtt-reve-de-dragon .chat-card-button-pushed { border-radius: 0.2rem; diff --git a/less/fonts.less b/less/fonts.less index f02a31e5..0fc3f995 100644 --- a/less/fonts.less +++ b/less/fonts.less @@ -80,5 +80,5 @@ .sheet header.sheet-header .header-compteurs, .sheet header.sheet-header .flex-group-center.flex-fatigue, select, .item-checkbox, #sidebar, #players, #navigation #nav-toggle { - font-family: "CaslonAntique"; /* For sheet parts; For nav and title */ + font-family: "CaslonAntique"; /* For sheet parts; For nav and title */ } diff --git a/less/foundryvtt-reve-de-dragon.less b/less/foundryvtt-reve-de-dragon.less index b86792b4..f320e480 100644 --- a/less/foundryvtt-reve-de-dragon.less +++ b/less/foundryvtt-reve-de-dragon.less @@ -15,8 +15,9 @@ background: rgba(0,0,0,0.75); } + .application .window-content, .window-app.sheet .window-content { - margin: 0; + margin: 0.2rem; padding: 0; } @@ -217,7 +218,6 @@ padding: 0; } - .grid-competence-archetype { display: grid; grid-column: span 3 / span 3; @@ -497,6 +497,7 @@ max-width: 1.5em; max-height: 1.5em; border-width: 0; + display: inline; } .dimmed { opacity: 50%; @@ -641,6 +642,7 @@ font-size: 1rem; letter-spacing: 1px; } + .app.sheet div.form-group { clear: both; display: flex; @@ -808,6 +810,7 @@ font-size: 0.8rem; text-align: right; } + .placeholder-ajustements { flex-direction: column; } @@ -820,7 +823,7 @@ background-color: lightblue; } - div.placeholder-resolution span.table-proba-reussite{ + span.table-proba-reussite{ font-size: 0.8rem; padding: 5px; } @@ -1017,7 +1020,7 @@ max-width: 90%; } - .window-app.sheet .window-content .tooltip:hover .tooltiptext { + .window-app.sheet .window-content :is(.tooltip, .tooltip-overflow):hover .tooltiptext { top: 2rem; left: 2rem; margin: 0; @@ -1504,6 +1507,14 @@ vertical-align: text-top; } + .actor-img-small { + max-width: 1.5rem; + max-height: 1.5rem; + flex-grow: 0; + margin-right: 0.2rem; + vertical-align: bottom; + } + #sidebar-tabs { flex: 0 0 28px; box-sizing: border-box; @@ -1853,66 +1864,78 @@ position: relative; display: inline-block; } - + .tooltip-overflow { + display: inline-block; + } + .tooltip-dotted { border-bottom: 1px dotted black; /* If you want dots under the hoverable text */ } - /* Tooltip text */ - .tooltip .tooltiptext { - text-align: center; - /* Position the tooltip text */ + div.message-content span .tooltip-overflow { + overflow: visible; position: absolute; - z-index: 1; - /* Fade in tooltip */ - visibility: hidden; - opacity: 0; - transition: opacity 0.3s; + span { + overflow: visible; + position: relative; + } } - .tooltip .left-competence { - transform: translate(-100%, 0%); + /* Show the tooltip text when you mouse over the tooltip container */ + :is(.tooltip, .tooltip-overflow):hover { + .tooltiptext { + visibility: visible; + opacity: 1; + } } + /* html Tooltips html*/ + :is(.tooltip, .tooltip-overflow){ + + .tooltiptext { + text-align: center; + /* Position the tooltip text */ + position: absolute; + z-index: 1; + /* Fade in tooltip */ + visibility: hidden; + opacity: 0; + transition: opacity 0.3s; + } - .tooltip .ttt-fatigue{ - width: 360px; + .ttt-fatigue { + width: 360px; - background: rgba(30, 25, 20, 0.9); - border-image: url(../assets/ui/bg_control.webp) 21 repeat; - border-image-slice: 6 6 6 6 fill; - border-image-width: 6px 6px 6px 6px; - border-image-outset: 0px 0px 0px 0px; - border-radius: 0px; + background: rgba(30, 25, 20, 0.9); + border-image: url(../assets/ui/bg_control.webp) 21 repeat; + border-image-slice: 6 6 6 6 fill; + border-image-width: 6px 6px 6px 6px; + border-image-outset: 0px 0px 0px 0px; + border-radius: 0px; - font-size: 0.8rem; - padding: 3px 0; - } + font-size: 0.8rem; + padding: 3px 0; + } - .tooltip .ttt-ajustements { - width: 150px; - background: var(--background-tooltip); - border-radius: 6px; - font-size: 0.9rem; - padding: 3px 0; - } - - .tooltip .ttt-titre { - text-align: justify; - width: 100%; - top: 30px; - background: var(--background-tooltip); - border-radius: 6px; - font-size: 0.9rem; - padding: 3px; + .ttt-ajustements { + width: 10rem; + background: var(--background-tooltip); + border-radius: 6px; + font-size: 0.9rem; + padding: 3px 0; + div:nth-child(odd) { + background: var(--background-tooltip-alt); + } + } } aside#tooltip { + max-width: 15rem; background: var(--background-tooltip); - /*color: var(--color-text-dark-primary);*/ color: rgba(100, 100, 50, 0.85); - font-size: 1rem; + font-size: 0.9rem; border-radius: 0.2rem; - padding: 0.4rem; + padding: 0.3rem; + font-family: "CaslonAntique"; } aside#tooltip span.reference { @@ -1924,19 +1947,6 @@ color: var(--color-tooltip-faint); } - .tooltip :is(.ttt-xp,.ttt-levelup) { - width: 250px; - background: var(--background-tooltip) !important; - border-radius: 6px; - font-size: 0.9rem; - padding: 3px 0; - } - - /* Show the tooltip text when you mouse over the tooltip container */ - .tooltip:hover .tooltiptext { - visibility: visible; - opacity: 1; - } .chat-card-button, .chat-card-button-pushed { border-radius: 0.2rem; diff --git a/module/actor.js b/module/actor.js index 0d50547c..4735abd1 100644 --- a/module/actor.js +++ b/module/actor.js @@ -1583,7 +1583,7 @@ export class RdDActor extends RdDBaseActorSang { return } if (rollData.rolled.isEchec || - (rollData.ajustements.diviseurSignificative && (rollData.rolled.roll * rollData.ajustements.diviseurSignificative > rollData.score))) { + (rollData.diviseurSignificative && (rollData.rolled.roll * rollData.diviseurSignificative > rollData.rolled.score))) { rollData.perteMoralEchec = rollData.moral <= -3 ? 'dissolution' : 'perte'; rollData.moral = await this.moralIncDec(-1); /* L'appel au moral a échoué. Le personnage perd un point de moral */ } diff --git a/module/migrations.js b/module/migrations.js index 153c96df..208b667a 100644 --- a/module/migrations.js +++ b/module/migrations.js @@ -632,7 +632,7 @@ class _12_0_38_TachesEcriture extends Migration { async migrate() { await this.applyItemsUpdates(items => items - .filter(it => [ITEM_TYPES.tache, ITEM_TYPES.livre, ITEM_TYPES.oeuvre, ITEM_TYPES.meditation].includes(it.type) ) + .filter(it => [ITEM_TYPES.tache, ITEM_TYPES.livre, ITEM_TYPES.oeuvre, ITEM_TYPES.meditation].includes(it.type)) .filter(it => Grammar.equalsInsensitive(it.system.competence, 'ecriture')) .map(it => { return { _id: it.id, 'system.competence': 'Écriture' } }) ) @@ -640,11 +640,26 @@ class _12_0_38_TachesEcriture extends Migration { } class _13_0_4_FixReveActuel extends Migration { - get code() { return "fix-revvve-actuel" } + get code() { return "fix-reve-actuel" } get version() { return "13.0.4" } async migrate() { - game.actors.forEach(it => it.update({'system.carac.-=reve-actuel': null})) + game.actors.forEach(it => it.update({ 'system.carac.-=reve-actuel': null })) + } +} + +class _13_0_7_FixNiveauOeuvres extends Migration { + get code() { return "fix-niveau-oeuvres" } + get version() { return "13.0.7" } + + async migrate() { + await this.applyItemsUpdates(items => items + .filter(it => [ITEM_TYPES.musique, ITEM_TYPES.chant, ITEM_TYPES.danse, ITEM_TYPES.recettecuisine].includes(it.type)) + .map(it => { + const niveau = isNaN(it.system.niveau) ? 0 : parseInt(it.system.niveau) + return { _id: it.id, 'system.niveau': niveau } + }) + ) } } @@ -671,7 +686,8 @@ export class Migrations { new _12_0_32_MigrationRaces(), new _12_0_37_MigrationAlchimieEtat(), new _12_0_38_TachesEcriture(), - new _13_0_4_FixReveActuel() + new _13_0_4_FixReveActuel(), + new _13_0_7_FixNiveauOeuvres(), ]; } diff --git a/module/rdd-combat.js b/module/rdd-combat.js index f596abad..d10c7cc4 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -17,23 +17,23 @@ import { RdDRollResult } from "./rdd-roll-result.js"; /* -------------------------------------------- */ const premierRoundInit = [ - { pattern: 'hast', init: 5.90 }, - { pattern: 'lance', init: 5.85 }, - { pattern: 'baton', init: 5.80 }, - { pattern: 'doubledragonne', init: 5.75 }, - { pattern: 'esparlongue', init: 5.70 }, - { pattern: 'epeedragonne', init: 5.65 }, - { pattern: 'epeebatarde', init: 5.60 }, - { pattern: 'epeecyane', init: 5.55 }, - { pattern: 'epeesorde', init: 5.50 }, - { pattern: 'grandehache', init: 5.45 }, - { pattern: 'bataille', init: 5.40 }, - { pattern: 'epeegnome', init: 5.35 }, - { pattern: 'masse', init: 5.30 }, - { pattern: 'gourdin', init: 5.25 }, - { pattern: 'fleau', init: 5.20 }, - { pattern: 'dague', init: 5.15 }, - { pattern: 'autre', init: 5.10 }, + { pattern: 'hast' }, + { pattern: 'lance' }, + { pattern: 'baton' }, + { pattern: 'doubledragonne' }, + { pattern: 'esparlongue' }, + { pattern: 'epeedragonne' }, + { pattern: 'epeebatarde' }, + { pattern: 'epeecyane' }, + { pattern: 'epeesorde' }, + { pattern: 'grandehache' }, + { pattern: 'bataille' }, + { pattern: 'epeegnome' }, + { pattern: 'masse' }, + { pattern: 'gourdin' }, + { pattern: 'fleau' }, + { pattern: 'dague' }, + { pattern: 'autre' }, ]; /* -------------------------------------------- */ @@ -45,6 +45,10 @@ export class RdDCombatManager extends Combat { Hooks.on("updateCombat", (combat, change, options, userId) => { RdDCombat.onUpdateCombat(combat, change, options, userId) }); Hooks.on("preDeleteCombat", (combat, html, id) => { combat.onPreDeleteCombat() }) Hooks.on("deleteCombat", (combat, html, id) => { combat.onDeleteCombat() }) + + for (let i = 0.0; i < premierRoundInit.length; i++) { + premierRoundInit[i].init = 5.99 - i / 100 + } } /* -------------------------------------------- */ @@ -108,9 +112,7 @@ export class RdDCombatManager extends Combat { async rollInitiative(ids, messageOptions = {}) { console.log(`${game.system.title} | Combat.rollInitiative()`, ids, messageOptions) ids = typeof ids === "string" ? [ids] : ids - ids.forEach(async id => - await this.rollInitRdD(id, undefined, messageOptions) - ) + Promise.all(ids.map(id => this.rollInitRdD(id, undefined, messageOptions))) return this } @@ -251,19 +253,20 @@ export class RdDCombatManager extends Combat { let initMissing = game.combat.combatants.find(it => !it.initiative); if (!initMissing) { // Premier round ! for (let combatant of game.combat.combatants) { - let action = combatant.initiativeData?.arme; - //console.log("Parsed !!!", combatant, initDone, game.combat.current, arme); - if (action && action.type == "arme") { - for (let initData of premierRoundInit) { - if (Grammar.toLowerCaseNoAccentNoSpace(action.system.initpremierround).includes(initData.pattern)) { - let msg = `

L'initiative de ${combatant.actor.getAlias()} a été modifiée !

+ if (combatant.initiativeData?.arme?.type == "arme") { + // TODO: get init data premier round + const initiativeData = combatant.initiativeData; + const action = combatant.initiativeData.arme; + const fromArme = Grammar.toLowerCaseNoAccentNoSpace(action.system.initpremierround) + const initData = premierRoundInit.find(it => fromArme.includes(initData.pattern)) + if (initData) { + let msg = `

L'initiative de ${combatant.actor.getAlias()} a été modifiée !


Etant donné son ${action.name}, son initative pour ce premier round est désormais de ${initData.init}.
` - ChatMessage.create({ content: msg }); - game.combat.setInitiative(combatant._id, initData.init); - } + ChatMessage.create({ content: msg }); + game.combat.setInitiative(combatant._id, initData.init); } } } @@ -297,7 +300,7 @@ export class RdDCombatManager extends Combat { ].concat(options); } /* -------------------------------------------- */ - static rollInitiativeAction(combatantId, action) { + static async rollInitiativeAction(combatantId, action) { const combatant = game.combat.combatants.get(combatantId) const actor = RdDCombatManager.getActorCombatant(combatant) if (actor == undefined) { return [] } @@ -308,7 +311,8 @@ export class RdDCombatManager extends Combat { const ajustement = RdDCombatManager.calculAjustementInit(actor, action) const rollFormula = RdDCombatManager.formuleInitiative(init.offset, init.carac, init.niveau, ajustement); - game.combat.rollInitRdD(combatantId, rollFormula, init); + await game.combat.rollInitRdD(combatantId, rollFormula, init); + combatant.initiativeData } static getInitData(actor, action) { @@ -1141,7 +1145,7 @@ export class RdDCombat { if (RdDCombat.isParticuliere(defenderRoll)) { await this._onEsquiveParticuliere(defenderRoll) } - return + return } return await this._onEsquiveEchec(defenderRoll) } 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/rdd-token-hud.js b/module/rdd-token-hud.js index f6e0975d..4b36f2ae 100644 --- a/module/rdd-token-hud.js +++ b/module/rdd-token-hud.js @@ -1,6 +1,5 @@ /* -------------------------------------------- */ import { HtmlUtility } from "./html-utility.js"; -import { Misc } from "./misc.js"; import { RdDCombatManager } from "./rdd-combat.js"; import { Targets } from "./targets.js"; 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' } diff --git a/template.json b/template.json index ac3f4c68..23c6e3ec 100644 --- a/template.json +++ b/template.json @@ -811,7 +811,7 @@ }, "musique": { "templates": ["description"], - "niveau": "", + "niveau": 0, "reference": "" }, "danse": { @@ -819,12 +819,12 @@ "type": "", "agilite": false, "apparence": false, - "niveau": "", + "niveau": 0, "reference": "" }, "chant": { "templates": ["description"], - "niveau": "", + "niveau": 0, "reference": "" }, "jeu": { @@ -836,7 +836,7 @@ }, "recettecuisine": { "templates": ["description"], - "niveau": "", + "niveau": 0, "ingredients": "", "duree": "", "sust": 0, diff --git a/templates/actor/carac-main.hbs b/templates/actor/carac-main.hbs index ec84ed66..5b26ef21 100644 --- a/templates/actor/carac-main.hbs +++ b/templates/actor/carac-main.hbs @@ -13,22 +13,22 @@