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

Function validspecmon

src/mon.c:4992–5011  ·  view source on GitHub ↗

restrict certain special monsters (shopkeepers, aligned priests, vault guards) to forms that allow them to behave sensibly (catching gold, speaking?) so that they don't need too much extra code */

Source from the content-addressed store, hash-verified

4990 vault guards) to forms that allow them to behave sensibly (catching
4991 gold, speaking?) so that they don't need too much extra code */
4992staticfn boolean
4993validspecmon(struct monst *mon, int mndx)
4994{
4995 if (mndx == NON_PM)
4996 return TRUE; /* caller wants random */
4997
4998 if (!accept_newcham_form(mon, mndx))
4999 return FALSE; /* geno'd or !polyok */
5000
5001 if (isspecmon(mon)) {
5002 struct permonst *ptr = &mons[mndx];
5003
5004 /* reject notake because object manipulation is expected
5005 and nohead because speech capability is expected */
5006 if (notake(ptr) || !has_head(ptr))
5007 return FALSE;
5008 /* [should we check ptr->msound here too?] */
5009 }
5010 return TRUE; /* potential new form is ok */
5011}
5012
5013/* used for hero polyself handling */
5014boolean

Callers 2

validvampFunction · 0.85
select_newcham_formFunction · 0.85

Calls 2

accept_newcham_formFunction · 0.85
isspecmonFunction · 0.85

Tested by

no test coverage detected