mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 19:51:08 +01:00
* Added parsing of effect values from Item data model. Almost finished with itemConfig. * Added the last to itemConfig * Fixed armor * ContextMenu localization fixes * Better tooltips for tagify * Corrected resource logic
40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
import { DHDamageData } from './actionDice.mjs';
|
|
import DHDamageAction from './damageAction.mjs';
|
|
|
|
export default class DHAttackAction extends DHDamageAction {
|
|
static extraSchemas = [...super.extraSchemas, ...['roll', 'save']];
|
|
|
|
static getRollType(parent) {
|
|
return parent.type === 'weapon' ? 'weapon' : 'spellcast';
|
|
}
|
|
|
|
get chatTemplate() {
|
|
return 'systems/daggerheart/templates/ui/chat/duality-roll.hbs';
|
|
}
|
|
|
|
prepareData() {
|
|
super.prepareData();
|
|
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';
|
|
}
|
|
}
|
|
}
|
|
|
|
getParentDamage() {
|
|
return {
|
|
value: {
|
|
multiplier: 'prof',
|
|
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?.attack.damage.parts[0].type,
|
|
base: true
|
|
};
|
|
}
|
|
}
|