diff --git a/icons/armures/icon_cuir_epais.png b/icons/armures/icon_cuir_epais.png new file mode 100644 index 00000000..5b1ab96a Binary files /dev/null and b/icons/armures/icon_cuir_epais.png differ diff --git a/icons/armures/icon_cuir_metal.png b/icons/armures/icon_cuir_metal.png new file mode 100644 index 00000000..478ced0a Binary files /dev/null and b/icons/armures/icon_cuir_metal.png differ diff --git a/icons/armures/icon_cuir_souple.png b/icons/armures/icon_cuir_souple.png new file mode 100644 index 00000000..71dc5fcb Binary files /dev/null and b/icons/armures/icon_cuir_souple.png differ diff --git a/icons/armures/icon_drap_matelasse.png b/icons/armures/icon_drap_matelasse.png new file mode 100644 index 00000000..0fd5a04b Binary files /dev/null and b/icons/armures/icon_drap_matelasse.png differ diff --git a/icons/armures/icon_mailles_fer.png b/icons/armures/icon_mailles_fer.png new file mode 100644 index 00000000..30e8c739 Binary files /dev/null and b/icons/armures/icon_mailles_fer.png differ diff --git a/icons/armures/icon_plaques_fer.png b/icons/armures/icon_plaques_fer.png new file mode 100644 index 00000000..f6fe1d38 Binary files /dev/null and b/icons/armures/icon_plaques_fer.png differ diff --git a/module/actor-sheet.js b/module/actor-sheet.js index b8a44023..453d8855 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -65,6 +65,9 @@ export class RdDActorSheet extends ActorSheet { arme.data.niveau = melee.data.niveau } } + + // To avoid armour and so on... + data.data.armes_seules = duplicate( this._checkNull(data.itemsByType['arme'])); if (data.competenceByCategory && data.competenceByCategory.melee) { //Specific case for Esquive and Corps à Corps @@ -88,9 +91,9 @@ export class RdDActorSheet extends ActorSheet { data.data.armures = this._checkNull(data.itemsByType['armure']); data.data.livres = this._checkNull(data.itemsByType['livre']); data.data.potions = this._checkNull(data.itemsByType['potions']); - data.data.herbes = this._checkNull(data.itemsByType['potions']); + data.data.herbes = this._checkNull(data.itemsByType['herbes']); data.data.competenceByCategory = data.competenceByCategory; - data.data.armes = data.itemsByType.arme; + //data.data.armes = data.itemsByType.arme; //console.log(">>>>> data update"); return data; @@ -119,6 +122,13 @@ export class RdDActorSheet extends ActorSheet { li.slideUp(200, () => this.render(false)); }); + // Equip Inventory Item + html.find('.item-equip').click(ev => { + const li = $(ev.currentTarget).parents(".item"); + this.actor.equiperObjet(li.data("itemId")); + this.render(true); + }); + // Roll Carac html.find('.carac-label a').click((event) => { let caracName = event.currentTarget.attributes.name.value; @@ -138,45 +148,45 @@ export class RdDActorSheet extends ActorSheet { }); // On carac change - $(".carac-value").change((event) => { + html.find('.carac-value').change((event) => { let caracName = event.currentTarget.name.replace(".value", "").replace("data.carac.", ""); //console.log("Value changed :", event, caracName); this.actor.updateCarac( caracName, parseInt(event.target.value) ); } ); // On competence change - $(".competence-value").change((event) => { + html.find('.competence-value').change((event) => { let compName = event.currentTarget.attributes.compname.value; //console.log("Competence changed :", compName); this.actor.updateCompetence( compName, parseInt(event.target.value) ); } ); // On competence change - $(".competence-xp").change((event) => { + html.find('.competence-xp').change((event) => { let compName = event.currentTarget.attributes.compname.value; this.actor.updateCompetenceXP( compName, parseInt(event.target.value) ); } ); - $("#vie-plus").click((event) => { + html.find('#vie-plus').click((event) => { this.actor.santeIncDec("vie", 1); this.render(true); }); - $("#vie-moins").click((event) => { + html.find('#vie-moins').click((event) => { this.actor.santeIncDec("vie", -1); this.render(true); }); - $("#endurance-plus").click((event) => { + html.find('#endurance-plus').click((event) => { this.actor.santeIncDec("endurance", 1); this.render(true); }); - $("#endurance-moins").click((event) => { + html.find('#endurance-moins').click((event) => { this.actor.santeIncDec("endurance", -1); this.render(true); }); - $("#fatigue-plus").click((event) => { + html.find('#fatigue-plus').click((event) => { this.actor.santeIncDec("fatigue", 1); this.render(true); }); - $("#fatigue-moins").click((event) => { + html.find('#fatigue-moins').click((event) => { this.actor.santeIncDec("fatigue", -1); this.render(true); }); diff --git a/module/actor.js b/module/actor.js index 0490c8af..98c7e689 100644 --- a/module/actor.js +++ b/module/actor.js @@ -394,11 +394,25 @@ export class RdDActor extends Actor { } } + /* -------------------------------------------- */ + equiperObjet( itemID ) + { + let item = this.getOwnedItem(itemID); + if ( item && item.data.data ) + item.data.data.equipe = !item.data.data.equipe; + } + /* -------------------------------------------- */ computeArmure( locData ) { - /* TODO */ - return 0; + let protection = 0; + for (const item of this.data.items) { + if (item.type == "armure" && item.data.equipe) { + protection += item.data.protection; + } + } + console.log("Final protect", protection); + return protection; } /* -------------------------------------------- */ diff --git a/module/rdd-roll-dialog.js b/module/rdd-roll-dialog.js index bd4dd751..bf1a7a48 100644 --- a/module/rdd-roll-dialog.js +++ b/module/rdd-roll-dialog.js @@ -93,12 +93,12 @@ export class RdDRollDialog extends Dialog { }); // Update ! - $('#bonusmalus').click((event) => { + html.find('#bonusmalus').click((event) => { rollData.bmValue = event.currentTarget.value; // Update the selected bonus/malus //console.log("BM CLICKED !!!", rollData.bmValue, rollData.competence.data.niveau, parseInt(rollData.competence.data.niveau) + parseInt(rollData.bmValue) ); updateRollResult(rollData); }); - $('#carac').click((event) => { + html.find('#carac').click((event) => { let caracKey = event.currentTarget.value; rollData.selectedCarac = rollData.carac[caracKey]; // Update the selectedCarac //console.log("CARAC CLICKED !!!", rollData.selectedCarac, rollData.competence.data.niveau, rollData.bmValue); diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 73f7f094..80d42107 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -77,6 +77,7 @@ export class RdDUtility { //Items 'systems/foundryvtt-reve-de-dragon/templates/item-competence-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/item-arme-sheet.html', + 'systems/foundryvtt-reve-de-dragon/templates/item-armure-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/competence-categorie.html', 'systems/foundryvtt-reve-de-dragon/templates/competence-carac-defaut.html', 'systems/foundryvtt-reve-de-dragon/templates/competence-base.html', diff --git a/system.json b/system.json index 18d476c4..59da0d68 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.4", + "version": "0.7.5", "minimumCoreVersion": "0.6.0", "compatibleCoreVersion": "0.6.2", - "templateVersion": 13, + "templateVersion": 14, "author": "LeRatierBretonnien", "esmodules": [ "module/rdd-main.js", "module/hook-renderChatLog.js" ], "styles": ["styles/simple.css"], diff --git a/template.json b/template.json index 1b2b0362..b7671f6a 100644 --- a/template.json +++ b/template.json @@ -330,7 +330,8 @@ "quantite": 1, "encombrement": 0, "equipe": false, - "pa": 0, + "protection": 0, + "deterioration": 0, "malus": 0, "cout": 0 }, diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index a508c2ac..856f773e 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -306,13 +306,27 @@ {{!-- Equipment Tab --}}
    - {{#each actor.items as |item id|}} + {{#each data.armes_seules as |item id|}}
  1. - +

    {{item.name}}

    +
  2. + {{/each}} +
+
    + {{#each data.armures as |item id|}} +
  1. + +

    {{item.name}}

    +
  2. {{/each}} diff --git a/templates/item-armure-sheet.html b/templates/item-armure-sheet.html new file mode 100644 index 00000000..dec0f65c --- /dev/null +++ b/templates/item-armure-sheet.html @@ -0,0 +1,39 @@ +
    +
    + +
    +

    +
    +
    + + {{!-- Sheet Body --}} +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + Description : +
    +
    + {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} +
    +
    + +