nathanj / spirit-island-pbp

Spirit Island PBP Helper
4 stars 7 forks source link

Reshuffle on take/host draw if deck empty #30

Closed petertseng closed 2 months ago

petertseng commented 3 months ago

Closes https://github.com/nathanj/spirit-island-pbp/issues/23

samsullivan commented 2 months ago

Not sure about taking cards, but with draw this only partially helps by reshuffling the deck. I am only able to actually draw if I refresh the page, though. Maybe I was doing something wrong, because I was technically testing a branch on my fork deployed on Vercel.

petertseng commented 2 months ago

Well, after it reshuffles the decks, it sets the list of cards to draw from to the contents of the newly-shuffled deck (lines 364 and 399), so this is meant to be a complete solution.

And it works when I do it, without needing to refresh, so can we compare what's different between my setup and the setup you used to test? Are there any clues given in the HTTP response to the POST to /game/<your-game-id>/draw/minor when you have the host draw a minor with the minor deck empty? For me it gives a 302 with this code change and would give a 500 without this code change. Which of these two does it give for you (or does it give something completely different)?

When we've figured out what the problem is, perhaps you can help by contributing a test demonstrating the problem, to be added to the tests added in this PR? That way we will put our experiences together and help others avoid this in the future!

samsullivan commented 2 months ago

Yea, I'll definitely report back when I have more time to thoroughly test. Could easily be something on my end!