From: PatR Date: Thu, 16 Apr 2020 08:09:01 +0000 (-0700) Subject: mimic in health food store X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=10a89a529cc75f49c7fc4584704b3562babffb51;p=nethack mimic in health food store Make a mimic that picks special VEGETARIAN_CLASS look like food instead of a random object. Also, at least a couple of Minetown variants are classified as mazes so had a 50% chance of not even making that choice and look like a statue instead. Override maze when 'in_town()' yields True. --- diff --git a/src/makemon.c b/src/makemon.c index d03801d65..a6aee572d 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 makemon.c $NHDT-Date: 1585361050 2020/03/28 02:04:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.162 $ */ +/* NetHack 3.6 makemon.c $NHDT-Date: 1587024537 2020/04/16 08:08:57 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.168 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2184,7 +2184,9 @@ register struct monst *mtmp; appear = Is_rogue_level(&u.uz) ? S_hwall : S_hcdoor; else appear = Is_rogue_level(&u.uz) ? S_vwall : S_vcdoor; - } else if (g.level.flags.is_maze_lev && !In_sokoban(&u.uz) && rn2(2)) { + } else if (g.level.flags.is_maze_lev + && !(In_mines(&u.uz) && in_town(u.ux, u.uy)) + && !In_sokoban(&u.uz) && rn2(2)) { ap_type = M_AP_OBJECT; appear = STATUE; } else if (roomno < 0 && !t_at(mx, my)) { @@ -2215,16 +2217,26 @@ register struct monst *mtmp; if (s_sym < 0) { ap_type = M_AP_OBJECT; appear = -s_sym; + } else if (rt == FODDERSHOP && s_sym > MAXOCLASSES) { + /* health food store usually generates pseudo-class + VEGETARIAN_CLASS which is MAXOCLASSES+1; we don't bother + trying to select among all possible vegetarian food items */ + ap_type = M_AP_OBJECT; + appear = rn2(2) ? LUMP_OF_ROYAL_JELLY : SLIME_MOLD; } else { if (s_sym == RANDOM_CLASS || s_sym >= MAXOCLASSES) - s_sym = syms[rn2((int) sizeof(syms) - 2) + 2]; + s_sym = syms[rn2(SIZE(syms) - 2) + 2]; goto assign_sym; } } else { - s_sym = syms[rn2((int) sizeof(syms))]; + s_sym = syms[rn2(SIZE(syms))]; assign_sym: if (s_sym == MAXOCLASSES) { - const int furnsyms[] = { S_upstair, S_dnstair, S_altar, S_grave, S_throne, S_sink }; + static const int furnsyms[] = { + S_upstair, S_upstair, S_dnstair, S_dnstair, + S_altar, S_grave, S_throne, S_sink + }; + ap_type = M_AP_FURNITURE; appear = furnsyms[rn2(SIZE(furnsyms))]; } else {