Fix bugs in SetMaster target handling. #804
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The ResetMonsterChasers message called by entering a room was masking bugs caused by SetMaster adding and removing targets but not correctly handling the piMonsterChasers property in Player used to keep track of how many mobs are chasing a player. That call was removed in the last hotfix as it was causing issues with multiple aggro on room entry with the faster movement timers and upgraded aggro code. SetMaster now handles target switching correctly by calling TargetSwitch or EnterStateWait which perform the appropriate checks before adding or removing a target.
Also modified SomethingMoved in brain.kod to take the correct action when the mob is in STATE_LIMBO rather than just print a debug string. If the monster hasn't been killed (i.e. still has an owner) it will return to action via entering STATE_MOVE, otherwise this will just return and not attempt any other actions the monster cannot take anyway.