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

Function polyman

src/polyself.c:199–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197
198/* make a (new) human out of the player */
199staticfn void
200polyman(const char *fmt, const char *arg)
201{
202 boolean sticking = (sticks(gy.youmonst.data) && u.ustuck && !u.uswallow),
203 was_mimicking = (U_AP_TYPE != M_AP_NOTHING);
204 boolean was_blind = !!Blind,
205 had_see_invis = !!See_invisible;
206
207 if (Upolyd) {
208 u.acurr = u.macurr; /* restore old attribs */
209 u.amax = u.mamax;
210 u.umonnum = u.umonster;
211 flags.female = u.mfemale;
212 }
213 set_uasmon();
214
215 u.mh = u.mhmax = 0;
216 u.mtimedone = 0;
217 skinback(FALSE);
218 u.uundetected = 0;
219
220 if (sticking)
221 uunstick();
222 find_ac();
223 if (was_mimicking) {
224 if (gm.multi < 0)
225 unmul("");
226 gy.youmonst.m_ap_type = M_AP_NOTHING;
227 gy.youmonst.mappearance = 0;
228 }
229
230 newsym(u.ux, u.uy);
231
232 urgent_pline(fmt, arg);
233 /* check whether player foolishly genocided self while poly'd */
234 if (ugenocided()) {
235 /* intervening activity might have clobbered genocide info */
236 struct kinfo *kptr = find_delayed_killer(POLYMORPH);
237
238 if (kptr != (struct kinfo *) 0 && kptr->name[0]) {
239 svk.killer.format = kptr->format;
240 Strcpy(svk.killer.name, kptr->name);
241 } else {
242 svk.killer.format = KILLED_BY;
243 Strcpy(svk.killer.name, "self-genocide");
244 }
245 dealloc_killer(kptr);
246 done(GENOCIDED);
247 }
248
249 if (!!See_invisible ^ had_see_invis)
250 set_mimic_blocking(); /* See_invisible just toggled */
251
252 if (u.twoweap && !could_twoweap(gy.youmonst.data))
253 untwoweapon();
254
255 if (u.utrap && u.utraptype == TT_PIT) {
256 set_utrap(rn1(6, 2), TT_PIT); /* time to escape resets */

Callers 2

newmanFunction · 0.85
rehumanizeFunction · 0.85

Calls 15

sticksFunction · 0.85
set_uasmonFunction · 0.85
skinbackFunction · 0.85
uunstickFunction · 0.85
find_acFunction · 0.85
unmulFunction · 0.85
newsymFunction · 0.85
urgent_plineFunction · 0.85
ugenocidedFunction · 0.85
find_delayed_killerFunction · 0.85
dealloc_killerFunction · 0.85
doneFunction · 0.85

Tested by

no test coverage detected