From 5a87791b417113ed6c5449413cc63cee82992a07 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 17 Dec 2020 19:42:25 +0100 Subject: [PATCH 1/8] =?UTF-8?q?Fix:=20load=20apr=C3=A8s=20restart?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Après restart, on a un Obnject dans les settings, pas une liste => plante la fenêtre --- module/rdd-calendrier.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/module/rdd-calendrier.js b/module/rdd-calendrier.js index e08a0dc4..bd9d0dda 100644 --- a/module/rdd-calendrier.js +++ b/module/rdd-calendrier.js @@ -58,13 +58,17 @@ export class RdDCalendrier extends Application { } // nombre astral if ( game.user.isGM) { - this.listeNombreAstral = duplicate(game.settings.get("foundryvtt-reve-de-dragon", "liste-nombre-astral")); + this.listeNombreAstral = this._loadListNombreAstral(); this.rebuildListeNombreAstral(); // Ensure always up-to-date } console.log(this.calendrier, this.calendrierPos, this.listeNombreAstral); } + _loadListNombreAstral() { + return Object.values(game.settings.get("foundryvtt-reve-de-dragon", "liste-nombre-astral")); + } + /* -------------------------------------------- */ static get defaultOptions() { const options = super.defaultOptions; @@ -114,7 +118,7 @@ export class RdDCalendrier extends Application { /* -------------------------------------------- */ getNombreAstral( index ) { - const liste = this.listeNombreAstral || game.settings.get("foundryvtt-reve-de-dragon", "liste-nombre-astral") + const liste = this.listeNombreAstral || this._loadListNombreAstral(); let astralData = liste.find( (nombreAstral, i) => nombreAstral.index == index ); return astralData.nombreAstral || "N/A"; } From 142db2697fe8768f5c171b6bd54f8859f005e225 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 17 Dec 2020 22:11:52 +0100 Subject: [PATCH 2/8] =?UTF-8?q?Fatigue=20pour=20humano=C3=AFdes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/rdd-utility.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 7734d4e3..0768aa13 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -78,7 +78,7 @@ function _cumulSegmentsFatigue(matrix) { } /* -------------------------------------------- */ -const fatigueMatrix = _buildAllSegmentsFatigue(30); +const fatigueMatrix = _buildAllSegmentsFatigue(60); const cumulFatigueMatrix = _cumulSegmentsFatigue(fatigueMatrix); const fatigueMalus = [ 0, 0, 0, -1, -1, -1, -2, -3, -4, -5, -6, -7 ]; // Provides the malus for each segment of fatigue From 18a4f1dcf945b32c34ae936b8f6b379274d41b91 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 18 Dec 2020 00:25:23 +0100 Subject: [PATCH 3/8] =?UTF-8?q?La=20fatigue=20s'incr=C3=A9mente?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Du coup, les t^ches doivent augmenter la fatigue --- module/actor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/actor.js b/module/actor.js index 03f9fb27..c62e0a69 100644 --- a/module/actor.js +++ b/module/actor.js @@ -1400,7 +1400,7 @@ export class RdDActor extends Actor { // Mise à jour de la tache rollData.tache.data.points_de_tache_courant += rollData.rolled.ptTache; this.updateEmbeddedEntity( "OwnedItem", rollData.tache); - this.santeIncDec( "fatigue", -rollData.tache.data.fatigue); + this.santeIncDec( "fatigue", rollData.tache.data.fatigue); // Message de résultat ChatUtility.chatWithRollMode({ From 1fb6dd8e96ed863791f0c5a8e649e97e7dc2786c Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 18 Dec 2020 00:44:38 +0100 Subject: [PATCH 4/8] Fix Defense contre armes de tir filtrer les items par type==armes, pour voir quelles parades sont disponibles --- module/rdd-combat.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/module/rdd-combat.js b/module/rdd-combat.js index 12edf14d..6a6a46d1 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -296,7 +296,9 @@ export class RdDCombat { switch (categorie) { case 'tir': case 'lancer': - return items.filter(item => item.data.competence.toLowerCase().match("bouclier")); + return items.filter(item => + item.type == 'arme' && + item.data.competence.toLowerCase().match("bouclier")); default: return items.filter(item => { if (item.type == 'competencecreature') { From da24ff723249a874179d59ec0b6e6cd9191e4127 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 18 Dec 2020 00:45:20 +0100 Subject: [PATCH 5/8] =?UTF-8?q?Echec=20total=20t=C3=A2che=20augmente=20la?= =?UTF-8?q?=20difficult=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/actor.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/module/actor.js b/module/actor.js index c62e0a69..585a47cf 100644 --- a/module/actor.js +++ b/module/actor.js @@ -1133,7 +1133,7 @@ export class RdDActor extends Actor { action: r => this._appliquerAjoutExperience(r) }; } - + /* -------------------------------------------- */ async _appliquerAjoutExperience(rollData) { let xpResult = this.appliquerExperience( rollData.rolled, rollData.selectedCarac.label, (rollData.competence) ? rollData.competence.data.name: undefined ); @@ -1389,6 +1389,7 @@ export class RdDActor extends Actor { label: 'Jet de Tâche ' + tache.name, callbacks: [ this.createCallbackExperience(), + { condition: r=> r.rolled.isETotal, action: r => this._tacheETotal(r)}, { action: r => this._tacheResult(r) } ] } ); @@ -1418,6 +1419,11 @@ export class RdDActor extends Actor { }, this.name); } + _tacheETotal(rollData) { + rollData.tache.data.difficulte --; + this.updateEmbeddedEntity( "OwnedItem", rollData.tache); + } + /* -------------------------------------------- */ _competenceResult(rollData) { ChatUtility.chatWithRollMode({ From 30d1ddef78a36d0a061cbf4a55acaab9c62ca849 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 18 Dec 2020 01:10:03 +0100 Subject: [PATCH 6/8] Editer la protection naturelle --- module/actor-sheet.js | 4 ++++ module/actor.js | 12 ++++++++++-- template.json | 4 ++-- templates/actor-sheet.html | 8 +++++++- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/module/actor-sheet.js b/module/actor-sheet.js index d0f05218..ecbbdf66 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -435,6 +435,10 @@ export class RdDActorSheet extends ActorSheet { this.actor.setPointsDeSeuil(event.currentTarget.value); } ); + html.find('#attribut-protection-edit').change((event) => { + this.actor.updateProtectionValue( event.currentTarget.attributes.name.value, parseInt(event.target.value) ); + } ); + // On stress change html.find('.compteur-edit').change((event) => { let fieldName = event.currentTarget.attributes.name.value; diff --git a/module/actor.js b/module/actor.js index 585a47cf..2707b46d 100644 --- a/module/actor.js +++ b/module/actor.js @@ -528,12 +528,19 @@ export class RdDActor extends Actor { async updateCompteurValue( fieldName, fieldValue ) { //console.log("Update", fieldName, fieldValue); - let content; let compteurs = duplicate(this.data.data.compteurs); compteurs[fieldName].value = fieldValue; await this.update( {"data.compteurs": compteurs } ); } + /* -------------------------------------------- */ + async updateProtectionValue( fieldName, fieldValue ) + { + let attributs = duplicate(this.data.data.attributs); + attributs[fieldName].value = fieldValue; + await this.update( {"data.attributs": attributs } ); + } + /* -------------------------------------------- */ /** Teste si le conteneur de destination a suffisament de capacité * pour recevoir le nouvel objet @@ -1694,7 +1701,8 @@ export class RdDActor extends Actor { this.updateEmbeddedEntity("OwnedItem", update); } } - protection = Math.max(protection - Misc.toInt(arme.data.penetration), 0); + const penetration = arme ? Misc.toInt(arme.data.penetration) : 0; + protection = Math.max(protection - penetration, 0); protection += this.getProtectionNaturelle(); console.log("Final protect", protection); return protection; diff --git a/template.json b/template.json index abf5e47c..a3a9339c 100644 --- a/template.json +++ b/template.json @@ -81,7 +81,7 @@ "protection": { "type": "number", "value": 0, - "label": "Protection", + "label": "Protection naturelle", "derivee": false } } @@ -189,7 +189,7 @@ "protection": { "type": "number", "value": 0, - "label": "Protection", + "label": "Protection naturelle", "derivee": false } }, diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index 6223eaa5..6ccaff32 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -125,7 +125,13 @@
    {{#each data.attributs as |attr key|}}
  • - {{attr.label}} : {{attr.value}} + {{attr.label}} : + {{#if (eq key 'protection')}} + + {{else}} + {{attr.value}} + {{/if}} +
  • {{/each}}
From 18545d5e884739fcf597d76fabede6a8fa940c13 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 18 Dec 2020 01:11:51 +0100 Subject: [PATCH 7/8] Supprimer code de templates --- module/actor.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/module/actor.js b/module/actor.js index 2707b46d..5b0d4d53 100644 --- a/module/actor.js +++ b/module/actor.js @@ -1319,10 +1319,6 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ async rollCompetence( name ) { - if (name == 'queue') { - await this.ajouterQueue({chat: true}); - return; - } let rollData = { competence: duplicate(this.getCompetence(name)), needSignificative : !this.isEntiteCauchemar() && this.data.data.sante.sonne.value From 635701033d4d483e4616c03963df5f6dc08b6908 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 18 Dec 2020 01:23:11 +0100 Subject: [PATCH 8/8] Bonus de conditions en attaque MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ne pas écraser diffConditions à chaque updateRollResult, sinon, la valeur est perdue et non visible sur le jet de dés --- module/rdd-roll.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/module/rdd-roll.js b/module/rdd-roll.js index 48d5993f..6070a707 100644 --- a/module/rdd-roll.js +++ b/module/rdd-roll.js @@ -35,7 +35,7 @@ export class RdDRoll extends Dialog { etat: actor.data.data.compteurs.etat.value, carac: actor.data.data.carac, finalLevel: 0, - diffConditions: 0, + diffConditions: rollData.arme ? RdDBonus.bonusAttaque(rollData.surpriseDefenseur) :0, diffLibre: 0, editLibre: true, editConditions: true, @@ -110,7 +110,6 @@ export class RdDRoll extends Dialog { rollData.dmg = rollData.attackerRoll ? rollData.attackerRoll.dmg : RdDBonus.dmg(rollData, actor.getBonusDegat()); rollData.finalLevel = rollLevel; rollData.caracValue = caracValue; - rollData.diffConditions = RdDBonus.bonusAttaque(rollData.surpriseDefenseur); rollData.coupsNonMortels = (rollData.attackerRoll ? rollData.attackerRoll.dmg.mortalite : rollData.dmg.mortalite) == 'non-mortel'; let dmgText = Misc.toSignedString(rollData.dmg.total); if (rollData.coupsNonMortels) {