Skip to content

Commit

Permalink
[#3914] Fix enchanted damage types into activities
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
arbron authored and Fyorl committed Sep 3, 2024
1 parent 4332fc4 commit 09b577f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion module/data/activity/attack-data.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion module/data/item/consumable.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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: "" },
Expand Down
2 changes: 1 addition & 1 deletion module/data/item/weapon.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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}` : "" },
Expand Down

0 comments on commit 09b577f

Please sign in to comment.