MCPcopy Create free account
hub / github.com/NetHack/NetHack / were_summon

Function were_summon

src/were.c:141–189  ·  view source on GitHub ↗

were-creature (even you) summons a horde */

Source from the content-addressed store, hash-verified

139
140/* were-creature (even you) summons a horde */
141int
142were_summon(
143 struct permonst *ptr,
144 boolean yours,
145 int *visible, /* number of visible helpers created */
146 char *genbuf)
147{
148 int i, typ, pm = monsndx(ptr);
149 struct monst *mtmp;
150 int total = 0;
151
152 *visible = 0;
153 if (Protection_from_shape_changers && !yours)
154 return 0;
155 for (i = rnd(5); i > 0; i--) {
156 switch (pm) {
157 case PM_WERERAT:
158 case PM_HUMAN_WERERAT:
159 typ = rn2(3) ? PM_SEWER_RAT
160 : rn2(3) ? PM_GIANT_RAT : PM_RABID_RAT;
161 if (genbuf)
162 Strcpy(genbuf, "rat");
163 break;
164 case PM_WEREJACKAL:
165 case PM_HUMAN_WEREJACKAL:
166 typ = rn2(7) ? PM_JACKAL : rn2(3) ? PM_COYOTE : PM_FOX;
167 if (genbuf)
168 Strcpy(genbuf, "jackal");
169 break;
170 case PM_WEREWOLF:
171 case PM_HUMAN_WEREWOLF:
172 typ = rn2(5) ? PM_WOLF : rn2(2) ? PM_WARG : PM_WINTER_WOLF;
173 if (genbuf)
174 Strcpy(genbuf, "wolf");
175 break;
176 default:
177 continue;
178 }
179 mtmp = makemon(&mons[typ], u.ux, u.uy, NO_MM_FLAGS);
180 if (mtmp) {
181 total++;
182 if (canseemon(mtmp))
183 *visible += 1;
184 }
185 if (yours && mtmp)
186 (void) tamedog(mtmp, (struct obj *) 0, FALSE);
187 }
188 return total;
189}
190
191void
192you_were(void)

Callers 2

dosummonFunction · 0.85
summonmuFunction · 0.85

Calls 5

rndFunction · 0.85
rn2Function · 0.85
makemonFunction · 0.85
canseemonFunction · 0.85
tamedogFunction · 0.85

Tested by

no test coverage detected