mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-22 07:23:37 +02:00
Fix Include Item Damage error in v14 damage system
- Change behavior from 'Include Item Damage' to 'Use Item Damage' - Replace action damage with weapon base damage instead of unshift - Fixes error where unshift fails due to v14 single damage instance limit - Update label to reflect new behavior Fixes Foundryborne/daggerheart#1794 Signed-off-by: codebytaki <codebytaki@users.noreply.github.com>
This commit is contained in:
parent
94f1fbdd9b
commit
6afc5d625a
4 changed files with 87 additions and 22 deletions
|
|
@ -11,9 +11,13 @@ export default class DHAttackAction extends DHDamageAction {
|
|||
prepareData() {
|
||||
super.prepareData();
|
||||
if (!!this.item?.system?.attack) {
|
||||
// In v14, we only allow a single instance of damage
|
||||
// If includeBase is checked, use the weapon's damage instead of the action's damage
|
||||
if (this.damage.includeBase) {
|
||||
const baseDamage = this.getParentDamage();
|
||||
this.damage.parts.unshift(new DHDamageData(baseDamage));
|
||||
// Replace the action damage with the weapon's base damage
|
||||
this.damage.parts = new Map();
|
||||
this.damage.parts.set('hitPoints', new DHDamageData(baseDamage));
|
||||
}
|
||||
if (this.roll.useDefault) {
|
||||
this.roll.trait = this.item.system.attack.roll.trait;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ export default class DamageField extends fields.SchemaField {
|
|||
parts: new IterableTypedObjectField(DHDamageData),
|
||||
includeBase: new fields.BooleanField({
|
||||
initial: false,
|
||||
label: 'DAGGERHEART.ACTIONS.Settings.includeBase.label'
|
||||
label: 'DAGGERHEART.ACTIONS.Settings.useItemDamage.label'
|
||||
}),
|
||||
direct: new fields.BooleanField({ initial: false, label: 'DAGGERHEART.CONFIG.DamageType.direct.name' }),
|
||||
groupAttack: new fields.StringField({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue