diff --git a/module/actor-creature-sheet.js b/module/actor-creature-sheet.js new file mode 100644 index 00000000..93cbdb97 --- /dev/null +++ b/module/actor-creature-sheet.js @@ -0,0 +1,180 @@ + +/** + * Extend the basic ActorSheet with some very simple modifications + * @extends {ActorSheet} + */ + +import { RdDUtility } from "./rdd-utility.js"; + +const creatureCarac = [ "taille", "constitution", "force", "perception", "volonte", "reve" ] +export class RdDActorCreatureSheet extends ActorSheet { + + /** @override */ + static get defaultOptions() { + return mergeObject(super.defaultOptions, { + classes: ["rdd", "sheet", "actor"], + template: "systems/foundryvtt-reve-de-dragon/templates/actor-creature-sheet.html", + width: 640, + height: 720, + tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac"}], + dragDrop: [{dragSelector: ".item-list .item", dropSelector: null}] + }); + } + + /* -------------------------------------------- */ + _checkNull(items) { + if (items && items.length) { + return items; + } + return []; + } + + /* -------------------------------------------- */ + getData() { + let data = super.getData(); + + data.itemsByType = {}; + for (const item of data.items) { + let list = data.itemsByType[item.type]; + if (!list) { + list = []; + data.itemsByType[item.type] = list; + } + list.push(item); + } + + // Compute current carac sum + let sum = 0; + Object.values(data.data.carac).forEach(carac => { if (!carac.derivee) { sum += parseInt(carac.value) } } ); + data.data.caracSum = sum; + + data.data.carac.taille.isTaille = true; // To avoid button link; + data.data.nbLegeres = this.actor.GetNumberBlessures(data.data.blessures.legeres.liste ); + data.data.nbGraves = this.actor.GetNumberBlessures(data.data.blessures.graves.liste ); + data.data.nbCritiques = this.actor.GetNumberBlessures(data.data.blessures.critiques.liste ); + + // low is normal, this the base used to compute the grid. + data.data.fatigueHTML = "
Morsure de la créature
"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_escalade.png","_id":"4GmpkphbsmQjvVVK"} -{"name":"Morsure","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac-value":0,"dommages":0,"description":"Morsure de la créature
"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-morsure.png","_id":"6DK46pyO0hzEuuUg"} -{"name":"Griffes et Crocs","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac-value":0,"dommages":0,"description":"Morsure de la créature
"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-griffes.png","_id":"BjqRrGtHtTzuNpZB"} -{"name":"Esquive","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac-value":0,"dommages":0,"description":"Morsure de la créature
"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_esquive.png","_id":"CYpxxf1uTa78NWR9"} -{"name":"Crête","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac-value":0,"dommages":0,"description":"Morsure de la créature
"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-crete.png","_id":"JTuBQCPdumw3DfxH"} -{"name":"Vol","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac-value":0,"dommages":0,"description":"Morsure de la créature
"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-vol.png","_id":"Kt7WlB5Ui97X211z"} -{"name":"Cornes","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac-value":0,"dommages":0,"description":"Morsure de la créature
"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-corne.png","_id":"LWQHz5ymNBzh6ZEr"} -{"name":"Bras-bouches","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac-value":0,"dommages":0,"description":"Morsure de la créature
"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-brasbouche.png","_id":"NctG7suzvGE7ZZzj"} -{"name":"Pierre Tenue","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac-value":0,"dommages":0,"description":"Morsure de la créature
"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-pierretenue.png","_id":"OzHBowOMADRwcVXR"} -{"name":"Contre","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac-value":0,"dommages":0,"description":"Morsure de la créature
"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-contre.png","_id":"QME3qvTducY1uqpw"} -{"name":"Pinces","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac-value":0,"dommages":0,"description":"Morsure de la créature
"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-pinces.png","_id":"RAnasKnoA3OQgwfv"} -{"name":"Mandibules","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac-value":0,"dommages":0,"description":"Morsure de la créature
"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-mandibules.png","_id":"XgfRxSj8Ty1d3JFM"} -{"name":"Pierre Lancée","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac-value":0,"dommages":0,"description":"Morsure de la créature
"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-pierrelancee.png","_id":"efl1HdDSKpBfImQ1"} -{"name":"Tronçonneuse","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac-value":0,"dommages":0,"description":"Morsure de la créature
"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-tronconneuse.png","_id":"h9ASt4vrvEgxfj7j"} -{"name":"Vigilance","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac-value":0,"dommages":0,"description":"Morsure de la créature
"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_vigilance.png","_id":"lzEdMrKXbOYrWG5S"} -{"name":"Serres","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac-value":0,"dommages":0,"description":"Morsure de la créature
"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-serres.png","_id":"ndNshntOYb1JFNqi"} -{"name":"Bec","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac-value":0,"dommages":0,"description":"Morsure de la créature
"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-beak.png","_id":"os88Rsp7mBkahqmh"} -{"name":"Dague","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac-value":0,"dommages":0,"description":"Morsure de la créature
"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_dague.png","_id":"qilRzXpVaGceNmQp"} -{"name":"Pickpocket","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac-value":0,"dommages":0,"description":"Morsure de la créature
"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_pickpocket.png","_id":"sUdXhpuVVOAlcVpo"} -{"name":"Course","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac-value":0,"dommages":0,"description":"Morsure de la créature
"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_course.png","_id":"shsUV8UpU18c0RJK"} -{"name":"Discrétion","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac-value":0,"dommages":0,"description":"Morsure de la créature
"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_discretion.png","_id":"yDHZfK4RmwQW4YaW"} +{"name":"Escalade","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_escalade.png","_id":"4GmpkphbsmQjvVVK"} +{"name":"Morsure","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/compcreature-morsure.png","_id":"6DK46pyO0hzEuuUg"} +{"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":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-griffes.png","_id":"BjqRrGtHtTzuNpZB"} +{"name":"Esquive","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac-value":0,"dommages":0,"iscombat":false,"description":"Morsure de la créature
"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_esquive.png","_id":"CYpxxf1uTa78NWR9"} +{"name":"Crête","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac-value":0,"dommages":0,"iscombat":true,"description":"Morsure de la créature
"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-crete.png","_id":"JTuBQCPdumw3DfxH"} +{"name":"Vol","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac-value":0,"dommages":0,"iscombat":false,"description":"Morsure de la créature
"},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-vol.png","_id":"Kt7WlB5Ui97X211z"} +{"name":"Cornes","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/compcreature-corne.png","_id":"LWQHz5ymNBzh6ZEr"} +{"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":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-brasbouche.png","_id":"NctG7suzvGE7ZZzj"} +{"name":"Pierre Tenue","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/compcreature-pierretenue.png","_id":"OzHBowOMADRwcVXR"} +{"name":"Pinces","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-pinces.png","_id":"RAnasKnoA3OQgwfv"} +{"name":"Mandibules","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/compcreature-mandibules.png","_id":"XgfRxSj8Ty1d3JFM"} +{"name":"Pierre Lancée","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/compcreature-pierrelancee.png","_id":"efl1HdDSKpBfImQ1"} +{"name":"Tronçonneuse","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/compcreature-tronconneuse.png","_id":"h9ASt4vrvEgxfj7j"} +{"name":"Vigilance","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_vigilance.png","_id":"lzEdMrKXbOYrWG5S"} +{"name":"Serres","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/compcreature-serres.png","_id":"ndNshntOYb1JFNqi"} +{"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":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-beak.png","_id":"os88Rsp7mBkahqmh"} +{"name":"Dague","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_dague.png","_id":"qilRzXpVaGceNmQp"} +{"name":"Pickpocket","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_pickpocket.png","_id":"sUdXhpuVVOAlcVpo"} +{"name":"Course","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_course.png","_id":"shsUV8UpU18c0RJK"} +{"name":"Discrétion","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_discretion.png","_id":"yDHZfK4RmwQW4YaW"} diff --git a/system.json b/system.json index 7ad3bb4b..c3564f28 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.5", + "version": "0.9.7", "minimumCoreVersion": "0.6.0", "compatibleCoreVersion": "0.6.6", - "templateVersion": 31, + "templateVersion": 33, "author": "LeRatierBretonnien", "esmodules": [ "module/rdd-main.js", "module/hook-renderChatLog.js" ], "styles": ["styles/simple.css"], diff --git a/template.json b/template.json index b4776ec8..c022273f 100644 --- a/template.json +++ b/template.json @@ -16,6 +16,133 @@ "beaute": 10, "main": "droitier" }, + "creature": { + "carac": { + "taille": { + "type": "number", + "value": 10, + "label": "Taille", + "xp": 0, + "derivee": false + }, + "constitution": { + "type": "number", + "value": 10, + "label": "Constitution", + "xp": 0, + "derivee": false + }, + "force": { + "type": "number", + "value": 10, + "label": "Force", + "xp": 0, + "derivee": false + }, + "perception": { + "type": "number", + "value": 10, + "label": "Perception", + "xp": 0, + "derivee": false + }, + "volonte": { + "type": "number", + "value": 10, + "label": "Volonté", + "xp": 0, + "derivee": false + }, + "reve": { + "type": "number", + "value": 10, + "label": "Rêve", + "xp": 0, + "derivee": false + } + }, + "sante": { + "vie": { + "type": "number", + "max": 10, + "value": 10, + "label": "Vie", + "derivee": true + }, + "endurance": { + "type": "number", + "max": 10, + "value": 10, + "label": "Endurance", + "derivee": true + }, + "fatigue": { + "type": "number", + "max": 0, + "value": 0, + "label": "Fatigue", + "derivee": true + }, + "sonne": { + "value": false, + "label": "Sonné" + } + }, + "blessures": { + "legeres": { + "liste": [ { "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" }, + { "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" }, + { "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" }, + { "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" }, + { "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" } ] + }, + "graves": { + "liste": [ { "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" }, + { "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" } ] + }, + "critiques": { + "liste": [ { "active": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "localisation": "" } ] + } + }, + "attributs": { + "sconst": { + "type": "number", + "value": 0, + "label": "S. Const", + "derivee": true + }, + "sust": { + "type": "number", + "value": 0, + "label": "Sustentation", + "derivee": true + }, + "plusdom": { + "type": "number", + "value": 0, + "label": "+dom", + "derivee": true + }, + "encombrement": { + "type": "number", + "value": 0, + "label": "Encombrement", + "derivee": true + }, + "malusarmure": { + "type": "number", + "value": 0, + "label": "Malus Armure", + "derivee": true + } + }, + "compteurs": { + "etat": { + "value": 0, + "label": "Etat général" + } + } + }, "common": { "carac": { "taille": { @@ -332,7 +459,7 @@ "templates": [ "common", "description" ] }, "creature": { - "templates": [ "common", "description" ] + "templates": [ "creature", "description" ] } }, "Item": { @@ -398,6 +525,7 @@ "competencecreature": { "niveau": 0, "carac-value": 0, + "iscombat": false, "dommages": 0, "description": "Compétence : ..." }, diff --git a/templates/actor-creature-sheet.html b/templates/actor-creature-sheet.html new file mode 100644 index 00000000..51dbbfee --- /dev/null +++ b/templates/actor-creature-sheet.html @@ -0,0 +1,205 @@ +