mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-22 10:29:54 +02:00
Fixed damage rerolls
This commit is contained in:
parent
3dd968f0f1
commit
8b34fde8f6
4 changed files with 22 additions and 17 deletions
|
|
@ -137,12 +137,17 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
|
|||
if (!this.damage.active) return;
|
||||
|
||||
const rerolls = [];
|
||||
const update = { system: { damage: { types: {} } } };
|
||||
for (const key of Object.keys(this.damage.types)) {
|
||||
const type = this.damage.types[key];
|
||||
const reroll = await type.reroll();
|
||||
const update = { system: { damage: { main: null, resources: _replace({}) } } };
|
||||
if (this.damage.main) {
|
||||
const reroll = await this.damage.main.reroll();
|
||||
rerolls.push(reroll);
|
||||
update.system.damage.types[key] = reroll.toJSON();
|
||||
update.system.damage.main = reroll.toJSON();
|
||||
}
|
||||
|
||||
for (const key of Object.keys(this.damage.resources)) {
|
||||
const reroll = await this.damage.resources[key].reroll();
|
||||
rerolls.push(reroll);
|
||||
update.system.damage.resources[key] = reroll.toJSON();
|
||||
}
|
||||
|
||||
await triggerChatRollFx(rerolls);
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ export class ChatDamageData extends foundry.abstract.DataModel {
|
|||
}
|
||||
}
|
||||
|
||||
async rerollDamageDie(damageType, dice, resultIndex) {
|
||||
const reroll = this.types[damageType];
|
||||
async rerollDamageDie(isResource, damageType, dice, resultIndex) {
|
||||
const reroll = isResource ? this.resources[damageType] : this.main;
|
||||
const rerollDice = reroll.dice[dice];
|
||||
await rerollDice.rerollResult(resultIndex);
|
||||
await reroll._evaluate();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue