From 09b577f5998f152a655dd8f3398441e4991186e8 Mon Sep 17 00:00:00 2001 From: Jeff Hitchcock Date: Tue, 3 Sep 2024 11:07:41 -0700 Subject: [PATCH] [#3914] Fix enchanted damage types into activities Uses source data rather than system data for displaying damage types on weapons & armor to avoid polluting base data with enchantment data. Ensures that the damage clone created for the attack activity includes changes caused by enchantments. --- module/data/activity/attack-data.mjs | 2 +- module/data/item/consumable.mjs | 2 +- module/data/item/weapon.mjs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/module/data/activity/attack-data.mjs b/module/data/activity/attack-data.mjs index 0cb80f894f..8960f0360a 100644 --- a/module/data/activity/attack-data.mjs +++ b/module/data/activity/attack-data.mjs @@ -177,7 +177,7 @@ export default class AttackActivityData extends BaseActivityData { /** @inheritDoc */ prepareFinalData(rollData) { if ( this.damage.includeBase && this.item.system.offersBaseDamage && this.item.system.damage.base.formula ) { - const basePart = this.item.system.damage.base.clone(); + const basePart = this.item.system.damage.base.clone(this.item.system.damage.base.toObject(false)); basePart.base = true; basePart.locked = true; this.damage.parts.unshift(basePart); diff --git a/module/data/item/consumable.mjs b/module/data/item/consumable.mjs index e1fbd93c72..f6b3b3a637 100644 --- a/module/data/item/consumable.mjs +++ b/module/data/item/consumable.mjs @@ -171,7 +171,7 @@ export default class ConsumableData extends ItemDataModel.mixin( ...this.physicalItemSheetFields ]; context.damageTypes = Object.entries(CONFIG.DND5E.damageTypes).map(([value, { label }]) => { - return { value, label, selected: this.damage.base.types.has(value) }; + return { value, label, selected: context.source.damage.base.types.includes(value) }; }); context.denominationOptions = [ { value: "", label: "" }, diff --git a/module/data/item/weapon.mjs b/module/data/item/weapon.mjs index 1db1191918..badbf6d890 100644 --- a/module/data/item/weapon.mjs +++ b/module/data/item/weapon.mjs @@ -267,7 +267,7 @@ export default class WeaponData extends ItemDataModel.mixin( // Damage context.damageTypes = Object.entries(CONFIG.DND5E.damageTypes).map(([value, { label }]) => { - return { value, label, selected: this.damage.base.types.has(value) }; + return { value, label, selected: context.source.damage.base.types.includes(value) }; }); const makeDenominationOptions = placeholder => [ { value: "", label: placeholder ? `d${placeholder}` : "" },