From 3e8963b20bd3f0eb25d95c52cc038fa3f5136728 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Wed, 15 Oct 2025 22:40:31 +0200 Subject: [PATCH] Impacts uniquement sur l'acteur --- module/roll/roll-dialog.mjs | 8 ++------ module/roll/roll-type-cuisine.mjs | 8 ++++---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/module/roll/roll-dialog.mjs b/module/roll/roll-dialog.mjs index 5d73e2a1..1c368137 100644 --- a/module/roll/roll-dialog.mjs +++ b/module/roll/roll-dialog.mjs @@ -450,10 +450,7 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2 roll.choix = {} roll.rolled = await RollDialogAdapter.rollDice(roll, this.rollTitle(roll)) - const impacts = { - active: new ActorImpacts(roll.active), - opponent: roll.opponent ? new ActorImpacts(roll.opponent) : undefined - } + const impacts = new ActorImpacts(roll.active) roll.result = selectedRollType.getResult(roll, impacts) @@ -465,8 +462,7 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2 await Promise.all(callbacks.map(async callback => await callback(roll))) - await impacts.active?.applyImpacts() - await impacts.opponent?.applyImpacts() + await impacts.applyImpacts() selectedRollType.onApplyImpacts(roll, impacts) await this.chatRollResult.display(roll, impacts) this.rollOptions.onRollDone(this) diff --git a/module/roll/roll-type-cuisine.mjs b/module/roll/roll-type-cuisine.mjs index 0f92ecde..c4b38d1f 100644 --- a/module/roll/roll-type-cuisine.mjs +++ b/module/roll/roll-type-cuisine.mjs @@ -32,17 +32,17 @@ export class RollTypeCuisine extends RollType { if (current.fabriquer) { const plat = this.$prepareNourriture(rollData.active.name, current, result) result.messages.push(`${plat.system.quantite} ${plat.name} ont été préparés dans l'équipement`) - impacts.active.addCreated('Item', plat) + impacts.addCreated('Item', plat) result.plat = { id: plat.id } } if (current.ingredient) { const quantite = Math.min(current.proportions, current.ingredient.system.quantite) if (quantite == current.ingredient.system.quantite) { - impacts.active.addDeleted('Item', current.ingredient) + impacts.addDeleted('Item', current.ingredient) result.messages.push(`Il n'y a plus de ${ingredient.name}`) } else { - impacts.active.addDelta('Item', current.ingredient, 'system.quantite', -current.proportions) + impacts.addDelta('Item', current.ingredient, 'system.quantite', -current.proportions) result.messages.push(`${current.proportions} ${current.ingredient.name} ont été utilisés`) } } @@ -51,7 +51,7 @@ export class RollTypeCuisine extends RollType { onApplyImpacts(roll, impacts) { if (roll.result.plat) { // le plat n'est pas créé immédiatement, il faut donc retrouver l'id - roll.result.plat.id = impacts.active.findCreatedId('Item', roll.result.plat.id) + roll.result.plat.id = impacts.findCreatedId('Item', roll.result.plat.id) } }