mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 07:59:03 +01:00
Fixed reroll correcting automation hope/fear/stress
This commit is contained in:
parent
6301e575e3
commit
aeb208e777
3 changed files with 17 additions and 3 deletions
|
|
@ -47,13 +47,13 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
element.addEventListener('click', this.onToggleTargets)
|
||||
);
|
||||
html.querySelectorAll('.ability-use-button').forEach(element =>
|
||||
element.addEventListener('click', event => this.abilityUseButton(this, event, data.message))
|
||||
element.addEventListener('click', event => this.abilityUseButton(event, data.message))
|
||||
);
|
||||
html.querySelectorAll('.action-use-button').forEach(element =>
|
||||
element.addEventListener('click', event => this.actionUseButton(this, event, data.message))
|
||||
element.addEventListener('click', event => this.actionUseButton(event, data.message))
|
||||
);
|
||||
html.querySelectorAll('.reroll-button').forEach(element =>
|
||||
element.addEventListener('click', event => this.rerollEvent(this, event, data.message))
|
||||
element.addEventListener('click', event => this.rerollEvent(event, data.message))
|
||||
);
|
||||
};
|
||||
|
||||
|
|
@ -287,6 +287,9 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
game.system.api.dice[
|
||||
message.type === 'dualityRoll' ? 'DualityRoll' : target.dataset.type === 'damage' ? 'DHRoll' : 'D20Roll'
|
||||
];
|
||||
|
||||
if (!game.modules.get('dice-so-nice')?.active) foundry.audio.AudioHelper.play({ src: CONFIG.sounds.dice });
|
||||
|
||||
const { newRoll, parsedRoll } = await rollClass.reroll(originalRoll_parsed, target, message);
|
||||
|
||||
await game.messages.get(message._id).update({
|
||||
|
|
|
|||
|
|
@ -193,6 +193,11 @@ export const registerRollDiceHooks = () => {
|
|||
if (config.roll.isCritical) updates.push({ key: 'stress', value: -1 });
|
||||
if (config.roll.result.duality === -1) updates.push({ key: 'fear', value: 1 });
|
||||
|
||||
if (config.rerolledRoll.isCritical || config.rerolledRoll.result.duality === 1)
|
||||
updates.push({ key: 'hope', value: -1 });
|
||||
if (config.rerolledRoll.isCritical) updates.push({ key: 'stress', value: 1 });
|
||||
if (config.rerolledRoll.result.duality === -1) updates.push({ key: 'fear', value: -1 });
|
||||
|
||||
if (updates.length) {
|
||||
const target = actor.system.partner ?? actor;
|
||||
if (!['dead', 'unconcious'].some(x => actor.statuses.has(x))) {
|
||||
|
|
|
|||
|
|
@ -232,6 +232,12 @@ 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: message.system.roll
|
||||
});
|
||||
return { newRoll, parsedRoll };
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue