divine gift of spell knowledge

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.
This commit is contained in:
PatR
2022-03-09 07:06:37 -08:00
parent 0effaf529a
commit e3490743e0
6 changed files with 151 additions and 75 deletions
+7 -8
View File
@@ -1,4 +1,4 @@
/* NetHack 3.7 teleport.c $NHDT-Date: 1605305493 2020/11/13 22:11:33 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.134 $ */
/* NetHack 3.7 teleport.c $NHDT-Date: 1646838392 2022/03/09 15:06:32 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.163 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
@@ -713,16 +713,15 @@ dotele(
if (!Teleportation || (u.ulevel < (Role_if(PM_WIZARD) ? 8 : 12)
&& !can_teleport(g.youmonst.data))) {
/* Try to use teleport away spell. */
boolean knownsp = known_spell(SPE_TELEPORT_AWAY);
int knownsp = known_spell(SPE_TELEPORT_AWAY);
/* casting isn't inhibited by being Stunned (...it ought to be) */
castit = (knownsp && !Confusion);
castit = (knownsp >= spe_Fresh && !Confusion);
if (!castit && !break_the_rules) {
You("%s.",
!Teleportation ? (knownsp
? "can't cast that spell"
: "don't know that spell")
: "are not able to teleport at will");
You("%s.", (!Teleportation ? ((knownsp != spe_Unknown)
? "can't cast that spell"
: "don't know that spell")
: "are not able to teleport at will"));
return 0;
}
}