Merge branch 'NetHack-3.6.2'

This commit is contained in:
nhmall
2019-04-13 22:40:44 -04:00
8 changed files with 93 additions and 46 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 invent.c $NHDT-Date: 1549075239 2019/02/02 02:40:39 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.252 $ */
/* NetHack 3.6 invent.c $NHDT-Date: 1555196229 2019/04/13 22:57:09 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.253 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -4288,12 +4288,17 @@ char *title;
* displaying 'weapon in claw', etc. properly.
*/
g.youmonst.data = mon->data;
/* in case inside a shop, don't append "for sale" prices */
iflags.suppress_price++;
n = query_objlist(title ? title : tmp, &(mon->minvent),
(INVORDER_SORT | (incl_hero ? INCLUDE_HERO : 0)),
&selected, pickings,
do_all ? allow_all : worn_wield_only);
set_uasmon();
iflags.suppress_price--;
/* was 'set_uasmon();' but that potentially has side-effects */
g.youmonst.data = &mons[u.umonnum]; /* most basic part of set_uasmon */
} else {
invdisp_nothing(title ? title : tmp, "(none)");
n = 0;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mkmaze.c $NHDT-Date: 1543185071 2018/11/25 22:31:11 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.67 $ */
/* NetHack 3.6 mkmaze.c $NHDT-Date: 1555022325 2019/04/11 22:38:45 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.68 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Pasi Kallinen, 2018. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1866,6 +1866,7 @@ boolean ini;
case CONS_MON: {
struct monst *mon = (struct monst *) cons->list;
(void) mnearto(mon, cons->x, cons->y, TRUE);
break;
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mon.c $NHDT-Date: 1554580625 2019/04/06 19:57:05 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.280 $ */
/* NetHack 3.6 mon.c $NHDT-Date: 1555022326 2019/04/11 22:38:46 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.281 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2634,10 +2634,15 @@ struct monst *mtmp;
/* mnearto()
* Put monster near (or at) location if possible.
* Returns:
* true if relocation was successful
* false otherwise
* 2 if another monster was moved out of this one's way;
* 1 if relocation was successful (without moving another one);
* 0 otherwise.
* Note: if already at the target spot, result is 1 rather than 0.
*
* Might be called recursively if 'move_other' is True; if so, that argument
* will be False on the nested call so there won't be any further recursion.
*/
boolean
int
mnearto(mtmp, x, y, move_other)
register struct monst *mtmp;
xchar x, y;
@@ -2646,15 +2651,18 @@ boolean move_other; /* make sure mtmp gets to x, y! so move m_at(x, y) */
struct monst *othermon = (struct monst *) 0;
xchar newx, newy;
coord mm;
int res = 1;
if (mtmp->mx == x && mtmp->my == y && m_at(x, y) == mtmp)
return TRUE;
return res;
if (move_other && (othermon = m_at(x, y)) != 0) {
if (othermon->wormno)
remove_worm(othermon);
else
remove_monster(x, y);
othermon->mx = othermon->my = 0; /* 'othermon' is not on the map */
}
newx = x;
@@ -2665,28 +2673,21 @@ boolean move_other; /* make sure mtmp gets to x, y! so move m_at(x, y) */
* no end of trouble.
*/
if (!enexto(&mm, newx, newy, mtmp->data))
return FALSE;
return 0;
if (!isok(mm.x, mm.y))
return FALSE;
return 0;
newx = mm.x;
newy = mm.y;
}
rloc_to(mtmp, newx, newy);
if (move_other && othermon) {
xchar oldx = othermon->mx, oldy = othermon->my;
othermon->mx = othermon->my = 0;
(void) mnearto(othermon, x, y, FALSE);
if (othermon->mx == 0 && othermon->my == 0) {
/* reloc failed */
othermon->mx = oldx;
othermon->my = oldy;
res = 2; /* moving another monster out of the way */
if (!mnearto(othermon, x, y, FALSE)) /* no 'move_other' this time */
m_into_limbo(othermon);
}
}
return TRUE;
return res;
}
/* monster responds to player action; not the same as a passive attack;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 restore.c $NHDT-Date: 1543972193 2018/12/05 01:09:53 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.128 $ */
/* NetHack 3.6 restore.c $NHDT-Date: 1555201698 2019/04/14 00:28:18 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.129 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2009. */
/* NetHack may be freely redistributed. See license for details. */
@@ -185,7 +185,7 @@ boolean ghostly;
struct monst *shkp = shop_keeper(*shp);
if (shkp && inhishop(shkp)
&& repair_damage(shkp, tmp_dam, TRUE))
&& repair_damage(shkp, tmp_dam, (int *) 0, TRUE))
break;
}
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 shk.c $NHDT-Date: 1551738135 2019/03/04 22:22:15 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.157 $ */
/* NetHack 3.6 shk.c $NHDT-Date: 1555201699 2019/04/14 00:28:19 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.159 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -3384,7 +3384,7 @@ register xchar x, y;
&& dist2(shkp->mx, shkp->my, x, y) < 3
/* if it is the shk's pos, you hit and anger him */
&& (shkp->mx != x || shkp->my != y)) {
if (mnearto(shkp, x, y, TRUE) && !Deaf && !muteshk(shkp))
if (mnearto(shkp, x, y, TRUE) == 2 && !Deaf && !muteshk(shkp))
verbalize("Out of my way, scum!");
if (cansee(x, y)) {
pline("%s nimbly%s catches %s.", Shknam(shkp),
@@ -3456,11 +3456,13 @@ struct monst *shkp;
boolean croaked;
{
struct damage *tmp_dam, *tmp2_dam;
struct obj *shk_inv = shkp->minvent;
boolean did_repair = FALSE, saw_door = FALSE, saw_floor = FALSE,
stop_picking = FALSE, doorway_trap = FALSE;
int saw_walls = 0, saw_untrap = 0;
stop_picking = FALSE, doorway_trap = FALSE, skip_msg = FALSE;
int saw_walls = 0, saw_untrap = 0, feedback;
char trapmsg[BUFSZ];
feedback = !croaked; /* 1 => give feedback, 0 => don't or already did */
tmp_dam = g.level.damagelist;
tmp2_dam = 0;
while (tmp_dam) {
@@ -3478,12 +3480,12 @@ boolean croaked;
if (croaked) {
disposition = (shops[1]) ? 0 : 1;
} else if (stop_picking) {
disposition = repair_damage(shkp, tmp_dam, FALSE);
disposition = repair_damage(shkp, tmp_dam, &feedback, FALSE);
} else {
/* Defer the stop_occupation() until after repair msgs */
if (closed_door(x, y))
stop_picking = picking_at(x, y);
disposition = repair_damage(shkp, tmp_dam, FALSE);
disposition = repair_damage(shkp, tmp_dam, &feedback, FALSE);
if (!disposition)
stop_picking = FALSE;
}
@@ -3526,7 +3528,16 @@ boolean croaked;
if (!did_repair)
return;
if (saw_untrap) {
trapmsg[0] = '\0'; /* not just lint suppression... */
shk_inv = (shkp->minvent != shk_inv) ? shkp->minvent : 0;
if (saw_untrap == 1 && shk_inv
&& (shk_inv->otyp == BEARTRAP || shk_inv->otyp == LAND_MINE)
&& canseemon(shkp)) {
pline("%s untraps %s.", Shknam(shkp), ansimpleoname(shk_inv));
/* we've already reported this trap (and know it's the only one) */
saw_untrap = 0;
skip_msg = !(saw_walls || saw_door || saw_floor);
} else if (saw_untrap) {
Sprintf(trapmsg, "%s trap%s",
(saw_untrap > 3) ? "several" : (saw_untrap > 1) ? "some"
: "a",
@@ -3534,10 +3545,11 @@ boolean croaked;
Sprintf(eos(trapmsg), " %s", vtense(trapmsg, "are"));
Sprintf(eos(trapmsg), " removed from the %s",
(doorway_trap && saw_untrap == 1) ? "doorway" : "floor");
} else
trapmsg[0] = '\0'; /* not just lint suppression... */
}
if (saw_walls) {
if (skip_msg) {
; /* already gave an untrap message which covered the only repair */
} else if (saw_walls) {
char wallbuf[BUFSZ];
Sprintf(wallbuf, "section%s", plur(saw_walls));
@@ -3559,6 +3571,10 @@ boolean croaked;
saw_floor ? "the floor damage is gone" : "",
((saw_door || saw_floor) && *trapmsg) ? " and " : "",
trapmsg);
/* FIXME:
* these messages aren't right if the unseen repairs were only
* for trap removal (except for hole and possibly trap door).
*/
else if (inside_shop(u.ux, u.uy) == ESHK(shkp)->shoproom)
You_feel("more claustrophobic than before.");
else if (!Deaf && !rn2(10))
@@ -3573,9 +3589,10 @@ boolean croaked;
* 3: untrap
*/
int
repair_damage(shkp, tmp_dam, catchup)
repair_damage(shkp, tmp_dam, once, catchup)
struct monst *shkp;
struct damage *tmp_dam;
int *once;
boolean catchup; /* restoring a level */
{
xchar x, y;
@@ -3594,13 +3611,30 @@ boolean catchup; /* restoring a level */
if (!IS_ROOM(tmp_dam->typ)) {
if ((x == u.ux && y == u.uy && !Passes_walls)
|| (x == shkp->mx && y == shkp->my)
|| ((mtmp = m_at(x, y)) && !passes_walls(mtmp->data)))
|| ((mtmp = m_at(x, y)) != 0 && !passes_walls(mtmp->data)))
return 0;
}
if ((ttmp = t_at(x, y)) != 0) {
if (x == u.ux && y == u.uy && !Passes_walls)
return 0;
if (ttmp->ttyp == LANDMINE || ttmp->ttyp == BEAR_TRAP) {
ttmp = t_at(x, y);
if (ttmp && x == u.ux && y == u.uy && !Passes_walls)
return 0;
if (once && *once) {
boolean shk_closeby = (distu(shkp->mx, shkp->my)
<= (BOLT_LIM / 2) * (BOLT_LIM / 2));
/* this is suboptimal if we eventually give a "shk untraps"
message for the only repair, but perhaps the shop repair
incantation means that shk's untrap attempt will never fail */
if (canseemon(shkp))
pline("%s whispers %s.", Shknam(shkp),
shk_closeby ? "an incantation" : "something");
else if (!Deaf && shk_closeby)
You_hear("someone muttering an incantation.");
*once = 0;
}
if (ttmp) {
if ((ttmp->ttyp == LANDMINE || ttmp->ttyp == BEAR_TRAP)
&& dist2(x, y, shkp->mx, shkp->my) <= 2) {
/* convert to an object */
otmp = mksobj((ttmp->ttyp == LANDMINE) ? LAND_MINE : BEARTRAP,
TRUE, FALSE);