mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Feature/253 weapon attack action (#290)
* Step #1 * Add Attack to Weapon & Override settings to Roll
This commit is contained in:
parent
52be430eff
commit
7d7fb88035
23 changed files with 168 additions and 91 deletions
|
|
@ -31,7 +31,8 @@ export class DHActionRollData extends foundry.abstract.DataModel {
|
|||
label: 'Should be'
|
||||
}),
|
||||
treshold: new fields.NumberField({ initial: 1, integer: true, min: 1, label: 'Treshold' })
|
||||
})
|
||||
}),
|
||||
useDefault: new fields.BooleanField({ initial: false })
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -47,7 +48,6 @@ export class DHActionRollData extends foundry.abstract.DataModel {
|
|||
formula = `${multiplier}${this.diceRolling.dice}cs${CONFIG.DH.ACTIONS.diceCompare[this.diceRolling.compare].operator}${this.diceRolling.treshold}`;
|
||||
break;
|
||||
default:
|
||||
// formula = `${(!!this.parent?.actor?.system?.attack ? `@attackBonus` : `@traits.${this.trait}.total`)}`;
|
||||
formula = '';
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,9 +14,15 @@ export default class DHAttackAction extends DHDamageAction {
|
|||
|
||||
prepareData() {
|
||||
super.prepareData();
|
||||
if (this.damage.includeBase && !!this.item?.system?.damage) {
|
||||
const baseDamage = this.getParentDamage();
|
||||
this.damage.parts.unshift(new DHDamageData(baseDamage));
|
||||
if(!!this.item?.system?.attack) {
|
||||
if (this.damage.includeBase) {
|
||||
const baseDamage = this.getParentDamage();
|
||||
this.damage.parts.unshift(new DHDamageData(baseDamage));
|
||||
}
|
||||
if(this.roll.useDefault) {
|
||||
this.roll.trait = this.item.system.attack.roll.trait;
|
||||
this.roll.type = 'weapon';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -24,10 +30,10 @@ export default class DHAttackAction extends DHDamageAction {
|
|||
return {
|
||||
value: {
|
||||
multiplier: 'prof',
|
||||
dice: this.item?.system?.damage.dice,
|
||||
bonus: this.item?.system?.damage.bonus ?? 0
|
||||
dice: this.item?.system?.attack.damage.parts[0].value.dice,
|
||||
bonus: this.item?.system?.attack.damage.parts[0].value.bonus ?? 0
|
||||
},
|
||||
type: this.item?.system?.damage.type,
|
||||
type: this.item?.system?.attack.damage.parts[0].type,
|
||||
base: true
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue