uclaacm / Playnet

project teletubbies :) - a wonderful CL collab!
https://playnet.uclaacm.com/
MIT License
7 stars 1 forks source link

fix: Fix bug where game 1 in activity 1 will sometimes be stuck at full bar #211

Closed darren2hang closed 3 years ago

darren2hang commented 3 years ago

https://user-images.githubusercontent.com/56695604/120063607-e2b40d00-c01c-11eb-9d4f-c472d9e0aa0e.MOV

The happiness state would sometimes get set to a state greater than the MAX_HAPPINESS value. The advanceRound detection was based on when happiness === MAX_HAPPINESS, and the Math.min was using 100 instead of MAX_HAPPINESS. This would sometimes cause the happiness to go over MAX_HAPPINESS and the game would be stuck. I have a video demonstrating the bug attached.

This bug was pretty hard to test, so I'm not sure if I fixed it. From a logically standpoint, I think it is fixed now.

mergify[bot] commented 3 years ago

Thanks for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).