Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Transfer inhaler to NPC inventory on mission end (#37454)
* Let asthmatic NPC keep inhaler after quest I recruited an asthmatic NPC after completing their inhaler mission and was startled to see they had already lost it. This allows them to keep the inhaler you find for them. Attempted fix for #31773. I have detailed some problems with this commit in comments on that issue. * Not take away all the player's inhalers This may be a case of the workaround being worse than what's being worked around. Will find a better solution. * Don't sell inhaler by individual charges When using this function to sell an inhaler to an NPC, `u.has_charges` is (apparently) returning true (since player has inhaler charges), although the inhaler itself is not counted by charges according to @BevapDin. This change makes `set_u_sell_item` follow more closely the pattern of `set_u_buy_item`, by merging the two separate `if/else` blocks into one, handling both the charge adjustment and `p.i_add` to transfer them item. Most importantly, the first condition for doing charge-based adjustment is whether `count_by_charges()` is true. I've preserved the check for `u.has_charges`, because we need to ensure the requested number of charges are available.
- Loading branch information