diff --git a/module/actor.js b/module/actor.js index f196e47d..4fd1aa9d 100644 --- a/module/actor.js +++ b/module/actor.js @@ -195,6 +195,9 @@ export class RdDActor extends Actor { rollData.degats = new Roll("2d10").roll().total + rollData.domArmePlusDom; rollData.loc = RdDUtility.getLocalisation(); for (let target of game.user.targets) { + rollData.mortalite = (rollData.mortalite) ? rollData.mortalite : "mortel";// Force default + rollData.mortalite = (target.actor.data.type == 'entite') ? "cauchemar" : rollData.mortalite; + console.log("Mortalité : ", rollData.mortalite, target.actor.data.type); defenseMsg = RdDUtility.buildDefenseChatCard(this, target, rollData); explications += "
Cible : " + target.actor.data.name; } @@ -246,6 +249,7 @@ export class RdDActor extends Actor { } } + /* -------------------------------------------- */ _calculBonusDommages(carac, arme, isForce=false) { const dmgArme = parseInt(arme.data.dommages) + (isForce)? 5 : 0; const dmgPerso = parseInt(this.data.data.attributs.plusdom.value); @@ -258,6 +262,7 @@ export class RdDActor extends Actor { return dmgArme + dmgPerso; } + /* -------------------------------------------- */ async _rollLancementDeSort(rollData, rolled) { let sort = duplicate(rollData.selectedSort); @@ -314,6 +319,7 @@ export class RdDActor extends Actor { return explications } + /* -------------------------------------------- */ async sortMisEnReserve(rollData, sort) { let reserve = duplicate(this.data.data.reve.reserve); reserve.list.push({ coord: rollData.coord, sort: sort, draconic: duplicate(rollData.selectedDraconic) }); @@ -469,6 +475,12 @@ export class RdDActor extends Actor { computeEtatGeneral( ) { let data = this.data.data; + // Pas d'état général pour les entités forçage à 0 + if ( this.data.type == 'entite') { + data.compteurs.etat.value = 0; + return; + } + // Pour les autres let state = 0; state = state - (data.sante.vie.max - data.sante.vie.value); if (data.sante.fatigue) // Creatures n'ont pas de fatigue @@ -576,7 +588,7 @@ export class RdDActor extends Actor { if ( data.value > data.max ) data.value = data.max; if ( data.value < 0 ) data.value = 0; - if (name == "endurance") { + if (name == "endurance" && this.data.type != 'entite' ) { if ( sante.fatigue && inc < 0 ) // Each endurance lost -> fatigue lost sante.fatigue.value = sante.fatigue.value - inc @@ -638,11 +650,11 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ manageBlessures( blessuresData ) { - let workData = duplicate(blessuresData); - // Fast exit + if ( this.data.type == 'entite') return; // Une entité n'a pas de blessures if ( blessuresData.legeres + blessuresData.graves + blessuresData.critiques == 0 ) return; + let workData = duplicate(blessuresData); let blessures = duplicate(this.data.data.blessures); // Manage blessures if ( workData.legeres > 0 ) { @@ -813,23 +825,23 @@ export class RdDActor extends Actor { this.rollCompetence( armeName ); //Bypass mode! } - /* -------------------------------------------- */ - async rollCompetence( name, armeItem=undefined, attackerRoll=undefined ) - { - let competence = RdDUtility.findCompetence( this.data.items, name); - console.log("rollCompetence !!!", competence, armeItem, attackerRoll); - // Common rollData values - let rollData = { - ajustementsConditions: CONFIG.RDD.ajustementsConditions, - difficultesLibres: CONFIG.RDD.difficultesLibres, - etat: this.data.data.compteurs.etat.value, - diffConditions: 0, - diffLibre: (attackerRoll) ? attackerRoll.diffLibre : 0, - attackerRoll: attackerRoll, - finalLevel: 0 - } + /* -------------------------------------------- */ + async rollCompetence( name, armeItem=undefined, attackerRoll=undefined ) { + let competence = RdDUtility.findCompetence( this.data.items, name); + console.log("rollCompetence !!!", competence, armeItem, attackerRoll); + // Common rollData values + let rollData = { + ajustementsConditions: CONFIG.RDD.ajustementsConditions, + difficultesLibres: CONFIG.RDD.difficultesLibres, + etat: this.data.data.compteurs.etat.value, + diffConditions: 0, + diffLibre: (attackerRoll) ? attackerRoll.diffLibre : 0, + attackerRoll: attackerRoll, + finalLevel: 0, + coupsNonMortels: false + } - if ( competence.type == 'competencecreature') { // Specific case for Creatures + if ( competence.type == 'competencecreature') { // Specific case for Creatures if ( competence.data.iscombat ) { armeItem = { name: name, data: { dommages: competence.data.dommages} }; } @@ -898,7 +910,8 @@ export class RdDActor extends Actor { let degatsReel = attackerRoll.degats - armure; let result = RdDUtility.computeBlessuresSante(degatsReel, attackerRoll.mortalite); - this.santeIncDec("vie", result.vie); + if ( this.data.type != 'entite') // Pas de PV chez les entités + this.santeIncDec("vie", result.vie); this.santeIncDec("endurance", result.endurance); result.locName = attackerRoll.loc.label; diff --git a/module/rdd-roll-dialog.js b/module/rdd-roll-dialog.js index 11fafe98..f1615405 100644 --- a/module/rdd-roll-dialog.js +++ b/module/rdd-roll-dialog.js @@ -141,6 +141,9 @@ export class RdDRollDialog extends Dialog { console.log("RdDRollDialog - Cout reve", ptreve); updateRollResult(rollData); }); + html.find('#coupsNonMortels').change((event) => { + this.rollData.mortalite = event.currentTarget.checked ? "non-mortel" : "non-mortel"; + }); } /* -------------------------------------------- */ diff --git a/packs/competences-entites.db b/packs/competences-entites.db index eae40968..519236fb 100644 --- a/packs/competences-entites.db +++ b/packs/competences-entites.db @@ -1,17 +1,11 @@ {"name":"Esquive","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":false,"dommages":0,"description":"

Morsure de la créature

"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_esquive.png","effects":[],"_id":"0Ms9iKxqigNNpZEx"} {"_id":"18wcei5hlEInsBFO","name":"Attaque","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"

Morsure de la créature

","carac-value":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-griffes.png","effects":[]} {"_id":"3Crwg8cx2JOb697T","name":"Parade","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":false,"dommages":0,"description":"

Morsure de la créature

","carac-value":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_saut.png","effects":[]} +{"_id":"9Y83OsQgeyR5oCdH","name":"Griffes","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"

Morsure de la créature

","carac-value":null},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-creatures.BjqRrGtHtTzuNpZB"}},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-griffes.png","effects":[]} {"_id":"QGULMUoC9JXFze0r","name":"Bouclier Lourd","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"

