[Fix] 397 - Reroll Improvements (#400)

* Fixed reroll correcting automation hope/fear/stress

* Fixed advantage/disadvantage reroll counting on d20s
This commit is contained in:
WBHarry 2025-07-25 00:06:41 +02:00 committed by GitHub
parent e8e328039e
commit 80744381f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 86 additions and 7 deletions

View file

@ -171,11 +171,19 @@ export default class DualityRoll extends D20Roll {
data.hope = {
dice: roll.dHope.denomination,
value: roll.dHope.total
value: roll.dHope.total,
rerolled: {
any: roll.dHope.results.some(x => x.rerolled),
rerolls: roll.dHope.results.filter(x => x.rerolled)
}
};
data.fear = {
dice: roll.dFear.denomination,
value: roll.dFear.total
value: roll.dFear.total,
rerolled: {
any: roll.dFear.results.some(x => x.rerolled),
rerolls: roll.dFear.results.filter(x => x.rerolled)
}
};
data.rally = {
dice: roll.dRally?.denomination,
@ -232,6 +240,13 @@ export default class DualityRoll extends D20Roll {
});
newRoll.extra = newRoll.extra.slice(2);
Hooks.call(`${CONFIG.DH.id}.postRollDuality`, {
source: { actor: message.system.source.actor ?? '' },
targets: message.system.targets,
roll: newRoll,
rerolledRoll:
newRoll.result.duality !== message.system.roll.result.duality ? message.system.roll : undefined
});
return { newRoll, parsedRoll };
}
}