Kruptein / PlanarAlly

A companion tool for when you travel into the planes.
https://www.planarally.io/
MIT License
392 stars 71 forks source link

bug(Initiative): Fix entry removal breaking turn logic in edge case #1266

Closed Kruptein closed 1 year ago

Kruptein commented 1 year ago

When the active initiative actor is the last entry in the initiative and is removed, the turn order was not being updated accordingly, causing the internal initiative tracker to point to an undefined entry. Attempts to advance/rewind initiative would fail as these do some sanity checks that were now failing.

This PR fixes the issue and also adds a sanity check to turn updating to catch faulty internal state and fix it.