[Fix] Reroll Fixes (#2103)
Some checks are pending
Project CI / build (24.x) (push) Waiting to run

This commit is contained in:
WBHarry 2026-07-22 23:45:03 +02:00 committed by GitHub
parent ffa7912d01
commit 80cc7f1502
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 15 additions and 8 deletions

View file

@ -247,7 +247,7 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
}
const message = game.messages.get(messageData._id);
const target = event.target.closest('[data-result]');
const target = event.target.closest('[data-type]');
if (target.dataset.type === 'damage') {
const { isResource, damageType, dice, result } = target.dataset;
@ -268,6 +268,8 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
isReaction: message.system.roll.options.actionType === 'reaction'
}
});
rerollDice.results[rerollDice.results.length - 1].rerolled = true;
await message.update({
rolls: [message.system.roll.toJSON()]
});

View file

@ -37,10 +37,9 @@ export class ChatDamageData extends foundry.abstract.DataModel {
async rerollDamageDie(isResource, damageType, dice, resultIndex) {
const reroll = isResource ? this.resources[damageType] : this.main;
const rerollDice = reroll.dice[dice];
await rerollDice.rerollResult(resultIndex);
const rerolledResult = await rerollDice.rerollResult(resultIndex);
await reroll._evaluate();
const rerolledResult = rerollDice.results[rerollDice.results.length - 1];
if (rerolledResult) {
const fakeRoll = {
_evaluated: true,

View file

@ -20,7 +20,10 @@ export default class BaseDie extends foundry.dice.terms.Die {
if (['c', 'cc'].some(x => this.modifiers.includes(x))) {
await this.handleComboDiceReroll(resultIndex, result);
}
}
rerolledResult.rerolled = true;
return rerolledResult;
}
/** @inheritDoc */

View file

@ -8,6 +8,10 @@ export default class DualityDie extends BaseDie {
this.modifiers = [];
}
get isRerolled() {
return this.results.some(x => x.rerolled);
}
#getDualityState(roll) {
if (!roll) return null;
return roll.withHope ? 1 : roll.withFear ? -1 : 0;