ScottLilly/SOSCSRPG

Possible for player to be killed, return home, but still battle

Opened this issue · 0 comments

Describe the bug
Using the keyboard to play the game can lead to an issue where the player has been killed, so they are returned home, but continual pressing of Z for attack can keep battling. This earns the player experience, gold, loot, etc.

To Reproduce
Steps to reproduce the behavior:

  1. Press and hold W to move all the way north in the sample world, which is Herbalist's Garden.
  2. Select your Pointy stick weapon.
  3. Press and hold Z to repeatedly attack.
  4. The player will eventually be killed and return home.
  5. Repeat the pressing & holding of W and Z until you are killed, return home, but you are still battling.

Expected behavior
When the player is killed and returns home, there should be no monster to battle.

Additional context
At this point, as seen in debug mode, there is no actual monster but there is a battle. The tutorial mentions events can sometimes fire not in the order you expect them to, so I suspect that's what's happening here, a race condition with returning home which loads the monster in that location (there isn't one) and clearing out the battle.