Impacts uniquement sur l'acteur

This commit is contained in:
2025-10-15 22:40:31 +02:00
parent 2cf5b06da8
commit 3e8963b20b
2 changed files with 6 additions and 10 deletions

View File

@@ -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)

View File

@@ -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)
}
}