]> granicus.if.org Git - nethack/commitdiff
Fix strange object mimic in shop sanity error
authorPasi Kallinen <paxed@alt.org>
Sat, 26 Jun 2021 10:00:32 +0000 (13:00 +0300)
committerPasi Kallinen <paxed@alt.org>
Sat, 26 Jun 2021 10:03:28 +0000 (13:03 +0300)
Shop population code set the mimic shape to strange object
without checking for protection from shape changers.
Let set_mimic_sym (via makemon) handle it correctly instead.

src/makemon.c
src/shknam.c

index b2900db9b6914aa9e0fc0c6c8fe64a0704dde1f1..5ed63ab646e70323c2e54edd8c70ae44566b721a 100644 (file)
@@ -2212,6 +2212,10 @@ set_mimic_sym(register struct monst *mtmp)
      */
 
     } else if (rt >= SHOPBASE) {
+        if (rn2(10) >= depth(&u.uz)) {
+            s_sym = S_MIMIC_DEF; /* -> STRANGE_OBJECT */
+            goto assign_sym;
+        }
         s_sym = get_shop_item(rt - SHOPBASE);
         if (s_sym < 0) {
             ap_type = M_AP_OBJECT;
index ecba179930baaf40e8cf1e143abeecfd9703230d..2f7e1998c2390bd8c916a1056b6ff9e3a43f128d 100644 (file)
@@ -463,11 +463,7 @@ mkshobj_at(const struct shclass* shp, int sx, int sy, boolean mkspecl)
     if (rn2(100) < depth(&u.uz) && !MON_AT(sx, sy)
         && (ptr = mkclass(S_MIMIC, 0)) != 0
         && (mtmp = makemon(ptr, sx, sy, NO_MM_FLAGS)) != 0) {
-        /* note: makemon will set the mimic symbol to a shop item */
-        if (rn2(10) >= depth(&u.uz)) {
-            mtmp->m_ap_type = M_AP_OBJECT;
-            mtmp->mappearance = STRANGE_OBJECT;
-        }
+        /* nothing */
     } else {
         atype = get_shop_item((int) (shp - shtypes));
         if (atype == VEGETARIAN_CLASS)