Remove the conduct-specific aspect of receiving spells as prayer boon.
Anyone now has a 25% chance of having the spell directly implanted
into their head, not just characters who have maintained illiterate
conduct. It can now also restore a forgotten spell or refresh one
that is nearly forgotten. It still tries to choose a spell which
isn't already known (new: or was known but has been forgotten) but if
it picks one that is known and doesn't need refreshing, a redundant
book will be given, same as the behavior in earlier versions.
The chance for receiving a blank spellbook is higher when that item
is undiscovered. When given as a prayer reward, make it become
discovered even if hero doesn't read it so that it will be less likely
to be given again. There's a 1% chance for that auto-discovery to
happen with other bestowed books. Unlike blank boots, having the book
be discovered doesn't lessen their chance of being repeat gifts.
Minor bug fix: for a spell implanted from scratch, the book remains
unknown. That's ok; it's actually more interesting than discovering
a book you haven't seen yet. But after acquiring and reading the book
you could get "you know <spell> quite well already" and the book would
stay undiscovered even though you were just told what spell it's for.
I did my best to exempt some of the bigger aligned blocks from the reformatting
using the /* clang-format off */ and /* clang-format on */ tags. Probably some
that shouldn't have been formatted were anyway; if you encounter them, please
fix.
The clang-format tags were left in on the basis that it's much easier to prune
those out later than to put them back in, and it means that, modulo my custom
version of clang-format, I should be able to run clang-format on the source tree
again without changing anything, now that Pat has fixed the VA_DECL issues.
Move NO_SPELL and MAX_SPELL_STUDY from hack.h to spell.h. I didn't
even remember that the latter existed when I put MAX_SPELL_STUDY in the
former recently.
Add a couple of new "spell is almost gone" messages that occur when
casting spells. One matches up with yesterday's change for when you can
re-read a spellbook to reinforce memory of a known spell.
When "too hungry", you can't cast any spells, except detect food so
that you can find something to eat. When "too weak" you couldn't cast any
spells at all; now you can cast restore ability so that you can recover
lost strength. [We still need to come up with a better crowning bonus for
monks than spellbook of restore ability.] I couldn't think of a reasonable
exception for the "can't cast when carrying too much" restriction. If we
can come up with one (levitation?), then remove curse could/should become
an exception for the "no free hands" restriction.