Skip to content

Commit

Permalink
[#4224] Fix consumption not scaling when consumed from chat card
Browse files Browse the repository at this point in the history
  • Loading branch information
arbron committed Sep 15, 2024
1 parent 25950bd commit e98900d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions module/documents/activity/mixin.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,8 @@ export default Base => class extends PseudoDocumentMixin(Base) {
if ( ((config.consume === true) || config.consume.spellSlot) && this.requiresSpellSlot ) {
const mode = this.item.system.preparation.mode;
const isLeveled = ["always", "prepared"].includes(mode);
const slot = config.spell?.slot ?? (isLeveled ? `spell${this.item.system.level}` : mode);
const effectiveLevel = this.item.system.level + (config.scaling ?? 0);
const slot = config.spell?.slot ?? (isLeveled ? `spell${effectiveLevel}` : mode);
const slotData = this.actor.system.spells?.[slot];
if ( slotData ) {
if ( slotData.value ) {
Expand Down Expand Up @@ -1149,7 +1150,8 @@ export default Base => class extends PseudoDocumentMixin(Base) {
*/
async #consumeResource(event, target, message) {
const messageConfig = {};
await this.consume({ consume: true, event }, messageConfig);
const scaling = message.getFlag("dnd5e", "scaling");
await this.consume({ consume: true, event, scaling }, messageConfig);
if ( !foundry.utils.isEmpty(messageConfig.data) ) await message.update(messageConfig.data);
}

Expand Down

0 comments on commit e98900d

Please sign in to comment.