Fix item duplication in same container

This commit is contained in:
sladecraven 2020-11-14 17:11:17 +01:00
parent be02d5a137
commit a1f73c0aa8
3 changed files with 10 additions and 5 deletions

View File

@ -158,7 +158,7 @@ export class RdDActorSheet extends ActorSheet {
async displayDialogEncaisser( ) { async displayDialogEncaisser( ) {
let data = { bonusmalusTable: CONFIG.RDD.bonusmalus }; let data = { bonusmalusTable: CONFIG.RDD.bonusmalus };
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-encaisser.html', data ); 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 let dropID = $(event.target).parents(".item").attr("data-item-id"); // Only relevant if container drop
if ( dropID ) { // Dropped over an item !!! if ( dropID ) { // Dropped over an item !!!
let objetId = dragData.id || dragData.data._id; let objetId = dragData.id || dragData.data._id;
this.actor.enleverDeConteneur(objetId, this.objetVersConteneur[objetId]); if ( this.objetVersConteneur[objetId] != dropID ) {
this.actor.ajouterAConteneur(objetId, dropID); this.actor.enleverDeConteneur(objetId, this.objetVersConteneur[objetId]);
this.actor.ajouterAConteneur(objetId, dropID);
}
} }
console.log("DATA !!!!", dragData, dropID ); console.log("DATA !!!!", dragData, dropID );
super._onDrop(event) super._onDrop(event)

View File

@ -162,6 +162,9 @@ export class RdDActor extends Actor {
} }
} else { // This is the attack roll! } else { // This is the attack roll!
if (rolled.isSuccess) { if (rolled.isSuccess) {
if (rolled.tache >= 3) { // Critique !
console.log("TODO Gérer critique!");
}
rollData.domArmePlusDom = parseInt(rollData.arme.data.dommages); rollData.domArmePlusDom = parseInt(rollData.arme.data.dommages);
if (rollData.selectedCarac.label == "Mêlée") // +dom only for Melee if (rollData.selectedCarac.label == "Mêlée") // +dom only for Melee
rollData.domArmePlusDom += parseInt(this.data.data.attributs.plusdom.value); 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; lvl = rollData.selectedDraconic.name + "/" + rollData.selectedSort.name;
let myReve = duplicate(this.data.data.reve.reve); let myReve = duplicate(this.data.data.reve.reve);
if (rolled.isSuccess) { // Réussite du sort ! 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; if (costReve < 1) costReve = 1;
myReve.value = myReve.value - costReve; // Todo 0 pts de reve !!!! myReve.value = myReve.value - costReve; // Todo 0 pts de reve !!!!
if (myReve.value < 0) myReve.value = 0; if (myReve.value < 0) myReve.value = 0;

View File

@ -2,7 +2,7 @@
"name": "foundryvtt-reve-de-dragon", "name": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon", "title": "Rêve de Dragon",
"description": "Rêve de Dragon RPG for FoundryVTT", "description": "Rêve de Dragon RPG for FoundryVTT",
"version": "0.9.37", "version": "0.9.38",
"minimumCoreVersion": "0.7.5", "minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.6", "compatibleCoreVersion": "0.7.6",
"templateVersion": 44, "templateVersion": 44,