+export const getConfigValue = (config, name, fallback) =>
+ Object.prototype.hasOwnProperty.call(config, name) ? config[name] : fallback;
+
+export const applyLogic = (config, dungeons, state) => {
+ const logic = Logic[config.worldState];
+ const map = {};
+ for (const name in logic) {
+ try {
+ map[name] = logic[name](config, dungeons, state);
+ } catch (e) {
+ console.error('error evaluating', name, e);
+ }
+ }
+ return map;
+};
+
+export const shouldShowDungeonItem = (config, which) => {
+ const show = config[`show${which}`] || 'always';
+ const wild = config[`wild${which}`] || false;
+ switch (show) {
+ default:
+ case 'always':
+ return true;
+ case 'situational':
+ return wild;
+ case 'never':
+ return false;
+ }
+};
+