Skip to content

Commit

Permalink
Merge pull request #188 from MangoFVTT/develop
Browse files Browse the repository at this point in the history
release/1.5.2
  • Loading branch information
MangoFVTT authored May 19, 2023
2 parents 01c70f2 + f95ab62 commit 50b1628
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/utils/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class CoreUtility {
}

const actorImage = (actor.img && !actor.img.includes("*")) ? actor.img : null;
const tokenImage = actor.prototypeToken?.texture?.src ? actor.prototypeToken.texture.src : null;
const tokenImage = actor.prototypeToken?.randomImg ? (actor.token?.texture?.src ?? null) : (actor.prototypeToken?.texture?.src ?? null);

switch(SettingsUtility.getSettingValue(SETTING_NAMES.DEFAULT_ROLL_ART)) {
case "actor":
Expand Down
2 changes: 1 addition & 1 deletion src/utils/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class HooksUtility {

Hooks.on(HOOKS_DND5E.USE_ITEM, (item, config, options) => {
if (!options?.ignore) {
RollUtility.rollItem(item, { ...config, ...options });
RollUtility.rollItem(item, foundry.utils.mergeObject(config, options, { recursive: false }));
}
});
}
Expand Down
4 changes: 3 additions & 1 deletion src/utils/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,9 @@ function _addFieldDamageButton(fields, item) {
* @param {Item} item The item from which to derive the field.
* @private
*/
function _addFieldEffectsButton(fields, item, params) {
function _addFieldEffectsButton(fields, item, params) {
ItemUtility.ensurePropertiesOnItem(item);

if (item.hasEffects) {
if (!Object.values(params.effectFlags).some(f => f === true)) {
return;
Expand Down
10 changes: 6 additions & 4 deletions src/utils/roll.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ export class RollUtility {
return await wrapper.call(caller, {}, { ignore: true });
}

const isAltRoll = CoreUtility.eventToAltRoll(options?.event);
const advMode = CoreUtility.eventToAdvantage(options?.event);
const config = ItemUtility.getRollConfigFromItem(caller, isAltRoll)
const isAltRoll = CoreUtility.eventToAltRoll(options?.event) || (options?.isAltRoll ?? false);

const config = foundry.utils.mergeObject(options, ItemUtility.getRollConfigFromItem(caller, isAltRoll), { recursive: false });
const configureDialog = config?.configureDialog ?? (caller?.type === ITEM_TYPE.SPELL ? true : false);

// Handle quantity when uses are not consumed
// While the rest can be handled by Item._getUsageUpdates(), this one thing cannot
Expand All @@ -101,7 +103,7 @@ export class RollUtility {
}

return await wrapper.call(caller, config, {
configureDialog: caller?.type === ITEM_TYPE.SPELL ? true : false,
configureDialog,
createMessage: false,
advMode,
isAltRoll,
Expand Down Expand Up @@ -129,7 +131,7 @@ export class RollUtility {

const skill = CONFIG.DND5E.skills[skillId];
let title = CoreUtility.localize(skill.label);
title += SettingsUtility.getSettingValue(SETTING_NAMES.SHOW_SKILL_ABILITIES) ? ` (${CONFIG.DND5E.abilities[skill.ability]})` : "";
title += SettingsUtility.getSettingValue(SETTING_NAMES.SHOW_SKILL_ABILITIES) ? ` (${CONFIG.DND5E.abilities[actor.system.skills[skillId].ability]})` : "";

return await _getActorRoll(actor, title, roll, ROLL_TYPE.SKILL, options);
}
Expand Down

0 comments on commit 50b1628

Please sign in to comment.