diff -urd nethack-3.6.0/src/hack.c modding-nethack-3.6.0/src/hack.c --- nethack-3.6.0/src/hack.c Wed Nov 25 03:11:02 2015 +++ modding-nethack-3.6.0/src/hack.c Mon Jan 4 12:59:30 2016 @@ -668,6 +668,8 @@ int y = uy + dy; register struct rm *tmpr = &levl[x][y]; register struct rm *ust; + char waterbuf[BUFSZ]; + register int wwalksafe = 0; context.door_opened = FALSE; /* @@ -789,13 +791,28 @@ } /* Pick travel path that does not require crossing a trap. * Avoid water and lava using the usual running rules. - * (but not u.ux/u.uy because findtravelpath walks toward u.ux/u.uy) */ + * (but not u.ux/u.uy because findtravelpath walks toward u.ux/u.uy) + * D.S. add water walking if safe */ if (context.run == 8 && mode != DO_MOVE && (x != u.ux || y != u.uy)) { struct trap *t = t_at(x, y); + if (Wwalking && !Is_waterlevel(&u.uz) && uarmf + && uarmf->dknown && objects[uarmf->otyp].oc_name_known) { + if (is_lava(x, y)) { + /* Walking over lava safely requires all of fire + * resistance, fireproof water walking boots, and to + * know the boots are such. */ + wwalksafe = uarmf->oerodeproof && uarmf->rknown + && Fire_resistance; + } + else { + wwalksafe = 1; + } + } + if ((t && t->tseen) || (!Levitation && !Flying && !is_clinger(youmonst.data) - && is_pool_or_lava(x, y) && levl[x][y].seenv)) + && is_pool_or_lava(x, y) && levl[x][y].seenv) && !wwalksafe) return FALSE; } @@ -836,6 +853,35 @@ /* assume you'll be able to push it when you get there... */ } + /* D.S. prompt if moving into lava or water and not absolutely safe. + * WWalking only works if boots are known (and known fireproof for lava) + * is_clinger(steed) appears to be a 3.6.0 change from 3.4.3 behavior + * Never ask if already on water, which should only mean unbreathing*/ + if (mode == DO_MOVE && is_pool_or_lava(x, y) && !is_pool_or_lava(ux, uy)){ + if (Wwalking && uarmf && uarmf->dknown + && objects[uarmf->otyp].oc_name_known) { + if (is_lava(x, y)) { + /* Walking over lava safely requires all of fire + * resistance, fireproof water walking boots, and to + * know the boots are such. */ + wwalksafe = uarmf->oerodeproof && uarmf->rknown + && Fire_resistance; + } + else { + wwalksafe = 1; + } + } + + if (Is_waterlevel(&u.uz) || (!Levitation && !Flying && !wwalksafe + && (u.usteed == NULL || (is_flyer(u.usteed->data) + || is_floater(u.usteed->data) || is_clinger(u.usteed->data)) ))) { + sprintf(waterbuf, "Really step into the %s?", surface(x, y)); + if (yn(waterbuf) != 'y') { + return FALSE; + } + } + } + /* OK, it is a legal place to move. */ return TRUE; } @@ -1820,6 +1866,10 @@ } else if (Flying) { You("fly out of the water."); } else if (Wwalking) { + /* D.S. The effect is unambiguous, identify the boots. */ + if (uarmf) { + makeknown(uarmf->otyp); + } You("slowly rise above the surface."); } else { still_inwater = TRUE; @@ -1863,9 +1913,15 @@ if (is_lava(u.ux, u.uy)) { if (lava_effects()) return TRUE; - } else if (!Wwalking - && (newspot || !u.uinwater || !(Swimming || Amphibious))) { - if (drown()) + } else if (newspot || !u.uinwater || (Swimming || Amphibious)) { + if (Wwalking) { + if (uarmf && !objects[uarmf->otyp].oc_name_known) { + /* D.S. Make boots known and print a message (once) */ + You("stand on top of the water."); + makeknown(uarmf->otyp); + } + } + else if (drown()) return TRUE; } } @@ -2378,7 +2434,7 @@ lookaround() { register int x, y, i, x0 = 0, y0 = 0, m0 = 1, i0 = 9; - register int corrct = 0, noturn = 0; + register int corrct = 0, noturn = 0, wwalksafe = 0; register struct monst *mtmp; register struct trap *trap; @@ -2455,11 +2511,25 @@ /* water and lava only stop you if directly in front, and stop * you even if you are running */ + if (uarmf && uarmf->dknown && + objects[uarmf->otyp].oc_name_known) { + if (is_lava(x, y)) { + /* Walking over lava safely requires all of fire + * resistance, fireproof water walking boots, and to + * know the boots are such. */ + wwalksafe = uarmf->oerodeproof && uarmf->rknown + && Fire_resistance; + } + else { + wwalksafe = 1; + } + } if (!Levitation && !Flying && !is_clinger(youmonst.data) - && x == u.ux + u.dx && y == u.uy + u.dy) + && !wwalksafe && x == u.ux + u.dx && y == u.uy + u.dy) /* No Wwalking check; otherwise they'd be able * to test boots by trying to SHIFT-direction * into a pool and seeing if the game allowed it + * D.S. - changed to allow if _known_ wwalking boots */ goto stop; continue; diff -urd nethack-3.6.0/src/trap.c modding-nethack-3.6.0/src/trap.c --- nethack-3.6.0/src/trap.c Thu Nov 26 00:41:58 2015 +++ modding-nethack-3.6.0/src/trap.c Mon Jan 4 12:59:51 2016 @@ -5000,6 +5000,15 @@ useup(obj); iflags.in_lava_effects--; } + else if (Wwalking && uarmf && is_organic(uarmf)) { + /* D.S. Waterwalking boots survived. Make the type known and that + * they're fireproof. Print a message as well (but only once) */ + if (!objects[uarmf->otyp].oc_name_known) { + You("stand on top of the lava."); + makeknown(uarmf->otyp); + } + uarmf->rknown = TRUE; + } if (!Fire_resistance) { if (Wwalking) {