The main discussion about all this occurred in
a past bug report. Prior to the bug fix (back in 2010), monsters would become unbrained as soon as the last brain was killed, unless there was still a Guard left in the room.
Mike didn't want monster movement order to determine whether the remaining enemies would be brained or unbrained, so the fix was built to make "
brain detection"
occur after a particular process sequence. And as noted, given the Slayers and Guards can still use brains to detect Beethro, it didn't make sense to have this check occur after they've moved. I chose after Player Doubles since it's also when objects can fall off platforms the first time.
(In retrospect, another method of dealing with this could've been to give Brains their own unique Processing Speed so that it's clear where they 'act' in the turn order -- they literally do nothing on their turn anyways. But changing that after all this time would be very risky now, since Fluff use monster movement order to break ties when picking targets.)
So whether this should be changed at all is certainly debatable. Also, if scripted characters ever get the ability to query or follow brained paths, then there may need to be an answer to what should occur if the character moves faster than Player Doubles (and thus before the brain would normally detect Beethro).
All this said, there *is* a current bug with the code that I can see, and that's down to a small optimization left in since JtRH that hasn't been looked at since but could now cause problems with scripting with custom Process Sequences. Namely, Brains can only be checked if at least one brain exists after Beethro moves, but the check will only happen once all Player Doubles have moved.
This means that a new Brain could be generated by a fast script (acting before Mimics) either via Generate Entity or Turn into Monster. If there were no brains in the room before that script, then the new Brain can't detect Beethro. But if there was a Brain still in the room after Beethro moved, then even if that Brain is killed by a Mimic, the new Brain would be allowed to run its check and detect Beethro on the turn it appeared.
Fixing that would be trivial: just make sure bBrainCheck starts as 'false' after Player Movement, and move the 'this->
pRoom->
wBrainCount >
0' optimization into the actual Brain Check code (so that the BrainSensesSwordsman() routine is only run if there's at least one Brain around during the check). bBrainCheck should be set to true afterwards in either case since we'd only want this to run once.
Technically Platform falling has a similar problem, but scripting can't create new Platforms at this time, so it's not an issue (yet).
[Last edited by TFMurphy at 02-21-2023 12:02 AM]