From a1f73c0aa83f0fb306c4f05cd14fc8d71feeadec Mon Sep 17 00:00:00 2001 From: sladecraven Date: Sat, 14 Nov 2020 17:11:17 +0100 Subject: [PATCH] Fix item duplication in same container --- module/actor-sheet.js | 8 +++++--- module/actor.js | 5 ++++- system.json | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/module/actor-sheet.js b/module/actor-sheet.js index bc955925..d87f3908 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -158,7 +158,7 @@ export class RdDActorSheet extends ActorSheet { async displayDialogEncaisser( ) { let data = { bonusmalusTable: CONFIG.RDD.bonusmalus }; let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-encaisser.html', data ); - new RdDEncaisser(html, this.actor ).render(true); + new RdDEncaisser(html, this.actor ).render(true);enleverDeConteneur } /* -------------------------------------------- */ @@ -167,8 +167,10 @@ export class RdDActorSheet extends ActorSheet { let dropID = $(event.target).parents(".item").attr("data-item-id"); // Only relevant if container drop if ( dropID ) { // Dropped over an item !!! let objetId = dragData.id || dragData.data._id; - this.actor.enleverDeConteneur(objetId, this.objetVersConteneur[objetId]); - this.actor.ajouterAConteneur(objetId, dropID); + if ( this.objetVersConteneur[objetId] != dropID ) { + this.actor.enleverDeConteneur(objetId, this.objetVersConteneur[objetId]); + this.actor.ajouterAConteneur(objetId, dropID); + } } console.log("DATA !!!!", dragData, dropID ); super._onDrop(event) diff --git a/module/actor.js b/module/actor.js index 3e8dbbae..924e4ada 100644 --- a/module/actor.js +++ b/module/actor.js @@ -162,6 +162,9 @@ export class RdDActor extends Actor { } } else { // This is the attack roll! if (rolled.isSuccess) { + if (rolled.tache >= 3) { // Critique ! + console.log("TODO Gérer critique!"); + } rollData.domArmePlusDom = parseInt(rollData.arme.data.dommages); if (rollData.selectedCarac.label == "Mêlée") // +dom only for Melee rollData.domArmePlusDom += parseInt(this.data.data.attributs.plusdom.value); @@ -196,7 +199,7 @@ export class RdDActor extends Actor { lvl = rollData.selectedDraconic.name + "/" + rollData.selectedSort.name; let myReve = duplicate(this.data.data.reve.reve); if (rolled.isSuccess) { // Réussite du sort ! - if (rolled.tache >= 4) costReve = Math.ceil(costReve / 2); + if (rolled.tache >= 3) costReve = Math.ceil(costReve / 2); if (costReve < 1) costReve = 1; myReve.value = myReve.value - costReve; // Todo 0 pts de reve !!!! if (myReve.value < 0) myReve.value = 0; diff --git a/system.json b/system.json index 1aefb817..958f5b69 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "name": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", "description": "Rêve de Dragon RPG for FoundryVTT", - "version": "0.9.37", + "version": "0.9.38", "minimumCoreVersion": "0.7.5", "compatibleCoreVersion": "0.7.6", "templateVersion": 44,