Refactors our Kleptomania brain trauma #5109
Open
+88
−35
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.
About The Pull Request
Our Kleptomania brain trauma isn't really that well coded. This PR attempts to fix that.
Non-exhaustive list of changes:
owner.m_intent == MOVE_INTENT_RUN
oview(1, owner)
, and stop once we managed to pickpocket one.view(1, owner)
, and stop once we found a target that (1) wasn't us, and (2) had items in their pockets.I am considering drafting this PR and adding some unit tests for kleptomania. However, the base functionality is complete and tested - so I'm submitting the PR regardless.
Why It's Good For The Game
Refactors are good.
Changelog
🆑MichiRecRoom
refactor: Refactors the Kleptomania brain trauma.
del: Kleptomania no longer requires that you be in the RUN move intent.
fix: Kleptomania now chooses randomly between available victims (when pickpocketing) or available items (when stealing from the ground).
fix: Kleptomania messages regarding pickpocketing are now sent to mobs further away - previously, they would only be seen by mobs on the same tile!
admin: Kleptomania logs have been improved. Pickpocket attempts are now logged under the ATTACK and VICTIM logs, and attached to the appropriate mobs. Stealing items off the ground is now logged under the ATTACK logs.
/:cl: