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

Fixes quivers not consuming charges. #34290

Merged
merged 1 commit into from
Sep 28, 2019
Merged

Conversation

BevapDin
Copy link
Contributor

SUMMARY: None

Fixes #32320.

This is what happens in the save from the linked issue:

g->u.ammo_location has an item_location that points to the nearby stack of arrows (when loading the save, the arrows are right next to the player character within a heap of items).

When firing the bow, the game uses g->u.ammo_location (as it is currently valid). This actually consumes the charges from that stack. The arrows in the quiver are not used as the arrows stack on the ground is enough. This may easily appear as if the firing had not consumed any ammo at all. (It actually does, I checked the stack on the ground after firing).

What is a bug is this:
ammo_location is used without accessibility check. It works, even when the location is far away (as long as it's inside the reality bubble).

g->u.ammo_location can be set via reloading the bow (this seems to be the intended behavior) or via changing the "attack mode of the wielded item" (F). The user may have accidentally selected that item stack nearby as their preferred ammo location.


I added some code to ensure the item from ammo_location is at least adjacent to the acting avatar.

@ZhilkinSerg ZhilkinSerg added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Ranged Ranged (firearms, bows, crossbows, throwing), balance, tactics Items: Ammo / Guns Ammunition for all kinds of weapons and these weapons themselves and removed Ranged Ranged (firearms, bows, crossbows, throwing), balance, tactics labels Sep 28, 2019
@ZhilkinSerg ZhilkinSerg merged commit ecedcee into CleverRaven:master Sep 28, 2019
@BevapDin BevapDin deleted the guh branch September 28, 2019 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Items: Ammo / Guns Ammunition for all kinds of weapons and these weapons themselves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quivers not consuming arrows, sometimes
2 participants