Skip to content

Commit

Permalink
[#2649] Fix enrichers using full key rather then short key when calli…
Browse files Browse the repository at this point in the history
…ng roll method (#2650)

Co-authored-by: Jeff Hitchcock <[email protected]>
  • Loading branch information
Ikaguia and arbron authored Nov 28, 2023
1 parent 0240d2e commit 0067cff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions module/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2080,8 +2080,8 @@ Object.defineProperty(DND5E, "enrichmentLookup", {
skills: foundry.utils.deepClone(DND5E.skills),
tools: foundry.utils.deepClone(DND5E.toolIds)
};
Object.values(DND5E.abilities).forEach(a => _enrichmentLookup.abilities[a.fullKey] = a);
Object.values(DND5E.skills).forEach(s => _enrichmentLookup.skills[s.fullKey] = s);
Object.entries(DND5E.abilities).forEach(([k, a]) => _enrichmentLookup.abilities[a.fullKey] = { ...a, key: k });
Object.entries(DND5E.skills).forEach(([k, s]) => _enrichmentLookup.skills[s.fullKey] = { ...s, key: k });
}
return _enrichmentLookup;
},
Expand Down
5 changes: 4 additions & 1 deletion module/enrichers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ async function enrichCheck(config, label, options) {
} else if ( config.skill && !config.ability ) {
config.ability = skillConfig.ability;
}
if ( skillConfig?.key ) config.skill = skillConfig.key;

const toolUUID = CONFIG.DND5E.enrichmentLookup.tools[config.tool];
const toolIndex = toolUUID ? Trait.getBaseItem(toolUUID, { indexOnly: true }) : null;
Expand All @@ -144,12 +145,13 @@ async function enrichCheck(config, label, options) {

let abilityConfig = CONFIG.DND5E.enrichmentLookup.abilities[config.ability];
if ( config.ability && !abilityConfig ) {
console.warn(`Ability ${ability} not found while enriching ${config.input}.`);
console.warn(`Ability ${ability} not found while enriching ${config.ability}.`);
invalid = true;
} else if ( !abilityConfig ) {
console.warn(`No ability provided while enriching check ${config.input}.`);
invalid = true;
}
if ( abilityConfig?.key ) config.ability = abilityConfig.key;

if ( config.dc && !Number.isNumeric(config.dc) ) config.dc = simplifyBonus(config.dc, options.rollData ?? {});

Expand Down Expand Up @@ -291,6 +293,7 @@ async function enrichSave(config, label, options) {
console.warn(`Ability ${config.ability} not found while enriching ${config.input}.`);
return config.input;
}
if ( abilityConfig?.key ) config.ability = abilityConfig.key;

if ( config.dc && !Number.isNumeric(config.dc) ) config.dc = simplifyBonus(config.dc, options.rollData ?? {});

Expand Down

0 comments on commit 0067cff

Please sign in to comment.