From 79e935807240024e11f17bdc7e184440f811d41c Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 9 Mar 2023 22:46:59 +0100 Subject: [PATCH 01/16] =?UTF-8?q?Pr=C3=A9paration=20Calendrier=20avant=20m?= =?UTF-8?q?igration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Les migrations peuvent avoir besoin du temps courant. Le calendrier est recréé après. --- module/rdd-calendrier.js | 8 ++++++++ module/rdd-main.js | 9 ++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/module/rdd-calendrier.js b/module/rdd-calendrier.js index 0053d319..03fb26a5 100644 --- a/module/rdd-calendrier.js +++ b/module/rdd-calendrier.js @@ -45,6 +45,14 @@ export class RdDCalendrier extends Application { Hooks.on('updateSetting', async (setting, update, options, id) => this.onUpdateSetting(setting, update, options, id)); } + display() { + let templatePath = "systems/foundryvtt-reve-de-dragon/templates/calendar-template.html"; + renderTemplate(templatePath, {}).then(html => { + this.render(true); + }); + return this; + } + async onUpdateSetting(setting, update, options, id) { if (setting.key == SYSTEM_RDD + '.' + WORLD_TIMESTAMP_SETTING) { this.timestamp = RdDTimestamp.getWorldTime(); diff --git a/module/rdd-main.js b/module/rdd-main.js index 81f12111..d25d622e 100644 --- a/module/rdd-main.js +++ b/module/rdd-main.js @@ -278,6 +278,7 @@ export class SystemReveDeDragon { } if (Misc.isUniqueConnectedGM()) { + game.system.rdd.calendrier = new RdDCalendrier(); new Migrations().migrate(); } @@ -286,13 +287,7 @@ export class SystemReveDeDragon { RdDDice.onReady(); /* -------------------------------------------- */ /* Affiche/Init le calendrier */ - let calendrier = new RdDCalendrier(); - let templatePath = "systems/foundryvtt-reve-de-dragon/templates/calendar-template.html"; - let templateData = {}; - renderTemplate(templatePath, templateData).then(html => { - calendrier.render(true); - }); - game.system.rdd.calendrier = calendrier; // Reference; + game.system.rdd.calendrier = new RdDCalendrier().display(); // Avertissement si joueur sans personnage if (!game.user.isGM && game.user.character == undefined) { From 45bfc69b39a4a79b98dfaa2e41a2f9181dbefcf2 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 9 Mar 2023 22:47:58 +0100 Subject: [PATCH 02/16] Ajout d'option pour informer si pas de cible Pour le HUD, on peut vouloir utiliser la cible (soins) --- module/targets.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/module/targets.js b/module/targets.js index f975a60d..7217bea1 100644 --- a/module/targets.js +++ b/module/targets.js @@ -39,18 +39,18 @@ export class Targets { } } - static getTarget() { + static getTarget(options = { warn: true }) { const targets = Targets.listTargets(); switch (targets.length) { case 1: return targets[0]; case 0: - ui.notifications.warn("Vous devez choisir une cible à attaquer!"); + if (options.warn) ui.notifications.warn("Vous devez choisir une cible à attaquer!"); break; default: - ui.notifications.warn("Vous devez choisir une cible (et une seule) à attaquer!"); - return; + if (options.warn) ui.notifications.warn("Vous devez choisir une cible (et une seule) à attaquer!"); } + return undefined; } } \ No newline at end of file From ffccc819f19b34ee0dfcb5e5f612bc2dc02b98d2 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Wed, 15 Mar 2023 00:34:20 +0100 Subject: [PATCH 03/16] Fix: merge d'options sur token --- module/rdd-sheet-utility.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/rdd-sheet-utility.js b/module/rdd-sheet-utility.js index da9732cb..28bca225 100644 --- a/module/rdd-sheet-utility.js +++ b/module/rdd-sheet-utility.js @@ -9,7 +9,7 @@ export class RdDSheetUtility { : document.getUserLevel(game.user); mergeObject(options, { isGM: game.user.isGM, - isOwned: document.parent, + isOwned: document.parent ? true : false, editable: editable, cssClass: editable ? "editable" : "locked", isLimited: userRightLevel >= CONST.DOCUMENT_OWNERSHIP_LEVELS.LIMITED, From e470d76ea03221291a22ceeaff3f6452edd3c130 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 10 Mar 2023 22:24:52 +0100 Subject: [PATCH 04/16] =?UTF-8?q?M=C3=A9thode=20de=20fen=C3=AAtre=20de=20j?= =?UTF-8?q?et=20partag=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/actor.js | 256 +++++++++++++++++++++--------------------------- 1 file changed, 109 insertions(+), 147 deletions(-) diff --git a/module/actor.js b/module/actor.js index 0a005dc1..7ab213fa 100644 --- a/module/actor.js +++ b/module/actor.js @@ -332,34 +332,42 @@ export class RdDActor extends RdDBaseActor { /* -------------------------------------------- */ async roll() { - const carac = mergeObject( - duplicate(this.system.carac), + const carac = mergeObject(duplicate(this.system.carac), { 'reve-actuel': this.getCaracReveActuel(), 'chance-actuelle': this.getCaracChanceActuelle() }); - let rollData = { - carac: carac, - selectedCarac: carac.apparence, - selectedCaracName: 'apparence', - competences: this.itemTypes['competence'] - }; + await this._openRollDialog({ + name: `jet-${this.id}`, + label: `Jet de ${this.name}`, + template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll.html', + rollData: { + carac: carac, + selectedCarac: carac.apparence, + selectedCaracName: 'apparence', + competences: this.itemTypes['competence'] + }, + callbackAction: r => this.$onRollCaracResult(r) + }); + } + + async _openRollDialog({ name, label, template, rollData, callbackAction }) { const dialog = await RdDRoll.create(this, rollData, - { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll.html' }, + { html: template }, { - name: `jet-${this.id}`, - label: `Jet de ${this.name}`, + name: name, + label: label, callbacks: [ this.createCallbackExperience(), this.createCallbackAppelAuMoral(), - { action: r => this._onRollCaracResult(r) } + { action: callbackAction } ] - } - ); + }); dialog.render(true); } + async prepareChateauDormant(consigne) { if (consigne.ignorer) { return; @@ -2089,22 +2097,21 @@ export class RdDActor extends RdDBaseActor { } /* -------------------------------------------- */ - filterSortList(sortList, coord) { + $filterSortList(sortList, coord) { let tmr = TMRUtility.getTMR(coord); - let letfilteredList = [] + let filtered = [] for (let sort of sortList) { if (sort.system.caseTMR.toLowerCase().includes('variable')) { - letfilteredList.push(sort); + filtered.push(sort); } else if (sort.system.caseTMRspeciale.toLowerCase().includes('variable')) { - letfilteredList.push(sort); + filtered.push(sort); } else if (sort.system.caseTMR.toLowerCase() == tmr.type) { - letfilteredList.push(sort); + filtered.push(sort); } else if (sort.system.caseTMR.toLowerCase().includes('special') && sort.system.caseTMRspeciale.toLowerCase().includes(coord.toLowerCase())) { - letfilteredList.push(sort); + filtered.push(sort); } } - - return letfilteredList; + return filtered; } /* -------------------------------------------- */ @@ -2136,52 +2143,39 @@ export class RdDActor extends RdDBaseActor { /* -------------------------------------------- */ async rollUnSort(coord) { - let sortList = duplicate(this.getSortList()); // Duplication car les pts de reve sont modifiés dans le sort - if (!sortList || sortList.length == 0) { - ui.notifications.info("Aucun sort disponible!"); - return; - } - sortList = this.filterSortList(sortList, coord); - if (!sortList || sortList.length == 0) { - ui.notifications.info("Aucun sort disponible pour cette case !"); - return; - } if (EffetsDraconiques.isSortImpossible(this)) { ui.notifications.error("Une queue ou un souffle vous empèche de lancer de sort!"); return; } + // Duplication car les pts de reve sont modifiés dans le sort + let sorts = duplicate(this.$filterSortList(this.getSortList(), coord)); + if (sorts.length == 0) { + ui.notifications.info(`Aucun sort disponible en ${TMRUtility.getTMR(coord).label} !`); + return; + } if (this.currentTMR) this.currentTMR.minimize(); // Hide - let draconicList = this.computeDraconicAndSortIndex(sortList); + const draconicList = this.computeDraconicAndSortIndex(sorts); const reve = duplicate(this.system.carac.reve); - let rollData = { - carac: { 'reve': reve }, - forceCarac: { 'reve': reve }, - selectedCarac: reve, - draconicList: draconicList, - competence: draconicList[0], - sortList: sortList, - selectedSort: sortList[0], - tmr: TMRUtility.getTMR(coord), - diffLibre: RdDItemSort.getDifficulte(sortList[0], -7), // Per default at startup - coutreve: Array(30).fill().map((item, index) => 1 + index), - } - const dialog = await RdDRoll.create(this, rollData, - { - html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-sort.html', - close: html => { this.currentTMR.maximize() } // Re-display TMR + await this._openRollDialog({ + name: 'lancer-un-sort', + label: 'Lancer un sort', + template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-sort.html', + rollData: { + carac: { 'reve': reve }, + forceCarac: { 'reve': reve }, + selectedCarac: reve, + draconicList: draconicList, + competence: draconicList[0], + sortList: sorts, + selectedSort: sorts[0], + tmr: TMRUtility.getTMR(coord), + diffLibre: RdDItemSort.getDifficulte(sorts[0], -7), // Per default at startup + coutreve: Array(30).fill().map((item, index) => 1 + index), }, - { - name: 'lancer-un-sort', - label: 'Lancer un sort', - callbacks: [ - this.createCallbackExperience(), - { action: r => this._rollUnSortResult(r) } - ] - } - ); - dialog.render(true); + callbackAction: r => this._rollUnSortResult(r) + }); } /* -------------------------------------------- */ @@ -2288,29 +2282,21 @@ export class RdDActor extends RdDBaseActor { /* -------------------------------------------- */ async rollCarac(caracName, jetResistance = undefined) { - let rollData = { - selectedCarac: this.getCaracByName(caracName), - competences: this.itemTypes['competence'], - jetResistance: jetResistance ? caracName : undefined - }; - - const dialog = await RdDRoll.create(this, rollData, - { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html' }, - { - name: 'jet-' + caracName, - label: 'Jet ' + Grammar.apostrophe('de', rollData.selectedCarac.label), - callbacks: [ - this.createCallbackExperience(), - this.createCallbackAppelAuMoral(), - { action: r => this._onRollCaracResult(r) } - ] - } - ); - dialog.render(true); + await this._openRollDialog({ + name: 'jet-' + caracName, + label: 'Jet ' + Grammar.apostrophe('de', rollData.selectedCarac.label), + template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html', + rollData: { + selectedCarac: this.getCaracByName(caracName), + competences: this.itemTypes['competence'], + jetResistance: jetResistance ? caracName : undefined + }, + callbackAction: r => this.$onRollCaracResult(r) + }); } /* -------------------------------------------- */ - async _onRollCaracResult(rollData) { + async $onRollCaracResult(rollData) { // Final chat message await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-general.html'); } @@ -2374,19 +2360,14 @@ export class RdDActor extends RdDBaseActor { // Transformer la competence de créature RdDItemCompetenceCreature.setRollDataCreature(rollData) } - console.log("rollCompetence !!!", rollData); - const dialog = await RdDRoll.create(this, rollData, - { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html' }, - { - name: 'jet-competence', - label: 'Jet ' + Grammar.apostrophe('de', rollData.competence.name), - callbacks: [ - this.createCallbackExperience(), - this.createCallbackAppelAuMoral(), - { action: r => this.$onRollCompetence(r) } - ] - }); - dialog.render(true); + + await this._openRollDialog({ + name: 'jet-competence', + label: 'Jet ' + Grammar.apostrophe('de', rollData.competence.name), + template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html', + rollData: rollData, + callbackAction: r => this.$onRollCompetence(r) + }); } /* -------------------------------------------- */ @@ -2427,39 +2408,31 @@ export class RdDActor extends RdDBaseActor { } /* -------------------------------------------- */ - async rollTache(id) { + async rollTache(id, options = {}) { const tacheData = this.getTache(id) const compData = this.getCompetence(tacheData.system.competence) compData.system.defaut_carac = tacheData.system.carac; // Patch ! - let rollData = { - competence: compData, - tache: tacheData, - diffLibre: tacheData.system.difficulte, - diffConditions: 0, - use: { libre: false, conditions: true }, - carac: {} - }; - rollData.carac[tacheData.system.carac] = duplicate(this.system.carac[tacheData.system.carac]); // Single carac - - console.log("rollTache !!!", rollData); - - const dialog = await RdDRoll.create(this, rollData, - { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html' }, - { - name: 'jet-competence', - label: 'Jet de Tâche ' + tacheData.name, - callbacks: [ - this.createCallbackExperience(), - this.createCallbackAppelAuMoral(), - { action: r => this._tacheResult(r) } - ] - }); - dialog.render(true); + await this._openRollDialog({ + name: 'jet-competence', + label: 'Jet de Tâche ' + tacheData.name, + template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html', + rollData: { + competence: compData, + tache: tacheData, + diffLibre: tacheData.system.difficulte, + diffConditions: 0, + use: { libre: false, conditions: true }, + carac: { + [tacheData.system.carac]: duplicate(this.system.carac[tacheData.system.carac]) + } + }, + callbackAction: r => this._tacheResult(r, options) + }); } /* -------------------------------------------- */ - async _tacheResult(rollData) { + async _tacheResult(rollData, options) { // Mise à jour de la tache rollData.appliquerFatigue = ReglesOptionelles.isUsing("appliquer-fatigue"); rollData.tache = duplicate(rollData.tache); @@ -2481,7 +2454,7 @@ export class RdDActor extends RdDBaseActor { } /* -------------------------------------------- */ - async _rollArt(artData, selected, oeuvre, callBackResult = r => this._resultArt(r)) { + async _rollArt(artData, selected, oeuvre, callbackAction = r => this._resultArt(r)) { oeuvre.system.niveau = oeuvre.system.niveau ?? 0; mergeObject(artData, { @@ -2499,18 +2472,14 @@ export class RdDActor extends RdDBaseActor { artData.forceCarac = {}; artData.forceCarac[selected] = duplicate(this.system.carac[selected]); } - const dialog = await RdDRoll.create(this, artData, - { html: `systems/foundryvtt-reve-de-dragon/templates/dialog-roll-${oeuvre.type}.html` }, - { - name: `jet-${artData.art}`, - label: `${artData.verbe} ${oeuvre.name}`, - callbacks: [ - this.createCallbackExperience(), - this.createCallbackAppelAuMoral(), - { action: r => callBackResult(r) } - ] - }); - dialog.render(true); + + await this._openRollDialog({ + name: `jet-${artData.art}`, + label: `${artData.verbe} ${oeuvre.name}`, + template: `systems/foundryvtt-reve-de-dragon/templates/dialog-roll-${oeuvre.type}.html`, + rollData: artData, + callbackAction: callbackAction + }); } /* -------------------------------------------- */ @@ -2778,25 +2747,18 @@ export class RdDActor extends RdDBaseActor { } /* -------------------------------------------- */ - async rollAppelChance(onSuccess = () => { }, onEchec = () => { }) { - // Stocke si utilisation de la chance - let rollData = { selectedCarac: this.getCaracByName('chance-actuelle'), surprise: '' }; - const dialog = await RdDRoll.create(this, rollData, - { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html' }, - { - name: 'appelChance', - label: 'Appel à la chance', - callbacks: [ - this.createCallbackExperience(), - { action: r => this._appelChanceResult(r, onSuccess, onEchec) }, - ] - } - ); - dialog.render(true); + async rollAppelChance(onSuccess = () => {}, onEchec = () => {}) { + await this._openRollDialog({ + name: 'appelChance', + label: 'Appel à la chance', + template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html', + rollData: { selectedCarac: this.getCaracByName('chance-actuelle'), surprise: '' }, + callbackAction: r => this._appelChanceResult(r, onSuccess, onEchec) + }); } /* -------------------------------------------- */ - async _appelChanceResult(rollData, onSuccess = () => { }, onEchec = () => { }) { + async _appelChanceResult(rollData, onSuccess, onEchec) { await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-appelchance.html') if (rollData.rolled.isSuccess) { await this.setFlag(SYSTEM_RDD, 'utilisationChance', true); From 41335cd4336f386609a76169ae57c31b602539cb Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 10 Mar 2023 22:25:53 +0100 Subject: [PATCH 05/16] =?UTF-8?q?Renommage=20m=C3=A9thode=20jet=20sans=20d?= =?UTF-8?q?ialog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/actor.js | 14 +++++++++++--- module/rdd-commands.js | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/module/actor.js b/module/actor.js index 7ab213fa..bcbc7388 100644 --- a/module/actor.js +++ b/module/actor.js @@ -1803,7 +1803,7 @@ export class RdDActor extends RdDBaseActor { async _surmonterExotisme(item) { const exotisme = Math.min(item.system.exotisme, item.system.qualite, 0); if (exotisme < 0) { - const rolled = await this.rollCaracCompetence('volonte', 'cuisine', exotisme, { title: `tente de surmonter l'exotisme de ${item.name}` }); + const rolled = await this.doRollCaracCompetence('volonte', 'cuisine', exotisme, { title: `tente de surmonter l'exotisme de ${item.name}` }); return rolled.isSuccess; } return true; @@ -1811,7 +1811,7 @@ export class RdDActor extends RdDBaseActor { /* -------------------------------------------- */ async apprecier(carac, compName, qualite, title) { - const rolled = await this.rollCaracCompetence(carac, compName, qualite, { title: title, apprecier: true }); + const rolled = await this.doRollCaracCompetence(carac, compName, qualite, { title: title, apprecier: true }); if (rolled?.isSuccess) { await this.jetDeMoral('heureux'); } @@ -2301,7 +2301,15 @@ export class RdDActor extends RdDBaseActor { await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-general.html'); } - async rollCaracCompetence(caracName, compName, diff, options = { title: "", apprecier: false }) { + /** + * Méthode pour faire un jet prédéterminer sans ouvrir la fenêtre de dialogue + * @param {*} caracName + * @param {*} compName + * @param {*} diff + * @param {*} options + * @returns + */ + async doRollCaracCompetence(caracName, compName, diff, options = { title: "", apprecier: false }) { const carac = this.getCaracByName(caracName); if (!carac) { ui.notifications.warn(`${this.name} n'a pas de caractéristique correspondant à ${caracName}`) diff --git a/module/rdd-commands.js b/module/rdd-commands.js index ebab970a..74dd1e61 100644 --- a/module/rdd-commands.js +++ b/module/rdd-commands.js @@ -332,7 +332,7 @@ export class RdDCommands { let competence = length > 1 ? actors[0].getCompetence(Misc.join(params.slice(1, length), ' ')) : { name: undefined }; if (competence) { for (let actor of actors) { - await actor.rollCaracCompetence(caracName, competence.name, diff); + await actor.doRollCaracCompetence(caracName, competence.name, diff); } } return; From d739a7993ae5eef8a982f6a9efc45c3410080628 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 10 Mar 2023 22:26:38 +0100 Subject: [PATCH 06/16] rollCaracCompetence avec dialog --- module/actor.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/module/actor.js b/module/actor.js index bcbc7388..4295e8b5 100644 --- a/module/actor.js +++ b/module/actor.js @@ -2413,6 +2413,24 @@ export class RdDActor extends RdDBaseActor { if (tache) { await this.createEmbeddedDocuments('Item', [tache], { renderSheet: false }); } + + async rollCaracCompetence(caracName, compName, diff, options = { title: "" }) { + const competence = this.getCompetence(compName); + await this._openRollDialog({ + name: 'jet-competence', + label: 'Jet ' + Grammar.apostrophe('de', competence.name), + template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html', + rollData: { + alias: this.name, + carac: this.system.carac, + selectedCarac: this.getCaracByName(caracName), + selectedCaracName: caracName, + diffLibre: diff, + competence: competence, + show: { title: options?.title ?? '' } + }, + callbackAction: r => this.$onRollCompetence(r) + }); } /* -------------------------------------------- */ From 4f5fb6375176d5df57b7d72a40be630feb6708ac Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 10 Mar 2023 22:33:37 +0100 Subject: [PATCH 07/16] =?UTF-8?q?Tri=20alphab=C3=A9tique=20des=20constante?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lang/fr.json | 64 ++++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/lang/fr.json b/lang/fr.json index f8cf04e8..435aeb04 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -7,47 +7,47 @@ "TypeVehicule": "Véhicule" }, "ITEM": { - "TypeObjet": "Objet", - "TypeGemme": "Gemme", - "TypeCompetence": "Compétence", - "TypeCompetencecreature": "Compétence de créature", - "TypeMaladie": "Maladie", - "TypePoison": "Poison", - "TypeNombreastral": "Nombre astral", - "TypeTarot": "Carte de tarot", - "TypeCasetmr": "TMR spéciale", - "TypeRencontre": "Rencontre TMR", - "TypeMunition": "Munition", - "TypeMonnaie": "Monnaie", - "TypeHerbe": "Herbe", - "TypePlante": "Plante", - "TypeIngredient": "Ingrédient", - "TypeFaune": "Faune", - "TypeLivre": "Livre", - "TypePotion": "Potion", "TypeArme": "Arme", "TypeArmure": "Armure", - "TypeConteneur": "Conteneur", - "TypeNourritureboisson": "Nourriture & boisson", - "TypeService": "Service", + "TypeCasetmr": "TMR spéciale", "TypeChant": "Chant", + "TypeCompetence": "Compétence", + "TypeCompetencecreature": "Compétence de créature", + "TypeConteneur": "Conteneur", "TypeDanse": "Danse", - "TypeMusique": "Musique", - "TypeOeuvre": "Oeuvre", - "TypeTache": "Tâche", + "TypeExtraitpoetique": "Extrait poetique", + "TypeFaune": "Faune", + "TypeGemme": "Gemme", + "TypeHerbe": "Herbe", + "TypeIngredient": "Ingrédient", "TypeJeu": "Jeu", + "TypeLivre": "Livre", + "TypeMaladie": "Maladie", + "TypeMeditation": "Méditation", + "TypeMonnaie": "Monnaie", + "TypeMunition": "Munition", + "TypeMusique": "Musique", + "TypeNombreastral": "Nombre astral", + "TypeNourritureboisson": "Nourriture & boisson", + "TypeObjet": "Objet", + "TypeOeuvre": "Oeuvre", + "TypeOmbre": "Ombre de Thanatos", + "TypePlante": "Plante", + "TypePoison": "Poison", + "TypePossession": "Possession", + "TypePotion": "Potion", + "TypeQueue": "Queue de Dragon", "TypeRecettealchimique": "Recette alchimique", "TypeRecettecuisine": "Recette de cuisine", - "TypeSort": "Sort", - "TypeMeditation": "Méditation", + "TypeRencontre": "Rencontre TMR", + "TypeService": "Service", "TypeSignedraconique": "Signe draconique", - "TypeQueue": "Queue de Dragon", - "TypeOmbre": "Ombre de Thanatos", - "TypeSouffle": "Souffle de Dragon", - "TypeTete": "Tête de Dragon", - "TypePossession": "Possession", + "TypeSort": "Sort", "TypeSortreserve": "Sort en réserve", - "TypeExtraitpoetique": "Extrait poetique" + "TypeSouffle": "Souffle de Dragon", + "TypeTache": "Tâche", + "TypeTarot": "Carte de tarot", + "TypeTete": "Tête de Dragon" }, "EFFECT": { "StatusStunned": "Sonné", From 2598ae34891befee548a673a2eeea507e6f51e6d Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 10 Mar 2023 22:37:21 +0100 Subject: [PATCH 08/16] Ajout item Blessure --- icons/sante/blessure-soins.webp | Bin 0 -> 5586 bytes icons/sante/blessure.webp | Bin 0 -> 6782 bytes lang/fr.json | 1 + module/actor/base-actor-sheet.js | 1 + module/item.js | 2 +- module/item/blessure.js | 19 ++++++++++++ module/item/sheet-blessure.js | 16 ++++++++++ module/migrations.js | 46 ++++++++++++++++++++++++++++- module/rdd-main.js | 5 +++- module/rdd-utility.js | 1 + styles/simple.css | 4 +++ template.json | 21 +++++++++++-- templates/actor/blessure.hbs | 22 ++++++++++++++ templates/actor/blessures.html | 5 ++++ templates/item-blessure-sheet.html | 43 +++++++++++++++++++++++++++ 15 files changed, 181 insertions(+), 5 deletions(-) create mode 100644 icons/sante/blessure-soins.webp create mode 100644 icons/sante/blessure.webp create mode 100644 module/item/blessure.js create mode 100644 module/item/sheet-blessure.js create mode 100644 templates/actor/blessure.hbs create mode 100644 templates/item-blessure-sheet.html diff --git a/icons/sante/blessure-soins.webp b/icons/sante/blessure-soins.webp new file mode 100644 index 0000000000000000000000000000000000000000..a8c317d795afc7b8c4d1354e973505abea52b383 GIT binary patch literal 5586 zcmZ`-by!qQ+dsQ>hcrkkg1U5rbhm^^$I>keND2ay(jW~B(w!0_wIHp4gwowCQX;wE z^1OdM?;r0s=giD+?mTnPoVl)hbW{`-hbRHSKtWdfg|^5`d;kD=(DfE{_o~RrY3qT} zLjbJj40VBFqFFAko*p_%vdk|HjhJz^01N;Rpa6sc4ofJ^T|-w6aYZDXbDNEyN4$lE2FXcYftw(oPx#_P~ z18@NB0DHg_c#5Wap{?7Xds{T!2K_h#zIX9Q>!HiPafR9P^Zi2t5y}Dp)*=dZ@(=)U zk^$f*0foBCN1<*C003hi0J>cN)pvsffXEq|p71a2K^_2*gaN=O#J@DFGyrIh005d_ z?v@^w|M_{RT<8Jc&;2R_aKfSx~ksYU@HBNG7F(eflF zGV0pOYasLrk?^3%$Yi~n4qWE0Yw@{Ph-$-idFj$CD&L(7>S5zfBtpZ2#DZ4Xx;~JP zqwwG|ogres-Nd4LN9OBqzTA*R1?fFo4;rsu4(C{3iDZr0T+Qgq9OxmX|keygB&v{RcY~*>us|<#8S}i=@=V`;()uOm%pkE)%s8MT2F2&pYWGSlDh2otYk;eS4n5myx}a+x={)UzJl0v~PKYG-tN;V6&4Wk(-PfBf8&J zy<*=L+2iJrq%L(t&D_QwM0TP4Mb}jd2SA@J%+_S+lcf~M0X;^6P$0>1+j4EG&b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7RD@w`F@EaT>ReB%X!Wd6(TcmBV=v_bgYO8GXqy80`FDDiX#MTux^94Hmp; zh14fM8XeN9f=;AOPJCaa7F|znRmAq|1;dRP;#>yuup#{u+?!{qvrfZGsn^RUeg_D& z9UPe-;J0|PAZC^kWxkaMES^R-;A1WB+%p?wLLHa&q{iA9DZw+^^Y)LrpR(i=1rFg# z004Btp9=&*sz2!z$d&#ri+`nBnX2OI8Pp;xX|JEMS5oITr*-kwVqjFy`m=(LhbsEU z0f-s3Ntr8d)~uSg>V_@ywQgcf$LLgOz9ue*3_R)RUT7;)Ke6JxPYVomSw2>*Ro^9@ z2nIk<_9sNrfu9PQYm69%G^$5kYtncxL*Y?E+0TD``y3TOnt|bLpR>=CmCJy>D6+?6 z<~18K`5|a>^u1I$DgM5X38alCor{>zGSHyY7%W_|Bf`&PM`m9}SyOA0h7pzQLp4+j z0MzukZkx%B;m0g5=8IW0K0P{or>hz~D2p`{U|xhmjnZb!FqyoPe~CfeufZ7Q6D^|h z$CF_6Jli{zPwd&Lc26-$6+2T=|hU)l@3-hIk7DK z6VCI6R>Dp3(5#$ZNp)q_ifBW@$`%I!X^_WCs(H6L#jWSF*CE+N&b$Jg+fM^J^ZL? z^b^49r&6<&)eMJQ_efge40@FGn}v7Y1ZF#+xZcIglsK0i)JIHo;#ckkN)?4wv&_aNQQL^QZ1$0J&r1uvkzLw z!n%G(Y5BtVH>m}9UqKX<;>8qa#}iVrSNi#wV7!{1vblCc*maR>^YNLELD|z5s$66h z5sv!h!v!azxHeMnE?M#=%mFPXgp8FQ7F+$S@BNZ?ng_> K@mLe|@9=*G5&G}| literal 0 HcmV?d00001 diff --git a/icons/sante/blessure.webp b/icons/sante/blessure.webp new file mode 100644 index 0000000000000000000000000000000000000000..f39016085845d261f3cc58f1ffd99607aadc1457 GIT binary patch literal 6782 zcmZ{nWmFtZ*2jAo+}(mZ1Wj<4!QBZG++72NFt`NQ;1CGG-2x%F1PKrxG%&a&8Qg*m z?_~GG?uUJ=yQ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z)e8C&>6(8!*zNVlWOjB^(GdmTF_18ngxZCZq2!#QnAR|7H^HyQ=4TuUv^-vu?J69; zc0YL|X5;=CQ}g?Y>U>Q}pnElTECafl)QBiGW+cTEpFEpn5?35)lW+39X-P`F1NFCI z6Ae-*66o(#u2;7|0uELu2+a>wuHbO0P(5Qc)smt(jpu#miEkbJSCX~_1{lZkEaG49 zXtoHAoZZe}{q&kEdH)q_;D8MNRb2Oc%Q^^6Ef>~48fUoN(Jt~B_&#w*O`ZM=H*PT> zoQEzEj`33a2hp4(u^~AOYQ3UnDyB#{ z$Z_rj$?jFWn{Ue=*^e0c6*lOK0%P5*|4m%y5P;=@;8AVY_mCI0y~>lU+TC?@mDe)U`B=r>;(pSS%xCw< gWtckLGNJXF2TD&Bo=bttMnkig0*m$ciUWZE19rPbr2qf` literal 0 HcmV?d00001 diff --git a/lang/fr.json b/lang/fr.json index 435aeb04..a671f680 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -9,6 +9,7 @@ "ITEM": { "TypeArme": "Arme", "TypeArmure": "Armure", + "TypeBlessure": "Blessure", "TypeCasetmr": "TMR spéciale", "TypeChant": "Chant", "TypeCompetence": "Compétence", diff --git a/module/actor/base-actor-sheet.js b/module/actor/base-actor-sheet.js index 9ac21339..11429c01 100644 --- a/module/actor/base-actor-sheet.js +++ b/module/actor/base-actor-sheet.js @@ -78,6 +78,7 @@ export class RdDBaseActorSheet extends ActorSheet { /* -------------------------------------------- */ static filterItemsPerTypeForSheet(formData, itemTypes) { + formData.blessures = Misc.arrayOrEmpty(itemTypes['blessure']); formData.recettescuisine = Misc.arrayOrEmpty(itemTypes['recettecuisine']); formData.recettesAlchimiques = Misc.arrayOrEmpty(itemTypes['recettealchimique']); formData.maladies = Misc.arrayOrEmpty(itemTypes['maladie']); diff --git a/module/item.js b/module/item.js index 74b59594..9195b29f 100644 --- a/module/item.js +++ b/module/item.js @@ -33,7 +33,7 @@ const typesObjetsDraconiques = ["queue", "ombre", "souffle", "tete", "signedraco const typesObjetsConnaissance = ["meditation", "recettealchimique", "sort"] const typesObjetsEffet = ["possession", "poison", "maladie"] const typesObjetsCompetence = ["competence", "competencecreature"] -const typesObjetsTemporels = ["poison", "maladie", "queue", "ombre", "souffle", "signedraconique", "rencontre"] +const typesObjetsTemporels = ["blessure", "poison", "maladie", "queue", "ombre", "souffle", "signedraconique", "rencontre"] const typesEnvironnement = typesInventaireMateriel; const encBrin = 0.00005; // un brin = 1 décigramme = 1/10g = 1/10000kg = 1/20000 enc const encPepin = 0.0007; /* un pépin de gemme = 1/10 cm3 = 1/1000 l = 3.5/1000 kg = 7/2000 kg = 7/1000 enc diff --git a/module/item/blessure.js b/module/item/blessure.js new file mode 100644 index 00000000..7b445bc0 --- /dev/null +++ b/module/item/blessure.js @@ -0,0 +1,19 @@ +import { RdDItem } from "../item.js"; + +export class RdDItemBlessure extends RdDItem { + + static get defaultIcon() { + return "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp"; + } + + async calculerFinPeriodeTemporel(debut) { + return await debut.nouveauJour().addJours(this.system.gravite); + } + + async onFinPeriode(oldTimestamp, newTimestamp) { + if (this.system.gravite <= 0) { + await super.onFinPeriode(oldTimestamp, newTimestamp) + } + } + +} \ No newline at end of file diff --git a/module/item/sheet-blessure.js b/module/item/sheet-blessure.js new file mode 100644 index 00000000..3d5e7ebf --- /dev/null +++ b/module/item/sheet-blessure.js @@ -0,0 +1,16 @@ +import { RdDItemSheet } from "../item-sheet.js"; + +export class RdDBlessureItemSheet extends RdDItemSheet { + + static get ITEM_TYPE() { return "blessure" }; + + async getData() { + const formData = await super.getData(); + formData.disabled = formData.options.isGM || formData.options.isOwned ? '' : 'disabled'; + return formData; + } + + activateListeners(html) { + super.activateListeners(html); + } +} diff --git a/module/migrations.js b/module/migrations.js index 8b97047c..b1d3513f 100644 --- a/module/migrations.js +++ b/module/migrations.js @@ -416,6 +416,49 @@ class _10_5_0_UpdatePeriodicite extends Migration { } } +class _10_7_0_MigrationBlessures extends Migration { + get code() { return "migration-blessures"; } + get version() { return "10.7.0"; } + + async migrate() { + const timestamp = game.system.rdd.calendrier.getTimestamp() + await Promise.all(game.actors.filter(it => it.isPersonnage() || it.isCreature()) + .map(async (actor) => { + const legeres = actor.system.blessures?.legeres.liste.filter(it => it.active).map(it => this.creerBlessure(2, 'légère', it, timestamp)) ?? []; + const graves = actor.system.blessures?.graves.liste.filter(it => it.active).map(it => this.creerBlessure(4, 'grave', it, timestamp)) ?? []; + const critiques = actor.system.blessures?.critiques.liste.filter(it => it.active).map(it => this.creerBlessure(6, 'critique', it, timestamp)); + const blessures = legeres.concat(graves).concat(critiques); + if (blessures.length > 0) { + await actor.createEmbeddedDocuments("Item", blessures); + } + await actor.update({ + 'system.blessures.legeres.liste': [], + 'system.blessures.graves.liste': [], + 'system.blessures.critiques.liste': [] + }) + })); + } + creerBlessure(gravite, graviteTexte, blessure, timestamp) { + const dateBlessure = timestamp.addJours(-blessure.jours); + const datePremiereRecup = dateBlessure.addJours(gravite); + return { + name: `Blessure ${graviteTexte}`, + type: 'blessure', + img: `systems/foundryvtt-reve-de-dragon/icons/sante/blessure${blessure.psdone ? '-soins' : ''}.webp`, + system: { + gravite: gravite, + difficulte: -gravite, + debut: { indexDate: dateBlessure.indexDate, indexMinute: 0 }, + fin: { indexDate: datePremiereRecup.indexDate, indexMinute: 0 }, + premierssoins: { done: blessure.psdone, bonus: blessure.premiers_soins }, + soinscomplets: { done: blessure.scdone, bonus: blessure.soins_complets }, + localisation: blessure.localisation, + jours: blessure.jours + } + } + } +} + export class Migrations { static getMigrations() { return [ @@ -431,6 +474,7 @@ export class Migrations { new _10_3_17_Monnaies(), new _10_4_6_ServicesEnCommerces(), new _10_5_0_UpdatePeriodicite(), + new _10_7_0_MigrationBlessures(), ]; } @@ -447,7 +491,7 @@ export class Migrations { migrate() { const currentVersion = game.settings.get(SYSTEM_RDD, "systemMigrationVersion"); if (isNewerVersion(game.system.version, currentVersion)) { - //if (true) { /* comment previous and uncomment here to test before upgrade */ + //if (true) { /* comment previous and uncomment here to test before upgrade */ const migrations = Migrations.getMigrations().filter(m => isNewerVersion(m.version, currentVersion)); if (migrations.length > 0) { migrations.sort((a, b) => this.compareVersions(a, b)); diff --git a/module/rdd-main.js b/module/rdd-main.js index d25d622e..849a7a48 100644 --- a/module/rdd-main.js +++ b/module/rdd-main.js @@ -36,6 +36,7 @@ import { RdDActorVehiculeSheet } from "./actor-vehicule-sheet.js"; import { RdDActorEntiteSheet } from "./actor-entite-sheet.js"; import { RdDItem } from "./item.js"; +import { RdDItemBlessure } from "./item/blessure.js"; import { RdDItemService } from "./item/service.js"; import { RdDItemMaladie } from "./item/maladie.js"; import { RdDItemPoison } from "./item/poison.js"; @@ -46,6 +47,7 @@ import { RdDItemSouffle } from "./item/souffle.js"; import { RdDRencontre } from "./item/rencontre.js"; import { RdDItemSheet } from "./item-sheet.js"; +import { RdDBlessureItemSheet } from "./item/sheet-blessure.js"; import { RdDServiceItemSheet } from "./item/sheet-service.js"; import { RdDRencontreItemSheet } from "./item/sheet-rencontre.js"; import { RdDHerbeItemSheet } from "./item/sheet-herbe.js"; @@ -74,6 +76,7 @@ export class SystemReveDeDragon { this.RdDUtility = RdDUtility; this.RdDHotbar = RdDHotbar; this.itemClasses = { + blessure: RdDItemBlessure, service: RdDItemService, maladie: RdDItemMaladie, poison: RdDItemPoison, @@ -157,6 +160,7 @@ export class SystemReveDeDragon { RdDItemSheet.register(RdDPlanteItemSheet); RdDItemSheet.register(RdDIngredientItemSheet); RdDItemSheet.register(RdDServiceItemSheet); + RdDItemSheet.register(RdDBlessureItemSheet); Items.registerSheet(SYSTEM_RDD, RdDItemInventaireSheet, { types: [ @@ -276,7 +280,6 @@ export class SystemReveDeDragon { let sidebar = document.getElementById("sidebar"); sidebar.style.width = "min-content"; } - if (Misc.isUniqueConnectedGM()) { game.system.rdd.calendrier = new RdDCalendrier(); new Migrations().migrate(); diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 460b96bb..68f0f232 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -140,6 +140,7 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/actor/combat.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/blessures.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/blessure.html', + 'systems/foundryvtt-reve-de-dragon/templates/actor/blessure.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/maladies-poisons.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/possessions.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/taches.html', diff --git a/styles/simple.css b/styles/simple.css index 01c3c55b..c4adf335 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -426,6 +426,7 @@ span.equipement-detail-buttons { justify-content: center; text-align: left; } + .blessure-control { flex-grow: 1; flex-direction: row; @@ -457,14 +458,17 @@ input:is(.blessure-premiers_soins, .blessure-soins_complets) { .blessure-inactive { color:rgba(150, 150, 150, 0.4); } +.blessure-active-2, .blessure-active-legere { color:rgba(60, 60, 60, 0.9); text-shadow: 1px 1px 4px rgba(60, 60, 60, 1); } +.blessure-active-4, .blessure-active-grave { color: rgba(218, 126, 21, 0.9); text-shadow: 1px 1px 4px rgba(60, 60, 60, 1); } +.blessure-active-6, .blessure-active-critique { color: rgba(173, 36, 26, 0.9); text-shadow: 1px 1px 4px rgba(60, 60, 60, 1); diff --git a/template.json b/template.json index 52543e5f..a861e523 100644 --- a/template.json +++ b/template.json @@ -567,7 +567,7 @@ "monnaie", "nourritureboisson", "gemme", "service", "meditation", "rencontre", "queue", "ombre", "souffle", "tete", "casetmr", "signedraconique", "sort", "sortreserve", - "nombreastral", "tache", "maladie", "poison", "possession", + "nombreastral", "tache", "blessure", "maladie", "poison", "possession", "tarot", "extraitpoetique" ], "templates": { @@ -636,6 +636,22 @@ "compteur": 0, "date": 0 }, + "blessure": { + "templates": ["temporel"], + "gravite": 0, + "difficulte": 0, + "premierssoins": { + "tache": 0, + "done": false, + "bonus": 0 + }, + "soinscomplets": { + "done": false, + "bonus": 0 + }, + "localisation": "", + "jours": 0 + }, "maladie": { "templates": ["description", "temporel"], "identifie": false, @@ -833,7 +849,8 @@ "points_de_tache_courant": 0, "nb_jet_echec": 0, "nb_jet_succes": 0, - "cacher_points_de_tache": false + "cacher_points_de_tache": false, + "itemId": "" }, "sort": { "templates": ["description"], diff --git a/templates/actor/blessure.hbs b/templates/actor/blessure.hbs new file mode 100644 index 00000000..a2b9666c --- /dev/null +++ b/templates/actor/blessure.hbs @@ -0,0 +1,22 @@ +
  • + + + {{name}} + + + + + + + + + + + + + + + + + +
  • diff --git a/templates/actor/blessures.html b/templates/actor/blessures.html index fa7705c6..88f185f0 100644 --- a/templates/actor/blessures.html +++ b/templates/actor/blessures.html @@ -5,6 +5,8 @@ Soins complets Age (jours) Localisation + Actions + {{#each system.blessures.legeres.liste as |blessure key|}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/blessure.html" blessure=blessure key=key gravite="legere" title="Légère"}} @@ -15,4 +17,7 @@ {{#each system.blessures.critiques.liste as |blessure key|}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/blessure.html" blessure=blessure key=key gravite="critique" title="Critique"}} {{/each}} + {{#each blessures as |blessure|}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor/blessure.hbs" blessure}} + {{/each}} diff --git a/templates/item-blessure-sheet.html b/templates/item-blessure-sheet.html new file mode 100644 index 00000000..ea8263bf --- /dev/null +++ b/templates/item-blessure-sheet.html @@ -0,0 +1,43 @@ +
    + {{>"systems/foundryvtt-reve-de-dragon/templates/header-item.html"}} +
    +
    + + +
    + +
    + + +
    + +
    + + {{#if system.premierssoins.done}} + + {{/if}} +
    + +
    + + {{#if system.soinscomplets.done}} + + {{/if}} +
    + + {{#if options.isOwned}} + {{>"systems/foundryvtt-reve-de-dragon/templates/item/temporel.hbs" this labeldebut="Obtenue" labelfin="Prochain jet"}} + {{/if}} +
    +
    From acc880b53f9581b5270355381f98b89618e9927d Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 10 Mar 2023 22:33:05 +0100 Subject: [PATCH 09/16] Preparation soins HUD --- module/rdd-token-hud.js | 69 ++++++++++++++++++-------------- styles/simple.css | 10 ++--- templates/hud-actor-attaque.html | 4 +- templates/hud-actor-init.html | 6 +-- 4 files changed, 50 insertions(+), 39 deletions(-) diff --git a/module/rdd-token-hud.js b/module/rdd-token-hud.js index 6d29ecab..8ef426ef 100644 --- a/module/rdd-token-hud.js +++ b/module/rdd-token-hud.js @@ -18,29 +18,36 @@ export class RdDTokenHud { } /* -------------------------------------------- */ - static async addExtensionHud(app, html, tokenId) { + static async addExtensionHud(app, html, tokenId, isCombat) { let token = canvas.tokens.get(tokenId); let actor = token.actor; - let combatant = game.combat.combatants.find(c => c.tokenId == tokenId); - if (! (combatant?.actor) ) { + app.hasExtension = true; + if (isCombat) { + let combatant = game.combat.combatants.find(c => c.tokenId == tokenId); + if (!(combatant?.actor)) { ui.notifications.warn(`Le combatant ${token.name} n'est pas associé à un acteur, impossible de déterminer ses actions de combat!`) return; + } + let actions = RdDCombatManager.listActionsCombat(combatant); + // initiative + await RdDTokenHud.addExtensionHudInit(html, combatant, actions); + // combat + await RdDTokenHud.addExtensionHudCombat(html, combatant, actions); } - app.hasExtension = true; - let actionsCombat = RdDCombatManager.listActionsCombat(combatant); + + } + + static async addExtensionHudInit(html, combatant, actions) { const hudData = { - combatant: combatant, - actions: actionsCombat, + combatant, actions, commandes: [ { name: "Autre action", command: 'autre' }, - { name: 'Initiative +1', command: 'inc', value: 0.01 }, + { name: 'Initiative +1', command: 'inc', value: 0.01 }, { name: 'Initiative -1', command: 'dec', value: -0.01 }] }; - const controlIconCombat = html.find('.control-icon[data-action=combat]'); - // initiative await RdDTokenHud._configureSubMenu(controlIconCombat, 'systems/foundryvtt-reve-de-dragon/templates/hud-actor-init.html', hudData, @@ -51,22 +58,25 @@ export class RdDTokenHud { RdDTokenHud._initiativeCommand(initCommand, combatantId); } else { let index = event.currentTarget.attributes['data-action-index'].value; - let action = actionsCombat[index]; + let action = hudData.actions[index]; RdDCombatManager.rollInitiativeAction(combatantId, action); - } + } }); + } + static async addExtensionHudCombat(html, combatant, actions) { + const hudData = { combatant, actions, commandes: [] }; const controlIconTarget = html.find('.control-icon[data-action=target]'); - // combat await RdDTokenHud._configureSubMenu(controlIconTarget, 'systems/foundryvtt-reve-de-dragon/templates/hud-actor-attaque.html', hudData, (event) => { const actionIndex = event.currentTarget.attributes['data-action-index']?.value; - const action = actionsCombat[actionIndex]; + const action = hudData.actions[actionIndex]; if (action.action == 'conjurer') { - actor.conjurerPossession(actor.getPossession(action.system.possessionid)); + const possession = combatant.actor.getPossession(action.system.possessionid); + combatant.actor.conjurerPossession(possession); } else { - actor.rollArme(action); + combatant.actor.rollArme(action); } }); } @@ -75,24 +85,25 @@ export class RdDTokenHud { switch (initCommand) { case 'inc': return RdDCombatManager.incDecInit(combatantId, 0.01); case 'dec': return RdDCombatManager.incDecInit(combatantId, -0.01); - case 'autre': return RdDCombatManager.rollInitiativeAction(combatantId, + case 'autre': return RdDCombatManager.rollInitiativeAction(combatantId, { name: "Autre action", action: 'autre', system: { initOnly: true, competence: "Autre action" } }); } } /* -------------------------------------------- */ static async addTokenHudExtensions(app, html, tokenId) { - const controlIconCombat = html.find('.control-icon[data-action=combat]'); - controlIconCombat.click(event => { - if (event.currentTarget.className.includes('active')) { - RdDTokenHud.removeExtensionHud(app, html, tokenId); - } else { - setTimeout(function () { RdDTokenHud.addExtensionHud(app, html, tokenId) }, 200); - } - }); + const controlIconCombat = html.find('.control-icon[data-action=combat]'); + if (controlIconCombat.length > 0) { + controlIconCombat.click(event => { + if (event.currentTarget.className.includes('active')) { + RdDTokenHud.removeExtensionHud(app, html, tokenId); + } else { + setTimeout(() => RdDTokenHud.addExtensionHud(app, html, tokenId), 200); + } + }); - if (controlIconCombat.length>0 && controlIconCombat[0].className.includes('active')) { - RdDTokenHud.addExtensionHud(app, html, tokenId); + const isCombat = controlIconCombat[0].className.includes('active'); + RdDTokenHud.addExtensionHud(app, html, tokenId, isCombat); } } @@ -100,9 +111,9 @@ export class RdDTokenHud { static async _configureSubMenu(insertionPoint, template, hudData, onMenuItem) { const hud = $(await renderTemplate(template, hudData)); const list = hud.find('div.rdd-hud-list'); - + RdDTokenHud._toggleHudListActive(hud, list); - + hud.find('img.rdd-hud-togglebutton').click(event => RdDTokenHud._toggleHudListActive(hud, list)); list.find('.rdd-hud-menu').click(onMenuItem); diff --git a/styles/simple.css b/styles/simple.css index c4adf335..5d2a90dc 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -1390,27 +1390,27 @@ table.table-nombres-astraux tr:hover { } /* ======================================== */ -.tokenhudext { +.token-hud-ext { display: flex; flex: 0 !important; font-family: CaslonPro; font-weight: 600; } -.tokenhudext.left { +.token-hud-ext.left { justify-content: flex-start; flex-direction: column; position: absolute; top: 2.75rem; right: 4rem; } -.tokenhudext.right { +.token-hud-ext.right { justify-content: flex-start; flex-direction: column; position: absolute; top: 2.75rem; left: 4rem; } -.control-icon.tokenhudicon { +.control-icon.token-hud-icon { width: fit-content; height: fit-content; min-width: 6rem; @@ -1419,7 +1419,7 @@ table.table-nombres-astraux tr:hover { line-height: 1rem; margin: 0.2rem; } -.control-icon.tokenhudicon.right { +.control-icon.token-hud-icon.right { margin-left: 8px; } .rdd-hud-menu label { diff --git a/templates/hud-actor-attaque.html b/templates/hud-actor-attaque.html index 54689bba..4b9ac185 100644 --- a/templates/hud-actor-attaque.html +++ b/templates/hud-actor-attaque.html @@ -1,9 +1,9 @@
    -
    +
    {{#each actions as |action key|}} {{#unless action.system.initOnly}} -
    diff --git a/templates/hud-actor-init.html b/templates/hud-actor-init.html index 575beae3..421a60cc 100644 --- a/templates/hud-actor-init.html +++ b/templates/hud-actor-init.html @@ -1,8 +1,8 @@
    -
    +
    {{#each actions as |action key|}} -
    @@ -10,7 +10,7 @@
    {{/each}} {{#each commandes as |commande key|}} -
    Date: Fri, 10 Mar 2023 22:41:11 +0100 Subject: [PATCH 10/16] =?UTF-8?q?Gestion=20des=20soins=20avanc=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - raccourci soins HUD - edition rapide des Item blessure - gestion des taches de soins liées aux blessures --- module/actor-sheet.js | 30 +++++++- module/actor.js | 106 ++++++++++++++++++++++++++--- module/actor/base-actor.js | 1 - module/item-tache.js | 18 ----- module/item.js | 3 +- module/item/blessure.js | 75 ++++++++++++++++++++ module/item/sheet-blessure.js | 13 ++++ module/rdd-token-hud.js | 25 +++++++ module/rdd-utility.js | 3 +- styles/simple.css | 9 +++ templates/actor/blessure.hbs | 35 ++++++---- templates/actor/blessures.html | 10 ++- templates/hud-actor-soins.hbs | 12 ++++ templates/item-blessure-sheet.html | 29 +++++--- 14 files changed, 311 insertions(+), 58 deletions(-) delete mode 100644 module/item-tache.js create mode 100644 templates/hud-actor-soins.hbs diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 7103aeff..e0101c55 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -13,6 +13,7 @@ import { STATUSES } from "./settings/status-effects.js"; import { MAINS_DIRECTRICES } from "./actor.js"; import { RdDBaseActorSheet } from "./actor/base-actor-sheet.js"; import { RdDItem } from "./item.js"; +import { RdDItemBlessure } from "./item/blessure.js"; /* -------------------------------------------- */ /** @@ -152,13 +153,13 @@ export class RdDActorSheet extends RdDBaseActorSheet { this.createEmptyTache(); }); this.html.find('.creer-tache-blessure-legere').click(async event => { - this.actor.createTacheBlessure('legere'); + RdDItemBlessure.createTacheSoinBlessure(this.actor, 'legere'); }); this.html.find('.creer-tache-blessure-grave').click(async event => { - this.actor.createTacheBlessure('grave'); + RdDItemBlessure.createTacheSoinBlessure(this.actor, 'grave'); }); this.html.find('.creer-tache-blessure-critique').click(async event => { - this.actor.createTacheBlessure('critique'); + RdDItemBlessure.createTacheSoinBlessure(this.actor, 'critique'); }); this.html.find('.creer-une-oeuvre').click(async event => { this.selectTypeOeuvreToCreate(); @@ -189,6 +190,23 @@ export class RdDActorSheet extends RdDBaseActorSheet { await this.actor.setDataBlessureFromSheet(btype, index, psoins, pcomplets, jours, loc, psdone, scdone); }); + this.html.find('.blessure-premierssoins-done').change(async event => { + const blessure = this.getBlessure(event); + await blessure?.setSoinsBlessure({ premierssoins: { done: event.currentTarget.checked } }); + }); + this.html.find('.blessure-soinscomplets-done').change(async event => { + const blessure = this.getBlessure(event); + await blessure?.setSoinsBlessure({ soinscomplets: { done: event.currentTarget.checked } }) + }); + this.html.find('.blessure-premierssoins-bonus').change(async event => { + const blessure = this.getBlessure(event); + await blessure?.setSoinsBlessure({ premierssoins: { bonus: Number(event.currentTarget.value) } }) + }); + this.html.find('.blessure-soinscomplets-bonus').change(async event => { + const blessure = this.getBlessure(event); + await blessure?.setSoinsBlessure({ soinscomplets: { bonus: Number(event.currentTarget.value) } }) + }); + // Equip Inventory Item this.html.find('.item-equip').click(async event => { this.actor.equiperObjet(RdDSheetUtility.getItemId(event)); @@ -426,6 +444,12 @@ export class RdDActorSheet extends RdDBaseActorSheet { }); } + getBlessure(event) { + const itemId = this.html.find(event.currentTarget).parents(".item-blessure").data('item-id'); + const blessure = this.actor.getItem(itemId, 'blessure'); + return blessure; + } + isCompetenceAffichable(competence) { return !this.options.showCompNiveauBase || !RdDItemCompetence.isNiveauBase(competence); } diff --git a/module/actor.js b/module/actor.js index 4295e8b5..00993a89 100644 --- a/module/actor.js +++ b/module/actor.js @@ -34,8 +34,8 @@ import { Targets } from "./targets.js"; import { DialogRepos } from "./sommeil/dialog-repos.js"; import { RdDBaseActor } from "./actor/base-actor.js"; import { RdDTimestamp } from "./rdd-timestamp.js"; -import { RdDItemTache } from "./item-tache.js"; -import { APP_ASTROLOGIE_REFRESH, AppAstrologie } from "./sommeil/app-astrologie.js"; +import { RdDItemBlessure } from "./item/blessure.js"; +import { AppAstrologie } from "./sommeil/app-astrologie.js"; const POSSESSION_SANS_DRACONIC = { img: 'systems/foundryvtt-reve-de-dragon/icons/entites/possession.webp', @@ -2374,13 +2374,16 @@ export class RdDActor extends RdDBaseActor { label: 'Jet ' + Grammar.apostrophe('de', rollData.competence.name), template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html', rollData: rollData, - callbackAction: r => this.$onRollCompetence(r) + callbackAction: r => this.$onRollCompetence(r, options) }); } /* -------------------------------------------- */ - async $onRollCompetence(rollData) { + async $onRollCompetence(rollData, options) { await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-competence.html') + if (options?.onRollAutomate) { + options.onRollAutomate(rollData); + } } /* -------------------------------------------- */ @@ -2408,11 +2411,21 @@ export class RdDActor extends RdDBaseActor { return tachesExistantes.length > 0 ? tachesExistantes[0] : undefined; } - async createTacheBlessure(gravite) { - const tache = RdDItemTache.prepareTacheSoin(gravite) - if (tache) { - await this.createEmbeddedDocuments('Item', [tache], { renderSheet: false }); + blessuresASoigner() { + // TODO or not TODO: filtrer les blessures poour lesquels on ne peut plus faire de premiers soins? + return this.filterItems(it => it.system.gravite > 0 && !(it.system.premierssoins.done && it.system.soinscomplets.done), 'blessure') + } + + async getTacheBlessure(blesse, blessure) { + const gravite = blessure?.system.gravite ?? 0; + if (gravite > 0) { + const tache = this.listItems('tache').find(it => it.system.itemId == blessure.id) + ?? await RdDItemBlessure.createTacheSoinBlessure(this, gravite); + await blessure?.updateTacheSoinBlessure(tache); + return tache } + return undefined; + } async rollCaracCompetence(caracName, compName, diff, options = { title: "" }) { const competence = this.getCompetence(compName); @@ -2429,7 +2442,7 @@ export class RdDActor extends RdDBaseActor { competence: competence, show: { title: options?.title ?? '' } }, - callbackAction: r => this.$onRollCompetence(r) + callbackAction: r => this.$onRollCompetence(r, options) }); } @@ -2477,6 +2490,9 @@ export class RdDActor extends RdDBaseActor { this.santeIncDec("fatigue", rollData.tache.system.fatigue); await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-tache.html'); + if (options?.onRollAutomate) { + options.onRollAutomate(rollData); + } } /* -------------------------------------------- */ @@ -2773,7 +2789,7 @@ export class RdDActor extends RdDBaseActor { } /* -------------------------------------------- */ - async rollAppelChance(onSuccess = () => {}, onEchec = () => {}) { + async rollAppelChance(onSuccess = () => { }, onEchec = () => { }) { await this._openRollDialog({ name: 'appelChance', label: 'Appel à la chance', @@ -3094,7 +3110,77 @@ export class RdDActor extends RdDBaseActor { } RdDCombat.rddCombatTarget(target, this).attaque(competence, arme); }) + } + async rollSoins(blesse, blessureId) { + const blessure = blesse.blessuresASoigner().find(it => it.id == blessureId); + if (blessure) { + if (!blessure.system.premierssoins.done) { + const tache = await this.getTacheBlessure(blesse, blessure); + return await this.rollTache(tache.id, { + onRollAutomate: async r => blesse.onRollTachePremiersSoins(blessureId, r) + }); + } + if (!blessure.system.soinscomplets.done) { + const diff = blessure.system.difficulte + (blessure.system.premierssoins.bonus ?? 0); + return await this.rollCaracCompetence("dexterite", "Chirurgie", diff, { + title: "Soins complets", + onRollAutomate: r => blesse.onRollSoinsComplets(blessureId, r) + }) + } + } + } + + async onRollTachePremiersSoins(blessureId, rollData) { + if (!this.isOwner) { + return RdDBaseActor.remoteActorCall({ actorId: this.id, method: 'onRollTachePremiersSoins', args: [blessureId, rollData] }); + } + const blessure = this.getItem(blessureId, 'blessure') + console.log('TODO update blessure', this, blessureId, rollData, rollData.tache); + if (blessure && !blessure.system.premierssoins.done) { + const tache = rollData.tache; + if (rollData.rolled.isETotal) { + await blessure.update({ + 'system.difficulte': blessure.system.difficulte - 1, + 'system.premierssoins.tache': Math.max(0, tache.system.points_de_tache_courant) + }) + } + else { + const bonus = tache.system.points_de_tache_courant - tache.system.points_de_tache + await blessure.update({ + 'system.premierssoins': { + done: (bonus >= 0), + bonus: Math.max(0, bonus), + tache: Math.max(0, tache.system.points_de_tache_courant) + } + }) + if (bonus>=0) { + await tache.delete() + } + } + } + } + + async onRollSoinsComplets(blessureId, rollData) { + if (!this.isOwner) { + return RdDBaseActor.remoteActorCall({ actorId: this.id, method: 'onRollSoinsComplets', args: [blessureId, rollData] }); + } + const blessure = this.getItem(blessureId, 'blessure') + if (blessure && blessure.system.premierssoins.done && !blessure.system.soinscomplets.done) { + // TODO: update de la blessure: passer par le MJ! + if (rollData.rolled.isETotal) { + await blessure.setSoinsBlessure({ + difficulte: blessure.system.difficulte - 1, + premierssoins: { done: false, bonus: 0 }, soinscomplets: { done: false, bonus: 0 }, + }) + } + else { + // soins complets finis + await blessure.setSoinsBlessure({ + soinscomplets: { done: true, bonus: Math.max(0, rollData.rolled.ptTache) }, + }) + } + } } /* -------------------------------------------- */ diff --git a/module/actor/base-actor.js b/module/actor/base-actor.js index 6c838523..769bc76e 100644 --- a/module/actor/base-actor.js +++ b/module/actor/base-actor.js @@ -21,7 +21,6 @@ export class RdDBaseActor extends Actor { Hooks.on("updateActor", (actor, change, options, actorId) => actor.onUpdateActor(change, options, actorId)); } - static onSocketMessage(sockmsg) { switch (sockmsg.msg) { case "msg_remote_actor_call": diff --git a/module/item-tache.js b/module/item-tache.js deleted file mode 100644 index f17bb9af..00000000 --- a/module/item-tache.js +++ /dev/null @@ -1,18 +0,0 @@ -const BASE_TACHE_SOIN_BLESSURE = { type: "tache", img: 'systems/foundryvtt-reve-de-dragon/icons/competence_chirurgie.webp', system: { carac: "dexterite", competence: "Chirurgie", periodicite: "1 round", fatigue: 0, } } -const TACHES_SOIN_BLESSURE = { - 'critique': { name: 'Blessure critique', system: { difficulte: -6, points_de_tache: 6 } }, - 'grave': { name: 'Blessure grave', system: { difficulte: -4, points_de_tache: 4 } }, - 'legere': { name: 'Blessure légère', system: { difficulte: -2, points_de_tache: 2 } }, -} - -export class RdDItemTache extends Item { - - static prepareTacheSoin(gravite) { - const blessure = TACHES_SOIN_BLESSURE[gravite] - if (blessure) { - return mergeObject(duplicate(BASE_TACHE_SOIN_BLESSURE), blessure) - } - ui.notifications.warn(`Pas de tâche de soins pour une blessure ${gravite}`) - return undefined; - } -} \ No newline at end of file diff --git a/module/item.js b/module/item.js index 9195b29f..bc1248a5 100644 --- a/module/item.js +++ b/module/item.js @@ -31,7 +31,7 @@ const typesInventaire = { const typesObjetsOeuvres = ["oeuvre", "recettecuisine", "musique", "chant", "danse", "jeu"] const typesObjetsDraconiques = ["queue", "ombre", "souffle", "tete", "signedraconique", "sortreserve", "rencontre"] const typesObjetsConnaissance = ["meditation", "recettealchimique", "sort"] -const typesObjetsEffet = ["possession", "poison", "maladie"] +const typesObjetsEffet = ["possession", "poison", "maladie", "blessure"] const typesObjetsCompetence = ["competence", "competencecreature"] const typesObjetsTemporels = ["blessure", "poison", "maladie", "queue", "ombre", "souffle", "signedraconique", "rencontre"] const typesEnvironnement = typesInventaireMateriel; @@ -176,6 +176,7 @@ export class RdDItem extends Item { isBoisson() { return this.isNourritureBoisson() && this.system.boisson; } isAlcool() { return this.isNourritureBoisson() && this.system.boisson && this.system.alcoolise; } isHerbeAPotion() { return this.type == 'herbe' && (this.system.categorie == 'Soin' || this.system.categorie == 'Repos'); } + isBlessure() { return this.type == 'blessure' } isPresentDansMilieux(milieux) { return this.getEnvironnements(milieux).length > 0 diff --git a/module/item/blessure.js b/module/item/blessure.js index 7b445bc0..0c71df22 100644 --- a/module/item/blessure.js +++ b/module/item/blessure.js @@ -1,11 +1,56 @@ import { RdDItem } from "../item.js"; +const BASE_TACHE_SOIN_BLESSURE = { + type: "tache", + img: 'systems/foundryvtt-reve-de-dragon/icons/competence_chirurgie.webp', + system: { carac: "dexterite", competence: "Chirurgie", periodicite: "1 round", fatigue: 0, } +} +const TACHES_SOIN_BLESSURE = { + 'critique': { name: 'Blessure critique', system: { difficulte: -6, points_de_tache: 6 } }, + 'grave': { name: 'Blessure grave', system: { difficulte: -4, points_de_tache: 4 } }, + 'legere': { name: 'Blessure légère', system: { difficulte: -2, points_de_tache: 2 } }, + 6: { name: 'Blessure critique', system: { difficulte: -6, points_de_tache: 6 } }, + 4: { name: 'Blessure grave', system: { difficulte: -4, points_de_tache: 4 } }, + 2: { name: 'Blessure légère', system: { difficulte: -2, points_de_tache: 2 } }, +} + export class RdDItemBlessure extends RdDItem { static get defaultIcon() { return "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp"; } + static prepareTacheSoin(gravite) { + const tache = TACHES_SOIN_BLESSURE[gravite] + if (!tache) { + ui.notifications.warn(`Pas de tâche de soins pour une blessure ${gravite}`) + return undefined; + } + return mergeObject(duplicate(BASE_TACHE_SOIN_BLESSURE), tache) + } + + + static async createTacheSoinBlessure(actor, gravite) { + const tache = RdDItemBlessure.prepareTacheSoin(gravite) + if (tache) { + const taches = await actor.createEmbeddedDocuments('Item', [tache], { renderSheet: false }); + return taches[0]; + } + return undefined + } + + async updateTacheSoinBlessure(tache) { + if (tache) { + await tache.update({ + system: { + itemId: this.id, + difficulte: Math.min(this.system.difficulte, tache.system.difficulte), + points_de_tache_courant: Math.max(0, this.system.premierssoins.tache) + } + }); + } + } + async calculerFinPeriodeTemporel(debut) { return await debut.nouveauJour().addJours(this.system.gravite); } @@ -16,4 +61,34 @@ export class RdDItemBlessure extends RdDItem { } } + prepareDerivedData() { + super.prepareDerivedData(); + this.system.labelGravite = this.getLabelGravite() + } + + async setSoinsBlessure(systemUpdate = {}) { + systemUpdate = mergeObject(systemUpdate, this.system, { overwrite: false }), + systemUpdate.soinscomplets.done = systemUpdate.premierssoins.done && systemUpdate.soinscomplets.done + await this.update({ + img: this.getImgSoins(systemUpdate.soinscomplets.done), + system: systemUpdate + }); + } + + getImgSoins(soins) { + return `systems/foundryvtt-reve-de-dragon/icons/sante/${soins ? 'blessure-soins' : 'blessure'}.webp` + } + + getLabelGravite() { + if (this.system.gravite >= 6) { + return 'Critique' + } + if (this.system.gravite >= 4) { + return 'Grave' + } + if (this.system.gravite >= 2) { + return 'Légère' + } + return 'Contusion/éraflure' + } } \ No newline at end of file diff --git a/module/item/sheet-blessure.js b/module/item/sheet-blessure.js index 3d5e7ebf..cbab7ad8 100644 --- a/module/item/sheet-blessure.js +++ b/module/item/sheet-blessure.js @@ -12,5 +12,18 @@ export class RdDBlessureItemSheet extends RdDItemSheet { activateListeners(html) { super.activateListeners(html); + + if (!this.options.editable) return; + + this.html.find('[name="premierssoins-done"]').change(async event => { + await this.item.setSoinsBlessure({ premierssoins: { done: event.currentTarget.checked } }); + }); + this.html.find('[name="soinscomplets-done"]').change(async event => { + await this.item.setSoinsBlessure({ soinscomplets: { done: event.currentTarget.checked } }) + }); + this.html.find('[name="system-gravite"]').change(async event => { + const gravite = Number(event.currentTarget.value) + await this.item.setSoinsBlessure({ gravite: gravite, difficulte: - gravite }) + }); } } diff --git a/module/rdd-token-hud.js b/module/rdd-token-hud.js index 8ef426ef..d96bb139 100644 --- a/module/rdd-token-hud.js +++ b/module/rdd-token-hud.js @@ -2,6 +2,7 @@ import { HtmlUtility } from "./html-utility.js"; import { Misc } from "./misc.js"; import { RdDCombatManager } from "./rdd-combat.js"; +import { Targets } from "./targets.js"; /* -------------------------------------------- */ export class RdDTokenHud { @@ -23,6 +24,9 @@ export class RdDTokenHud { let token = canvas.tokens.get(tokenId); let actor = token.actor; app.hasExtension = true; + // soins + await RdDTokenHud.addExtensionHudSoins(html, actor); + if (isCombat) { let combatant = game.combat.combatants.find(c => c.tokenId == tokenId); if (!(combatant?.actor)) { @@ -81,6 +85,27 @@ export class RdDTokenHud { }); } + static async addExtensionHudSoins(html, sourceActor) { + const target = Targets.getTarget({ warn: false }); + if (target?.actor) { + const hudSoins = { + targetActor: target.actor, + blessures: target.actor.blessuresASoigner() ?? [] + }; + if (hudSoins.blessures.length > 0) { + // soins + const controlIconTarget = html.find('.control-icon[data-action=combat]'); + await RdDTokenHud._configureSubMenu(controlIconTarget, + 'systems/foundryvtt-reve-de-dragon/templates/hud-actor-soins.hbs', + hudSoins, + (event) => { + const blessureId = event.currentTarget.attributes['data-blessure-id']?.value; + sourceActor.rollSoins(target.actor, blessureId) + }); + } + } + } + static _initiativeCommand(initCommand, combatantId) { switch (initCommand) { case 'inc': return RdDCombatManager.incDecInit(combatantId, 0.01); diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 68f0f232..235d46ad 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -277,7 +277,8 @@ export class RdDUtility { Handlebars.registerHelper('computeResolutionChances', (row, col) => RdDResolutionTable.computeChances(row, col)); Handlebars.registerHelper('upperFirst', str => Misc.upperFirst(str ?? 'Null')); Handlebars.registerHelper('lowerFirst', str => Misc.lowerFirst(str ?? 'Null')); - Handlebars.registerHelper('upper', str => str?.toUpperCase() ?? 'NULL'); + Handlebars.registerHelper('upper', str => str?.toUpperCase() ?? ''); + Handlebars.registerHelper('lowercase', str => str?.toLowerCase() ?? ''); Handlebars.registerHelper('le', str => Grammar.articleDetermine(str)); Handlebars.registerHelper('apostrophe', (article, str) => Grammar.apostrophe(article, str)); Handlebars.registerHelper('un', str => Grammar.articleIndetermine(str)); diff --git a/styles/simple.css b/styles/simple.css index 5d2a90dc..df341346 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -1403,6 +1403,15 @@ table.table-nombres-astraux tr:hover { top: 2.75rem; right: 4rem; } +.token-hud-ext.soins { + justify-content: flex-start; + flex-direction: column; + position: absolute; + top: 13.2rem; + left: -5rem; + max-width: 8.5rem +} + .token-hud-ext.right { justify-content: flex-start; flex-direction: column; diff --git a/templates/actor/blessure.hbs b/templates/actor/blessure.hbs index a2b9666c..7fed6645 100644 --- a/templates/actor/blessure.hbs +++ b/templates/actor/blessure.hbs @@ -1,22 +1,31 @@ -
  • - - - {{name}} +
  • + + + + {{system.labelGravite}} ({{system.localisation}}) - - - + + + {{#if system.premierssoins.done}} + + {{else}} + + + {{/if}} - - - + + {{#if system.premierssoins.done}} + + {{#if system.soinscomplets.done}} + + {{/if}} + {{else}} + + {{/if}} - - -
  • diff --git a/templates/actor/blessures.html b/templates/actor/blessures.html index 88f185f0..e8a31a54 100644 --- a/templates/actor/blessures.html +++ b/templates/actor/blessures.html @@ -5,8 +5,6 @@ Soins complets Age (jours) Localisation - Actions - {{#each system.blessures.legeres.liste as |blessure key|}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/blessure.html" blessure=blessure key=key gravite="legere" title="Légère"}} @@ -17,6 +15,14 @@ {{#each system.blessures.critiques.liste as |blessure key|}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/blessure.html" blessure=blessure key=key gravite="critique" title="Critique"}} {{/each}} + +
      +
    • + Blessures + Premiers soins + Soins complets + Actions +
    • {{#each blessures as |blessure|}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/blessure.hbs" blessure}} {{/each}} diff --git a/templates/hud-actor-soins.hbs b/templates/hud-actor-soins.hbs new file mode 100644 index 00000000..73a474a8 --- /dev/null +++ b/templates/hud-actor-soins.hbs @@ -0,0 +1,12 @@ +
      + +
      + {{#each blessures as |blessure|}} +
      + +
      + {{/each}} +
      +
      diff --git a/templates/item-blessure-sheet.html b/templates/item-blessure-sheet.html index ea8263bf..a476506e 100644 --- a/templates/item-blessure-sheet.html +++ b/templates/item-blessure-sheet.html @@ -2,8 +2,8 @@ {{>"systems/foundryvtt-reve-de-dragon/templates/header-item.html"}}
      - - {{#select system.gravite}} @@ -13,28 +13,39 @@
      +
      + + +
      +
      -
      - + + {{#if system.premierssoins.done}}
      -
      + {{/if}} {{#if options.isOwned}} {{>"systems/foundryvtt-reve-de-dragon/templates/item/temporel.hbs" this labeldebut="Obtenue" labelfin="Prochain jet"}} From a3694c1673e8f584170c0c14d6e3a21f7f67e496 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Mon, 13 Mar 2023 22:25:52 +0100 Subject: [PATCH 11/16] Cleanup --- module/actor.js | 7 ++++--- module/rdd-main.js | 10 +++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/module/actor.js b/module/actor.js index 00993a89..6dc88e88 100644 --- a/module/actor.js +++ b/module/actor.js @@ -2388,9 +2388,10 @@ export class RdDActor extends RdDBaseActor { /* -------------------------------------------- */ async creerTacheDepuisLivre(item, options = { renderSheet: true }) { + // TODO: déplacer vers Item pour livres const nomTache = "Lire " + item.name; - const filterTacheLecture = it => it.type == 'tache' && it.name == nomTache; - let tachesExistantes = this.filterItems(filterTacheLecture); + const filterTacheLecture = it => it.name == nomTache; + let tachesExistantes = this.filterItems(filterTacheLecture, 'tache'); if (tachesExistantes.length == 0) { const tache = { name: nomTache, type: 'tache', @@ -2406,7 +2407,7 @@ export class RdDActor extends RdDBaseActor { } } await this.createEmbeddedDocuments('Item', [tache], options); - tachesExistantes = this.filterItems(filterTacheLecture); + tachesExistantes = this.filterItems(filterTacheLecture, 'tache'); } return tachesExistantes.length > 0 ? tachesExistantes[0] : undefined; } diff --git a/module/rdd-main.js b/module/rdd-main.js index 849a7a48..73cf5d55 100644 --- a/module/rdd-main.js +++ b/module/rdd-main.js @@ -77,21 +77,21 @@ export class SystemReveDeDragon { this.RdDHotbar = RdDHotbar; this.itemClasses = { blessure: RdDItemBlessure, - service: RdDItemService, maladie: RdDItemMaladie, + ombre: RdDItemOmbre, poison: RdDItemPoison, queue: RdDItemQueue, - ombre: RdDItemOmbre, - souffle: RdDItemSouffle, + rencontre: RdDRencontre, + service: RdDItemService, signedraconique: RdDItemSigneDraconique, - rencontre: RdDRencontre + souffle: RdDItemSouffle, } this.actorClasses = { + commerce: RdDCommerce, creature: RdDActor, entite: RdDActor, personnage: RdDActor, vehicule: RdDActor, - commerce: RdDCommerce, } } From d0475e867754e3688d36892ee127c96ea25d4a95 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Mon, 13 Mar 2023 02:44:31 +0100 Subject: [PATCH 12/16] Suppression anciennes blessures --- template.json | 32 -------------------------------- templates/actor/blessures.html | 19 +------------------ 2 files changed, 1 insertion(+), 50 deletions(-) diff --git a/template.json b/template.json index a861e523..4d1cfd28 100644 --- a/template.json +++ b/template.json @@ -181,22 +181,6 @@ "derivee": false } }, - "blessures": { - "legeres": { - "liste": [ { "active": false, "psdone": false, "premiers_soins": -1, "scdone": false, "soins_complets": -1, "jours": 0, "localisation": "" }, - { "active": false, "psdone": false, "premiers_soins": -1, "scdone": false, "soins_complets": -1, "jours": 0, "localisation": "" }, - { "active": false, "psdone": false, "premiers_soins": -1, "scdone": false, "soins_complets": -1, "jours": 0, "localisation": "" }, - { "active": false, "psdone": false, "premiers_soins": -1, "scdone": false, "soins_complets": -1, "jours": 0, "localisation": "" }, - { "active": false, "psdone": false, "premiers_soins": -1, "scdone": false, "soins_complets": -1, "jours": 0, "localisation": "" } ] - }, - "graves": { - "liste": [ { "active": false, "psdone": false, "premiers_soins": -1, "scdone": false, "soins_complets": -1, "jours": 0, "localisation": "" }, - { "active": false, "psdone": false, "premiers_soins": -1, "scdone": false, "soins_complets": -1, "jours": 0, "localisation": "" } ] - }, - "critiques": { - "liste": [ { "active": false, "psdone": false, "premiers_soins": -1, "scdone": false, "soins_complets": -1, "jours": 0, "localisation": "" } ] - } - }, "attributs": { "plusdom": { "type": "number", @@ -382,22 +366,6 @@ "derivee": true } }, - "blessures": { - "legeres": { - "liste": [ { "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" }, - { "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" }, - { "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" }, - { "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" }, - { "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" } ] - }, - "graves": { - "liste": [ { "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" }, - { "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" } ] - }, - "critiques": { - "liste": [ { "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" } ] - } - }, "attributs": { "sconst": { "type": "number", diff --git a/templates/actor/blessures.html b/templates/actor/blessures.html index e8a31a54..f5ce7fa2 100644 --- a/templates/actor/blessures.html +++ b/templates/actor/blessures.html @@ -1,21 +1,3 @@ -
        -
      • - Blessures - Premiers soins - Soins complets - Age (jours) - Localisation -
      • - {{#each system.blessures.legeres.liste as |blessure key|}} - {{> "systems/foundryvtt-reve-de-dragon/templates/actor/blessure.html" blessure=blessure key=key gravite="legere" title="Légère"}} - {{/each}} - {{#each system.blessures.graves.liste as |blessure key|}} - {{> "systems/foundryvtt-reve-de-dragon/templates/actor/blessure.html" blessure=blessure key=key gravite="grave" title="Grave"}} - {{/each}} - {{#each system.blessures.critiques.liste as |blessure key|}} - {{> "systems/foundryvtt-reve-de-dragon/templates/actor/blessure.html" blessure=blessure key=key gravite="critique" title="Critique"}} - {{/each}} -
      • Blessures @@ -27,3 +9,4 @@ {{> "systems/foundryvtt-reve-de-dragon/templates/actor/blessure.hbs" blessure}} {{/each}}
      + From 3e189cbe5f03690cafc38bf03b247c8cfad23db4 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Tue, 14 Mar 2023 02:38:21 +0100 Subject: [PATCH 13/16] Ajout des blessures sur encaissement --- icons/sante/blessure-mort.webp | Bin 0 -> 5190 bytes icons/sante/eraflure.webp | Bin 0 -> 4936 bytes icons/sante/mort.webp | Bin 0 -> 7766 bytes module/actor-sheet.js | 31 +- module/actor.js | 370 +++++++--------------- module/item/blessure.js | 143 +++++++-- module/rdd-bonus.js | 11 +- module/rdd-combat.js | 9 +- module/rdd-roll-encaisser.js | 5 +- module/rdd-token-hud.js | 5 +- module/rdd-utility.js | 55 ++-- styles/simple.css | 4 +- template.json | 6 +- templates/actor/blessure.hbs | 11 +- templates/actor/blessure.html | 27 -- templates/actor/blessures.html | 1 + templates/actor/header-effects.html | 4 +- templates/actor/header-etat.html | 6 +- templates/chat-resultat-encaissement.html | 18 +- templates/item-blessure-sheet.html | 15 +- 20 files changed, 304 insertions(+), 417 deletions(-) create mode 100644 icons/sante/blessure-mort.webp create mode 100644 icons/sante/eraflure.webp create mode 100644 icons/sante/mort.webp delete mode 100644 templates/actor/blessure.html diff --git a/icons/sante/blessure-mort.webp b/icons/sante/blessure-mort.webp new file mode 100644 index 0000000000000000000000000000000000000000..21294caf2e1bb163e4330e1e5549dc86a834a29f GIT binary patch literal 5190 zcmZ{obzD@>`p0Jp>0VNhmJlhIX6bGb36YjkSQeHJK|xwVkd{=7Hm4}c5E06pLW(l&M|r0xSXqrcw&JN=#p zkiVA6yMM>}-#-7ZO7g@WWd{I+5bGglhxG8ovIdrQd_0kVIT_1PJ13hbST4r0fCu&l zu{`xxxBWM7{$xlMw*SR;P9CmUpT9xja&_^--owAr-xPzK^a1V~{^ac~!i0zqsG{6GEwj?E18fE%{29kxUQ zKi~nJfg^ANoF<^cfaD2QPxz0-1p7yzF;|D)Na0#F|T0K+WO z#>3`c*TKb>I1UZ~92NmUW(EMw7y!iP|Be~f_SX&yW&kh>z%JD=0O=V3+{XG-JXX{( z&{&6HSBOFwLq(^P3TJx?^*Dwo zSF!D-^uC*PRM*f#^>xcNMO3g6934Dfy&TSqUWw$0*;q~Q&JdLxEr0JRmr2s4!$fRL zG)UR41ItRRR^g-3rW(4R;GWK$#;8vuazAzOMuik%31sZTX46M7SQ$S(s~ikYwX&!rpi=vR~u$dR`y?q=P_c~<=D z2niAF@N&9aaNc(9GHn%skt2K%e{rOZhk~|?JEe?4GuUBdjw_}eVo18U113q5Ufd(+@Z{%txiUeOLRbH zpNYsG(eibyoO|wqRc996E_WhxeOa_uX6c=yVcwTB0auVWfV;Ht1qC1fED?ede=z)m z%fp(twh=i{{(8_vZ|4J%lzn>3CMC?kBet|}VdYn9m!+D$h_ck>%OR@d7dPKc|B0nU zSHyRi?+oEvo#}QIa35@-``UeeU4fX)rMkEcZBAi%~ zdy>C~Y#6xB<}zGM=(hUF#o`E&`cu(yZ=XsEti&F_4{perQOUT1_Wg8ln>$-k&%X{GAxR6oJ^M&<8i`)}N|>&nJM3?+Ja^4Qq4g5`IWd zw4Uu0rQhzQt&cBd3y=Ku2v4nu zk_?xKR7=y;yFvD%b2h2hDE&lMQ<_lb9TUotz^Ta9iTuvpHg=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1x literal 0 HcmV?d00001 diff --git a/icons/sante/eraflure.webp b/icons/sante/eraflure.webp new file mode 100644 index 0000000000000000000000000000000000000000..fc3b4a10258478daa9fd868853a854381039ae7c GIT binary patch literal 4936 zcmZ{kXIN9q7KS&WcQEu`6{NS&i-Z=MbP$ymN`L^NOEXc3NKsG_=|!pp=?ExDF9Onp zgGd*oDIi5aT5dS!$GJc5oxNwxJKtJs_RN~+*%mN8JuNT**y?JV*_bKWQ2_uTP3U-{ z%NGWPnpuGeQvhUzg!=@N5L`aKK>-%}+I)7m?D@#o0Ahd^UN5I& zx5K{xqD#+biOaSAcg+7)sa@Ry;Q&BHL5R?RqXL2mY(QY+&>++$rxKV6j&OD*a2bKc z0|*-=@WiF=@(-_Hvd2GscF6%&7Er?37zoVg@n7unUkpbC_z+?)iz4KM3?}U1?{;|- z8aH2SOTs8X=v+V`U;*d@+5jH_19Sl>00CqGWrBqO5`ZiqNtgluC;xJ7F2EG0e~mq0U&@NK%Afk6IOR4jP3;8jqo6Wu*>=r@(AtUx(2$-$^I=7(P#qz={z34 zFAM3&G*X(0HxmqJ^5cvC=USWV*uc7*T0&}O8{t$ z1pu~blyiXd-`^o7SdhCr0PK|l0PQUR0FMFy)$M<3M(|zwfx;;Ou!@>7ZH9-6H^Z#}1vLtCk@pvP(#ABn6iJr+n<{g%;_DXTP6Q52++ zMcr-8LFGa@$k1afpZ%;>M-*(tIAosepTU*Rev?wh{N*57r8329qQyJ)6IXe~CRdib z?d9*PEe9^%s6%a=(MfglC!n4wqVkq}7i)v$%y0X@y%5NxY$#2bvH}%M-;zo*9U+|y zf)B9jfx3dhNzmFZCy#t9Ki}P+!8XNcr|bDykrq9zr!d8nE2Gz%LQ_Ucr+4~xJ(h+j z)-R6RQFGs-^>ZE24LD6l72?vDj<`S#33mw$0S&r#j95s5FtVE@|)5p?E4K zvaf=?%dq<>BFTy%~NGFvX^o@)Cc+uMU9AlI`3{f^0^1x9)860s0>^% z69l|}R7fO9)m99XJ@0nJtY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A6qXiI+ENeJzwn@b=~2l5 z@TzrtiuT7H{@^SS#*E>V3^wOdSb5euQ)oEzAD2Db)LhORJZ*U)qEQZSge2O}*jc%> z{kX9{^S%+YZx)Tj=WG{$n=lpeMpQzV<4_1WNuYZiW0 zSXZZ%o3>vBi(&dcsh@3o^*1dfdvm+Ja{es=Ie7C|Vgof`A#*FwN`f*`}zxUyJ+)saWk}a_SXBz*}t-Zo}MsyFOXcU(t zY=}cOD#Z*|Yr;hc{R#fydqt`GHmti8|Zm)0(y5UzP7VDKCY z=2u3u8&(baia2-rs$s$$6b_lad;z9WH(BL#yxG> zlJ;~N1rhUOa96oZN$6~ukTOQ~Xd9N4$~N``KzFLue=2`^WwWvUM9m`&xa^BwJ9k=x-Og}3qCWv40{CA?en)mZj z)s8y(x@S{c74~*iyT@4l32(WbtY3dZ`VXL;2b8xBxx=Fm#df%h+*>U^X#a+7n-0ne z+D%RLI>k141|v-ml}6S6C51zJTUoFHJL%) zQqfe2x0XSoCntGLM^x3bZ7fmn#X zcSp|baRgbCJ2+DS24P-cjc~lbZnafwkZp96t*UGOnvQWX?PNpx+av{dHYf!U1sk7z zS^oifahFSuu4)<+wYVQU6I*#Mw9%y73nzK_?M0}_hD&ni-D8Ky5qvQ9CqvQxxWEM!gQNIZM2NJ@iJOBUy literal 0 HcmV?d00001 diff --git a/icons/sante/mort.webp b/icons/sante/mort.webp new file mode 100644 index 0000000000000000000000000000000000000000..7bbe06269fc32d5020d92b7b0ab6b9dcc7a3a80f GIT binary patch literal 7766 zcmZ{oby!rvyT=dR-JnRTbfUEHbQn7T3V;Vt08D_Wg{2!rO-DiZpZEWrE`I??|18rS z|Hk^ieg0n+$I9Bx5&)1epFAWiA+GLEtn|dHUha^8obbe?mUb3aPh9fE?5oVRCfvczTEbPXA_tYwe_` z^HeiDN%eRd-TJAvdD5+)E(gHpU;Ll?J*EG|)y;;F_rE11Tp0jBTX}pu zV+H_>cmTMMeSEyjeSEyn0|1mI0O)f1Pk-ke01&=-(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?VIp*>;1h3{GwXe^M zEEHny^pH@^sh^yy>|FYW&Q=FjY;|BwK0Q$)9Iqq8IF@JL(B@ewm2XHHui)=Gp`=%* z%8ddDzk%P16`p_j+&EjjuMZ1ae-EH?0Vc-%!z{nbt@#x4vgI{@d%G zojq4g+rCcn?w**_q~dhA?V8(S>AeNvbB$DK)nY?}z^&QXI7mn$`n~-9I$n?V~|F! zEMw6=BoyzNty05aya~N=6Eoh)x**x)tj$7O^jUg}ZAI)y9tF_~B%-7xT~=9KRm$)2 zP}zA}Br#q^CabreLwL6b{$k=2p;ySOFA;GX>x_tE4rV5Tgn0+}URUFIbg`x%9dCfu zkGN(58CWE)+eEVz;&NWa`3tjkF}jTs7LyFIP*Cm;W2&k=m;jc_uY^H#0b0fNc)akl zq0@;@4{-MFW072pC_t$^9=Xq^v>3rgrx#a&zqz%K+j{oki=X9$#A&Af`FxCpUmn-+ zeSMShauJr>`QB-1HOY8izRV)&Onh_QbDmTGI7=x=wab+5+c3=)793jkIoZSzcPS=q z=JF6KzRmEe8O*d?#M8D#{uF1bau#HP{%ji;WIE~ zGMf8H=r5Hz0v)$Nhr2ZdVB;U6J0}wEm#t*Qt8{mLr)3jA088N6@7>bc^n6YqYH!r6 zea8_x&aSU0QrwjEmGQWtbSp@zD|=zuKaq~d?=4PS@Sz-UG{0v)ldD&?-mN*WQ4CeS zEDlu7-`lvtj;)%p0%y0bIILn}Bh0*Pw(DZMb z{4iQ5b$}7-gnG)!vdhhJ*9|6seNX_C+{TLSO1T%`eH@_Jiy&p4TZ}SaNqTkekhWSo WjCrhd>+U>1Jh>yU>#Rx$0RIIUyFU2< literal 0 HcmV?d00001 diff --git a/module/actor-sheet.js b/module/actor-sheet.js index e0101c55..5e33065a 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -153,43 +153,18 @@ export class RdDActorSheet extends RdDBaseActorSheet { this.createEmptyTache(); }); this.html.find('.creer-tache-blessure-legere').click(async event => { - RdDItemBlessure.createTacheSoinBlessure(this.actor, 'legere'); + RdDItemBlessure.createTacheSoinBlessure(this.actor, 2); }); this.html.find('.creer-tache-blessure-grave').click(async event => { - RdDItemBlessure.createTacheSoinBlessure(this.actor, 'grave'); + RdDItemBlessure.createTacheSoinBlessure(this.actor, 4); }); this.html.find('.creer-tache-blessure-critique').click(async event => { - RdDItemBlessure.createTacheSoinBlessure(this.actor, 'critique'); + RdDItemBlessure.createTacheSoinBlessure(this.actor, 6); }); this.html.find('.creer-une-oeuvre').click(async event => { this.selectTypeOeuvreToCreate(); }); - // Blessure control - this.html.find('.blessure-control').click(async event => { - const tr = this.html.find(event.currentTarget).parents(".item"); - let btype = tr.data("blessure-type"); - let index = tr.data('blessure-index'); - let active = this.html.find(event.currentTarget).data('blessure-active'); - //console.log(btype, index, active); - await this.actor.manageBlessureFromSheet(btype, index, active); - }); - - // Blessure data - this.html.find('.blessure-soins').change(async event => { - const tr = this.html.find(event.currentTarget).parents(".item"); - let btype = tr.data('blessure-type'); - let index = tr.data('blessure-index'); - let psoins = tr.find('.blessure-premiers_soins').val(); - let pcomplets = tr.find('.blessure-soins_complets').val(); - let jours = tr.find('.blessure-jours').val(); - let loc = tr.find('.blessure-localisation').val(); - let psdone = tr.find('.blessure-psdone:checked').val(); - let scdone = tr.find('.blessure-scdone:checked').val(); - console.log(btype, index, psoins, pcomplets, jours, loc, psdone, scdone); - await this.actor.setDataBlessureFromSheet(btype, index, psoins, pcomplets, jours, loc, psdone, scdone); - }); - this.html.find('.blessure-premierssoins-done').change(async event => { const blessure = this.getBlessure(event); await blessure?.setSoinsBlessure({ premierssoins: { done: event.currentTarget.checked } }); diff --git a/module/actor.js b/module/actor.js index 6dc88e88..f51ae2aa 100644 --- a/module/actor.js +++ b/module/actor.js @@ -26,7 +26,7 @@ import { DialogConsommer } from "./dialog-item-consommer.js"; import { DialogFabriquerPotion } from "./dialog-fabriquer-potion.js"; import { RollDataAjustements } from "./rolldata-ajustements.js"; import { RdDPossession } from "./rdd-possession.js"; -import { ENTITE_BLURETTE, ENTITE_INCARNE, ENTITE_NONINCARNE, SHOW_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js"; +import { ENTITE_INCARNE, ENTITE_NONINCARNE, SHOW_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js"; import { RdDConfirm } from "./rdd-confirm.js"; import { DialogValidationEncaissement } from "./dialog-validation-encaissement.js"; import { RdDRencontre } from "./item/rencontre.js"; @@ -46,7 +46,6 @@ const POSSESSION_SANS_DRACONIC = { } }; -const PAS_DE_BLESSURE = { "active": false, "psdone": false, "scdone": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "loc": "" }; export const MAINS_DIRECTRICES = ['Droitier', 'Gaucher', 'Ambidextre'] /* -------------------------------------------- */ @@ -403,7 +402,7 @@ export class RdDActor extends RdDBaseActor { } await this._recupereChance(); await this.transformerStress(); - this.bonusRecuperationPotion = 0; // Reset potion + await this.setBonusPotionSoin(0); } await this.resetInfoSommeil() ChatMessage.create(message); @@ -414,11 +413,8 @@ export class RdDActor extends RdDBaseActor { const maladiesPoisons = this._maladiePoisons(message); const isMaladeEmpoisonne = maladiesPoisons.length > 0; this._messageRecuperationMaladiePoisons(maladiesPoisons, message); - const blessures = duplicate(this.system.blessures); - await this._recupererBlessures(message, "legere", blessures.legeres.liste.filter(b => b.active), [], isMaladeEmpoisonne); - await this._recupererBlessures(message, "grave", blessures.graves.liste.filter(b => b.active), blessures.legeres.liste, isMaladeEmpoisonne); - await this._recupererBlessures(message, "critique", blessures.critiques.liste.filter(b => b.active), blessures.graves.liste, isMaladeEmpoisonne); - await this.update({ "system.blessures": blessures }); + + await this._recuperationBlessures(message, isMaladeEmpoisonne); await this._recupererVie(message, isMaladeEmpoisonne); } @@ -460,7 +456,7 @@ export class RdDActor extends RdDBaseActor { await this._recupereChance(); await this.transformerStress(); await this.retourSeuilDeReve(message); - this.bonusRecuperationPotion = 0; // Reset potion + await this.setBonusPotionSoin(0); await this.retourSust(message); await this.verifierPotionsEnchantees(); if (message.content != "") { @@ -523,65 +519,36 @@ export class RdDActor extends RdDBaseActor { } /* -------------------------------------------- */ - async _recupererBlessures(message, type, liste, moindres, isMaladeEmpoisonne) { - if (!this.bonusRecuperationPotion) this.bonusRecuperationPotion = 0; - let count = 0; - const definitions = RdDUtility.getDefinitionsBlessures(); - let definition = definitions.find(d => d.type == type); - for (let blessure of liste) { - if (blessure.jours >= definition.facteur) { - let rolled = await this._jetRecuperationConstitution(Misc.toInt(blessure.soins_complets) + this.bonusRecuperationPotion, message); - blessure.soins_complets = 0; - if (!isMaladeEmpoisonne && rolled.isSuccess && this._retrograderBlessure(type, blessure, moindres)) { - message.content += ` -- une blessure ${type} cicatrise`; - count++; - } - else if (rolled.isETotal) { - message.content += ` -- une blessure ${type} s'infecte (temps de guérison augmenté de ${definition.facteur} jours, perte de vie)`; - blessure.jours = 0; - await this.santeIncDec("vie", -1); - } - else { - blessure.jours++; - message.content += ` -- une blessure ${type} reste stable`; - } - } - else { - blessure.jours++; - } - } + async _recuperationBlessures(message, isMaladeEmpoisonne) { + const timestamp = game.system.rdd.calendrier.getTimestamp() + const blessures = this.filterItems(it => it.gravite > 0, 'blessure').sort(Misc.ascending(it => it.system.gravite)) + + Promise.all(blessures.map(b => b.recuperationBlessure({ + actor: this, + timestamp, + message, + isMaladeEmpoisonne, + blessures + }))); + await this.supprimerBlessures(filterToDelete); } - /* -------------------------------------------- */ - _retrograderBlessure(type, blessure, blessuresMoindres) { - if (type != "legere") { - let retrograde = blessuresMoindres.find(b => !b.active); - if (!retrograde) { - return false; - } - mergeObject(retrograde, { "active": true, "psdone": blessure.psdone, "scdone": blessure.scdone, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "loc": blessure.loc }); - } - this._supprimerBlessure(blessure); - return true; - } - - /* -------------------------------------------- */ - _supprimerBlessure(blessure) { - mergeObject(blessure, PAS_DE_BLESSURE); + async supprimerBlessures(filterToDelete) { + const toDelete = this.filterItems(filterToDelete, 'blessure') + .map(it => it.id); + await this.deleteEmbeddedDocuments('Item', toDelete); } /* -------------------------------------------- */ async _recupererVie(message, isMaladeEmpoisonne) { const tData = this.system - let blessures = [].concat(tData.blessures.legeres.liste).concat(tData.blessures.graves.liste).concat(tData.blessures.critiques.liste); - let nbBlessures = blessures.filter(b => b.active); + let blessures = this.filterItems(it => it.system.gravite > 0, 'blessure'); + if (blessures.length > 0) { + return + } let vieManquante = tData.sante.vie.max - tData.sante.vie.value; - if (nbBlessures == 0 && vieManquante > 0) { - let bonusSoins = 0; - for (let b of blessures) { - bonusSoins = Math.max(bonusSoins, Misc.toInt(b.soins_complets)); - } - let rolled = await this._jetRecuperationConstitution(bonusSoins, message) + if (vieManquante > 0) { + let rolled = await this.jetRecuperationConstitution(bonusSoins, message) if (!isMaladeEmpoisonne && rolled.isSuccess) { const gain = Math.min(rolled.isPart ? 2 : 1, vieManquante); message.content += " -- récupération de vie: " + gain; @@ -598,7 +565,7 @@ export class RdDActor extends RdDBaseActor { } /* -------------------------------------------- */ - async _jetRecuperationConstitution(bonusSoins, message = undefined) { + async jetRecuperationConstitution(bonusSoins, message = undefined) { let difficulte = Misc.toInt(bonusSoins) + Math.min(0, this.system.sante.vie.value - this.system.sante.vie.max); let rolled = await RdDResolutionTable.roll(this.system.carac.constitution.value, difficulte); if (message) { @@ -623,17 +590,13 @@ export class RdDActor extends RdDBaseActor { const updates = { 'system.sante.endurance.value': this.system.sante.endurance.max }; - if (!this.isEntite([ENTITE_INCARNE, ENTITE_BLURETTE])) { - if (this.system.blessures) { - updates['system.blessures.legeres.liste'] = [PAS_DE_BLESSURE, PAS_DE_BLESSURE, PAS_DE_BLESSURE, PAS_DE_BLESSURE, PAS_DE_BLESSURE]; - updates['system.blessures.graves.liste'] = [PAS_DE_BLESSURE, PAS_DE_BLESSURE]; - updates['system.blessures.critiques.liste'] = [PAS_DE_BLESSURE]; - } + if (this.isPersonnage() || this.isCreature()) { + await this.supprimerBlessures(it => true); updates['system.sante.vie.value'] = this.system.sante.vie.max; updates['system.sante.fatigue.value'] = 0; - if (this.isPersonnage()) { - updates['system.compteurs.ethylisme'] = { value: 1, nb_doses: 0, jet_moral: false }; - } + } + if (this.isPersonnage()) { + updates['system.compteurs.ethylisme'] = { value: 1, nb_doses: 0, jet_moral: false }; } await this.update(updates); await this.removeEffects(e => e.flags.core.statusId !== STATUSES.StatusDemiReve); @@ -1147,35 +1110,31 @@ export class RdDActor extends RdDBaseActor { } /* -------------------------------------------- */ - computeResumeBlessure(blessures = undefined) { - blessures = blessures ?? this.system.blessures; - if (!blessures) { - return "Pas de blessures possibles"; - } - let nbLegeres = this.countBlessures(blessures.legeres.liste); - let nbGraves = this.countBlessures(blessures.graves.liste); - let nbCritiques = this.countBlessures(blessures.critiques.liste); + computeResumeBlessure() { + const blessures = this.filterItems(it => it.system.gravite > 0, 'blessure') - let resume = "Blessures:"; - if (nbCritiques > 0 || nbGraves > 0 || nbLegeres > 0) { - if (nbLegeres > 0) { - resume += " " + nbLegeres + " légère" + (nbLegeres > 1 ? "s" : ""); - } - if (nbGraves > 0) { - if (nbLegeres > 0) - resume += ","; - resume += " " + nbGraves + " grave" + (nbGraves > 1 ? "s" : ""); - } - if (nbCritiques > 0) { - if (nbGraves > 0 || nbLegeres > 0) - resume += ","; - resume += " une CRITIQUE !"; - } - return resume; - } - else { + const nbLegeres = blessures.filter(it => it.isLegere()).length; + const nbGraves = blessures.filter(it => it.isGrave()).length; + const nbCritiques = blessures.filter(it => it.isCritique()).length; + + if (nbLegeres + nbGraves + nbCritiques == 0) { return "Aucune blessure"; } + let resume = "Blessures:"; + if (nbLegeres > 0) { + resume += " " + nbLegeres + " légère" + (nbLegeres > 1 ? "s" : ""); + } + if (nbGraves > 0) { + if (nbLegeres > 0) + resume += ","; + resume += " " + nbGraves + " grave" + (nbGraves > 1 ? "s" : ""); + } + if (nbCritiques > 0) { + if (nbGraves > 0 || nbLegeres > 0) + resume += ","; + resume += " une CRITIQUE !"; + } + return resume; } recompute() { @@ -1384,11 +1343,11 @@ export class RdDActor extends RdDBaseActor { ChatMessage.create({ content: `${this.name} n'est plus ${Misc.lowerFirst(game.i18n.localize(effect.system.label))} !` }); } } - if (this.type == 'personnage') { - // Gestion blessure graves : -1 pt endurance - let nbGraves = this.countBlessuresNonSoigneeByName('graves'); + if (this.isPersonnage() || this.isCreature()) { + const nbGraves = this.filterItems(it => it.isGrave(), 'blessure').length if (nbGraves > 0) { - await this.santeIncDec("endurance", -1); + // Gestion blessure graves : -1 pt endurance par blessure grave + await this.santeIncDec("endurance", - nbGraves); } } } @@ -1419,20 +1378,8 @@ export class RdDActor extends RdDBaseActor { } /* -------------------------------------------- */ - countBlessures(blessuresListe) { - return blessuresListe.filter(b => b.active).length - } - /* -------------------------------------------- */ - countBlessuresByName(name) { - return this.countBlessures(this.system.blessures[name].liste); - } - - countBlessuresNonSoigneeByName(name) { - if (this.system.blessures) { - let blessures = this.system.blessures[name].liste; - return blessures.filter(b => b.active && !b.psdone).length; - } - return 0; + countBlessures(filter = it => !it.isContusion()) { + return this.filterItems(filter, 'blessure').length } /* -------------------------------------------- */ @@ -1583,40 +1530,15 @@ export class RdDActor extends RdDBaseActor { /* -------------------------------------------- */ _computeEnduranceMax() { - let blessures = this.system.blessures; - let diffVie = this.system.sante.vie.max - this.system.sante.vie.value; - let maxEndVie = this.system.sante.endurance.max - (diffVie * 2); - let nbGraves = this.countBlessures(blessures.graves.liste); - let nbCritiques = this.countBlessures(blessures.critiques.liste); - let maxEndGraves = Math.floor(this.system.sante.endurance.max / (2 * nbGraves)); - let maxEndCritiques = nbCritiques > 0 ? 1 : this.system.sante.endurance.max; + const diffVie = this.system.sante.vie.max - this.system.sante.vie.value; + const maxEndVie = this.system.sante.endurance.max - (diffVie * 2); + const nbGraves = this.countBlessures(it => it.isGraves()) > 0 + const nbCritiques = this.countBlessures(it => it.isCritique()) > 0 + const maxEndGraves = Math.floor(this.system.sante.endurance.max / (2 * nbGraves)); + const maxEndCritiques = nbCritiques > 0 ? 1 : this.system.sante.endurance.max; return Math.max(0, Math.min(maxEndVie, maxEndGraves, maxEndCritiques)); } - /* -------------------------------------------- */ - async manageBlessureFromSheet(gravite, index) { - let listBlessures = duplicate(this.system.blessures); - let blessure = listBlessures[gravite + "s"].liste[index]; - blessure.active = !blessure.active; - if (!blessure.active) { - this._supprimerBlessure(blessure); - } - await this.update({ 'system.blessures': listBlessures }); - } - - /* -------------------------------------------- */ - async setDataBlessureFromSheet(gravite, index, psoins, pcomplets, jours, loc, psdone, scdone) { - let listBlessures = duplicate(this.system.blessures); - let blessure = listBlessures[gravite + "s"].liste[index]; - blessure.psdone = psdone; - blessure.scdone = scdone; - blessure.premiers_soins = psoins; - blessure.soins_complets = pcomplets; - blessure.jours = jours; - blessure.loc = loc; - await this.update({ 'system.blessures': listBlessures }); - } - /* -------------------------------------------- */ async jetDeMoral(situation, messageReussi = undefined, messageManque = undefined) { const jetMoral = await this._jetDeMoral(situation); @@ -2388,10 +2310,9 @@ export class RdDActor extends RdDBaseActor { /* -------------------------------------------- */ async creerTacheDepuisLivre(item, options = { renderSheet: true }) { - // TODO: déplacer vers Item pour livres const nomTache = "Lire " + item.name; - const filterTacheLecture = it => it.name == nomTache; - let tachesExistantes = this.filterItems(filterTacheLecture, 'tache'); + const filterTacheLecture = it => it.type == 'tache' && it.name == nomTache; + let tachesExistantes = this.filterItems(filterTacheLecture); if (tachesExistantes.length == 0) { const tache = { name: nomTache, type: 'tache', @@ -2407,14 +2328,14 @@ export class RdDActor extends RdDBaseActor { } } await this.createEmbeddedDocuments('Item', [tache], options); - tachesExistantes = this.filterItems(filterTacheLecture, 'tache'); + tachesExistantes = this.filterItems(filterTacheLecture); } return tachesExistantes.length > 0 ? tachesExistantes[0] : undefined; } blessuresASoigner() { // TODO or not TODO: filtrer les blessures poour lesquels on ne peut plus faire de premiers soins? - return this.filterItems(it => it.system.gravite > 0 && !(it.system.premierssoins.done && it.system.soinscomplets.done), 'blessure') + return this.filterItems(it => it.system.gravite > 0 && it.system.gravite <= 6 && !(it.system.premierssoins.done && it.system.soinscomplets.done), 'blessure') } async getTacheBlessure(blesse, blessure) { @@ -3155,8 +3076,8 @@ export class RdDActor extends RdDBaseActor { tache: Math.max(0, tache.system.points_de_tache_courant) } }) - if (bonus>=0) { - await tache.delete() + if (bonus >= 0) { + await this.deleteEmbeddedDocuments('Item', [tache.id]) } } } @@ -3311,11 +3232,11 @@ export class RdDActor extends RdDBaseActor { async _appliquerEncaissement(encaissement, show) { let santeOrig = duplicate(this.system.sante); - this.ajouterBlessure(encaissement); // Will upate the result table + const blessure = await this.ajouterBlessure(encaissement); // Will upate the result table const perteVie = this.isEntite() ? { newValue: 0 } : await this.santeIncDec("vie", -encaissement.vie); - const perteEndurance = await this.santeIncDec("endurance", -encaissement.endurance, encaissement.critiques > 0); + const perteEndurance = await this.santeIncDec("endurance", -encaissement.endurance, blessure?.isCritique()); mergeObject(encaissement, { alias: this.name, @@ -3325,6 +3246,7 @@ export class RdDActor extends RdDBaseActor { jetEndurance: perteEndurance.jetEndurance, endurance: santeOrig.endurance.value - perteEndurance.newValue, vie: this.isEntite() ? 0 : (santeOrig.vie.value - perteVie.newValue), + blessure: blessure, show: show ?? {} }); @@ -3344,73 +3266,33 @@ export class RdDActor extends RdDBaseActor { } /* -------------------------------------------- */ - ajouterBlessure(encaissement) { - if (this.type == 'entite') return; // Une entité n'a pas de blessures - if (encaissement.legeres + encaissement.graves + encaissement.critiques == 0) return; - + async ajouterBlessure(encaissement) { + if (this.isEntite()) return; // Une entité n'a pas de blessures + if (encaissement.gravite < 0) return; + if (encaissement.gravite > 0) { + while (this.countBlessures(it => it.system.gravite == encaissement.gravite) >= RdDItemBlessure.maxBlessures(encaissement.gravite) && encaissement.gravite <= 6) { + // Aggravation + encaissement.gravite += 2 + if (encaissement.gravite > 2) { + encaissement.vie += 2; + } + } + } const endActuelle = Number(this.system.sante.endurance.value); - let blessures = duplicate(this.system.blessures); - - let count = encaissement.legeres; - // Manage blessures - while (count > 0) { - let legere = blessures.legeres.liste.find(it => !it.active); - if (legere) { - this._setBlessure(legere, encaissement); - count--; - } - else { - encaissement.graves += count; - encaissement.legeres -= count; - break; - } + const blessure = await RdDItemBlessure.createBlessure(this, encaissement.gravite, encaissement.dmg.loc.label); + if (blessure.isCritique()) { + encaissement.endurance = endActuelle; } - count = encaissement.graves; - while (count > 0) { - let grave = blessures.graves.liste.find(it => !it.active); - if (grave) { - this._setBlessure(grave, encaissement); - count--; - } - else { - encaissement.critiques += count; - encaissement.graves -= count; - encaissement.endurance = endActuelle; - encaissement.vie = 4; - break; - } + if (blessure.isMort()) { + this.setEffect(STATUSES.StatusComma, true); + encaissement.mort = true; + ChatMessage.create({ + content: `charge + ${this.name} vient de succomber à une seconde blessure critique ! Que les Dragons gardent son Archétype en paix !` + }); } - - count = encaissement.critiques; - while (count > 0) { - let critique = blessures.critiques.liste[0]; - if (!critique.active) { - this._setBlessure(critique, encaissement); - count--; - } else { - // TODO: status effect dead - this.setEffect(STATUSES.StatusComma, true); - ChatMessage.create({ - content: `charge - ${this.name} vient de succomber à une seconde blessure critique ! Que les Dragons gardent son Archétype en paix !` - }); - encaissement.critiques -= count; - encaissement.mort = true; - break; - } - } - - encaissement.endurance = Math.max(encaissement.endurance, -endActuelle); - this.update({ "system.blessures": blessures }); - } - - /* -------------------------------------------- */ - _setBlessure(blessure, encaissement) { - blessure.active = true; - blessure.psdone = false; - blessure.scdone = false; - blessure.loc = encaissement.locName; + return blessure; } /* -------------------------------------------- */ @@ -3643,42 +3525,28 @@ export class RdDActor extends RdDBaseActor { /* -------------------------------------------- */ async buildPotionGuerisonList(pointsGuerison) { - let pointsGuerisonInitial = pointsGuerison; - let myData = this.system; - const blessures = duplicate(myData.blessures); - let guerisonData = { list: [], pointsConsommes: 0 } - - console.log(blessures); - for (let critique of blessures.critiques.liste) { - if (critique.active && pointsGuerison >= 6) { - pointsGuerison -= 6; - critique.active = false; - guerisonData.list.push("1 Blessure Critique (6 points)"); + const pointsGuerisonInitial = pointsGuerison; + const blessures = this.filterItems(it => it.isLegere() || it.isGrave() || it.isCritique()).sort(Misc.descending(it => it.system.gravite)) + const ids = [] + const guerisonData = { list: [], pointsConsommes: 0 } + for (let blessure of blessures) { + if (pointsGuerison >= blessure.system.gravite) { + pointsGuerison -= blessure.system.gravite; + guerisonData.list.push(`1 Blessure ${blessure.system.labelGravite} (${blessure.system.gravite} points)`); + ids.push(blessure.id) } } - for (let grave of blessures.graves.liste) { - if (grave.active && pointsGuerison >= 4) { - pointsGuerison -= 4; - grave.active = false; - guerisonData.list.push("1 Blessure Grave (4 points)"); - } + if (ids.length > 0) { + await this.supprimerBlessures(it => ids.includes(it.id)); } - for (let legere of blessures.legeres.liste) { - if (legere.active && pointsGuerison >= 2) { - pointsGuerison -= 2; - legere.active = false; - guerisonData.list.push("1 Blessure Légère (2 points)"); - } + if (blessures.length == ids.length) { + let pvManquants = this.system.sante.vie.max - this.system.sante.vie.value; + let pvSoignees = Math.min(pvManquants, Math.floor(pointsGuerison / 2)); + pointsGuerison -= pvSoignees * 2; + guerisonData.list.push(pvSoignees + " Points de Vie soignés"); + await this.santeIncDec('vie', +pvSoignees, false); } - await this.update({ "system.blessures": blessures }); - - let pvManquants = myData.sante.vie.max - myData.sante.vie.value; - let pvSoignees = Math.min(pvManquants, Math.floor(pointsGuerison / 2)); - pointsGuerison -= pvSoignees * 2; - guerisonData.list.push(pvSoignees + " Points de Vie soignés"); - await this.santeIncDec('vie', +pvSoignees, false); guerisonData.pointsConsommes = pointsGuerisonInitial - pointsGuerison; - return guerisonData; } @@ -3697,7 +3565,7 @@ export class RdDActor extends RdDBaseActor { } } if (!potionData.system.magique || potionData.rolled.isSuccess) { - this.bonusRecuperationPotion = potionData.system.herbeBonus; + await this.setBonusPotionSoin(potionData.system.herbeBonus); } ChatMessage.create({ whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name), @@ -3705,6 +3573,10 @@ export class RdDActor extends RdDBaseActor { }); } + async setBonusPotionSoin(bonus) { + await this.update({ 'sante.bonusPotion': bonus }); + } + /* -------------------------------------------- */ async consommerPotionRepos(potionData) { potionData.alias = this.name; diff --git a/module/item/blessure.js b/module/item/blessure.js index 0c71df22..063b7885 100644 --- a/module/item/blessure.js +++ b/module/item/blessure.js @@ -1,4 +1,6 @@ import { RdDItem } from "../item.js"; +import { Misc } from "../misc.js"; +import { RdDTimestamp } from "../rdd-timestamp.js"; const BASE_TACHE_SOIN_BLESSURE = { type: "tache", @@ -6,20 +8,30 @@ const BASE_TACHE_SOIN_BLESSURE = { system: { carac: "dexterite", competence: "Chirurgie", periodicite: "1 round", fatigue: 0, } } const TACHES_SOIN_BLESSURE = { - 'critique': { name: 'Blessure critique', system: { difficulte: -6, points_de_tache: 6 } }, - 'grave': { name: 'Blessure grave', system: { difficulte: -4, points_de_tache: 4 } }, - 'legere': { name: 'Blessure légère', system: { difficulte: -2, points_de_tache: 2 } }, 6: { name: 'Blessure critique', system: { difficulte: -6, points_de_tache: 6 } }, 4: { name: 'Blessure grave', system: { difficulte: -4, points_de_tache: 4 } }, 2: { name: 'Blessure légère', system: { difficulte: -2, points_de_tache: 2 } }, } +const definitionsBlessures = [ + { type: "contusion", gravite: 0, labelGravite: 'Contusion/éraflure', max: 100, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/eraflure.webp" }, + { type: "legere", gravite: 2, labelGravite: 'Légère', max: 5, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp" }, + { type: "grave", gravite: 4, labelGravite: 'Grave', max: 2, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp" }, + { type: "critique", gravite: 6, labelGravite: 'Critique', max: 1, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp" }, + { type: "mort", gravite: 8, labelGravite: 'Mort', max: 1, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/mort.webp" } +] + export class RdDItemBlessure extends RdDItem { static get defaultIcon() { return "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp"; } + prepareDerivedData() { + super.prepareDerivedData(); + this.system.labelGravite = this.getLabelGravite() + } + static prepareTacheSoin(gravite) { const tache = TACHES_SOIN_BLESSURE[gravite] if (!tache) { @@ -28,7 +40,22 @@ export class RdDItemBlessure extends RdDItem { } return mergeObject(duplicate(BASE_TACHE_SOIN_BLESSURE), tache) } + static async createBlessure(actor, gravite, localisation) { + const definition = RdDItemBlessure.getDefinition(gravite) + const blessure = { + name: definition.labelGravite, + type: 'blessure', + img: definition.icon, + system: { + gravite: gravite, + difficulte: - gravite, + localisation: localisation + } + } + const blessures = await actor.createEmbeddedDocuments('Item', [blessure]) + return blessures[0] + } static async createTacheSoinBlessure(actor, gravite) { const tache = RdDItemBlessure.prepareTacheSoin(gravite) @@ -51,6 +78,54 @@ export class RdDItemBlessure extends RdDItem { } } + async setSoinsBlessure(systemUpdate = {}) { + systemUpdate = mergeObject(systemUpdate, this.system, { overwrite: false }), + systemUpdate.soinscomplets.done = systemUpdate.premierssoins.done && systemUpdate.soinscomplets.done + await this.update({ + img: this.getImgSoins(systemUpdate.gravite, systemUpdate.soinscomplets.done), + system: systemUpdate + }); + } + + async recuperationBlessure({ actor, timestamp, message, isMaladeEmpoisonne, blessures }) { + if (this.parent != actor || actor == undefined) { + return; + } + if (new RdDTimestamp(this.system.fin).isAfterIndexDate(timestamp)) { + // attente periode + return + } + if (this.system.gravite > 0) { + const update = { premierssoins: { bonus: 0 }, soinscomplets: { bonus: 0 } } + const gravite = this.system.gravite; + const graviteMoindre = gravite - 2; + const moindres = blessures.filter(it => it.system.gravite == graviteMoindre, 'blessures').length + const labelGravite = RdDItemBlessure.getLabelGravite(gravite); + + let rolled = await actor.jetRecuperationConstitution(Misc.toInt(this.system.soinscomplets.bonus) + actor.system.sante.bonusPotion, message); + + if (rolled.isETotal) { + message.content += ` -- une blessure ${labelGravite} s'infecte (temps de guérison augmenté de ${definition.facteur} jours, perte de vie)`; + mergeObject(update, { fin: { indexDate: timestamp.addJours(gravite).indexDate } }); + await actor.santeIncDec("vie", -1); + } + else { + if (!isMaladeEmpoisonne && rolled.isSuccess && this.peutRetrograder(graviteMoindre, moindres)) { + message.content += ` -- une blessure ${labelGravite} cicatrise`; + mergeObject(update, { gravite: graviteMoindre, fin: { indexDate: timestamp.addJours(graviteMoindre).indexDate } }); + } + else { + message.content += ` -- une blessure ${labelGravite} reste stable`; + } + } + await this.update(update); + } + } + + peutRetrograder(graviteMoindre, moindres) { + return moindres < RdDItemBlessure.getDefinition(graviteMoindre).max + } + async calculerFinPeriodeTemporel(debut) { return await debut.nouveauJour().addJours(this.system.gravite); } @@ -61,34 +136,42 @@ export class RdDItemBlessure extends RdDItem { } } - prepareDerivedData() { - super.prepareDerivedData(); - this.system.labelGravite = this.getLabelGravite() - } - - async setSoinsBlessure(systemUpdate = {}) { - systemUpdate = mergeObject(systemUpdate, this.system, { overwrite: false }), - systemUpdate.soinscomplets.done = systemUpdate.premierssoins.done && systemUpdate.soinscomplets.done - await this.update({ - img: this.getImgSoins(systemUpdate.soinscomplets.done), - system: systemUpdate - }); - } - - getImgSoins(soins) { - return `systems/foundryvtt-reve-de-dragon/icons/sante/${soins ? 'blessure-soins' : 'blessure'}.webp` + getImgSoins(gravite, soins) { + let img = 'blessure' + if (gravite > 6) { + img = 'mort' + } + if (gravite <= 0) { + img = 'eraflure' + } + return `systems/foundryvtt-reve-de-dragon/icons/sante/${soins ? 'blessure-soins' : img}.webp` } getLabelGravite() { - if (this.system.gravite >= 6) { - return 'Critique' - } - if (this.system.gravite >= 4) { - return 'Grave' - } - if (this.system.gravite >= 2) { - return 'Légère' - } - return 'Contusion/éraflure' + return RdDItemBlessure.getDefinition(this.system.gravite).labelGravite } -} \ No newline at end of file + + static getDefinition(gravite) { + return definitionsBlessures.sort(Misc.ascending(it => it.gravite)) + .find(it => it.gravite >= gravite); + } + static maxBlessures(gravite) { + return RdDItemBlessure.getDefinition(gravite).max + } + + isContusion() { + return this.system.gravite <= 0 + } + isLegere() { + return this.system.gravite > 0 && this.system.gravite <= 2 + } + isGrave() { + return this.system.gravite > 2 && this.system.gravite <= 4 + } + isCritique() { + return this.system.gravite > 4 && this.system.gravite <= 6 + } + isMort() { + return this.system.gravite > 6 + } +} diff --git a/module/rdd-bonus.js b/module/rdd-bonus.js index 25bbdb3e..2516b0ff 100644 --- a/module/rdd-bonus.js +++ b/module/rdd-bonus.js @@ -28,7 +28,7 @@ export class RdDBonus { } /* -------------------------------------------- */ - static dmg(rollData, dmgActor, isCauchemar = false) { + static dmg(rollData, dmgActor, isEntiteIncarnee = false) { let dmg = { total: 0 }; if (rollData.arme && rollData.arme.name.toLowerCase() == "esquive") { // Specific case management @@ -41,7 +41,7 @@ export class RdDBonus { dmg.dmgSurprise = RdDBonus.dmgBonus(rollData.ajustements?.attaqueDefenseurSurpris.used); dmg.dmgActor = rollData.selectedCarac ? RdDBonus._dmgPerso(dmgActor, rollData.selectedCarac.label, dmg.dmgArme) : 0; dmg.total = dmg.dmgSurprise + dmg.dmgTactique + dmg.dmgArme + dmg.dmgActor + dmg.dmgParticuliere; - dmg.mortalite = RdDBonus._calculMortalite(rollData, isCauchemar) + dmg.mortalite = RdDBonus._calculMortalite(rollData, isEntiteIncarnee) } return dmg; } @@ -62,11 +62,8 @@ export class RdDBonus { } /* -------------------------------------------- */ - static _calculMortalite(rollData, isCauchemar) { - if (isCauchemar) { - return "cauchemar"; - } - return isCauchemar ? "cauchemar" + static _calculMortalite(rollData, isEntiteIncarnee) { + return isEntiteIncarnee ? "entiteincarnee" : rollData.dmg?.mortalite ?? rollData.arme?.system.mortalite ?? "mortel"; diff --git a/module/rdd-combat.js b/module/rdd-combat.js index 904384d6..435be56d 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -1295,13 +1295,8 @@ export class RdDCombat { blessuresStatus: actor.computeResumeBlessure(), SConst: actor.getSConst(), actorId: actor.id, - isGrave: false, - isCritique: false - } - if (actor.countBlessuresNonSoigneeByName("critiques") > 0) { // Pour éviter le cumul grave + critique - formData.isCritique = true; - } else if (actor.countBlessuresNonSoigneeByName("graves") > 0) { - formData.isGrave = true; + isGrave: actor.countBlessures(it => it.isGraves()) > 0, + isCritique: actor.countBlessures(it => it.isCritique()) > 0 } ChatUtility.createChatWithRollMode(actor.name, { diff --git a/module/rdd-roll-encaisser.js b/module/rdd-roll-encaisser.js index 4d98e413..a9fc2d84 100644 --- a/module/rdd-roll-encaisser.js +++ b/module/rdd-roll-encaisser.js @@ -30,9 +30,9 @@ export class RdDEncaisser extends Dialog { }; } else if (actor.isEntite([ENTITE_BLURETTE, ENTITE_INCARNE])) { - dialogConf.default = "cauchemar" + dialogConf.default = "entiteincarnee" dialogConf.buttons = { - "cauchemar": { label: "Cauchemar", callback: html => this.performEncaisser("cauchemar") } + "entiteincarnee": { label: "Entité incarnée", callback: html => this.performEncaisser("entiteincarnee") } } } @@ -70,7 +70,6 @@ export class RdDEncaisser extends Dialog { total: Number(this.modifier), ajustement: Number(this.modifier), encaisserSpecial: this.encaisserSpecial, - loc: { result: 0, label: "" }, mortalite: mortalite } }); diff --git a/module/rdd-token-hud.js b/module/rdd-token-hud.js index d96bb139..12dcaf4d 100644 --- a/module/rdd-token-hud.js +++ b/module/rdd-token-hud.js @@ -88,10 +88,7 @@ export class RdDTokenHud { static async addExtensionHudSoins(html, sourceActor) { const target = Targets.getTarget({ warn: false }); if (target?.actor) { - const hudSoins = { - targetActor: target.actor, - blessures: target.actor.blessuresASoigner() ?? [] - }; + const hudSoins = { blessures: target.actor.blessuresASoigner() ?? [] }; if (hudSoins.blessures.length > 0) { // soins const controlIconTarget = html.find('.control-icon[data-action=combat]'); diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 235d46ad..55e968de 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -19,7 +19,7 @@ import { RdDRaretes } from "./item/raretes.js"; /* -------------------------------------------- */ // This table starts at 0 -> niveau -10 const carac_array = ["taille", "apparence", "constitution", "force", "agilite", "dexterite", "vue", "ouie", "odoratgout", "volonte", "intellect", "empathie", "reve", "chance", "melee", "tir", "lancer", "derobee"]; -const difficultesLibres = Misc.intArray(0, -11); +const difficultesLibres = Misc.intArray(0, -11); const ajustementsConditions = Misc.intArray(-10, 11); const ajustementsEncaissement = Misc.intArray(-10, 26); @@ -66,38 +66,31 @@ const fatigueMarche = { "tresdifficile": { "4": 4, "6": 6 } } -/* -------------------------------------------- */ -const definitionsBlessures = [ - { type: "legere", facteur: 2 }, - { type: "grave", facteur: 4 }, - { type: "critique", facteur: 6 } -] - /* -------------------------------------------- */ const nomEthylisme = ["Emeché", "Gris", "Pinté", "Pas frais", "Ivre", "Bu", "Complètement fait", "Ivre mort"]; /* -------------------------------------------- */ const definitionsEncaissement = { "mortel": [ - { minimum: undefined, maximum: 0, endurance: "0", vie: "0", eraflures: 0, legeres: 0, graves: 0, critiques: 0 }, - { minimum: 1, maximum: 10, endurance: "1d4", vie: "0", eraflures: 1, legeres: 0, graves: 0, critiques: 0 }, - { minimum: 11, maximum: 15, endurance: "1d6", vie: "0", eraflures: 0, legeres: 1, graves: 0, critiques: 0 }, - { minimum: 16, maximum: 19, endurance: "2d6", vie: "2", eraflures: 0, legeres: 0, graves: 1, critiques: 0 }, - { minimum: 20, maximum: undefined, endurance: "100", vie: "4 + @over20", eraflures: 0, legeres: 0, graves: 0, critiques: 1 }, + { minimum: undefined, maximum: 0, endurance: "0", vie: "0", gravite: -1}, + { minimum: 1, maximum: 10, endurance: "1d4", vie: "0", gravite: 0}, + { minimum: 11, maximum: 15, endurance: "1d6", vie: "0", gravite: 2}, + { minimum: 16, maximum: 19, endurance: "2d6", vie: "2", gravite: 4}, + { minimum: 20, maximum: undefined, endurance: "100", vie: "4 + @over20", gravite: 6}, ], "non-mortel": [ - { minimum: undefined, maximum: 0, endurance: "0", vie: "0", eraflures: 0, legeres: 0, graves: 0, critiques: 0 }, - { minimum: 1, maximum: 10, endurance: "1d4", vie: "0", eraflures: 1, legeres: 0, graves: 0, critiques: 0 }, - { minimum: 11, maximum: 15, endurance: "1d6", vie: "0", eraflures: 1, legeres: 0, graves: 0, critiques: 0 }, - { minimum: 16, maximum: 19, endurance: "2d6", vie: "0", eraflures: 0, legeres: 1, graves: 0, critiques: 0 }, - { minimum: 20, maximum: undefined, endurance: "100", vie: "0", eraflures: 0, legeres: 1, graves: 0, critiques: 0 }, + { minimum: undefined, maximum: 0, endurance: "0", vie: "0", gravite: -1}, + { minimum: 1, maximum: 10, endurance: "1d4", vie: "0", gravite: 0 }, + { minimum: 11, maximum: 15, endurance: "1d6", vie: "0", gravite: 0 }, + { minimum: 16, maximum: 19, endurance: "2d6", vie: "0", gravite: 2 }, + { minimum: 20, maximum: undefined, endurance: "100", vie: "0", gravite: 2 }, ], - "cauchemar": [ - { minimum: undefined, maximum: 0, endurance: "0", vie: "0", eraflures: 0, legeres: 0, graves: 0, critiques: 0 }, - { minimum: 1, maximum: 10, endurance: "1d4", vie: "0", eraflures: 1, legeres: 0, graves: 0, critiques: 0 }, - { minimum: 11, maximum: 15, endurance: "1d6", vie: "0", eraflures: 1, legeres: 0, graves: 0, critiques: 0 }, - { minimum: 16, maximum: 19, endurance: "2d6", vie: "0", eraflures: 1, legeres: 0, graves: 0, critiques: 0 }, - { minimum: 20, maximum: undefined, endurance: "3d6 + @over20", vie: "0", eraflures: 1, legeres: 0, graves: 0, critiques: 0 }, + "entiteincarnee": [ + { minimum: undefined, maximum: 0, endurance: "0", vie: "0", gravite: -1}, + { minimum: 1, maximum: 10, endurance: "1d4", vie: "0", gravite: 0}, + { minimum: 11, maximum: 15, endurance: "1d6", vie: "0", gravite: 0 }, + { minimum: 16, maximum: 19, endurance: "2d6", vie: "0", gravite: 0 }, + { minimum: 20, maximum: undefined, endurance: "3d6 + @over20", vie: "0", gravite: 0 }, ] }; @@ -139,7 +132,6 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/actor/xp-competences.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/combat.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/blessures.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/blessure.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/blessure.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/maladies-poisons.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/possessions.html', @@ -474,10 +466,6 @@ export class RdDUtility { return ajustementsEncaissement; } - static getDefinitionsBlessures() { - return definitionsBlessures; - } - /* -------------------------------------------- */ static getSegmentsFatigue(maxEnd) { maxEnd = Math.max(maxEnd, 1); @@ -618,17 +606,10 @@ export class RdDUtility { encaissement.dmg.loc.label = encaissement.dmg.loc.label ?? 'Corps;'; encaissement.roll = roll; encaissement.armure = armure; + encaissement.penetration = rollData.arme?.system.penetration ?? 0; encaissement.total = jetTotal; encaissement.vie = await RdDUtility._evaluatePerte(encaissement.vie, over20); encaissement.endurance = await RdDUtility._evaluatePerte(encaissement.endurance, over20); - encaissement.penetration = rollData.arme?.system.penetration ?? 0; - encaissement.blessures = ( - encaissement.critiques > 0 ? "Critique" : - encaissement.graves > 0 ? "Grave" : - encaissement.legeres > 0 ? "Légère" : - encaissement.eraflures > 0 ? "Contusions/Eraflures" : - 'Aucune' - ); return encaissement; } diff --git a/styles/simple.css b/styles/simple.css index df341346..f5144534 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -186,7 +186,7 @@ i:is(.fas, .far) { } .system-foundryvtt-reve-de-dragon .sheet-header :is(.header-compteurs,.header-etats,.profile-img, .profile-img-token){ - padding: 0 3%; + padding: 0 0.4rem; } .system-foundryvtt-reve-de-dragon .sheet-header :is(.profile-img, .profile-img-token) { @@ -213,11 +213,13 @@ i:is(.fas, .far) { } .system-foundryvtt-reve-de-dragon .sheet-header .header-compteurs { + width: calc(60% - 110px - 1rem); text-align: right; max-width: fit-content; } .system-foundryvtt-reve-de-dragon .sheet-header div.header-etats { + width: calc(40% - 32px - 1rem); height: 48px; max-width: fit-content; flex: initial; diff --git a/template.json b/template.json index 4d1cfd28..a58c064c 100644 --- a/template.json +++ b/template.json @@ -179,7 +179,8 @@ "value": 10, "label": "Endurance", "derivee": false - } + }, + "bonusPotion": 0 }, "attributs": { "plusdom": { @@ -364,7 +365,8 @@ "value": 0, "label": "Fatigue", "derivee": true - } + }, + "bonusPotion": 0 }, "attributs": { "sconst": { diff --git a/templates/actor/blessure.hbs b/templates/actor/blessure.hbs index 7fed6645..16d9bc12 100644 --- a/templates/actor/blessure.hbs +++ b/templates/actor/blessure.hbs @@ -2,15 +2,18 @@ - {{system.labelGravite}} ({{system.localisation}}) + {{system.labelGravite}} + {{#if (gt system.gravite 6)}} + + + {{else}} {{#if system.premierssoins.done}} {{else}} - {{/if}} @@ -23,6 +26,10 @@ {{/if}} + {{/if}} + + {{system.localisation}} + diff --git a/templates/actor/blessure.html b/templates/actor/blessure.html deleted file mode 100644 index fb5b863d..00000000 --- a/templates/actor/blessure.html +++ /dev/null @@ -1,27 +0,0 @@ -
    • - - - {{title}} - - {{#if blessure.active}} - - - - - - - - - - - {{else}} - - - - - {{/if}} -
    • diff --git a/templates/actor/blessures.html b/templates/actor/blessures.html index f5ce7fa2..0974c2a0 100644 --- a/templates/actor/blessures.html +++ b/templates/actor/blessures.html @@ -3,6 +3,7 @@ Blessures Premiers soins Soins complets + Loc. Actions {{#each blessures as |blessure|}} diff --git a/templates/actor/header-effects.html b/templates/actor/header-effects.html index 3a94f93e..a1d52317 100644 --- a/templates/actor/header-effects.html +++ b/templates/actor/header-effects.html @@ -1,4 +1,4 @@ - +
      {{#if effects}} {{#each effects as |effect key|}} @@ -9,4 +9,4 @@ {{else}} Aucun effet actif {{/if}} - +
      diff --git a/templates/actor/header-etat.html b/templates/actor/header-etat.html index a2e30510..8d928cf5 100644 --- a/templates/actor/header-etat.html +++ b/templates/actor/header-etat.html @@ -1,8 +1,8 @@
      - {{system.compteurs.etat.label}}: {{system.compteurs.etat.value}} - Sur-encombrement: {{calc.surenc}} - {{calc.resumeBlessures}} +
      {{system.compteurs.etat.label}}: {{system.compteurs.etat.value}}
      +
      Sur-encombrement: {{calc.surenc}}
      +
      {{calc.resumeBlessures}}
      {{>"systems/foundryvtt-reve-de-dragon/templates/actor/header-effects.html"}}
      diff --git a/templates/chat-resultat-encaissement.html b/templates/chat-resultat-encaissement.html index 04d3ccd6..1950bf63 100644 --- a/templates/chat-resultat-encaissement.html +++ b/templates/chat-resultat-encaissement.html @@ -1,4 +1,5 @@ {{#if isGM}} +{{log this}} {{#if (gt endurance 0)}} De plus, {{alias}} a perdu {{endurance}} points d'endurance @@ -11,7 +12,7 @@ {{numberFormat dmg.total decimals=0 sign=true}} {{#if (eq dmg.mortalite 'non-mortel')~}}(coups non mortels) - {{~else if (eq dmg.mortalite 'cauchemar')}}(entité de cauchemar) + {{~else if (eq dmg.mortalite 'entiteincarnee')}}(entité incarnée) {{~/if}} @@ -22,15 +23,16 @@ {{~/unless}}, total: {{total}}
      {{alias}} - {{#if (eq dmg.mortalite 'cauchemar')}}subit le coup - {{else if eraflures}}subit une contusion - {{else if legeres}}subit une blessure légère - {{else if graves}}subit une blessure grave - {{else if critiques}}subit une blessure critique + {{#if (eq dmg.mortalite 'entiteincarnee')}}subit le coup {{else if mort}}vient de mourir + {{else if blessure}} + {{#if (gt blessure.system.gravite 0)}}subit une blessure {{blessure.system.labelGravite}} + {{else}}subit une contusion + {{~/if~}} {{else}}s'en sort sans une égratignure {{~/if~}} - {{~#unless (eq dmg.mortalite 'cauchemar')}} + + {{~#unless (eq dmg.mortalite 'entiteincarnee')}} {{#if dmg.loc.label}} {{#if (gt roll.total 0)}}({{dmg.loc.label}}){{/if}} {{/if}} @@ -39,7 +41,7 @@ {{~#if hasPlayerOwner}}, a perdu {{endurance}} points d'endurance {{#if (ne vie 0)}}, {{vie}} points de vie{{/if}} {{/if}} - {{#if (ne dmg.mortalite 'cauchemar')}} + {{#if (ne dmg.mortalite 'entiteincarnee')}} {{#if (gt endurance 1)}}et {{#if sonne}}est sonnécharge jusqu'à la fin du prochain round{{else}}n'est pas sonné{{/if}}! {{#if hasPlayerOwner}}Jet d'endurance : Jet d'endurance : {{jetEndurance}} / {{resteEndurance}}{{/if}} diff --git a/templates/item-blessure-sheet.html b/templates/item-blessure-sheet.html index a476506e..83037f2b 100644 --- a/templates/item-blessure-sheet.html +++ b/templates/item-blessure-sheet.html @@ -9,19 +9,19 @@ + {{/select}}
    - -
    - - -
    -
    + {{#if (lt system.gravite 7)}} +
    + + +
    - + {{#if system.premierssoins.done}}
    {{/if}} + {{/if}} {{#if options.isOwned}} {{>"systems/foundryvtt-reve-de-dragon/templates/item/temporel.hbs" this labeldebut="Obtenue" labelfin="Prochain jet"}} From afc23dfa7b3121f169cbac206b7c0407ccead824 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Wed, 15 Mar 2023 00:41:29 +0100 Subject: [PATCH 14/16] Fix: message sans jet d'endurance --- templates/chat-resultat-encaissement.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/chat-resultat-encaissement.html b/templates/chat-resultat-encaissement.html index 1950bf63..146bf264 100644 --- a/templates/chat-resultat-encaissement.html +++ b/templates/chat-resultat-encaissement.html @@ -5,7 +5,7 @@ De plus, {{alias}} a perdu {{endurance}} points d'endurance {{#if (ne vie 0)}}et {{vie}} points de vie{{/if}} {{/if}} - {{#if (gt endurance 1)}}Jet d'endurance : {{jetEndurance}} / {{resteEndurance}} {{/if}} + {{#if (and jetEndurance (gt endurance 1))}}Jet d'endurance : {{jetEndurance}} / {{resteEndurance}} {{/if}} {{else}}

    {{alias}} encaisse à From 83e2d56fd47c27e3eea8a40a84a31af8776ee467 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Wed, 15 Mar 2023 00:46:08 +0100 Subject: [PATCH 15/16] Boutons soins&blessures --- module/actor-sheet.js | 15 ++++++--------- module/item/blessure.js | 2 +- templates/actor/blessures.html | 9 ++++++++- templates/actor/chirurgie.html | 8 +++++--- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 5e33065a..00f2fa96 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -152,15 +152,12 @@ export class RdDActorSheet extends RdDBaseActorSheet { this.html.find('.creer-tache').click(async event => { this.createEmptyTache(); }); - this.html.find('.creer-tache-blessure-legere').click(async event => { - RdDItemBlessure.createTacheSoinBlessure(this.actor, 2); - }); - this.html.find('.creer-tache-blessure-grave').click(async event => { - RdDItemBlessure.createTacheSoinBlessure(this.actor, 4); - }); - this.html.find('.creer-tache-blessure-critique').click(async event => { - RdDItemBlessure.createTacheSoinBlessure(this.actor, 6); - }); + this.html.find('.creer-tache-blessure-legere').click(async event => RdDItemBlessure.createTacheSoinBlessure(this.actor, 2)); + this.html.find('.creer-tache-blessure-grave').click(async event => RdDItemBlessure.createTacheSoinBlessure(this.actor, 4)); + this.html.find('.creer-tache-blessure-critique').click(async event => RdDItemBlessure.createTacheSoinBlessure(this.actor, 6)); + this.html.find('.creer-blessure-legere').click(async event => RdDItemBlessure.createBlessure(this.actor, 2)); + this.html.find('.creer-blessure-grave').click(async event => RdDItemBlessure.createBlessure(this.actor, 4)); + this.html.find('.creer-blessure-critique').click(async event => RdDItemBlessure.createBlessure(this.actor, 6)); this.html.find('.creer-une-oeuvre').click(async event => { this.selectTypeOeuvreToCreate(); }); diff --git a/module/item/blessure.js b/module/item/blessure.js index 063b7885..2c59a9be 100644 --- a/module/item/blessure.js +++ b/module/item/blessure.js @@ -40,7 +40,7 @@ export class RdDItemBlessure extends RdDItem { } return mergeObject(duplicate(BASE_TACHE_SOIN_BLESSURE), tache) } - static async createBlessure(actor, gravite, localisation) { + static async createBlessure(actor, gravite, localisation = '') { const definition = RdDItemBlessure.getDefinition(gravite) const blessure = { name: definition.labelGravite, diff --git a/templates/actor/blessures.html b/templates/actor/blessures.html index 0974c2a0..910b2480 100644 --- a/templates/actor/blessures.html +++ b/templates/actor/blessures.html @@ -1,6 +1,13 @@ +

    blessures

    + +
    • - Blessures + Premiers soins Soins complets Loc. diff --git a/templates/actor/chirurgie.html b/templates/actor/chirurgie.html index d53c3da1..4ed4e170 100644 --- a/templates/actor/chirurgie.html +++ b/templates/actor/chirurgie.html @@ -1,7 +1,9 @@

      Soins

      -Blessure légère -Blessure grave -Blessure critique +
        {{#each taches as |tache id|}} {{#if (eq tache.system.competence 'Chirurgie')}} From dd79e16ea58f660bc277baedcc519c87dd19eecc Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Tue, 14 Mar 2023 23:41:41 +0100 Subject: [PATCH 16/16] Version 10.7.0 --- system.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system.json b/system.json index 9d83c073..805704df 100644 --- a/system.json +++ b/system.json @@ -1,8 +1,8 @@ { "id": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", - "version": "10.6.25", - "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.6.25.zip", + "version": "10.7.0", + "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.7.0.zip", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json", "compatibility": { "minimum": "10",