[FIX] Fix Code Loop in rod of asclepius try_attach_to_owner() #28036
+35
−26
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.
What Does This PR Do
Fixes a code loop in the try_attach_to_owner() function of the Rod of Asclepius by adding a check to see if the owner is equal to the thief. Previously, it was called on dropped(), which forced the thief to drop the rod and then it returns to the owner's hand, causing an infinite loop.
Additionally, refactors try_attach_to_owner() to utilize guard clauses.
Fixes #28035
Why It's Good For The Game
Code loops are bad
Testing
Used the rod of asclepius, gave myself advanced kingston disease, changed the disease's stage probability to 50, transformed into Unathi, spawned a human, and set his brute damage to 50. The code did not loop, and the rod still healed the human.
Declaration
Changelog
🆑
fix: Fixed code loop when you change your species with rod of asclepius in hand
/:cl: