mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-24 03:19:55 +02:00
[Fix] Reroll Fixes (#2103)
Some checks are pending
Project CI / build (24.x) (push) Waiting to run
Some checks are pending
Project CI / build (24.x) (push) Waiting to run
This commit is contained in:
parent
ffa7912d01
commit
80cc7f1502
7 changed files with 15 additions and 8 deletions
|
|
@ -3331,7 +3331,6 @@
|
||||||
"rangeAndTarget": "Range & Target",
|
"rangeAndTarget": "Range & Target",
|
||||||
"dragApplyEffect": "Drag effect to apply it to an actor",
|
"dragApplyEffect": "Drag effect to apply it to an actor",
|
||||||
"appliedEvenIfSuccessful": "Applied even if save succeeded",
|
"appliedEvenIfSuccessful": "Applied even if save succeeded",
|
||||||
"diceIsRerolled": "The dice has been rerolled (x{times})",
|
|
||||||
"pendingSaves": "Pending Reaction Rolls",
|
"pendingSaves": "Pending Reaction Rolls",
|
||||||
"openSheetSettings": "Open Settings",
|
"openSheetSettings": "Open Settings",
|
||||||
"compendiumBrowser": "Compendium Browser",
|
"compendiumBrowser": "Compendium Browser",
|
||||||
|
|
|
||||||
|
|
@ -247,7 +247,7 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
||||||
}
|
}
|
||||||
|
|
||||||
const message = game.messages.get(messageData._id);
|
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') {
|
if (target.dataset.type === 'damage') {
|
||||||
const { isResource, damageType, dice, result } = target.dataset;
|
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'
|
isReaction: message.system.roll.options.actionType === 'reaction'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
rerollDice.results[rerollDice.results.length - 1].rerolled = true;
|
||||||
|
|
||||||
await message.update({
|
await message.update({
|
||||||
rolls: [message.system.roll.toJSON()]
|
rolls: [message.system.roll.toJSON()]
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,9 @@ export class ChatDamageData extends foundry.abstract.DataModel {
|
||||||
async rerollDamageDie(isResource, damageType, dice, resultIndex) {
|
async rerollDamageDie(isResource, damageType, dice, resultIndex) {
|
||||||
const reroll = isResource ? this.resources[damageType] : this.main;
|
const reroll = isResource ? this.resources[damageType] : this.main;
|
||||||
const rerollDice = reroll.dice[dice];
|
const rerollDice = reroll.dice[dice];
|
||||||
await rerollDice.rerollResult(resultIndex);
|
const rerolledResult = await rerollDice.rerollResult(resultIndex);
|
||||||
await reroll._evaluate();
|
await reroll._evaluate();
|
||||||
|
|
||||||
const rerolledResult = rerollDice.results[rerollDice.results.length - 1];
|
|
||||||
if (rerolledResult) {
|
if (rerolledResult) {
|
||||||
const fakeRoll = {
|
const fakeRoll = {
|
||||||
_evaluated: true,
|
_evaluated: true,
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,10 @@ export default class BaseDie extends foundry.dice.terms.Die {
|
||||||
|
|
||||||
if (['c', 'cc'].some(x => this.modifiers.includes(x))) {
|
if (['c', 'cc'].some(x => this.modifiers.includes(x))) {
|
||||||
await this.handleComboDiceReroll(resultIndex, result);
|
await this.handleComboDiceReroll(resultIndex, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rerolledResult.rerolled = true;
|
||||||
|
return rerolledResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,10 @@ export default class DualityDie extends BaseDie {
|
||||||
this.modifiers = [];
|
this.modifiers = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isRerolled() {
|
||||||
|
return this.results.some(x => x.rerolled);
|
||||||
|
}
|
||||||
|
|
||||||
#getDualityState(roll) {
|
#getDualityState(roll) {
|
||||||
if (!roll) return null;
|
if (!roll) return null;
|
||||||
return roll.withHope ? 1 : roll.withFear ? -1 : 0;
|
return roll.withHope ? 1 : roll.withFear ? -1 : 0;
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@
|
||||||
class="dice reroll-button {{coalesce dieResult.denomination dice.denomination}}"
|
class="dice reroll-button {{coalesce dieResult.denomination dice.denomination}}"
|
||||||
data-type="damage" data-dice="{{diceKey}}" data-result="{{resultKey}}" {{#if ../../resource}}data-damage-type="{{../../resource}}" data-is-resource="true"{{/if}}
|
data-type="damage" data-dice="{{diceKey}}" data-result="{{resultKey}}" {{#if ../../resource}}data-damage-type="{{../../resource}}" data-is-resource="true"{{/if}}
|
||||||
>
|
>
|
||||||
{{#if hasRerolls}}<i class="fa-solid fa-dice dice-rerolled" data-tooltip="{{localize "DAGGERHEART.GENERAL.rerolled"}}"></i>{{/if}}
|
{{#if dieResult.rerolled}}<i class="fa-solid fa-dice dice-rerolled" data-tooltip="{{localize "DAGGERHEART.GENERAL.rerolled"}}"></i>{{/if}}
|
||||||
{{result}}
|
{{result}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -47,14 +47,14 @@
|
||||||
<div class="roll-die">
|
<div class="roll-die">
|
||||||
<label>{{localize "DAGGERHEART.GENERAL.hope"}}</label>
|
<label>{{localize "DAGGERHEART.GENERAL.hope"}}</label>
|
||||||
<div class="dice {{roll.dHope.denomination}} color-hope reroll-button" data-die-index="0" data-type="hope" data-tooltip="{{localize "DAGGERHEART.GENERAL.rerollThing" thing=(localize "DAGGERHEART.GENERAL.hope")}}">
|
<div class="dice {{roll.dHope.denomination}} color-hope reroll-button" data-die-index="0" data-type="hope" data-tooltip="{{localize "DAGGERHEART.GENERAL.rerollThing" thing=(localize "DAGGERHEART.GENERAL.hope")}}">
|
||||||
{{#if roll.dHopehope.rerolled.any}}<i class="fa-solid fa-dice dice-rerolled" data-tooltip="{{localize "DAGGERHEART.UI.Tooltip.diceIsRerolled" times=roll.dHope.rerolled.rerolls.length}}"></i>{{/if}}
|
{{#if roll.dHope.isRerolled}}<i class="fa-solid fa-dice dice-rerolled" data-tooltip="{{localize "DAGGERHEART.GENERAL.rerolled"}}"></i>{{/if}}
|
||||||
{{roll.dHope.total}}
|
{{roll.dHope.total}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="roll-die has-plus">
|
<div class="roll-die has-plus">
|
||||||
<label>{{localize "DAGGERHEART.GENERAL.fear"}}</label>
|
<label>{{localize "DAGGERHEART.GENERAL.fear"}}</label>
|
||||||
<div class="dice {{roll.dFear.denomination}} color-fear reroll-button" data-die-index="1" data-type="fear" style="--svg-folder: 'fear';" data-tooltip="{{localize "DAGGERHEART.GENERAL.rerollThing" thing=(localize "DAGGERHEART.GENERAL.fear")}}">
|
<div class="dice {{roll.dFear.denomination}} color-fear reroll-button" data-die-index="1" data-type="fear" style="--svg-folder: 'fear';" data-tooltip="{{localize "DAGGERHEART.GENERAL.rerollThing" thing=(localize "DAGGERHEART.GENERAL.fear")}}">
|
||||||
{{#if roll.dFear.rerolled.any}}<i class="fa-solid fa-dice dice-rerolled" data-tooltip="{{localize "DAGGERHEART.UI.Tooltip.diceIsRerolled" times=roll.dFear.rerolled.rerolls.length}}"></i>{{/if}}
|
{{#if roll.dFear.isRerolled}}<i class="fa-solid fa-dice dice-rerolled" data-tooltip="{{localize "DAGGERHEART.GENERAL.rerolled"}}"></i>{{/if}}
|
||||||
{{roll.dFear.total}}
|
{{roll.dFear.total}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue