From 046e2e97ba4ab81289787183655d390da6fd7aef Mon Sep 17 00:00:00 2001 From: sladecraven Date: Sun, 20 Sep 2020 17:38:21 +0200 Subject: [PATCH] =?UTF-8?q?Gestion=20des=20cr=C3=A9atures?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/actor-creature-sheet.js | 180 +++++++++++++++ module/actor.js | 42 +++- module/rdd-main.js | 11 +- packs/competences-creatures.db | 41 ++-- system.json | 4 +- template.json | 130 ++++++++++- templates/actor-creature-sheet.html | 205 ++++++++++++++++++ templates/item-competence-creature-sheet.html | 4 + templates/item-competencecreature-sheet.html | 4 + 9 files changed, 586 insertions(+), 35 deletions(-) create mode 100644 module/actor-creature-sheet.js create mode 100644 templates/actor-creature-sheet.html 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 = "" + RdDUtility.makeHTMLfatigueMatrix( data.data.sante.fatigue.value, data.data.sante.endurance.max ).html() + "
"; + data.data.competencecreature = data.itemsByType["competencecreature"]; + + return data; + } + + /* -------------------------------------------- */ + /** @override */ + activateListeners(html) { + super.activateListeners(html); + + // Everything below here is only needed if the sheet is editable + if (!this.options.editable) return; + + // Update Inventory Item + html.find('.item-edit').click(ev => { + const li = $(ev.currentTarget).parents(".item"); + const item = this.actor.getOwnedItem(li.data("itemId")); + item.sheet.render(true); + }); + + // Delete Inventory Item + html.find('.item-delete').click(ev => { + const li = $(ev.currentTarget).parents(".item"); + this.actor.deleteOwnedItem(li.data("itemId")); + li.slideUp(200, () => this.render(false)); + }); + + // Blessure control + html.find('.blessure-control').click(ev => { + const li = $(ev.currentTarget).parents(".item"); + let btype = li.data("blessure-type"); + let index = li.data('blessure-index'); + let active = $(ev.currentTarget).data('blessure-active'); + //console.log(btype, index, active); + this.actor.manageBlessureFromSheet(btype, index, active).then( this.render(true) ); + }); + + // Blessure data + html.find('.blessures-soins').change(ev => { + const li = $(ev.currentTarget).parents(".item"); + let btype = li.data('blessure-type'); + let index = li.data('blessure-index'); + let psoins = li.find('input[name=premiers_soins]').val(); + let pcomplets = li.find('input[name=soins_complets]').val(); + let jours = li.find('input[name=jours]').val(); + let loc = li.find('input[name=localisation]').val(); + //console.log(btype, index, psoins, pcomplets, jours, loc); + this.actor.setDataBlessureFromSheet(btype, index, psoins, pcomplets, jours, loc).then( this.render(true) ); + }); + + // Roll Carac + html.find('.carac-label a').click((event) => { + let caracName = event.currentTarget.attributes.name.value; + this.actor.rollCarac( caracName.toLowerCase() ); + }); + + // On competence change + html.find('.creature-carac').change((event) => { + let compName = event.currentTarget.attributes.compname.value; + this.actor.updateCreatureCompetence( compName, "carac-value", parseInt(event.target.value) ); + } ); + html.find('.creature-niveau').change((event) => { + let compName = event.currentTarget.attributes.compname.value; + this.actor.updateCreatureCompetence( compName, "niveau", parseInt(event.target.value) ); + } ); + html.find('.creature-dommages').change((event) => { + let compName = event.currentTarget.attributes.compname.value; + this.actor.updateCreatureCompetence( compName, "dommages", parseInt(event.target.value) ); + } ); + + // Roll Skill + html.find('.competence-label a').click((event) => { + let compName = event.currentTarget.text; + this.actor.rollCreatureCompetence( compName ); + }); + + html.find('#vie-plus').click((event) => { + this.actor.santeIncDec("vie", 1); + this.render(true); + }); + html.find('#vie-moins').click((event) => { + this.actor.santeIncDec("vie", -1); + this.render(true); + }); + html.find('#endurance-plus').click((event) => { + this.actor.santeIncDec("endurance", 1); + this.render(true); + }); + html.find('#endurance-moins').click((event) => { + this.actor.santeIncDec("endurance", -1); + this.render(true); + }); + html.find('#fatigue-plus').click((event) => { + this.actor.santeIncDec("fatigue", 1); + this.render(true); + }); + html.find('#fatigue-moins').click((event) => { + this.actor.santeIncDec("fatigue", -1); + this.render(true); + }); + } + + + /* -------------------------------------------- */ + + /** @override */ + setPosition(options={}) { + const position = super.setPosition(options); + const sheetBody = this.element.find(".sheet-body"); + const bodyHeight = position.height - 192; + sheetBody.css("height", bodyHeight); + return position; + } + + + /* -------------------------------------------- */ + + /** @override */ + _updateObject(event, formData) { + // Update the Actor + return this.object.update(formData); + } +} diff --git a/module/actor.js b/module/actor.js index 64f77c54..c60bc20e 100644 --- a/module/actor.js +++ b/module/actor.js @@ -27,25 +27,21 @@ export class RdDActor extends Actor { if (data.items) { return super.create(data, options); } - + data.items = []; + let compendiumName = ""; if (data.type == "personnage") { - this.push_competence( data, "foundryvtt-reve-de-dragon.competences" ); + compendiumName = "foundryvtt-reve-de-dragon.competences"; } if (data.type == "humanoide") { - this.push_competence( data, "foundryvtt-reve-de-dragon.competences-humanoide" ); + compendiumName = "foundryvtt-reve-de-dragon.competences-humanoide"; } if (data.type == "creature") { - this.push_competence( data, "foundryvtt-reve-de-dragon.competences-creature" ); + compendiumName = "foundryvtt-reve-de-dragon.competences-creatures"; } - super.create(data, options); - } - - /* -------------------------------------------- */ - async push_competence( data, compendiumName ) { let competences = []; const pack = game.packs.get(compendiumName); await pack.getIndex().then(index => competences = index); @@ -55,7 +51,12 @@ export class RdDActor extends Actor { await pack.getEntity(comp._id).then(skill => compItem = skill); data.items.push(compItem); } + + super.create(data, options); } + + /* -------------------------------------------- */ + /* -------------------------------------------- */ prepareData() { @@ -302,6 +303,22 @@ export class RdDActor extends Actor { this.update( { caracpath: caracValue } ); } + /* -------------------------------------------- */ + async updateCreatureCompetence( compName, fieldName, compValue ) + { + let comp = RdDUtility.findCompetence( this.data.items, compName); + if ( comp ) { + const update = {_id: comp._id } + if (fieldName == "niveau") + update['data.niveau']= compValue; + else if (fieldName == "dommages") + update['data.dommages']= compValue; + else + update['data.cacac-value']= compValue; + const updated = await this.updateEmbeddedEntity("OwnedItem", update); // Updates one EmbeddedEntity + } + } + /* -------------------------------------------- */ async updateCompetence( compName, compValue ) { @@ -701,6 +718,13 @@ export class RdDActor extends Actor { this.rollCompetence( armeName ); //Bypass mode! } + /* -------------------------------------------- */ + rollCreatureCompetence( compName ) + { + let compItem = RdDUtility.findCompetence( this.data.items, compName); + //TODO !!!! + } + /* -------------------------------------------- */ async rollCompetence( compName, armeItem=undefined, attackerRoll=undefined ) { diff --git a/module/rdd-main.js b/module/rdd-main.js index 0e750729..59bc08db 100644 --- a/module/rdd-main.js +++ b/module/rdd-main.js @@ -11,8 +11,8 @@ import { RdDActor } from "./actor.js"; import { RdDItemSheet } from "./item-sheet.js"; import { RdDActorSheet } from "./actor-sheet.js"; +import { RdDActorCreatureSheet } from "./actor-creature-sheet.js"; import { RdDUtility } from "./rdd-utility.js"; -import { TMRUtility } from "./tmr-utility.js"; import { RdDCalendrier } from "./rdd-calendrier.js"; /* -------------------------------------------- */ @@ -120,7 +120,14 @@ Hooks.once("init", async function() { // Register sheet application classes Actors.unregisterSheet("core", ActorSheet); - Actors.registerSheet("foundryvtt-reve-de-dragon", RdDActorSheet, { makeDefault: true }); + Actors.registerSheet("foundryvtt-reve-de-dragon", RdDActorSheet, { + types: ["personnage"], + makeDefault: true } + ); + Actors.registerSheet("wfrp4e", RdDActorCreatureSheet, { + types: ["creature"], + makeDefault: true + }); Items.unregisterSheet("core", ItemSheet); Items.registerSheet("foundryvtt-reve-de-dragon", RdDItemSheet, {makeDefault: true}); diff --git a/packs/competences-creatures.db b/packs/competences-creatures.db index 3d5f7412..963eb01f 100644 --- a/packs/competences-creatures.db +++ b/packs/competences-creatures.db @@ -1,21 +1,20 @@ -{"name":"Escalade","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_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 @@ +
+ + {{!-- Sheet Header --}} +
+ +
+

+
+
+
+ Vie + / - + /{{data.sante.vie.max}} +
+
+ Endurance + / - + /{{data.sante.endurance.max}} +
+
+ Sonné : + +
+
+
+ Fatigue + / - + {{{data.fatigueHTML}}} +
+
+
+
+
Blessures légères : {{data.nbLegeres}}
+
Blessures graves : {{data.nbGraves}}
+
Blessure critique : {{data.nbCritiques}}
+
+
+
+
+ + {{!-- Sheet Tab Navigation --}} + + + {{!-- Sheet Body --}} +
+ + {{!-- Carac Tab --}} +
+
+
+
    + {{#each data.carac as |carac key|}} +
  1. + {{#if carac.isTaille}} + {{carac.label}} + {{else}} + {{carac.label}} + {{/if}} + {{#if carac.derivee}} + + {{else}} + + + {{/if}} +
  2. + {{/each}} +
  3. + Total Caractéristiques + {{data.caracSum}} +
  4. +
+
+
+
    + {{#each data.attributs as |attr key|}} +
  1. + {{attr.label}} : {{attr.value}} +
  2. + {{/each}} + {{#each data.sante as |point key|}} +
  3. + {{point.label}} : {{point.value}} / {{point.max}} +
  4. + {{/each}} +
+
+
+
+ + {{!-- Compétences Tab --}} +
+
+
+
    + {{#each data.competencecreature as |comp key|}} +
  1. + + {{comp.name}} + + + +
    + + +
    +
  2. + {{/each}} +
+ +
+ +
+ + {{!-- Combat Tab --}} +
+
+ Armes + Niveau + XP +
+
    + {{#each data.armes as |arme key|}} +
  1. + {{arme.name}} + {{arme.data.competence}} + {{numberFormat arme.data.niveau decimals=0 sign=true}} + {{numberFormat arme.data.dommages decimals=0 sign=true}} +
  2. + {{/each}} +
+
+ + {{!-- blessures Tab --}} +
+ Blessures Légeres : +
+ {{#each data.blessures.legeres.liste as |bless key|}} +
  • + {{#if bless.active}}{{else}}{{/if}} + Premiers soins - + Soins complets - + Jours - + Loc. +
  • + {{/each}} +
    + Blessures Graves : +
    + {{#each data.blessures.graves.liste as |bless key|}} +
  • + {{#if bless.active}}{{else}}{{/if}} + Premiers soins - + Soins complets - + Jours - + Loc. +
  • + {{/each}} +
    + Blessure Critique : +
    + {{#each data.blessures.critiques.liste as |bless key|}} +
  • + {{#if bless.active}}{{else}}{{/if}} + Premiers soins - + Soins complets - + Jours - + Loc. +
  • + + {{/each}} +
    +
    + + {{!-- Biography Tab --}} +
    +
    +
    +
      +
    1. Sexe :
    2. +
    3. Poids :
    4. +
    5. Taille :
    6. +
    7. Cheveux :
    8. +
    9. Yeux :
    10. +
    +
    +
    +
      +
    1. Age :
    2. +
    3. Heure de naissance :
    4. +
    5. Beauté :
    6. +
    7. Main directrice :
    8. +
    + +
    +
    +
    + {{editor content="data.biographie" target="data.biographie" button=true owner=owner editable=editable}} +
    +
    + +
    +
    + diff --git a/templates/item-competence-creature-sheet.html b/templates/item-competence-creature-sheet.html index 729b2295..3c50a1e2 100644 --- a/templates/item-competence-creature-sheet.html +++ b/templates/item-competence-creature-sheet.html @@ -16,6 +16,10 @@ +
    + + +
    diff --git a/templates/item-competencecreature-sheet.html b/templates/item-competencecreature-sheet.html index 729b2295..3c50a1e2 100644 --- a/templates/item-competencecreature-sheet.html +++ b/templates/item-competencecreature-sheet.html @@ -16,6 +16,10 @@
    +
    + + +