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

Function accept_newcham_form

src/mon.c:5228–5252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5226
5227/* this used to be inline within newcham() but monpolycontrol needs it too */
5228staticfn struct permonst *
5229accept_newcham_form(struct monst *mon, int mndx)
5230{
5231 struct permonst *mdat;
5232
5233 if (mndx == NON_PM)
5234 return 0;
5235 mdat = &mons[mndx];
5236 if ((svm.mvitals[mndx].mvflags & G_GENOD) != 0)
5237 return 0;
5238 if (is_placeholder(mdat))
5239 return 0;
5240 /* select_newcham_form() might deliberately pick a player
5241 character type (random selection never does) which
5242 polyok() rejects, so we need a special case here */
5243 if (is_mplayer(mdat))
5244 return mdat;
5245 /* shapeshifters are rejected by polyok() but allow a shapeshifter
5246 to take on its 'natural' form */
5247 if (is_shapeshifter(mdat)
5248 && ismnum(mon->cham) && mdat == &mons[mon->cham])
5249 return mdat;
5250 /* polyok() rules out M2_PNAME, M2_WERE, and all humans except Kops */
5251 return polyok(mdat) ? mdat : 0;
5252}
5253
5254/* shapechanger might take on a shape that forces gender change */
5255void

Callers 2

validspecmonFunction · 0.85
newchamFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected