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

Encapsulate Character::weapon #2657

Merged
merged 7 commits into from
May 8, 2023
Merged

Encapsulate Character::weapon #2657

merged 7 commits into from
May 8, 2023

Conversation

Coolthulhu
Copy link
Member

Summary

SUMMARY: Infrastructure "Encapsulate Character::weapon"

Purpose of change

Character::weapon implies that a character can only wield one item at a time. This is a step towards removing this limitation.

Describe the solution

Created new getter primary_weapon(). It returns a reference to the weapon.
Made Character::weapon private.

Describe alternatives you've considered

  • Not moving towards multi-wield at all
  • Starting with hacks involving wearing items
  • Starting with hacks involving items directly in inventory

Testing

  • Save+load doesn't break character's wielded item
  • Starting new game doesn't break character's item whether the character starts with an item or no item in hands

Additional context

@github-actions github-actions bot added src PR changes related to source code. tests PR changes related to tests labels Apr 16, 2023
@Coolthulhu
Copy link
Member Author

Self-merging in 1 day or so. Brace for impact (conflicts in PRs).

@Coolthulhu Coolthulhu requested a review from scarf005 May 8, 2023 02:26
Copy link
Member

@scarf005 scarf005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saving and Loading test

image

Starting a profession with wielded items

image
was able to follow given tests. LGTM

@scarf005 scarf005 merged commit 8572e8b into upload May 8, 2023
15 of 16 checks passed
@scarf005 scarf005 deleted the multiwield-part-0 branch May 8, 2023 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
src PR changes related to source code. tests PR changes related to tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants