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

Function pauper_reinit

src/u_init.c:869–925  ·  view source on GitHub ↗

for 'pauper' aka 'unprepared'; take away any skills (bare-handed combat, riding) that are better than unskilled; learn the book (without carrying it or knowing its spell yet) for some key spells */

Source from the content-addressed store, hash-verified

867 riding) that are better than unskilled; learn the book (without carrying
868 it or knowing its spell yet) for some key spells */
869staticfn void
870pauper_reinit(void)
871{
872 int skill, preknown = STRANGE_OBJECT;
873
874 if (!u.uroleplay.pauper)
875 return;
876
877 for (skill = 0; skill < P_NUM_SKILLS; skill++)
878 if (P_SKILL(skill) > P_UNSKILLED) {
879 P_SKILL(skill) = P_UNSKILLED;
880 P_ADVANCE(skill) = 0;
881 }
882 /* pauper has lost out on initial skills, but provide some unspent skill
883 credits to make up for that */
884 u.weapon_slots = 2;
885
886 /* paupers don't know any spells yet, but several roles will recognize
887 the spellbook for a key spell (not necessarily that role's special
888 spell); "supply chests" on the first few levels provide a fairly
889 high chance to find the book; some other roles know a non-book item */
890 switch (Role_switch) {
891 case PM_HEALER:
892 preknown = SPE_HEALING;
893 break;
894 case PM_CLERIC:
895 case PM_KNIGHT:
896 case PM_MONK:
897 preknown = SPE_PROTECTION;
898 break;
899 case PM_WIZARD:
900 preknown = SPE_FORCE_BOLT;
901 break;
902 case PM_ARCHEOLOGIST:
903 preknown = TOUCHSTONE;
904 break;
905 case PM_CAVE_DWELLER:
906 preknown = FLINT;
907 break;
908 case PM_ROGUE:
909 case PM_TOURIST:
910 preknown = SACK;
911 break;
912 case PM_SAMURAI:
913 /* food ration isn't interesting to discover, but put "gunyoki" into
914 discoveries list for players who might not recognize what it is */
915 preknown = FOOD_RATION;
916 break;
917 default:
918 case PM_BARBARIAN:
919 case PM_RANGER:
920 case PM_VALKYRIE:
921 break;
922 }
923 if (preknown != STRANGE_OBJECT)
924 knows_object(preknown, TRUE);
925}
926

Callers 1

Calls 1

knows_objectFunction · 0.85

Tested by

no test coverage detected