-/* NetHack 3.6 do.c $NHDT-Date: 1548978604 2019/01/31 23:50:04 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.189 $ */
+/* NetHack 3.6 do.c $NHDT-Date: 1576638499 2019/12/18 03:08:19 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.198 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
/* JNetHack Copyright */
/* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000 */
-/* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2019 */
+/* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2022 */
/* JNetHack may be freely redistributed. See license for details. */
#include "hack.h"
struct trap *t;
struct monst *mtmp;
struct obj *otmp;
+#if 0 /*JP*//*unused*/
boolean tseen;
int ttyp = NO_TRAP;
+#endif
if (obj->where != OBJ_FREE)
panic("flooreffects: obj not free");
return TRUE;
} else if (obj->otyp == BOULDER && (t = t_at(x, y)) != 0
&& (is_pit(t->ttyp) || is_hole(t->ttyp))) {
+#if 0 /*JP*/
ttyp = t->ttyp;
tseen = t->tseen ? TRUE : FALSE;
+#endif
if (((mtmp = m_at(x, y)) && mtmp->mtrapped)
|| (u.utrap && u.ux == x && u.uy == y)) {
if (*verb && (cansee(x, y) || distu(x, y) == 0))
since trapped target is a sitting duck */
int damage, dieroll = 1;
- /* 3.6.2: this was calling hmon() unconditionally
+ /* As of 3.6.2: this was calling hmon() unconditionally
so always credited/blamed the hero but the boulder
might have been thrown by a giant or launched by
a rolling boulder trap triggered by a monster or
}
return water_damage(obj, NULL, FALSE) == ER_DESTROYED;
} else if (u.ux == x && u.uy == y && (t = t_at(x, y)) != 0
- && uteetering_at_seen_pit(t)) {
+ && (uteetering_at_seen_pit(t) || uescaped_shaft(t))) {
if (Blind && !Deaf)
/*JP
You_hear("%s tumble downwards.", the(xname(obj)));
You_hear("%s\82ª\89º\82Ì\95û\82Ö\93]\82ª\82Á\82Ä\82¢\82\89¹\82ð\95·\82¢\82½\81D", xname(obj));
else
#if 0 /*JP*/
- pline("%s %s into %s pit.", The(xname(obj)),
- otense(obj, "tumble"), the_your[t->madeby_u]);
+ pline("%s %s into %s %s.", The(xname(obj)),
+ otense(obj, "tumble"), the_your[t->madeby_u],
+ is_pit(t->ttyp) ? "pit" : "hole");
#else
- pline("%s\82Í%s\97\8e\82Æ\82µ\8c\8a\82É\93]\82ª\82è\82¨\82¿\82½\81D", xname(obj),
+ pline("%s\82Í%s\8c\8a\82É\93]\82ª\82è\82¨\82¿\82½\81D", xname(obj),
set_you[t->madeby_u]);
#endif
} else if (obj->globby) {
#else
pline("%s\82ª\8dÕ\92d\82É\90G\82ê\82é\82Æ%s\8cõ\82Á\82½\81D",
doname(obj),
- jconj_adj(hcolor(obj->blessed ? NH_AMBER : NH_BLACK)));
+ hcolor_adv(obj->blessed ? NH_AMBER : NH_BLACK));
#endif
if (!Hallucination)
- obj->bknown = 1;
+ obj->bknown = 1; /* ok to bypass set_bknown() */
} else {
/*JP
pline("%s %s on the altar.", Doname2(obj), otense(obj, "land"));
*/
pline("%s\82ð\8dÕ\92d\82Ì\8fã\82É\92u\82¢\82½\81D", Doname2(obj));
if (obj->oclass != COIN_CLASS)
- obj->bknown = 1;
+ obj->bknown = 1; /* ok to bypass set_bknown() */
}
}
{
uchar sym = S_sink;
boolean sinklooted;
+ int algn;
if (levl[u.ux][u.uy].typ != SINK)
return;
case 2:
sym = S_altar;
levl[u.ux][u.uy].typ = ALTAR;
- levl[u.ux][u.uy].altarmask = Align2amask(rn2((int) A_LAWFUL + 2) - 1);
+ /* 3.6.3: this used to pass 'rn2(A_LAWFUL + 2) - 1' to
+ Align2amask() but that evaluates its argument more than once */
+ algn = rn2(3) - 1; /* -1 (A_Cha) or 0 (A_Neu) or +1 (A_Law) */
+ levl[u.ux][u.uy].altarmask = ((Inhell && rn2(3)) ? AM_NONE
+ : Align2amask(algn));
break;
case 3:
sym = S_room;
hcolor((obj->spe < 0) ? NH_BLACK : NH_SILVER));
#else
pline("\97¬\82µ\91ä\82Í\88ê\8fu%s\8bP\82¢\82½\81D",
- jconj_adj(hcolor((obj->spe < 0) ? NH_BLACK : NH_SILVER)));
+ hcolor_adv((obj->spe < 0) ? NH_BLACK : NH_SILVER));
#endif
break;
case RIN_WARNING:
/*JP
pline_The("sink glows %s for a moment.", hcolor(NH_WHITE));
*/
- pline("\97¬\82µ\91ä\82Í\88ê\8fu%s\8bP\82¢\82½\81D", jconj_adj(hcolor(NH_WHITE)));
+ pline("\97¬\82µ\91ä\82Í\88ê\8fu%s\8bP\82¢\82½\81D", hcolor_adv(NH_WHITE));
break;
case RIN_TELEPORT_CONTROL:
/*JP: "beam aboard" \82Í\83X\83^\81[\83g\83\8c\83b\83N\82Ì\81u\93]\91\97\81v*/
#endif
}
obj->corpsenm = 0; /* reset */
- obj->bknown = 1;
+ set_bknown(obj, 1);
return FALSE;
}
if (obj->otyp == LEASH && obj->leashmon != 0) {
#endif
return 0; /* didn't move */
}
+
+ if (Upolyd && ceiling_hider(&mons[u.umonnum]) && u.uundetected) {
+ u.uundetected = 0;
+ if (Flying) { /* lurker above */
+/*JP
+ You("fly out of hiding.");
+*/
+ You("\89B\82ê\82é\82Ì\82ð\82â\82ß\82Ä\94ò\82Ñ\8fo\82µ\82½\81D");
+ } else { /* piercer */
+/*JP
+ You("drop to the %s.", surface(u.ux, u.uy));
+*/
+ You("%s\82É\97\8e\82¿\82½\81D", surface(u.ux, u.uy));
+ if (is_pool_or_lava(u.ux, u.uy)) {
+ pooleffects(FALSE);
+ } else {
+ (void) pickup(1);
+ if ((trap = t_at(u.ux, u.uy)) != 0)
+ dotrap(trap, TOOKPLUNGE);
+ }
+ }
+ return 1; /* came out of hiding; might need '>' again to go down */
+ }
+
if (!stairs_down && !ladder_down) {
trap = t_at(u.ux, u.uy);
- if (trap && uteetering_at_seen_pit(trap)) {
+ if (trap && (uteetering_at_seen_pit(trap) || uescaped_shaft(trap))) {
dotrap(trap, TOOKPLUNGE);
return 1;
} else if (!trap || !is_hole(trap->ttyp)
}
if (trap) {
+#if 0 /*JP*/
const char *down_or_thru = trap->ttyp == HOLE ? "down" : "through";
+#endif
#if 0 /*JP*/
const char *actn = Flying ? "fly" : locomotion(youmonst.data, "jump");
#else
}
savelev(fd, ledger_no(&u.uz),
cant_go_back ? FREE_SAVE : (WRITE_SAVE | FREE_SAVE));
+ /* air bubbles and clouds are saved in game-state rather than with the
+ level they're used on; in normal play, you can't leave and return
+ to any endgame level--bubbles aren't needed once you move to the
+ next level so used to be discarded when the next special level was
+ loaded; but in wizard mode you can leave and return, and since they
+ aren't saved with the level and restored upon return (new ones are
+ created instead), we need to discard them to avoid a memory leak;
+ so bubbles are now discarded as we leave the level they're used on */
+ if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz))
+ save_waterlevel(-1, FREE_SAVE);
bclose(fd);
if (cant_go_back) {
/* discard unreachable levels; keep #0 */
reseed_random(rn2_on_display_rng);
minit(); /* ZEROCOMP */
getlev(fd, hackpid, new_ledger, FALSE);
+ /* when in wizard mode, it is possible to leave from and return to
+ any level in the endgame; above, we discarded bubble/cloud info
+ when leaving Plane of Water or Air so recreate some now */
+ if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz))
+ restore_waterlevel(-1);
(void) nhclose(fd);
oinit(); /* reassign level dependent obj probabilities */
}
reglyph_darkroom();
+ u.uinwater = 0;
/* do this prior to level-change pline messages */
vision_reset(); /* clear old level's line-of-sight */
vision_full_recalc = 0; /* don't let that reenable vision yet */