mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 15:39:02 +01:00
Adapt healing
This commit is contained in:
parent
92feddce1b
commit
3186378872
12 changed files with 95 additions and 87 deletions
|
|
@ -10,10 +10,11 @@ export default class DamageRoll extends DHRoll {
|
|||
|
||||
static DefaultDialog = DamageDialog;
|
||||
|
||||
static async buildEvaluate(rolls, config = {}, message = {}) {
|
||||
static async buildEvaluate(roll, config = {}, message = {}) {
|
||||
if ( config.evaluate !== false ) {
|
||||
for ( const roll of config.roll ) await roll.roll.evaluate();
|
||||
}
|
||||
roll._evaluated = true;
|
||||
const parts = config.roll.map(r => this.postEvaluate(r));
|
||||
config.roll = this.unifyDamageRoll(parts);
|
||||
}
|
||||
|
|
@ -22,7 +23,7 @@ export default class DamageRoll extends DHRoll {
|
|||
return {
|
||||
...roll,
|
||||
...super.postEvaluate(roll.roll, config),
|
||||
damageTypes: [...roll.damageTypes],
|
||||
damageTypes: [...(roll.damageTypes ?? [])],
|
||||
roll: roll.roll,
|
||||
type: config.type,
|
||||
modifierTotal: this.calculateTotalModifiers(roll.roll)
|
||||
|
|
|
|||
|
|
@ -57,13 +57,13 @@ export default class DHRoll extends Roll {
|
|||
|
||||
// Create Chat Message
|
||||
if (config.source?.message) {
|
||||
console.log(config)
|
||||
if(Array.isArray(config.roll?.parts)) {
|
||||
const pool = foundry.dice.terms.PoolTerm.fromRolls(config.roll.parts.map(r => r.roll));
|
||||
if(Object.values(config.roll)?.length) {
|
||||
const pool = foundry.dice.terms.PoolTerm.fromRolls(Object.values(config.roll).flatMap(r => r.parts.map(p => p.roll)));
|
||||
roll = Roll.fromTerms([pool]);
|
||||
}
|
||||
if (game.modules.get('dice-so-nice')?.active) await game.dice3d.showForRoll(roll, game.user, true);
|
||||
} else {
|
||||
console.log(roll, config)
|
||||
config.message = await this.toMessage(roll, config);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue