From 136ed0825a9e9398255ab80026549ac8b0a3621b Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sun, 3 Jan 2021 16:56:25 +0100 Subject: [PATCH 1/6] #95 Fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - filtrer les items equipés - ensuite filtrer parmi ceux-ci les armes de parade --- module/rdd-combat.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/module/rdd-combat.js b/module/rdd-combat.js index dd9e37b2..536ac566 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -299,17 +299,17 @@ export class RdDCombat { /* -------------------------------------------- */ _filterArmesParade(items, competence) { - let itemsEquipped = items.filter(item => item.data.equipe == true ); + items = items.filter(item => item.data.equipe == true ); switch (competence.data.categorie) { case 'tir': case 'lancer': - return items.filter(item => RdDItemArme.getCategorieParade(itemsEquipped) == 'boucliers') + return items.filter(item => RdDItemArme.getCategorieParade(item) == 'boucliers') default: // Le fléau ne peut être paré qu’au bouclier p115 if (competence.name == "Fléau"){ - return items.filter(item => RdDItemArme.getCategorieParade(itemsEquipped) == 'boucliers') + return items.filter(item => RdDItemArme.getCategorieParade(item) == 'boucliers') } - return items.filter(item => RdDItemArme.getCategorieParade(itemsEquipped)); + return items.filter(item => RdDItemArme.getCategorieParade(item)); } } From 4c76fc607f02e724e92dbb7f0270832c910fb5c0 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sun, 3 Jan 2021 16:58:11 +0100 Subject: [PATCH 2/6] Renomme particuliereAttaque --- module/rdd-bonus.js | 2 +- module/rdd-combat.js | 10 +++++----- templates/chat-resultat-attaque.html | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/module/rdd-bonus.js b/module/rdd-bonus.js index 6276c514..e5b7c156 100644 --- a/module/rdd-bonus.js +++ b/module/rdd-bonus.js @@ -84,7 +84,7 @@ export class RdDBonus { /* -------------------------------------------- */ static _dmgParticuliere(rollData) { - return rollData.particuliereAttaque == 'force' ? 5 : 0; + return rollData.particuliere == 'force' ? 5 : 0; } } \ No newline at end of file diff --git a/module/rdd-combat.js b/module/rdd-combat.js index 536ac566..0ffc6d09 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -247,7 +247,7 @@ export class RdDCombat { rollData.show = { cible: this.target ? this.defender.data.name : 'la cible', - isRecul: (rollData.particuliereAttaque == 'force' || rollData.tactique == 'charge') + isRecul: (rollData.particuliere == 'force' || rollData.tactique == 'charge') } await RdDResolutionTable.displayRollData(rollData, this.attacker.name, 'chat-resultat-attaque.html'); @@ -336,7 +336,7 @@ export class RdDCombat { /* -------------------------------------------- */ async choixParticuliere(rollData, choix) { console.log("RdDCombat.choixParticuliere >>>", rollData, choix); - rollData.particuliereAttaque = choix; + rollData.particuliere = choix; await this._onAttaqueNormale(rollData); } @@ -404,7 +404,7 @@ export class RdDCombat { } static isAttaqueFinesse(attackerRoll) { - return attackerRoll && attackerRoll.particuliereAttaque == 'finesse'; + return attackerRoll && attackerRoll.particuliere == 'finesse'; } needParadeSignificative(attackerRoll, armeParade) { @@ -555,7 +555,7 @@ export class RdDCombat { // Est-ce une parade normale? if (rollData.arme && attackerRoll && !rollData.rolled.isPart) { // Est-ce que l'attaque est une particulière en force ou une charge - if (rollData.needResist || attackerRoll.particuliereAttaque == 'force' || attackerRoll.tactique == 'charge') { + if (rollData.needResist || attackerRoll.particuliere == 'force' || attackerRoll.tactique == 'charge') { rollData.show = rollData.show || {} @@ -621,7 +621,7 @@ export class RdDCombat { } _isAttaqueCauseRecul(attaque) { - return attaque.particuliereAttaque == 'force' || attaque.tactique == 'charge'; + return attaque.particuliere == 'force' || attaque.tactique == 'charge'; } _computeImpactRecul(attaque) { diff --git a/templates/chat-resultat-attaque.html b/templates/chat-resultat-attaque.html index 9ce13b37..82cd90ed 100644 --- a/templates/chat-resultat-attaque.html +++ b/templates/chat-resultat-attaque.html @@ -27,7 +27,7 @@ Le coup vise: {{dmg.loc.label}}. - {{#if (eq particuliereAttaque 'rapidite')}} + {{#if (eq particuliere 'rapidite')}}

