diff --git a/module/applications/characterCreation.mjs b/module/applications/characterCreation.mjs index d10bfe17..da76d0a9 100644 --- a/module/applications/characterCreation.mjs +++ b/module/applications/characterCreation.mjs @@ -300,9 +300,9 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl return { armor: characterGuide.suggestedArmor ?? null, primaryWeapon: characterGuide.suggestedPrimaryWeapon ?? null, - secondaryWeapon: - { ...characterGuide.suggestedSecondaryWeapon, uuid: characterGuide.suggestedSecondaryWeapon.uuid } ?? - null, + secondaryWeapon: characterGuide.suggestedSecondaryWeapon + ? { ...characterGuide.suggestedSecondaryWeapon, uuid: characterGuide.suggestedSecondaryWeapon.uuid } + : null, inventory: { take: inventory.take ?? [], choiceA: @@ -399,11 +399,19 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl const data = TextEditor.getDragEventData(event); const item = await foundry.utils.fromUuid(data.uuid); if (item.type === 'ancestry' && event.target.closest('.ancestry-card')) { - this.setup.ancestry = { ...item, uuid: item.uuid }; + this.setup.ancestry = { + ...item, + effects: Array.from(item.effects).map(x => x.toObject()), + uuid: item.uuid + }; } else if (item.type === 'community' && event.target.closest('.community-card')) { - this.setup.community = { ...item, uuid: item.uuid }; + this.setup.community = { + ...item, + effects: Array.from(item.effects).map(x => x.toObject()), + uuid: item.uuid + }; } else if (item.type === 'class' && event.target.closest('.class-card')) { - this.setup.class = { ...item, uuid: item.uuid }; + this.setup.class = { ...item, effects: Array.from(item.effects).map(x => x.toObject()), uuid: item.uuid }; this.setup.subclass = {}; this.setup.domainCards = { [foundry.utils.randomID()]: {}, @@ -417,7 +425,11 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl return; } - this.setup.subclass = { ...item, uuid: item.uuid }; + this.setup.subclass = { + ...item, + effects: Array.from(item.effects).map(x => x.toObject()), + uuid: item.uuid + }; } else if (item.type === 'domainCard' && event.target.closest('.domain-card')) { if (!this.setup.class.uuid) { ui.notifications.error(game.i18n.localize('DAGGERHEART.CharacterCreation.Notifications.MissingClass')); diff --git a/module/applications/countdowns.mjs b/module/applications/countdowns.mjs index 354541fe..8f7c1cbf 100644 --- a/module/applications/countdowns.mjs +++ b/module/applications/countdowns.mjs @@ -302,7 +302,7 @@ export class EncounterCountdowns extends Countdowns { } export const registerCountdownApplicationHooks = () => { - const updateCountdowns = async shouldIncrease => { + const updateCountdowns = async shouldProgress => { if (game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Automation).countdowns) { const countdownSetting = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Countdowns); for (let countdownCategoryKey in countdownSetting) { @@ -310,10 +310,10 @@ export const registerCountdownApplicationHooks = () => { for (let countdownKey in countdownCategory.countdowns) { const countdown = countdownCategory.countdowns[countdownKey]; - if (shouldIncrease(countdown)) { + if (shouldProgress(countdown)) { await countdownSetting.updateSource({ [`${countdownCategoryKey}.countdowns.${countdownKey}.progress.current`]: - countdown.progress.current + 1 + countdown.progress.current - 1 }); await game.settings.set(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Countdowns, countdownSetting); foundry.applications.instances.get(`${countdownCategoryKey}-countdowns`)?.render(); @@ -326,18 +326,14 @@ export const registerCountdownApplicationHooks = () => { Hooks.on(SYSTEM.HOOKS.characterAttack, async () => { updateCountdowns(countdown => { return ( - countdown.progress.type.value === countdownTypes.characterAttack.id && - countdown.progress.current < countdown.progress.max + countdown.progress.type.value === countdownTypes.characterAttack.id && countdown.progress.current > 0 ); }); }); Hooks.on(SYSTEM.HOOKS.spotlight, async () => { updateCountdowns(countdown => { - return ( - countdown.progress.type.value === countdownTypes.spotlight.id && - countdown.progress.current < countdown.progress.max - ); + return countdown.progress.type.value === countdownTypes.spotlight.id && countdown.progress.current > 0; }); }); }; diff --git a/module/data/countdowns.mjs b/module/data/countdowns.mjs index fec2b790..e71cda55 100644 --- a/module/data/countdowns.mjs +++ b/module/data/countdowns.mjs @@ -89,7 +89,7 @@ class DhCountdown extends foundry.abstract.DataModel { current: new fields.NumberField({ required: true, integer: true, - initial: 0, + initial: 1, label: 'DAGGERHEART.Countdown.FIELDS.countdowns.element.progress.current.label' }), max: new fields.NumberField({ diff --git a/module/data/item/subclass.mjs b/module/data/item/subclass.mjs index 61eec6c4..3c996584 100644 --- a/module/data/item/subclass.mjs +++ b/module/data/item/subclass.mjs @@ -64,7 +64,7 @@ export default class DHSubclass extends BaseDataItem { } else if (subclassData) { ui.notifications.error(game.i18n.localize('DAGGERHEART.Item.Errors.SubclassAlreadySelected')); return false; - } else if (classData.system.subclasses.every(x => x.uuid !== data.uuid ?? `Item.${data._id}`)) { + } else if (classData.system.subclasses.every(x => x.uuid !== (data.uuid ?? `Item.${data._id}`))) { ui.notifications.error(game.i18n.localize('DAGGERHEART.Item.Errors.SubclassNotInClass')); return false; }