Morsure de la créature

","carac-value":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_bouclier.png","effects":[]} {"_id":"WsYnwR8GcOxfuCI0","name":"Bras-Galet","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"

Morsure de la créature

","carac-value":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_course.png","effects":[]} {"name":"Corps à Corps","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"

Morsure de la créature

"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_corps_a_corps.png","effects":[],"_id":"c0I93Q53i4ZmxpyT"} -{"name":"Morsure","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":false,"dommages":0,"description":"

Morsure de la créature

"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-morsure.png","effects":[],"_id":"j1xHCzfIeYKgXxoH"} {"name":"Bec","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"

Morsure de la créature

"},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-creatures.os88Rsp7mBkahqmh"}},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-beak.png","effects":[],"_id":"d5SZ09sFaG3cL2Rg"} -{"name":"Griffes et Crocs","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"

Morsure de la créature

"},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-creatures.BjqRrGtHtTzuNpZB"}},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-griffes.png","effects":[],"_id":"9Y83OsQgeyR5oCdH"} -{"_id":"9Y83OsQgeyR5oCdH","name":"Griffes","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"

Morsure de la créature

","carac-value":null},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-creatures.BjqRrGtHtTzuNpZB"}},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-griffes.png","effects":[]} -{"_id":"3Crwg8cx2JOb697T","name":"Parade","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":false,"dommages":0,"description":"

Morsure de la créature

","carac-value":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_saut.png","effects":[]} -{"name":"Epée Sorde","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"

Morsure de la créature

"},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-humanoides.YTKld5ggDsHqwYoR"}},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_epee_1_main.png","effects":[],"_id":"gPOQd9NI7AFH0whX"} -{"_id":"gPOQd9NI7AFH0whX","name":"Epée Bâtarde","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"

Morsure de la créature

","carac-value":null},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-humanoides.YTKld5ggDsHqwYoR"}},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_epee_1_main.png","effects":[]} -{"_id":"gPOQd9NI7AFH0whX","name":"Epée Bâtarde","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"

Morsure de la créature

","carac-value":null},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-humanoides.YTKld5ggDsHqwYoR"}},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_epee_1_main.png","effects":[]} -{"name":"Bras-bouches","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"

Morsure de la créature

"},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-creatures.NctG7suzvGE7ZZzj"}},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-brasbouche.png","effects":[],"_id":"db8E8HwROw1ZcwRR"} -{"_id":"db8E8HwROw1ZcwRR","name":"Crocs","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"

Morsure de la créature

","carac-value":null},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-creatures.NctG7suzvGE7ZZzj"}},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-brasbouche.png","effects":[]} {"_id":"db8E8HwROw1ZcwRR","name":"Crocs","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"

Morsure de la créature

","carac-value":null},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-creatures.NctG7suzvGE7ZZzj"}},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-brasbouche.png","effects":[]} +{"_id":"gPOQd9NI7AFH0whX","name":"Epée Bâtarde","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"

Morsure de la créature

","carac-value":null},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-humanoides.YTKld5ggDsHqwYoR"}},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_epee_1_main.png","effects":[]} +{"name":"Morsure","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":false,"dommages":0,"description":"

Morsure de la créature

"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-morsure.png","effects":[],"_id":"j1xHCzfIeYKgXxoH"} diff --git a/system.json b/system.json index bf3ac155..132188c0 100644 --- a/system.json +++ b/system.json @@ -2,10 +2,10 @@ "name": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", "description": "Rêve de Dragon RPG for FoundryVTT", - "version": "0.9.44", + "version": "0.9.45", "minimumCoreVersion": "0.7.5", "compatibleCoreVersion": "0.7.6", - "templateVersion": 45, + "templateVersion": 46, "author": "LeRatierBretonnien", "esmodules": [ "module/rdd-main.js", "module/hook-renderChatLog.js" ], "styles": ["styles/simple.css"], diff --git a/template.json b/template.json index c611e197..18fbf7be 100644 --- a/template.json +++ b/template.json @@ -50,6 +50,12 @@ "derivee": false } }, + "compteurs": { + "etat": { + "value": 0, + "label": "Etat général" + } + }, "attributs": { "plusdom": { "type": "number", diff --git a/templates/dialog-competence.html b/templates/dialog-competence.html index 5c919c39..f1eeccce 100644 --- a/templates/dialog-competence.html +++ b/templates/dialog-competence.html @@ -19,7 +19,7 @@ {{/each}} {{/select}} - + {{/if}}