pongstylin / tactics

A tactical turn-based board game
The Unlicense
77 stars 23 forks source link

Fix bug where furgon shrub causes NPE when checking wait recovery #121

Closed gr8st closed 10 months ago

gr8st commented 1 year ago

The previous pull request actually introduced a bug which breaks the game when a furgon casts a shrub! This is due to the fact that we now check unit at start of turn to see if they are in recovery - but the furgon shrub did not exist at start of turn, which trickles down into an NPE when checking recovery time.

Since the shrubs have no actual recovery, we can just skip past them on this check. Added simple null check.

Testing
http://localhost:2000

  1. Cast furgon shrub
  2. Successfully end turn - previously the game froze at this step.