Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactors our Kleptomania brain trauma #5109

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

LikeLakers2
Copy link
Contributor

@LikeLakers2 LikeLakers2 commented Jan 26, 2025

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:

  • The kleptomania brain trauma is now responsible for handling the effects, rather than delegating this to a permanent status effect.
  • No more requirement for owner.m_intent == MOVE_INTENT_RUN
  • When stealing an item off the ground, we gather a list of all valid items, shuffle the list, then loop through the list until we manage to grab one (or not)
    • Before, we would just loop through the results of oview(1, owner), and stop once we managed to pickpocket one.
  • When stealing an item off of another person, we now select a random victim.
    • Before, we would just loop through the results of view(1, owner), and stop once we found a target that (1) wasn't us, and (2) had items in their pockets.
  • When stealing an item off of another person, the resulting visible messages are now sent to mobs further away. Previously, the victim would only see the messages if they were on the same tile!
  • Kleptomania logging has been improved. More information in the changelog below.

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:

@LikeLakers2 LikeLakers2 force-pushed the project/rewrite/kleptomania branch from 82fee44 to 0d1fcba Compare January 26, 2025 04:49
@Kitsunemitsu Kitsunemitsu added the Refactor/Rework Completely redoing a larger thing / recoding a thing label Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactor/Rework Completely redoing a larger thing / recoding a thing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants