Browse Source

add error handling to relics

main
Stephanie Gredell 4 months ago
parent
commit
ceb36aaa80
  1. 8
      src/engine/battle.js

8
src/engine/battle.js

@ -282,7 +282,13 @@ export function makeBattleContext(root) { @@ -282,7 +282,13 @@ export function makeBattleContext(root) {
}
export function attachRelics(root, relicIds) {
root.relicStates = relicIds.map(id => ({ id, hooks: RELICS[id].hooks || {}, state: structuredClone(RELICS[id].state || {}) }));
root.relicStates = relicIds.filter(id => {
if (!RELICS[id]) {
console.error(`Relic with ID '${id}' not found in RELICS data`);
return false;
}
return true;
}).map(id => ({ id, hooks: RELICS[id].hooks || {}, state: structuredClone(RELICS[id].state || {}) }));
const relicCtx = {
...root,

Loading…
Cancel
Save