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

Function pick_familiar_pm

src/dog.c:103–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103staticfn struct permonst *
104pick_familiar_pm(struct obj *otmp, boolean quietly)
105{
106 struct permonst *pm = (struct permonst *) 0;
107
108 if (otmp) { /* figurine; otherwise spell */
109 int mndx = otmp->corpsenm;
110
111 assert(ismnum(mndx));
112 pm = &mons[mndx];
113 /* activating a figurine provides one way to exceed the
114 maximum number of the target critter created--unless
115 it has a special limit (erinys, Nazgul) */
116 if ((svm.mvitals[mndx].mvflags & G_EXTINCT)
117 && mbirth_limit(mndx) != MAXMONNO) {
118 if (!quietly)
119 /* have just been given "You <do something with>
120 the figurine and it transforms." message */
121 pline("... into a pile of dust.");
122 return (struct permonst *) 0;
123 }
124 } else if (!rn2(3)) {
125 pm = &mons[pet_type()];
126 } else {
127 int skill = spell_skilltype(SPE_CREATE_FAMILIAR);
128 int max = 3 * P_SKILL(skill);
129
130 pm = rndmonst_adj(0, max);
131 if (!pm && !quietly)
132 There("seems to be nothing available for a familiar.");
133 }
134 return pm;
135}
136
137struct monst *
138make_familiar(struct obj *otmp, coordxy x, coordxy y, boolean quietly)

Callers 1

make_familiarFunction · 0.85

Calls 7

mbirth_limitFunction · 0.85
rn2Function · 0.85
pet_typeFunction · 0.85
spell_skilltypeFunction · 0.85
rndmonst_adjFunction · 0.85
ThereFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected