-/* NetHack 3.6 do.c $NHDT-Date: 1472809073 2016/09/02 09:37:53 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.158 $ */
+/* 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-2016 */
+/* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2023 */
/* JNetHack may be freely redistributed. See license for details. */
#include "hack.h"
levl[rx][ry].drawbridgemask &= ~DB_UNDER; /* clear lava */
levl[rx][ry].drawbridgemask |= DB_FLOOR;
} else
- levl[rx][ry].typ = ROOM;
+ levl[rx][ry].typ = ROOM, levl[rx][ry].flags = 0;
if (ttmp)
(void) delfloortrap(ttmp);
Strcpy(whobuf, "\82 \82È\82½");
if (u.usteed)
Strcpy(whobuf, y_monnam(u.usteed));
-#if 0 /*JP*/
+#if 0 /*JP:T*/
pline("%s %s %s into the %s.", upstart(whobuf),
vtense(whobuf, "push"), the(xname(otmp)), what);
#else
if (!fills_up || !pushing) { /* splashing occurs */
if (!u.uinwater) {
if (pushing ? !Blind : cansee(rx, ry)) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
There("is a large splash as %s %s the %s.",
the(xname(otmp)), fills_up ? "fills" : "falls into",
what);
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");
if (obj->otyp == BOULDER && boulder_hits_pool(obj, x, y, FALSE)) {
return TRUE;
} else if (obj->otyp == BOULDER && (t = t_at(x, y)) != 0
- && (t->ttyp == PIT || t->ttyp == SPIKED_PIT
- || t->ttyp == TRAPDOOR || t->ttyp == HOLE)) {
+ && (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)
-#if 0 /*JP*/
- pline_The("boulder %s into the pit%s.",
- vtense((const char *) 0, verb),
- (mtmp) ? "" : " with you");
+ if (*verb && (cansee(x, y) || distu(x, y) == 0))
+#if 0 /*JP:T*/
+ pline("%s boulder %s into the pit%s.",
+ Blind ? "A" : "The",
+ vtense((const char *) 0, verb),
+ mtmp ? "" : " with you");
#else
pline("\8aâ\82Í%s\97\8e\82µ\8c\8a\82Ö%s\81D",
- (mtmp) ? "" : "\82 \82È\82½\82Æ\82¢\82Á\82µ\82å\82É",
+ mtmp ? "" : "\82 \82È\82½\82Æ\82¢\82Á\82µ\82å\82É",
jpast(verb));
#endif
if (mtmp) {
if (!passes_walls(mtmp->data) && !throws_rocks(mtmp->data)) {
- int dieroll = rnd(20);
-
- if (hmon(mtmp, obj, HMON_THROWN, dieroll)
- && !is_whirly(mtmp->data))
+ /* dieroll was rnd(20); 1: maximum chance to hit
+ since trapped target is a sitting duck */
+ int damage, dieroll = 1;
+
+ /* 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
+ dropped by a scroll of earth read by a monster */
+ if (context.mon_moving) {
+ /* normally we'd use ohitmon() but it can call
+ drop_throw() which calls flooreffects() */
+ damage = dmgval(obj, mtmp);
+ mtmp->mhp -= damage;
+ if (DEADMONSTER(mtmp)) {
+ if (canspotmon(mtmp))
+#if 0 /*JP:T*/
+ pline("%s is %s!", Monnam(mtmp),
+ (nonliving(mtmp->data)
+ || is_vampshifter(mtmp))
+ ? "destroyed" : "killed");
+#else
+ pline("%s\82Í%s\81I", Monnam(mtmp),
+ (nonliving(mtmp->data)
+ || is_vampshifter(mtmp))
+ ? "\93|\82³\82ê\82½" : "\8eE\82³\82ê\82½");
+#endif
+ mondied(mtmp);
+ }
+ } else {
+ (void) hmon(mtmp, obj, HMON_THROWN, dieroll);
+ }
+ if (!DEADMONSTER(mtmp) && !is_whirly(mtmp->data))
return FALSE; /* still alive */
}
mtmp->mtrapped = 0;
#endif
return FALSE; /* player remains trapped */
} else
- u.utrap = 0;
+ reset_utrap(TRUE);
}
}
if (*verb) {
*/
You_hear("\91«\8c³\82Å\89½\82©\82ª\8dÓ\82¯\82é\89¹\82ð\95·\82¢\82½\81D");
} else if (!Blind && cansee(x, y)) {
-#if 0 /*JP*/
- pline_The("boulder %s%s.", t->tseen ? "" : "triggers and ",
- t->ttyp == TRAPDOOR
+#if 0 /*JP:T*/
+ pline_The("boulder %s%s.",
+ (ttyp == TRAPDOOR && !tseen)
+ ? "triggers and " : "",
+ (ttyp == TRAPDOOR)
? "plugs a trap door"
- : t->ttyp == HOLE ? "plugs a hole"
- : "fills a pit");
+ : (ttyp == HOLE) ? "plugs a hole"
+ : "fills a pit");
#else
pline_The("\8aâ\82Í%s%s\81D", t->tseen ? "" : "ã©\82ð\8bN\93®\82µ\82Ä\81C",
t->ttyp == TRAPDOOR ? "\97\8e\82µ\94à\82ð\96\84\82ß\82½" :
You_hear("\8aâ\82ª%s\89¹\82ð\95·\82¢\82½\81D", verb);
}
}
- deltrap(t);
+ /*
+ * Note: trap might have gone away via ((hmon -> killed -> xkilled)
+ * || mondied) -> mondead -> m_detach -> fill_pit.
+ */
+ if ((t = t_at(x, y)) != 0)
+ deltrap(t);
useupf(obj, 1L);
bury_objs(x, y);
newsym(x, y);
}
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) {
}
if (obj->blessed || obj->cursed) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
There("is %s flash as %s %s the altar.",
an(hcolor(obj->blessed ? NH_AMBER : NH_BLACK)), doname(obj),
otense(obj, "hit"));
#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() */
}
}
polymorph_sink()
{
uchar sym = S_sink;
+ boolean sinklooted;
+ int algn;
if (levl[u.ux][u.uy].typ != SINK)
return;
+ sinklooted = levl[u.ux][u.uy].looted != 0;
level.flags.nsinks--;
- levl[u.ux][u.uy].doormask = 0;
+ levl[u.ux][u.uy].doormask = 0; /* levl[][].flags */
switch (rn2(4)) {
default:
case 0:
sym = S_fountain;
levl[u.ux][u.uy].typ = FOUNTAIN;
+ levl[u.ux][u.uy].blessedftn = 0;
+ if (sinklooted)
+ SET_FOUNTAIN_LOOTED(u.ux, u.uy);
level.flags.nfountains++;
break;
case 1:
sym = S_throne;
levl[u.ux][u.uy].typ = THRONE;
+ if (sinklooted)
+ levl[u.ux][u.uy].looted = T_LOOTED;
break;
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;
pline_The("ring is regurgitated!");
*/
pline("\8ew\97Ö\82Í\8bt\97¬\82µ\82½\81I");
- giveback:
+ giveback:
obj->in_use = FALSE;
dropx(obj);
trycall(obj);
if (otmp != uball && otmp != uchain
&& !obj_resists(otmp, 1, 99)) {
if (!Blind) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
pline("Suddenly, %s %s from the sink!", doname(otmp),
otense(otmp, "vanish"));
#else
/* give message even if blind; we know we're not levitating,
so can feel the outcome even if we can't directly see it */
/*JP
- pline_The("sink %svanishes.", nosink ? "" : "momentarily ");
+ pline_The("sink %svanishes.", nosink ? "" : "momentarily ");
*/
- pline_The("\97¬\82µ\91ä\82Í%s\8fÁ\82¦\82½\81D", nosink ? "" : "\88ê\8fu");
+ pline_The("\97¬\82µ\91ä\82Í%s\8fÁ\82¦\82½\81D", nosink ? "" : "\88ê\8fu");
ideed = FALSE;
break;
case RIN_POLYMORPH:
pline("\8ew\97Ö\82ª\94r\90\85\8cû\82ð\82·\82é\82è\82Æ\94ð\82¯\82é\82Ì\82ð\8c©\82½\81I");
break;
case RIN_SEE_INVISIBLE:
-#if 0 /*JP*/
+#if 0 /*JP:T*/
You_see("some %s in the sink.",
Hallucination ? "oxygen molecules" : "air");
#else
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*/
case RIN_POLYMORPH_CONTROL:
pline_The(
/*JP
- "sink momentarily looks like a regularly erupting geyser.");
+ "sink momentarily looks like a regularly erupting geyser.");
*/
- "\97¬\82µ\91ä\82Í\88ê\8fu\8bK\91¥\90³\82µ\82\95¬\8fo\82·\82é\8aÔ\8c\87\90ò\82Ì\82æ\82¤\82É\8c©\82¦\82½\81D");
+ "\97¬\82µ\91ä\82Í\88ê\8fu\8bK\91¥\90³\82µ\82\95¬\8fo\82·\82é\8aÔ\8c\87\90ò\82Ì\82æ\82¤\82É\8c©\82¦\82½\81D");
break;
default:
break;
if (!strcmp(word, "throw") && obj->quan > 1L)
obj->corpsenm = 1;
#endif
-#if 0 /*JP*/
+#if 0 /*JP:T*/
pline("For some reason, you cannot %s%s the stone%s!", word,
obj->corpsenm ? " any of" : "", plur(obj->quan));
#else
#endif
}
obj->corpsenm = 0; /* reset */
- obj->bknown = 1;
+ set_bknown(obj, 1);
return FALSE;
}
if (obj->otyp == LEASH && obj->leashmon != 0) {
if (u.uswallow) {
/* barrier between you and the floor */
if (flags.verbose) {
- char buf[BUFSZ];
+ char *onam_p, monbuf[BUFSZ];
/* doname can call s_suffix, reusing its buffer */
- Strcpy(buf, s_suffix(mon_nam(u.ustuck)));
-#if 0 /*JP*/
- You("drop %s into %s %s.", doname(obj), buf,
+ Strcpy(monbuf, s_suffix(mon_nam(u.ustuck)));
+ onam_p = is_unpaid(obj) ? yobjnam(obj, (char *) 0) : doname(obj);
+#if 0 /*JP:T*/
+ You("drop %s into %s %s.", onam_p, monbuf,
mbodypart(u.ustuck, STOMACH));
#else
- You("%s\82ð%s%s\82É\92u\82¢\82½\81D", doname(obj), buf,
+ You("%s\82ð%s%s\82É\92u\82¢\82½\81D", onam_p, monbuf,
mbodypart(u.ustuck, STOMACH));
#endif
}
if (obj->oclass == COIN_CLASS)
context.botl = 1;
freeinv(obj);
- hitfloor(obj);
+ hitfloor(obj, TRUE);
if (levhack)
float_down(I_SPECIAL | TIMEOUT, W_ARTI | W_ART);
return 1;
could_grow = (obj->corpsenm == PM_WRAITH);
could_heal = (obj->corpsenm == PM_NURSE);
}
+ if (is_unpaid(obj))
+ (void) stolen_value(obj, u.ux, u.uy, TRUE, FALSE);
(void) mpickobj(u.ustuck, obj);
if (is_animal(u.ustuck->data)) {
if (could_poly || could_slime) {
bypass_objlist(invent, FALSE);
} else {
/* should coordinate with perm invent, maybe not show worn items */
-#if 0 /*JP*/
+#if 0 /*JP:T*/
n = query_objlist("What would you like to drop?", &invent,
(USE_INVLET | INVORDER_SORT), &pick_list, PICK_ANY,
all_categories ? allow_all : allow_category);
}
}
-drop_done:
+ drop_done:
return n_dropped;
}
*/
You("%s\82Ì\92\86\82É\95\82\82¢\82Ä\82¢\82é\81D", surface(u.ux, u.uy));
else if (Is_waterlevel(&u.uz))
-#if 0 /*JP*/
+#if 0 /*JP:T*/
You("are floating in %s.",
is_pool(u.ux, u.uy) ? "the water" : "a bubble of air");
#else
#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 || (trap->ttyp != TRAPDOOR && trap->ttyp != HOLE)
+ } else if (!trap || !is_hole(trap->ttyp)
|| !Can_fall_thru(&u.uz) || !trap->tseen) {
if (flags.autodig && !context.nopick && uwep && is_pick(uwep)) {
return use_pick_axe2(uwep);
return 0;
}
- if (trap)
+ if (trap) {
+#if 0 /*JP*/
+ const char *down_or_thru = trap->ttyp == HOLE ? "down" : "through";
+#endif
#if 0 /*JP*/
- You("%s %s.", Flying ? "fly" : locomotion(youmonst.data, "jump"),
- trap->ttyp == HOLE ? "down the hole" : "through the trap door");
+ const char *actn = Flying ? "fly" : locomotion(youmonst.data, "jump");
#else
- You("%s\81D",
- trap->ttyp == HOLE ? "\8c\8a\82ð\8d~\82è\82½" : "\97\8e\82µ\94à\82ð\92Ê\82è\94²\82¯\82½");
+ const char *actn = "";
#endif
+ if (youmonst.data->msize >= MZ_HUGE) {
+ char qbuf[QBUFSZ];
+
+#if 0 /*JP:T*/
+ You("don't fit %s easily.", down_or_thru);
+ Sprintf(qbuf, "Try to squeeze %s?", down_or_thru);
+#else
+ pline("\82±\82±\82Í\8b·\82\82Ä\8aÈ\92P\82É\82Í\92Ê\82è\94²\82¯\82ç\82ê\82È\82¢\81D");
+ Sprintf(qbuf, "\91Ì\82ð\89\9f\82µ\8d\9e\82Ý\82Ü\82·\82©?");
+#endif
+ if (yn(qbuf) == 'y') {
+ if (!rn2(3)) {
+#if 0 /*JP*/
+ actn = "manage to squeeze";
+#else
+ actn = "\82È\82ñ\82Æ\82©";
+#endif
+#if 0 /*JP*/
+ losehp(Maybe_Half_Phys(rnd(4)),
+ "contusion from a small passage", KILLED_BY);
+#else
+ losehp(Maybe_Half_Phys(rnd(4)),
+ "\8b·\82¢\93¹\82Å\82Ì\91Å\82¿\90g\82Å", KILLED_BY);
+#endif
+ } else {
+/*JP
+ You("were unable to fit %s.", down_or_thru);
+*/
+ You("\92Ê\82è\94²\82¯\82ç\82ê\82È\82¢\81D");
+ return 0;
+ }
+ } else {
+ return 0;
+ }
+ }
+#if 0 /*JP:T*/
+ You("%s %s the %s.", actn, down_or_thru,
+ trap->ttyp == HOLE ? "hole" : "trap door");
+#else
+ You("%s%s\81D", actn,
+ trap->ttyp == HOLE ? "\8c\8a\82ð\8d~\82è\82½" : "\97\8e\82µ\94à\82ð\92Ê\82è\94²\82¯\82½");
+#endif
+ }
if (trap && Is_stronghold(&u.uz)) {
goto_hell(FALSE, TRUE);
} else {
return 0;
}
if (u.ustuck) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
You("are %s, and cannot go up.",
!u.uswallow ? "being held" : is_animal(u.ustuck->data)
? "swallowed"
}
if (near_capacity() > SLT_ENCUMBER) {
/* No levitation check; inv_weight() already allows for it */
-#if 0 /*JP*/
+#if 0 /*JP:T*/
Your("load is too heavy to climb the %s.",
levl[u.ux][u.uy].typ == STAIRS ? "stairs" : "ladder");
#else
return 1;
}
if (ledger_no(&u.uz) == 1) {
+ if (iflags.debug_fuzzer)
+ return 0;
/*JP
- if (yn("Beware, there will be no return! Still climb?") != 'y')
+ if (yn("Beware, there will be no return! Still climb?") != 'y')
*/
if (yn("\8bC\82ð\82Â\82¯\82ë\81C\96ß\82ê\82È\82¢\82¼\81I\82»\82ê\82Å\82à\8fã\82é\81H") != 'y')
return 0;
}
*/
+/* when arriving on a level, if hero and a monster are trying to share same
+ spot, move one; extracted from goto_level(); also used by wiz_makemap() */
+void
+u_collide_m(mtmp)
+struct monst *mtmp;
+{
+ coord cc;
+
+ if (!mtmp || mtmp == u.usteed || mtmp != m_at(u.ux, u.uy)) {
+ impossible("level arrival collision: %s?",
+ !mtmp ? "no monster"
+ : (mtmp == u.usteed) ? "steed is on map"
+ : "monster not co-located");
+ return;
+ }
+
+ /* There's a monster at your target destination; it might be one
+ which accompanied you--see mon_arrive(dogmove.c)--or perhaps
+ it was already here. Randomly move you to an adjacent spot
+ or else the monster to any nearby location. Prior to 3.3.0
+ the latter was done unconditionally. */
+ if (!rn2(2) && enexto(&cc, u.ux, u.uy, youmonst.data)
+ && distu(cc.x, cc.y) <= 2)
+ u_on_newpos(cc.x, cc.y); /*[maybe give message here?]*/
+ else
+ mnexto(mtmp);
+
+ if ((mtmp = m_at(u.ux, u.uy)) != 0) {
+ /* there was an unconditional impossible("mnexto failed")
+ here, but it's not impossible and we're prepared to cope
+ with the situation, so only say something when debugging */
+ if (wizard)
+ pline("(monster in hero's way)");
+ if (!rloc(mtmp, TRUE) || (mtmp = m_at(u.ux, u.uy)) != 0)
+ /* no room to move it; send it away, to return later */
+ m_into_limbo(mtmp);
+ }
+}
+
void
goto_level(newlevel, at_stairs, falling, portal)
d_level *newlevel;
if (fd < 0)
return;
+ /* discard context which applies to the level we're leaving;
+ for lock-picking, container may be carried, in which case we
+ keep context; if on the floor, it's about to be saved+freed and
+ maybe_reset_pick() needs to do its carried() check before that */
+ maybe_reset_pick((struct obj *) 0);
+ reset_trapset(); /* even if to-be-armed trap obj is accompanying hero */
+ iflags.travelcc.x = iflags.travelcc.y = 0; /* travel destination cache */
+ context.polearm.hitmon = (struct monst *) 0; /* polearm target */
+ /* digging context is level-aware and can actually be resumed if
+ hero returns to the previous level without any intervening dig */
+
if (falling) /* assuming this is only trap door or hole */
impact_drop((struct obj *) 0, u.ux, u.uy, newlevel->dlevel);
check_special_room(TRUE); /* probably was a trap door */
if (Punished)
unplacebc();
- u.utrap = 0; /* needed in level_tele */
+ reset_utrap(FALSE); /* needed in level_tele */
fill_pit(u.ux, u.uy);
u.ustuck = 0; /* idem */
u.uinwater = 0;
}
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 */
/* we'll reach here if running in wizard mode */
error("Cannot continue this game.");
}
+ reseed_random(rn2);
+ 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 */
selftouch("\97\8e\82¿\82È\82ª\82ç\81C\82 \82È\82½\82Í");
} else { /* ordinary descent */
if (flags.verbose)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
You("%s.", at_ladder ? "climb down the ladder"
: "descend the stairs");
#else
*/
run_timers();
- initrack();
+ /* hero might be arriving at a spot containing a monster;
+ if so, move one or the other to another location */
+ if ((mtmp = m_at(u.ux, u.uy)) != 0)
+ u_collide_m(mtmp);
- if ((mtmp = m_at(u.ux, u.uy)) != 0 && mtmp != u.usteed) {
- /* There's a monster at your target destination; it might be one
- which accompanied you--see mon_arrive(dogmove.c)--or perhaps
- it was already here. Randomly move you to an adjacent spot
- or else the monster to any nearby location. Prior to 3.3.0
- the latter was done unconditionally. */
- coord cc;
-
- if (!rn2(2) && enexto(&cc, u.ux, u.uy, youmonst.data)
- && distu(cc.x, cc.y) <= 2)
- u_on_newpos(cc.x, cc.y); /*[maybe give message here?]*/
- else
- mnexto(mtmp);
-
- if ((mtmp = m_at(u.ux, u.uy)) != 0) {
- /* there was an unconditional impossible("mnearto failed")
- here, but it's not impossible and we're prepared to cope
- with the situation, so only say something when debugging */
- if (wizard)
- pline("(monster in hero's way)");
- if (!rloc(mtmp, TRUE))
- /* no room to move it; send it away, to return later */
- migrate_to_level(mtmp, ledger_no(&u.uz), MIGR_RANDOM,
- (coord *) 0);
- }
- }
+ initrack();
/* initial movement of bubbles just before vision_recalc */
if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz))
"You feel like you've been here before.",
*/
"\91O\82É\82±\82±\82É\97\88\82½\82±\82Æ\82ª\82 \82é\82æ\82¤\82È\8bC\82ª\82µ\82½\81D",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"This place %s familiar...", 0 /* no message */
#else
"\82±\82Ì\8fê\8f\8a\82Í\89ù\82©\82µ\82¢\81D\81D\81D", 0 /* no message */
"You are surrounded by twisty little passages, all alike.",
*/
"\82 \82È\82½\82Í\82Ü\82ª\82è\82\82Ë\82Á\82½\92Ê\98H\82É\82©\82±\82Ü\82ê\82Ä\82¢\82½\81D\81D\81D",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"Gee, this %s like uncle Conan's place...", 0 /* no message */
#else
"\83Q\81[\81I\83R\83i\83\93\82¨\82¶\82³\82ñ\82Ì\8fê\8f\8a\82É\8e\97\82Ä\82¢\82é\81D\81D\81D", 0 /* no message */
/* assume this will always return TRUE when changing level */
(void) in_out_region(u.ux, u.uy);
(void) pickup(1);
-
- /* discard context which applied to previous level */
- maybe_reset_pick(); /* for door or for box not accompanying hero */
- reset_trapset(); /* even if to-be-armed trap obj is accompanying hero */
- iflags.travelcc.x = iflags.travelcc.y = -1; /* travel destination cache */
- context.polearm.hitmon = (struct monst *) 0; /* polearm target */
- /* digging context is level-aware and can actually be resumed if
- hero returns to the previous level without any intervening dig */
}
STATIC_OVL void
where = corpse->where;
is_uwep = (corpse == uwep);
chewed = (corpse->oeaten != 0);
- Strcpy(cname,
-/*JP
- corpse_xname(corpse, chewed ? "bite-covered" : (const char *) 0,
-*/
- corpse_xname(corpse, chewed ? "\8e\95\8c^\82Ì\82Â\82¢\82½" : (const char *) 0,
- CXN_SINGULAR));
+#if 0 /*JP:T*/
+ Strcpy(cname, corpse_xname(corpse,
+ chewed ? "bite-covered" : (const char *) 0,
+ CXN_SINGULAR));
+#else
+ Strcpy(cname, corpse_xname(corpse,
+ chewed ? "\8e\95\8c^\82Ì\82Â\82¢\82½" : (const char *) 0,
+ CXN_SINGULAR));
+#endif
mcarry = (where == OBJ_MINVENT) ? corpse->ocarry : 0;
if (where == OBJ_CONTAINED) {
struct monst *mtmp2;
container = corpse->ocontainer;
- mtmp2 =
- get_container_location(container, &container_where, (int *) 0);
+ mtmp2 = get_container_location(container, &container_where, (int *) 0);
/* container_where is the outermost container's location even if
* nested */
if (container_where == OBJ_MINVENT && mtmp2)
case OBJ_FLOOR:
if (cansee(mtmp->mx, mtmp->my))
-#if 0 /*JP*/
+#if 0 /*JP:T*/
pline("%s rises from the dead!",
chewed ? Adjmonnam(mtmp, "bite-covered")
: Monnam(mtmp));
case OBJ_MINVENT: /* probably a nymph's */
if (cansee(mtmp->mx, mtmp->my)) {
if (canseemon(mcarry))
-#if 0 /*JP*/
+#if 0 /*JP:T*/
pline("Startled, %s drops %s as it revives!",
mon_nam(mcarry), an(cname));
#else
cname, mon_nam(mcarry), cname);
#endif
else
-#if 0 /*JP*/
+#if 0 /*JP:T*/
pline("%s suddenly appears!",
chewed ? Adjmonnam(mtmp, "bite-covered")
: Monnam(mtmp));
yname(container));
} else if (container_where == OBJ_INVENT && container) {
Strcpy(sackname, an(xname(container)));
-#if 0 /*JP*/
+#if 0 /*JP:T*/
pline("%s %s out of %s in your pack!",
Blind ? Something : Amonnam(mtmp),
locomotion(mtmp->data, "writhes"), sackname);
*/
pline("%s\82Í\8fÁ\82¦\82½\81D", monname);
else if (!notice_it && canseemon(mtmp))
-#if 0 /*JP*/
+#if 0 /*JP:T*/
pline("%s appears.", Monnam(mtmp)); /* not pre-rloc monname */
#else
pline("%s\82ª\8c»\82ê\82½\81D", Monnam(mtmp)); /* not pre-rloc monname */
#endif
else if (notice_it && dist2(mtmp->mx, mtmp->my, x, y) > 2)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
pline("%s teleports.", monname); /* saw it and still see it */
#else
pline("%s\82Í\8fu\8aÔ\88Ú\93®\82µ\82½\81D", monname); /* saw it and still see it */
}
void
-heal_legs()
+heal_legs(how)
+int how; /* 0: ordinary, 1: dismounting steed, 2: limbs turn to stone */
{
if (Wounded_legs) {
if (ATEMP(A_DEX) < 0) {
context.botl = 1;
}
- if (!u.usteed) {
+ /* when mounted, wounded legs applies to the steed;
+ during petrification countdown, "your limbs turn to stone"
+ before the final stages and that calls us (how==2) to cure
+ wounded legs, but we want to suppress the feel better message */
+ if (!u.usteed && how != 2) {
+#if 0 /*JP:T*/
const char *legs = body_part(LEG);
-#if 0 /*JP*/
if ((EWounded_legs & BOTH_SIDES) == BOTH_SIDES)
legs = makeplural(legs);
/* this used to say "somewhat better" but that was
#endif
}
- HWounded_legs = EWounded_legs = 0;
+ HWounded_legs = EWounded_legs = 0L;
/* Wounded_legs reduces carrying capacity, so we want
an encumbrance check when they're healed. However,
it might be immediately contradicted [able to carry
more when steed becomes healthy, then possible floor
feedback, then able to carry less when back on foot]. */
- if (!in_steed_dismounting)
+ if (how == 0)
(void) encumber_msg();
}
}