like mkclass(), but excludes difficulty considerations; used when player with polycontrol picks a class instead of a specific type; genocided types are avoided but extinct ones are acceptable; we don't check polyok() here--caller accepts some choices !polyok() would reject */
| 1980 | genocided types are avoided but extinct ones are acceptable; we don't |
| 1981 | check polyok() here--caller accepts some choices !polyok() would reject */ |
| 1982 | int |
| 1983 | mkclass_poly(int class) |
| 1984 | { |
| 1985 | int first, last, num = 0; |
| 1986 | unsigned gmask; |
| 1987 | |
| 1988 | for (first = LOW_PM; first < SPECIAL_PM; first++) |
| 1989 | if (mons[first].mlet == class) |
| 1990 | break; |
| 1991 | if (first == SPECIAL_PM) |
| 1992 | return NON_PM; |
| 1993 | |
| 1994 | gmask = (G_NOGEN | G_UNIQ); |
| 1995 | /* mkclass() does this on a per monster type basis, but doing that here |
| 1996 | would make the two loops inconsistent with each other for non L */ |
| 1997 | if (rn2(9) || class == S_LICH) |
| 1998 | gmask |= (Inhell ? G_NOHELL : G_HELL); |
| 1999 | |
| 2000 | for (last = first; last < SPECIAL_PM && mons[last].mlet == class; last++) |
| 2001 | if (mk_gen_ok(last, G_GENOD, gmask)) |
| 2002 | num += mons[last].geno & G_FREQ; |
| 2003 | if (!num) |
| 2004 | return NON_PM; |
| 2005 | |
| 2006 | for (num = rnd(num); num > 0; first++) |
| 2007 | if (mk_gen_ok(first, G_GENOD, gmask)) |
| 2008 | num -= mons[first].geno & G_FREQ; |
| 2009 | first--; /* correct an off-by-one error */ |
| 2010 | |
| 2011 | return first; |
| 2012 | } |
| 2013 | |
| 2014 | /* adjust strength of monsters based on u.uz and u.ulevel */ |
| 2015 | int |
no test coverage detected