orichalque / yet-an-other-gloomhaven-companion

Deckbuilding and card simulator for the Gloomhaven board game
https://www.gloomhaven-deck.com
MIT License
17 stars 25 forks source link

BUG: CS Special modifiers throwing Undefined error #279

Open kiwitrav opened 9 months ago

kiwitrav commented 9 months ago

To Replicate: Switch to the Crimson Scales expansion (even if already selected) Add ANY modifier Errors occur in JS console

Issue: checkIfSanctuary in modifiers.js causing new game to not work & anomalous behaviour when playing modifiers (same modifier keeps playing over & over)

Temp work-around: Either revert PR #277 or Add element.name !== undefined && to the filter on line 146, ie: const sanctuaryCards = this.modifiersSpecial.find(element => element.name !== undefined && element.name.startsWith(sanctuaryNamePrefix))

Working on actual fix

Debugging:

loaded crimson scales
vue.js:634 [Vue warn]: Error in v-on handler: "TypeError: Cannot read properties of undefined (reading 'startsWith')"

(found in <Root>)
warn @ vue.js:634
logError @ vue.js:1893
globalHandleError @ vue.js:1888
handleError @ vue.js:1848
invokeWithErrorHandling @ vue.js:1871
invoker @ vue.js:2188
original._wrapper @ vue.js:7547
vue.js:1897 TypeError: Cannot read properties of undefined (reading 'startsWith')
    at modifiers.js:146:88
    at Array.find (<anonymous>)
    at Vue.checkIfSanctuary (modifiers.js:146:58)
    at Vue.checkIfBlessing (modifiers.js:154:117)
    at Vue.removeModifier (modifiers.js:120:22)
    at click (eval at createFunction (vue.js:1:1), <anonymous>:3:24828)
    at invokeWithErrorHandling (vue.js:1863:28)
    at HTMLDivElement.invoker (vue.js:2188:16)
    at original._wrapper (vue.js:7547:27)