]> granicus.if.org Git - nethack/commitdiff
fix #H165 - sokoban "flaw" (trunk only)
authornethack.rankin <nethack.rankin>
Tue, 3 Apr 2007 03:20:27 +0000 (03:20 +0000)
committernethack.rankin <nethack.rankin>
Tue, 3 Apr 2007 03:20:27 +0000 (03:20 +0000)
     Back in <email deleted> complained
that randomly generated giants in Sokoban would drop boulders when killed,
interfering with the puzzle solution.  He suggested that giants either
be disallowed or be generated without inventory in that dungeon branch.
This doesn't go that far; it just rejects giants on the first pass during
random monster selection, making them much less likely to appear there
but still allowing them if giant is chosen two times in a row.  (Existing
boulders aren't an issue here; giants can't pick them up in Sokoban.)

doc/fixes35.0
src/makemon.c

index 815628b62ac135db7b2052260edbd5b8624c8a61..1c136f1f6bdf31ad0f51a26a046d09f7d09d3404 100644 (file)
@@ -209,6 +209,7 @@ effect of negative AC on damage received was calculated differently than
 unicorn horn produced by revived monster will polymorph as if non-magic
 stone-to-flesh on any golem statue or golem figurine creates flesh golem
 stone-to-flesh which activates shop-owned figurine entails shop charges
+make giants be less likely to be randomly generated in Sokoban
 
 
 Platform- and/or Interface-Specific Fixes
index f8d4164510422eaca40bd0c45c32ac3c1c05b396..6499298eb79c0cb9572185a3a5546b53085e4f4e 100644 (file)
@@ -938,6 +938,7 @@ register int        mmflags;
                 */
                int tryct = 0;  /* maybe there are no good choices */
                struct monst fakemon;
+
                do {
                        if(!(ptr = rndmonst())) {
 #ifdef DEBUG
@@ -946,7 +947,11 @@ register int       mmflags;
                            return((struct monst *) 0); /* no more monsters! */
                        }
                        fakemon.data = ptr;     /* set up for goodpos */
-               } while(!goodpos(x, y, &fakemon, gpflags) && tryct++ < 50);
+               } while (++tryct <= 50 &&
+                   /* in Sokoban, don't accept a giant on first try;
+                      after that, boulder carriers are fair game */
+                   ((tryct == 1 && throws_rocks(ptr) && In_sokoban(&u.uz)) ||
+                       !goodpos(x, y, &fakemon, gpflags)));
                mndx = monsndx(ptr);
        }
        (void) propagate(mndx, countbirth, FALSE);