MCPcopy Index your code
hub / github.com/NetHack/NetHack / skill_based_spellbook_id

Function skill_based_spellbook_id

src/spell.c:863–906  ·  view source on GitHub ↗

Wizards learn what spellbooks look like based on their skill in the spell's school */

Source from the content-addressed store, hash-verified

861/* Wizards learn what spellbooks look like based on their skill in the
862 spell's school */
863void
864skill_based_spellbook_id(void)
865{
866 if (!Role_if(PM_WIZARD))
867 return;
868
869 int booktype;
870 const uchar spbook_class = (uchar) SPBOOK_CLASS;
871
872 for (booktype = svb.bases[spbook_class];
873 booktype < svb.bases[spbook_class + 1];
874 booktype++) {
875 int known_up_to_level;
876 int skill = spell_skilltype(booktype);
877
878 if (skill == P_NONE)
879 continue;
880
881 switch (P_SKILL(skill)) {
882 case P_BASIC:
883 known_up_to_level = 3;
884 break;
885 case P_SKILLED:
886 known_up_to_level = 5;
887 break;
888 case P_EXPERT:
889 case P_MASTER:
890 case P_GRAND_MASTER:
891 known_up_to_level = 7;
892 break;
893 case P_UNSKILLED:
894 default:
895 /* paupers need more skill than this to ID books, but most wizards
896 know the basics */
897 known_up_to_level = u.uroleplay.pauper ? 0 : 1;
898 break;
899 }
900
901 if (objects[booktype].oc_level <= known_up_to_level)
902 /* makeknown(booktype) but don't exercise Wisdom or mark as
903 encountered */
904 discover_object(booktype, TRUE, FALSE, FALSE);
905 }
906}
907
908
909/* Limit the total area chain lightning can cover; this is both for

Callers 2

skill_advanceFunction · 0.85
skill_initFunction · 0.85

Calls 2

spell_skilltypeFunction · 0.85
discover_objectFunction · 0.85

Tested by

no test coverage detected