diff --git a/module/config/generalConfig.mjs b/module/config/generalConfig.mjs index cb12f8f0..8f889bf0 100644 --- a/module/config/generalConfig.mjs +++ b/module/config/generalConfig.mjs @@ -166,26 +166,26 @@ export const healingTypes = { export const defeatedConditions = () => { const defeated = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).defeated; - return { - defeated: { - id: 'defeated', - name: 'DAGGERHEART.CONFIG.Condition.defeated.name', - img: defeated.defeatedIcon, - description: 'DAGGERHEART.CONFIG.Condition.defeated.description' - }, - unconscious: { - id: 'unconscious', - name: 'DAGGERHEART.CONFIG.Condition.unconscious.name', - img: defeated.unconsciousIcon, - description: 'DAGGERHEART.CONFIG.Condition.unconscious.description' - }, - dead: { - id: 'dead', - name: 'DAGGERHEART.CONFIG.Condition.dead.name', - img: defeated.deadIcon, - description: 'DAGGERHEART.CONFIG.Condition.dead.description' - } - }; + return Object.values(defeatedConditionChoices).map(x => ({ + ...x, + img: defeated[`${x.id}Icon`], + description: `DAGGERHEART.CONFIG.Condition.${x.id}.description` + })); +}; + +const defeatedConditionChoices = { + defeated: { + id: 'defeated', + name: 'DAGGERHEART.CONFIG.Condition.defeated.name' + }, + unconscious: { + id: 'unconscious', + name: 'DAGGERHEART.CONFIG.Condition.unconscious.name' + }, + dead: { + id: 'dead', + name: 'DAGGERHEART.CONFIG.Condition.dead.name' + } }; export const conditions = () => ({ diff --git a/module/data/settings/Automation.mjs b/module/data/settings/Automation.mjs index 43000277..be1b71ef 100644 --- a/module/data/settings/Automation.mjs +++ b/module/data/settings/Automation.mjs @@ -68,19 +68,19 @@ export default class DhAutomation extends foundry.abstract.DataModel { }), characterDefault: new fields.StringField({ required: true, - choices: () => CONFIG.DH.GENERAL.defeatedConditions(), + choices: CONFIG.DH.GENERAL.defeatedConditionChoices, initial: 'unconscious', label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.characterDefault.label' }), adversaryDefault: new fields.StringField({ required: true, - choices: () => CONFIG.DH.GENERAL.defeatedConditions(), + choices: CONFIG.DH.GENERAL.defeatedConditionChoices, initial: 'defeated', label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.adversaryDefault.label' }), companionDefault: new fields.StringField({ required: true, - choices: () => CONFIG.DH.GENERAL.defeatedConditions(), + choices: CONFIG.DH.GENERAL.defeatedConditionChoices, initial: 'defeated', label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.companionDefault.label' }), diff --git a/module/systemRegistration/migrations.mjs b/module/systemRegistration/migrations.mjs index e27fa3bd..98a9a7e6 100644 --- a/module/systemRegistration/migrations.mjs +++ b/module/systemRegistration/migrations.mjs @@ -1,6 +1,6 @@ export async function runMigrations() { let lastMigrationVersion = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LastMigrationVersion); - if (!lastMigrationVersion) lastMigrationVersion = '1.0.6'; + if (!lastMigrationVersion) lastMigrationVersion = game.system.version; if (foundry.utils.isNewerVersion('1.1.0', lastMigrationVersion)) { const lockedPacks = [];