Add Attack to Weapon & Override settings to Roll

This commit is contained in:
Dapoolp 2025-07-07 19:58:54 +02:00
parent 21f7d785f7
commit 357679a0a8
20 changed files with 140 additions and 107 deletions

View file

@ -156,17 +156,22 @@ export default class DHBaseAction extends foundry.abstract.DataModel {
static getSourceConfig(parent) {
const updateSource = {};
updateSource.img ??= parent?.img ?? parent?.system?.img;
if (parent?.system?.trait) {
updateSource['roll'] = {
type: this.getRollType(parent),
trait: parent.system.trait
};
}
if (parent?.type === 'weapon' && !!this.schema.fields.damage) {
if (parent?.type === 'weapon') {
updateSource['damage'] = { includeBase: true };
}
if (parent?.system?.range) {
updateSource['range'] = parent?.system?.range;
updateSource['range'] = parent?.system?.attack?.range;
updateSource['roll'] = {
useDefault: true
}
} else {
if (parent?.system?.trait) {
updateSource['roll'] = {
type: this.getRollType(parent),
trait: parent.system.trait
};
}
if (parent?.system?.range) {
updateSource['range'] = parent?.system?.range;
}
}
return updateSource;
}