]> granicus.if.org Git - nethack/commitdiff
U979 followup - mimic mimicking a boulder on Sokobon hole
authorcohrs <cohrs>
Tue, 25 May 2004 18:20:35 +0000 (18:20 +0000)
committercohrs <cohrs>
Tue, 25 May 2004 18:20:35 +0000 (18:20 +0000)
The previous change only affected mimics that started mimicing after the
level was created.  This change tries to perform a similar behavior for
randomly placed mimics that are forced to mimic a boulder on special levels.
In this case, since the symbol is fixed and the location is "random", try
several times to find a non-trap location for such a mimic.

src/sp_lev.c

index f0fe4c94c8290c77d11196d45105088246499da6..ba545952a5f1b9ed9487b2f6d81368fda8fdbe39 100644 (file)
@@ -860,6 +860,23 @@ struct mkroom      *croom;
                        } else {
                            mtmp->m_ap_type = M_AP_OBJECT;
                            mtmp->mappearance = i;
+                           /* try to avoid placing mimic boulder on a trap */
+                           if (i == BOULDER && m->x < 0 && t_at(x, y)) {
+                               int k;
+
+                               for (k = 0; k < 10 && t_at(x, y); ++k) {
+                                   x = m->x;
+                                   y = m->y;
+                                   if (croom)
+                                       get_room_loc(&x, &y, croom);
+                                   else {
+                                       get_location(&x, &y, DRY);
+                                   }
+                                   if (MON_AT(x,y) && enexto(&cc, x, y, pm))
+                                       x = cc.x,  y = cc.y;
+                               }
+                               place_monster(mtmp, x, y);
+                           }
                        }
                        break;