From 259a7577e832ba3d3f5220c9073eb683088e6c08 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Wed, 17 Jun 2020 20:31:43 +0200 Subject: [PATCH] Sync with gitlab --- RdD.geany | 22 ++++----- module/actor.js | 14 ++++-- module/rdd-main.js | 4 ++ module/rdd-utility.js | 40 ++++++++++++++-- system.json | 11 +++-- template.json | 2 +- templates/actor-sheet.html | 84 ++++++++++++++++++++++------------ templates/item-arme-sheet.html | 12 +++++ 8 files changed, 135 insertions(+), 54 deletions(-) diff --git a/RdD.geany b/RdD.geany index 1b76476a..795cbc6e 100644 --- a/RdD.geany +++ b/RdD.geany @@ -27,18 +27,18 @@ long_line_behaviour=1 long_line_column=72 [files] -current_page=2 -FILE_NAME_0=4448;JSON;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplate.json;0;2 -FILE_NAME_1=5464;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor-sheet.js;0;2 -FILE_NAME_2=1630;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Factor-sheet.html;0;2 -FILE_NAME_3=2579;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-roll-dialog.js;0;2 -FILE_NAME_4=10119;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor.js;0;2 -FILE_NAME_5=0;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fdialog-competence.html;0;2 -FILE_NAME_6=14208;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-utility.js;0;2 -FILE_NAME_7=543;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-main.js;0;2 +current_page=7 +FILE_NAME_0=3953;JSON;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplate.json;0;2 +FILE_NAME_1=2644;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor-sheet.js;0;2 +FILE_NAME_2=17522;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Factor-sheet.html;0;2 +FILE_NAME_3=1360;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-roll-dialog.js;0;2 +FILE_NAME_4=13867;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor.js;0;2 +FILE_NAME_5=416;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fdialog-roll-carac.html;0;2 +FILE_NAME_6=20632;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-utility.js;0;2 +FILE_NAME_7=975;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-main.js;0;2 FILE_NAME_8=1639;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fitem-competence-sheet.html;0;2 -FILE_NAME_9=1796;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fitem-arme-sheet.html;0;2 -FILE_NAME_10=10349;CSS;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fstyles%2Fsimple.css;0;2 +FILE_NAME_9=2486;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fitem-arme-sheet.html;0;2 +FILE_NAME_10=0;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Ftoto_init_hook.js;0;2 [VTE] last_dir=/home/sigmar diff --git a/module/actor.js b/module/actor.js index 34381641..eae69eeb 100644 --- a/module/actor.js +++ b/module/actor.js @@ -133,11 +133,19 @@ export class RdDActor extends Actor { specialStr = "
Esquive/Parade échouée, encaissement !"; encaisser = true; } - } else { + } else { // This is the attack roll! if ( rollData.pointsDeTache > 0 ) { let myroll = new Roll("2d10"); myroll.roll(); - rollData.degats = parseInt(myroll.result) + parseInt(rollData.arme.data.dommages) + parseInt(this.data.data.attributs.plusdom.value); + rollData.degats = parseInt(myroll.result) + parseInt(rollData.arme.data.dommages); + if ( rollData.selectedCarac.label == "Mêlée" ) // +dom only for Melee + rollData.degats += parseInt(this.data.data.attributs.plusdom.value); + if ( rollData.selectedCarac.label == "Lancer" ) { // +dom only for Melee/Lancer + let bdom = parseInt(this.data.data.attributs.plusdom.value); + if ( bdom > parseInt(rollData.arme.data.dommages)*2 ) + bdom = parseInt(rollData.arme.data.dommages)*2; + rollData.degats += bdom + } rollData.loc = RdDUtility.getLocalisation(); for (let target of game.user.targets) { defenseMsg = RdDUtility.buildDefenseChatCard(this, target, rollData ); @@ -156,7 +164,7 @@ export class RdDActor extends Actor { let lvl = (rollData.competence) ? rollData.competence.name : rollData.bmValue; let chatOptions = { content: "Test : " + rollData.selectedCarac.label + " / " + lvl + "
Jet : " + - rollData.selectedCarac.value + " / " + rollData.finalLevelStr + " - " + rollData.rollTarget.score + "%
Résutat : " + myroll.total + "
" + + rollData.selectedCarac.value + " / " + rollData.finalLevelStr + " -> " + rollData.rollTarget.score + "%
Résutat : " + myroll.total + "
" + "" + quality + "" + specialStr + xpmsg, user: game.user._id, title: "Résultat du test" diff --git a/module/rdd-main.js b/module/rdd-main.js index ad48fba6..ca9372d8 100644 --- a/module/rdd-main.js +++ b/module/rdd-main.js @@ -31,6 +31,10 @@ Hooks.once("init", async function() { formula: "1d20", decimals: 2 }; + + game.socket.on("system.foundryvtt-reve-de-dragon", data => { + RdDUtility.performSocketMesssage( data ); + }); // Define custom Entity classes CONFIG.Actor.entityClass = RdDActor; diff --git a/module/rdd-utility.js b/module/rdd-utility.js index e6372df2..21c78f06 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -435,22 +435,52 @@ export class RdDUtility { defenseMsg.content += "
Parer avec " + arme.name + ""; } } + defenseMsg.content += "
Esquiver"; } - // TODO - Tir + Lancer - + if ( rollData.competence.data.categorie == "tir" ) { + for (const arme of target.actor.data.items) { // Bouclier for parry + if ( arme.type == "arme" && arme.name.toLowerCase.match("bouclier") ) { + defenderArmes.push( arme ); + defenseMsg.content += "
Parer avec " + arme.name + ""; + } + } + } + if ( rollData.competence.data.categorie == "lancer" ) { + for (const arme of target.actor.data.items) { // Bouclier for parry Dodge/Esquive + if ( arme.type == "arme" && arme.name.toLowerCase.match("bouclier") ) { + defenderArmes.push( arme ); + defenseMsg.content += "
Parer avec " + arme.name + ""; + } + } + defenseMsg.content += "
Esquiver"; + } + return defenseMsg; } + /* -------------------------------------------- */ + static performSocketMesssage( data ) + { + console.log(">>>>> MSG RECV", data); + } + /* -------------------------------------------- */ static async chatListeners( html ) { html.on("click", '#encaisser-button', event => { event.preventDefault(); console.log("Encaisser button", event); - let attackerActor = game.actors.get(event.currentTarget.attributes['data-attackerid'].value ); - let defenderActor = game.actors.get(event.currentTarget.attributes['data-defenderid'].value ); + let attackerActor = game.actors.get( event.currentTarget.attributes['data-attackerid'].value ); + //let defenderActor = game.actors.get(event.currentTarget.attributes['data-defenderid'].value ); let rollData = attackerActor.getFlag("foundryvtt-reve-de-dragon", "rollData"); - defenderActor.encaisserDommages( rollData ); + rollData.attackerid = event.currentTarget.attributes['data-attackerid'].value; + rollData.defenderid = event.currentTarget.attributes['data-defenderid'].value; + game.socket.emit("system.foundryvtt-reve-de-dragon", { + msg: "msg_encaisser", + data: rollData + } ); + console.log("-> MSG SENT"); + //defenderActor.encaisserDommages( rollData ); }); html.on("click", '#parer-button', event => { diff --git a/system.json b/system.json index 1f7b1fab..c098f981 100644 --- a/system.json +++ b/system.json @@ -2,10 +2,10 @@ "name": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", "description": "L'implémentation de Rêve de Dragon pour FoundryVTT", - "version": "0.7.2", + "version": "0.7.4", "minimumCoreVersion": "0.6.0", - "compatibleCoreVersion": "0.6.0", - "templateVersion": 12, + "compatibleCoreVersion": "0.6.2", + "templateVersion": 13, "author": "LeRatierBretonnien", "esmodules": [ "module/rdd-main.js", "module/hook-renderChatLog.js" ], "styles": ["styles/simple.css"], @@ -13,8 +13,9 @@ "languages": [], "gridDistance": 5, "gridUnits": "ft", - "primaryTokenAttribute": "data.sante.vie", - "secondaryTokenAttribute": "data.sante.fatigue", + "primaryTokenAttribute": "sante.vie", + "secondaryTokenAttribute": "sante.endurance", + "socket": true, "url": "https://gitlab.com/LeRatierBretonnien/foundryvtt-reve-de-dragon/", "manifest": "https://gitlab.com/LeRatierBretonnien/foundryvtt-reve-de-dragon/raw/master/system.json", "download": "https://gitlab.com/LeRatierBretonnien/foundryvtt-reve-de-dragon/-/archive/master/foundryvtt-reve-de-dragon-master.zip", diff --git a/template.json b/template.json index 98c3000e..1b2b0362 100644 --- a/template.json +++ b/template.json @@ -315,7 +315,7 @@ "cout": 0, "portee_courte": 0, "portee_moyenne": 0, - "portee_longue": 0, + "portee_extreme": 0, "rapide": false }, "munition": { diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index bc181faf..c9d3b61e 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -137,6 +137,60 @@
+
+ Compétences De Mêlée +
+
    + {{#each data.competenceByCategory.melee as |comp key|}} +
  1. + + {{comp.name}} + + +
    + + +
    +
  2. + {{/each}} +
+ +
+ Compétences De Tir +
+
    + {{#each data.competenceByCategory.tir as |comp key|}} +
  1. + + {{comp.name}} + + +
    + + +
    +
  2. + {{/each}} +
+ +
+ Compétences De Lancer +
+
    + {{#each data.competenceByCategory.lancer as |comp key|}} +
  1. + + {{comp.name}} + + +
    + + +
    +
  2. + {{/each}} +
+
Compétences Spécialisées
@@ -197,7 +251,7 @@ {{!-- Combat Tab --}}
- Compétences de Mêlée + Armes Niveau XP
@@ -211,34 +265,6 @@ {{/each}} -
- Compétences de Tir - Niveau - XP -
-
    - {{#each data.competenceByCategory.tir as |comp key|}} -
  1. - {{comp.name}} - - -
  2. - {{/each}} -
-
- Compétences de Lancer - Niveau - XP -
-
    - {{#each data.competenceByCategory.lancer as |comp key|}} -
  1. - {{comp.name}} - - -
  2. - {{/each}} -
{{!-- blessures Tab --}} diff --git a/templates/item-arme-sheet.html b/templates/item-arme-sheet.html index 58fe860f..701f9626 100644 --- a/templates/item-arme-sheet.html +++ b/templates/item-arme-sheet.html @@ -36,6 +36,18 @@
+
+ + +
+
+ + +
+
+ + +