Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix #H2161 - writing scrolls based on description (trunk only)
From a bug report, you could write scrolls by type name ("magic mapping") if you had that type of scroll in your discoveries list via assigning a name to an unknown scroll ("scroll labeled FOOBIE BLETCH called foo"). Being on that list was enough to treat the type as known when writing scrolls and books. And he fealt that it was abusive to be able to collect and name a lot of unknown scrolls and then write favorite ones which had good odds of being in the collected set. This changes it to the original intent: if your discoveries list has FOOBIE BLETCH on it, you can write a scroll by that label (since we decided way back when that a scroll's label was its magic, to explain how a blind hero can read any scroll whose description is known even though they aren't constructed in braille). If you have identified the type ("scroll of magic mapping labeled FOOBIE BLETCH") then you can write by type or by description, but you can no longer write one by type when only the description is known. There is a potential can-of-worms bug here: if you walked across a "scroll labeled YUM YUM" but have not assigned it any name, you've still learned its magic words and ought to be able to write a scroll of YUM YUM. We don't have any mechanism to track items which have been observed but not been put on the discoveries list. This patch plugs one obvious hole, by scanning inventory to treat any seen scroll labels there as an extension of the discoveries list. But the more general case of something once seen but not named or currently held is ignored. This also adds writing scrolls by the user-assigned name, so if your discoveries list has "scroll labeled FOOBIE BLETCH called foo" you can write either foo or FOOBIE BLETCH to get the scroll. I'm not sure the bug report advocated that--parts of it were a bit confusing, at least to me--and I'm not completely sure that we want to have it, but it does work. Without it, you got "no such thing as \"foo\"", which seems counter-intuitive when "foo" is there in plain sight on your discoveries list. The new code chooses randomly if multiple scrolls have been called "foo". And if you've called something by an actual object name, it uses your knowledge of that object rather than anything you've given its name to. In other words, if you have "scroll labeled YUM YUM called magic mapping" and try to write magic mapping, it will use your knowledge--or lack of same--about scroll of magic mapping rather than scroll labeled YUM YUM to decide whether you'll succeed. There is also a minor tweak in the chance to write a completely unknown scroll or book. Wizards almost never failed once their Luck was 5 or more; using rnl(5) instead of rnl(3) requires Luck 11 rather than just 5 to get that ~39/40 chance of success. Non-wizards didn't change. Lastly, this fixes an unrelated bug when writing spellbooks. The message "the spellbook warps strangely, then turns <new description>" works okay when <new description> is "red" or even "ragged", but not so well when it's "vellum". A handful of book descriptions refer to the item composition rather than the appearance of the cover, and turning into a new composition needs different phrasing. I just tweaked it to be "turns into vellum", which is probably suboptimal (particularly for the book description "cloth" :-).
- Loading branch information