Votre attaque rapide vous permet une deuxième attaque, ou défense supplémentaire! From 3211c305195fe541e615f7a527afaa3a3f8ce9b0 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sun, 3 Jan 2021 17:54:16 +0100 Subject: [PATCH 3/6] Fix boutons init/attaque MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Utiliser tout le bouton plutôt que le texte uniquement --- templates/hud-actor-attaque.html | 5 ++--- templates/hud-actor-init.html | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/templates/hud-actor-attaque.html b/templates/hud-actor-attaque.html index a25d2238..5f657c1e 100644 --- a/templates/hud-actor-attaque.html +++ b/templates/hud-actor-attaque.html @@ -3,9 +3,8 @@
{{#each armes as |arme key|}} {{#unless arme.data.initOnly}} -
- +
+
{{/unless}} {{/each}} diff --git a/templates/hud-actor-init.html b/templates/hud-actor-init.html index 11b40a22..94ba2d57 100644 --- a/templates/hud-actor-init.html +++ b/templates/hud-actor-init.html @@ -2,9 +2,8 @@
{{#each armes as |arme key|}} -
- +
+
{{/each}}
From 0072861c3f57f85f0bb85ad5c69657ead5f64ea2 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sun, 3 Jan 2021 19:19:02 +0100 Subject: [PATCH 4/6] =?UTF-8?q?Montrer/cacher=20l'arch=C3=A9type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/actor-sheet.js | 59 +++++++++++--------------------------- module/actor.js | 12 ++++++++ templates/actor-sheet.html | 50 +++++++++++++++++++++++++------- 3 files changed, 69 insertions(+), 52 deletions(-) diff --git a/module/actor-sheet.js b/module/actor-sheet.js index fbad5d0b..e2f6c4fe 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -20,7 +20,8 @@ export class RdDActorSheet extends ActorSheet { tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac"}], dragDrop: [{dragSelector: ".item-list .item", dropSelector: null}], editCaracComp: false, - cacherCompetencesNiveauBase: false, + montrerCompetencesNiveauBase: false, + montrerArchetype: false }); } @@ -28,17 +29,13 @@ export class RdDActorSheet extends ActorSheet { getData() { let data = super.getData(); - // Gestion du lock/unlock des zones éditables (carac+compétences) data.data.editCaracComp = this.options.editCaracComp; - data.data.lockUnlockText = (this.options.editCaracComp) ? "Bloquer" : "Débloquer"; - data.data.lockUnlockIcon = (this.options.editCaracComp) ? "unlocked.svg" : "locked.svg"; - // Gestion de l'affichage total/partiel des compétences - data.data.cacherCompetencesNiveauBase = this.options.cacherCompetencesNiveauBase; - data.data.showHideCompetenceText = (this.options.cacherCompetencesNiveauBase) ? "Montrer tout" : "Filtrer" ; - data.data.showHideCompetenceIcon = (this.options.cacherCompetencesNiveauBase) ? "no-filter.svg" : "filter.svg"; + data.data.montrerCompetencesNiveauBase = this.options.montrerCompetencesNiveauBase; + data.data.montrerArchetype = this.options.montrerArchetype; let compCategorieNiveau = RdDUtility.getLevelCategory(); // recup catégorie data.itemsByType = RdDUtility.buildItemsClassification(data.items); + // Competence per category data.competenceByCategory = {}; let competenceXPTotal = 0; @@ -54,7 +51,7 @@ export class RdDActorSheet extends ActorSheet { if (!RdDUtility.isTronc( item.name ) ) // Ignorer les compétences 'troncs' à ce stade competenceXPTotal += RdDUtility.computeCompetenceXPCost(item); item.data.afficherCompetence = true; - if ( data.data.cacherCompetencesNiveauBase && (Number(item.data.niveau) == Number(compCategorieNiveau[item.data.categorie]) ) ) { + if ( data.data.montrerCompetencesNiveauBase && (Number(item.data.niveau) == Number(compCategorieNiveau[item.data.categorie]) ) ) { item.data.afficherCompetence = false; } list.push(item); @@ -170,31 +167,6 @@ export class RdDActorSheet extends ActorSheet { d.render(true); } - /* -------------------------------------------- */ - afficheResumeArchetype() { - let levelCategory = RdDUtility.getLevelCategory(); - let labelCategory = RdDUtility.getLabelCategory(); - let contentHTML = ""; - for (let compCategory in this.competenceByCategory) { - console.log(">>>>", compCategory); - contentHTML += "
" + labelCategory[compCategory] + ""; - for (let comp of this.competenceByCategory[compCategory]) { - if ( !comp.data.niveau_archetype ) comp.data.niveau_archetype = levelCategory[compCategory]; - contentHTML += "
" + comp.name + " : " + comp.data.niveau_archetype; - } - } - let dialogData = { - content: contentHTML, - buttons: { - one: { - icon: '', - label: "Fermer" - } - } - } - new Dialog( dialogData ).render(true); - } - /* -------------------------------------------- */ async createEmptyTache( ) { await this.actor.createOwnedItem( { name: 'Nouvelle tache', type: 'tache'}, { renderSheet: true } ); @@ -419,6 +391,11 @@ export class RdDActorSheet extends ActorSheet { let compName = event.currentTarget.attributes.compname.value; this.actor.updateCompetenceXP( compName, parseInt(event.target.value) ); } ); + // On competence archetype change + html.find('.competence-archetype').change((event) => { + let compName = event.currentTarget.attributes.compname.value; + this.actor.updateCompetenceArchetype( compName, parseInt(event.target.value) ); + } ); } // Gestion du bouton lock/unlock @@ -426,8 +403,12 @@ export class RdDActorSheet extends ActorSheet { this.options.editCaracComp = !this.options.editCaracComp; this.render(true); }); - html.find('.show-hide-competences').click((event) => { - this.options.cacherCompetencesNiveauBase = !this.options.cacherCompetencesNiveauBase; + html.find('#show-hide-competences').click((event) => { + this.options.montrerCompetencesNiveauBase = !this.options.montrerCompetencesNiveauBase; + this.render(true); + }); + html.find('#show-hide-archetype').click((event) => { + this.options.montrerArchetype = !this.options.montrerArchetype; this.render(true); }); @@ -458,12 +439,6 @@ export class RdDActorSheet extends ActorSheet { html.find('#ethylisme').change((event) => { this.actor.setEthylisme(parseInt(event.target.value) ); } ); - - // Dialog d'archetype - html.find("#affiche-archetype").click((event) => { - this.afficheResumeArchetype() - } ); - html.find('#stress-test').click((event) => { this.actor.stressTest(); this.render(true); diff --git a/module/actor.js b/module/actor.js index 6b2ec179..5d08602a 100644 --- a/module/actor.js +++ b/module/actor.js @@ -611,6 +611,18 @@ export class RdDActor extends Actor { console.log("Competence not found", compName); } } + + /* -------------------------------------------- */ + async updateCompetenceArchetype( compName, compValue ) + { + let comp = this.getCompetence(compName); + if ( comp ) { + const update = {_id: comp._id, 'data.niveau_archetype': compValue }; + const updated = await this.updateEmbeddedEntity("OwnedItem", update); // Updates one EmbeddedEntity + } else { + console.log("Competence not found", compName); + } + } /* -------------------------------------------- */ async updateCompteurValue( fieldName, fieldValue ) diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index 8eb79477..31d24de7 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -98,7 +98,9 @@
+ {{#if ../data.montrerArchetype}} + + {{/if}} {{/if}} {{/each}} @@ -243,6 +258,9 @@
+ {{#if ../data.montrerArchetype}} + + {{/if}} {{/if}} {{/each}} @@ -265,6 +283,9 @@
+ {{#if ../data.montrerArchetype}} + + {{/if}} {{/if}} {{/each}} @@ -285,6 +306,9 @@
+ {{#if ../data.montrerArchetype}} + + {{/if}} {{/if}} {{/each}} @@ -305,6 +329,9 @@
+ {{#if ../data.montrerArchetype}} + + {{/if}} {{/if}} {{/each}} @@ -322,9 +349,12 @@
- - + +
+ {{#if ../data.montrerArchetype}} + + {{/if}} {{/if}} {{/each}} @@ -345,6 +375,9 @@
+ {{#if ../data.montrerArchetype}} + + {{/if}} {{/if}} {{/each}} @@ -355,9 +388,6 @@ Total XP compétences {{data.competenceXPTotal}} -
  • - Voir l'Archetype -
  • From 0aab060dc6737eec1b268c312d11c968b1bff9ca Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sun, 3 Jan 2021 19:20:35 +0100 Subject: [PATCH 5/6] Suppression champs "name" inutiles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ces champ ne sont pas utiles fonctionellement et créent des noeuds inutiles dans le json des personnages. --- templates/actor-creature-sheet.html | 4 +- templates/actor-entite-sheet.html | 4 +- templates/actor-humanoide-sheet.html | 4 +- templates/actor-sheet.html | 65 ++++++++++++++-------------- 4 files changed, 39 insertions(+), 38 deletions(-) diff --git a/templates/actor-creature-sheet.html b/templates/actor-creature-sheet.html index d1e16dae..46aa3029 100644 --- a/templates/actor-creature-sheet.html +++ b/templates/actor-creature-sheet.html @@ -101,12 +101,12 @@ {{#each data.competencecreature as |comp key|}}
  • - {{comp.name}} + {{comp.name}} - {{comp.name}} + {{comp.name}} - {{comp.name}} + {{comp.name}} - {{comp.name}} - - + {{comp.name}} + +
    @@ -229,9 +229,9 @@ {{#if data.afficherCompetence}}
  • - {{comp.name}} - - + {{comp.name}} + +
    @@ -251,9 +251,9 @@ {{#if data.afficherCompetence}}
  • - {{comp.name}} - - + {{comp.name}} + +
    @@ -276,8 +276,8 @@ {{#if data.afficherCompetence}}
  • - {{comp.name}} - + {{comp.name}} +
    @@ -299,8 +299,8 @@ {{#if data.afficherCompetence}}
  • - {{comp.name}} - + {{comp.name}} +
    @@ -322,8 +322,8 @@ {{#if data.afficherCompetence}}
  • - {{comp.name}} - + {{comp.name}} +
    @@ -345,8 +345,8 @@ {{#if data.afficherCompetence}}
  • - {{comp.name}} - + {{comp.name}} +
    @@ -368,9 +368,10 @@ {{#if data.afficherCompetence}}
  • - {{comp.name}} - + {{comp.name}} + +
    @@ -408,7 +409,7 @@
  • {{arme.name}} {{arme.data.initiative}} - {{arme.data.competence}} + {{arme.data.competence}} {{numberFormat arme.data.niveau decimals=0 sign=true}} {{numberFormat arme.data.dommages decimals=0 sign=true}}
  • @@ -434,19 +435,19 @@
  • Premiers soins - +
  • Soins complets - +
  • Jours - +
  • Loc. - +
  • @@ -466,19 +467,19 @@
  • Premiers soins - +
  • Soins complets - +
  • Jours - +
  • Loc. - +
  • @@ -498,19 +499,19 @@
  • Premiers soins - +
  • Soins complets - +
  • Jours - +
  • Loc. - +
  • From 3d98d57fb57e5026bac2b9e3bc6994f1c35a5d3f Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sun, 3 Jan 2021 19:31:06 +0100 Subject: [PATCH 6/6] =?UTF-8?q?Ajout=20xp=5Fsort=20=C3=A0=20xp=20total?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/rdd-utility.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 8c939dc3..69d65567 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -431,6 +431,9 @@ export class RdDUtility { xp += competence_xp_par_niveau[i+10]; //console.log(i, i+10, competence_xp_par_niveau[i+10]); } + if (competence.data.categorie == 'draconic') { + xp+= competence.data.xp_sort; + } return xp; }