From d816490839cda483859589519b887ca499d7ec12 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 19 Jan 2023 01:39:25 +0100 Subject: [PATCH 1/8] =?UTF-8?q?Exp=C3=A9rience=20sur=20jets=20de=20r=C3=A9?= =?UTF-8?q?sistance?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Une réussite particulière à un JR de difficulté négative fait gagner un point d’expérience. On ne gagne qu’un seul point quelle que soit la difficulté du JR, et cet unique point va toujours en caractéristique RÊVE, jamais en Draconic. Pour l'éthylisme, le jet de vie n'est pas un jet d'action, mais de résistance, limitation à 1 point d'expérience pour lutter contre l'alcoolisme optimisateur. --- module/actor-sheet.js | 2 +- module/actor.js | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 6c43d5c1..6ec548c6 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -249,7 +249,7 @@ export class RdDActorSheet extends RdDBaseActorSheet { // Points de reve actuel this.html.find('.ptreve-actuel a').click(async event => { - this.actor.rollCarac('reve-actuel'); + this.actor.rollCarac('reve-actuel', true); }); // Roll Weapon1 diff --git a/module/actor.js b/module/actor.js index 59a3402f..db382a10 100644 --- a/module/actor.js +++ b/module/actor.js @@ -1764,6 +1764,7 @@ export class RdDActor extends RdDBaseActor { forceAlcool: forceAlcool, nbDoses: nbDoses, selectedCarac: this.system.sante.vie, + jetResistance: 'ethylisme', carac: this.system.carac, caracValue: this.system.sante.vie.max, finalLevel: etat + forceAlcool - nbDoses @@ -1972,7 +1973,7 @@ export class RdDActor extends RdDBaseActor { async appliquerAjoutExperience(rollData, hideChatMessage = 'show') { if (!this.isPersonnage()) return; hideChatMessage = hideChatMessage == 'hide' || (Misc.isRollModeHiddenToPlayer() && !game.user.isGM) - let xpData = await this._appliquerExperience(rollData.rolled, rollData.selectedCarac.label, rollData.competence); + let xpData = await this._appliquerExperience(rollData.rolled, rollData.selectedCarac.label, rollData.competence, rollData.jetResistance); if (xpData) { const content = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-gain-xp.html`, xpData); if (hideChatMessage) { @@ -2197,10 +2198,11 @@ export class RdDActor extends RdDBaseActor { } /* -------------------------------------------- */ - async rollCarac(caracName) { + async rollCarac(caracName, jetResistance = undefined) { let rollData = { selectedCarac: this.getCaracByName(caracName), - competences: this.itemTypes['competence'] + competences: this.itemTypes['competence'], + jetResistance: jetResistance ? caracName : undefined }; const dialog = await RdDRoll.create(this, rollData, @@ -2754,7 +2756,7 @@ export class RdDActor extends RdDBaseActor { } /* -------------------------------------------- */ - async _appliquerExperience(rolled, caracName, competence) { + async _appliquerExperience(rolled, caracName, competence, jetResistance) { if (!this.isPersonnage()) return; // Pas d'XP if (!rolled.isPart || rolled.finalLevel >= 0) { @@ -2771,16 +2773,19 @@ export class RdDActor extends RdDBaseActor { if (caracName == 'Vie') caracName = 'constitution'; if (caracName == 'derobee') caracName = 'agilite'; if (caracName == 'reve-actuel') caracName = 'reve'; - let xp = Math.abs(rolled.finalLevel); // impair: arrondi inférieur en carac let xpCarac = competence ? Math.floor(xp / 2) : Math.max(Math.floor(xp / 2), 1); - let xpData = { - alias: this.name, - caracName: caracName, xpCarac: xpCarac, - competence: competence, xpCompetence: competence ? xp - xpCarac : 0 - }; + const xpCompetence = competence ? xp - xpCarac : 0; + if (jetResistance) { + const message = `Jet de résistance ${jetResistance}, l'expérience est limitée à 1`; + ui.notifications.info(message); + console.log(message) + // max 1 xp sur jets de résistance + xpCarac = Math.min(1, xpCarac); + } + let xpData = { alias: this.name, caracName, xpCarac, competence, xpCompetence }; await this._xpCompetence(xpData); await this._xpCarac(xpData); -- 2.35.3 From 37704558e06d4fbea63194f25e7f7524399b9785 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 19 Jan 2023 01:42:42 +0100 Subject: [PATCH 2/8] =?UTF-8?q?Combat=20bloqu=C3=A9=20en=20cas=20d'init=20?= =?UTF-8?q?n=C3=A9gative?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Le code essayait de modifier le total d'un roll, qui n'est pas un champ mais une methode get de la classe Roll --- module/rdd-combat.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/module/rdd-combat.js b/module/rdd-combat.js index 45202088..9aedd422 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -1,6 +1,5 @@ import { ChatUtility } from "./chat-utility.js"; -import { ENTITE_BLURETTE, ENTITE_INCARNE, ENTITE_NONINCARNE, HIDE_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js"; -import { DialogSelectTarget } from "./dialog-select-target.js"; +import { ENTITE_BLURETTE, HIDE_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js"; import { Grammar } from "./grammar.js"; import { RdDItemArme } from "./item-arme.js"; import { RdDItemCompetence } from "./item-competence.js"; @@ -111,10 +110,10 @@ export class RdDCombatManager extends Combat { if (!roll.total) { roll.evaluate({ async: false }); } - if (roll.total <= 0) roll.total = 0.00; - console.log("Compute init for", rollFormula, roll.total, combatant); + const total = Math.max(roll.total, 0.00); + console.log("Compute init for", rollFormula, roll, total, combatant); let id = combatant._id || combatant.id; - await this.updateEmbeddedDocuments("Combatant", [{ _id: id, initiative: roll.total }]); + await this.updateEmbeddedDocuments("Combatant", [{ _id: id, initiative: total }]); // Send a chat message let rollMode = messageOptions.rollMode || game.settings.get("core", "rollMode"); -- 2.35.3 From 024e3555864e7b05c9ba3e75a9c78970148598c1 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 19 Jan 2023 01:43:52 +0100 Subject: [PATCH 3/8] Fix: Affichage d'anciens objets temporels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Les objets temporels créés avant la 10.5.0 ne pouvaient pas être édités --- module/rdd-timestamp.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/module/rdd-timestamp.js b/module/rdd-timestamp.js index 831e48e1..5dbce01d 100644 --- a/module/rdd-timestamp.js +++ b/module/rdd-timestamp.js @@ -73,6 +73,9 @@ export class RdDTimestamp { * @returns L'entrée de DEFINITION_HEURES correspondant au signe */ static definition(signe) { + if (signe == undefined) { + signe = 0; + } if (Number.isInteger(signe)) { return DEFINITION_HEURES[signe % RDD_HEURES_PAR_JOUR]; } @@ -96,7 +99,7 @@ export class RdDTimestamp { } static imgSigne(signe) { - return `${signe.label}` + return signe == undefined ? '' : `${signe.label}` } static handleTimestampEditor(html, path, consumeTimestamp = async (path, timestamp) => { }) { -- 2.35.3 From 782dc38268de0431ceee23cee106146e07f293a6 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 19 Jan 2023 01:45:30 +0100 Subject: [PATCH 4/8] Ajout de message si rencontre perdue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ajout d'un message pour comprendre comment une rencontre peut être perdue ( Issue #612) --- module/rdd-tmr-dialog.js | 8 +++++++- module/rdd-tmr-rencontre-dialog.js | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index ac450e98..9dc42f28 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -285,7 +285,12 @@ export class RdDTMRDialog extends Dialog { } /* -------------------------------------------- */ - async onActionRencontre(action, tmr) { + async onActionRencontre(action, tmr, rencontre) { + if (!this.currentRencontre){ + ui.notifications.warn("#612 Rencontre perdue, récupération en cours. Vous pouvez contacter l'équipe avec les logs pour aider à résoudre ce problème") + console.error("#612 Rencontre perdue", action, tmr, rencontre, this); + this.currentRencontre = rencontre; + } switch (action) { case 'derober': await this.derober(); @@ -589,6 +594,7 @@ export class RdDTMRDialog extends Dialog { return await game.system.rdd.rencontresTMR.getRencontreAleatoire(tmr, this.actor.isMauvaiseRencontre()) } else { this._tellToUser(myRoll + ": Pas de rencontre en " + locTMR); + return undefined; } } diff --git a/module/rdd-tmr-rencontre-dialog.js b/module/rdd-tmr-rencontre-dialog.js index 804dd160..b1a859f2 100644 --- a/module/rdd-tmr-rencontre-dialog.js +++ b/module/rdd-tmr-rencontre-dialog.js @@ -29,12 +29,13 @@ export class RdDTMRRencontreDialog extends Dialog { this.toClose = false; this.tmr = tmr; this.tmrApp = tmrApp; + this.rencontre = rencontre; this.tmrApp.minimize(); } async onButtonAction(action) { this.toClose = true; - this.tmrApp.onActionRencontre(action, this.tmr) + this.tmrApp.onActionRencontre(action, this.tmr, this.rencontre) } /* -------------------------------------------- */ -- 2.35.3 From bdc2d8db3aa06386e42913711988193b875a910a Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 19 Jan 2023 01:48:35 +0100 Subject: [PATCH 5/8] Fix blocage du round MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Les ActiveEffect n'ont pas de system, et causaint une exception dans la méthode de passage de fin de round --- module/actor.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/module/actor.js b/module/actor.js index db382a10..450f9591 100644 --- a/module/actor.js +++ b/module/actor.js @@ -859,7 +859,7 @@ export class RdDActor extends RdDBaseActor { return undefined } const path = getPath(fieldName); - if (path){ + if (path) { await this.updateEmbeddedDocuments('Item', [{ _id: competence.id, [path]: value }]); // updates one EmbeddedEntity } } @@ -1284,12 +1284,7 @@ export class RdDActor extends RdDBaseActor { async finDeRound(options = { terminer: false }) { for (let effect of this.getEffects()) { if (effect.duration.type !== 'none' && (effect.duration.remaining <= 0 || options.terminer)) { - if (effect.system.origin) { - await effect.update({ 'disabled': true }); - } - else { - await effect.delete(); - } + await effect.delete(); ChatMessage.create({ content: `${this.name} n'est plus ${Misc.lowerFirst(game.i18n.localize(effect.system.label))} !` }); } } -- 2.35.3 From f221bb31eb69043b96deb0583a48d0af2581903f Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 19 Jan 2023 01:50:02 +0100 Subject: [PATCH 6/8] Version 10.6.3 --- system.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system.json b/system.json index 7bfb9168..5ccab435 100644 --- a/system.json +++ b/system.json @@ -1,8 +1,8 @@ { "id": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", - "version": "10.6.2", - "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.6.2.zip", + "version": "10.6.3", + "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.6.3.zip", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json", "compatibility": { "minimum": "10", -- 2.35.3 From a790c366186276eff7d690b1b0358c7b2b9e8152 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 19 Jan 2023 02:42:25 +0100 Subject: [PATCH 7/8] Soins des blessures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Maintenant, les tâches peuvent être créées directement dans l'onglet combat, à côté des blessures. Les tâches des oins sont dans cet onglet --- module/actor-sheet.js | 10 +++++++++- module/actor.js | 9 ++++++++- module/item-tache.js | 18 ++++++++++++++++-- module/rdd-utility.js | 1 + templates/actor-sheet.html | 1 + templates/actor/chirurgie.html | 21 +++++++++++++++++++++ templates/actor/taches.html | 24 +++++++++++++----------- 7 files changed, 69 insertions(+), 15 deletions(-) create mode 100644 templates/actor/chirurgie.html diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 6ec548c6..221b4ae7 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -151,6 +151,15 @@ 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 => { + this.actor.createTacheBlessure('legere'); + }); + this.html.find('.creer-tache-blessure-grave').click(async event => { + this.actor.createTacheBlessure('grave'); + }); + this.html.find('.creer-tache-blessure-critique').click(async event => { + this.actor.createTacheBlessure('critique'); + }); this.html.find('.creer-une-oeuvre').click(async event => { this.selectTypeOeuvreToCreate(); }); @@ -477,7 +486,6 @@ export class RdDActorSheet extends RdDBaseActorSheet { async createEmptyTache() { await this.actor.createItem('tache', 'Nouvelle tache'); } - _optionRecherche(target) { if (!target.value?.length) { return undefined; diff --git a/module/actor.js b/module/actor.js index 450f9591..22467755 100644 --- a/module/actor.js +++ b/module/actor.js @@ -35,6 +35,7 @@ import { Targets } from "./targets.js"; import { DialogRepos } from "./dialog-repos.js"; import { RdDBaseActor } from "./actor/base-actor.js"; import { RdDTimestamp } from "./rdd-timestamp.js"; +import { RdDItemTache } from "./item-tache.js"; const POSSESSION_SANS_DRACONIC = { img: 'systems/foundryvtt-reve-de-dragon/icons/entites/possession.webp', @@ -46,7 +47,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'] /* -------------------------------------------- */ @@ -2325,6 +2325,13 @@ 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 }); + } + } + /* -------------------------------------------- */ async rollTache(id) { const tacheData = this.getTache(id) diff --git a/module/item-tache.js b/module/item-tache.js index 43b441d5..f17bb9af 100644 --- a/module/item-tache.js +++ b/module/item-tache.js @@ -1,4 +1,18 @@ -export class RdDItemTache extends Item { - +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/rdd-utility.js b/module/rdd-utility.js index b62961df..ef8a1000 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -149,6 +149,7 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/actor/jeux.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/alchimie.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/astrologie.html', + 'systems/foundryvtt-reve-de-dragon/templates/actor/chirurgie.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/non-haut-revant.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/haut-revant.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queues.html', diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index 772f0e72..d27e5384 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -89,6 +89,7 @@ {{#if options.isObserver}}{{!-- Combat Tab --}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/combat.html"}}
+ {{> "systems/foundryvtt-reve-de-dragon/templates/actor/chirurgie.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/blessures.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/maladies-poisons.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/possessions.html"}} diff --git a/templates/actor/chirurgie.html b/templates/actor/chirurgie.html new file mode 100644 index 00000000..2ac0d7ae --- /dev/null +++ b/templates/actor/chirurgie.html @@ -0,0 +1,21 @@ +

Soins

+Blessure légère +Blessure grave +Blessure critique + diff --git a/templates/actor/taches.html b/templates/actor/taches.html index 62afffc2..579d026f 100644 --- a/templates/actor/taches.html +++ b/templates/actor/taches.html @@ -1,16 +1,18 @@

Tâches

Nouvelle Tâche -- 2.35.3 From e19451496504ac7f72d17f7f4c82bcdf9a73d161 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 19 Jan 2023 02:46:54 +0100 Subject: [PATCH 8/8] Taille de titre soins --- templates/actor/chirurgie.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/actor/chirurgie.html b/templates/actor/chirurgie.html index 2ac0d7ae..d53c3da1 100644 --- a/templates/actor/chirurgie.html +++ b/templates/actor/chirurgie.html @@ -1,4 +1,4 @@ -

Soins

+

Soins

Blessure légère Blessure grave Blessure critique -- 2.35.3