Merge branch 'NetHack-3.6.2'

This commit is contained in:
nhmall
2018-12-20 08:04:49 -05:00
5 changed files with 134 additions and 42 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mon.c $NHDT-Date: 1544658160 2018/12/12 23:42:40 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.274 $ */
/* NetHack 3.6 mon.c $NHDT-Date: 1545259929 2018/12/19 22:52:09 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.275 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1476,6 +1476,7 @@ nexttry: /* eels prefer the water, but if there is no water nearby,
if ((ttmp->ttyp != RUST_TRAP
|| mdat == &mons[PM_IRON_GOLEM])
&& ttmp->ttyp != STATUE_TRAP
&& ttmp->ttyp != VIBRATING_SQUARE
&& ((!is_pit(ttmp->ttyp) && !is_hole(ttmp->ttyp))
|| (!is_flyer(mdat) && !is_floater(mdat)
&& !is_clinger(mdat)) || Sokoban)

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 trap.c $NHDT-Date: 1543515862 2018/11/29 18:24:22 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.312 $ */
/* NetHack 3.6 trap.c $NHDT-Date: 1545259936 2018/12/19 22:52:16 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.313 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2691,13 +2691,29 @@ register struct monst *mtmp;
break;
case VIBRATING_SQUARE:
if (see_it && !Blind) {
if (in_sight)
pline("You see a strange vibration beneath %s %s.",
s_suffix(mon_nam(mtmp)),
makeplural(mbodypart(mtmp, FOOT)));
else
pline("You see the ground vibrate in the distance.");
seetrap(trap);
seetrap(trap); /* before messages */
if (in_sight) {
char buf[BUFSZ], *p, *monnm = mon_nam(mtmp);
if (nolimbs(mtmp->data)
|| is_floater(mtmp->data) || is_flyer(mtmp->data)) {
/* just "beneath <mon>" */
Strcpy(buf, monnm);
} else {
Strcpy(buf, s_suffix(monnm));
p = eos(strcat(buf, " "));
Strcpy(p, makeplural(mbodypart(mtmp, FOOT)));
/* avoid "beneath 'rear paws'" or 'rear hooves' */
(void) strsubst(p, "rear ", "");
}
You_see("a strange vibration beneath %s.", buf);
} else {
/* notice something (hearing uses a larger threshold
for 'nearby') */
You_see("the ground vibrate %s.",
(distu(mtmp->mx, mtmp->my) <= 2 * 2)
? "nearby" : "in the distance");
}
}
break;
default:

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 vault.c $NHDT-Date: 1545217597 2018/12/19 11:06:37 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.58 $ */
/* NetHack 3.6 vault.c $NHDT-Date: 1545269451 2018/12/20 01:30:51 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.59 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
@@ -15,6 +15,7 @@ STATIC_DCL boolean FDECL(find_guard_dest, (struct monst *, xchar *, xchar *));
STATIC_DCL void FDECL(move_gold, (struct obj *, int));
STATIC_DCL void FDECL(wallify_vault, (struct monst *));
STATIC_DCL void FDECL(gd_mv_monaway, (struct monst *, int, int));
STATIC_OVL void FDECL(gd_pick_corridor_gold, (struct monst *, int, int));
void
newegd(mtmp)
@@ -604,9 +605,9 @@ struct monst *grd;
}
STATIC_OVL void
gd_mv_monaway(grd, nx,ny)
gd_mv_monaway(grd, nx, ny)
register struct monst *grd;
int nx,ny;
int nx, ny;
{
if (MON_AT(nx, ny) && !(nx == grd->mx && ny == grd->my)) {
if (!Deaf)
@@ -616,6 +617,97 @@ int nx,ny;
}
}
/* have guard pick gold off the floor, possibly moving to the gold's
position before message and back to his current spot after */
STATIC_OVL void
gd_pick_corridor_gold(grd, goldx, goldy)
struct monst *grd;
int goldx, goldy; /* <gold->ox, gold->oy> */
{
struct obj *gold;
coord newcc, bestcc;
int gdelta, newdelta, bestdelta, tryct,
guardx = grd->mx, guardy = grd->my;
boolean under_u = (goldx == u.ux && goldy == u.uy),
see_it = cansee(goldx, goldy);
if (under_u) {
/* Grab the gold from between the hero's feet.
If guard is two or more steps away; bring him closer first. */
gold = g_at(goldx, goldy);
if (!gold) {
impossible("vault guard: no gold at hero's feet?");
return;
}
gdelta = distu(guardx, guardy);
if (gdelta > 2 && see_it) { /* skip if player won't see it */
bestdelta = gdelta;
bestcc.x = (xchar) guardx, bestcc.y = (xchar) guardy;
tryct = 9;
do {
/* pick an available spot nearest the hero and also try
to find the one meeting that criterium which is nearest
the guard's current location */
if (enexto(&newcc, goldx, goldy, grd->data)) {
if ((newdelta = distu(newcc.x, newcc.y)) < bestdelta
|| (newdelta == bestdelta
&& dist2(newcc.x, newcc.y, guardx, guardy)
< dist2(bestcc.x, bestcc.y, guardx, guardy))) {
bestdelta = newdelta;
bestcc = newcc;
}
}
} while (--tryct >= 0);
if (bestdelta < gdelta) {
remove_monster(guardx, guardy);
newsym(guardx, guardy);
place_monster(grd, (int) bestcc.x, (int) bestcc.y);
newsym(grd->mx, grd->my);
}
}
obj_extract_self(gold);
add_to_minv(grd, gold);
newsym(goldx, goldy);
/* guard is already at gold's location */
} else if (goldx == guardx && goldy == guardy) {
mpickgold(grd); /* does a newsym */
/* gold is at some third spot, neither guard's nor hero's */
} else {
/* just for insurance... */
gd_mv_monaway(grd, goldx, goldy); /* make room for guard */
if (see_it) { /* skip if player won't see the message */
remove_monster(grd->mx, grd->my);
newsym(grd->mx, grd->my);
place_monster(grd, goldx, goldy); /* sets <grd->mx, grd->my> */
}
mpickgold(grd); /* does a newsym */
}
if (see_it) { /* cansee(goldx, goldy) */
char monnambuf[BUFSZ];
Strcpy(monnambuf, Monnam(grd));
if (!strcmpi(monnambuf, "It"))
Strcpy(monnambuf, "Someone");
pline("%s%s picks up the gold%s.", monnambuf,
(grd->mpeaceful && EGD(grd)->warncnt > 5)
? " calms down and" : "",
under_u ? " from beneath you" : "");
}
/* if guard was moved to get the gold, move him back */
if (grd->mx != guardx || grd->my != guardy) {
remove_monster(grd->mx, grd->my);
newsym(grd->mx, grd->my);
place_monster(grd, guardx, guardy);
newsym(guardx, guardy);
}
return;
}
/*
* return 1: guard moved, 0: guard didn't, -1: let m_move do it, -2: died
*/
@@ -774,35 +866,12 @@ register struct monst *grd;
m = egrd->fakecorr[fci].fx;
n = egrd->fakecorr[fci].fy;
goldincorridor = TRUE;
break;
}
/* new gold can appear if it was embedded in stone and hero kicks it
(on even via wish and drop) so don't assume hero has been warned */
if (goldincorridor && !egrd->gddone) {
x = grd->mx;
y = grd->my;
if (m == u.ux && n == u.uy) {
struct obj *gold = g_at(m, n);
/* Grab the gold from between the hero's feet. */
obj_extract_self(gold);
add_to_minv(grd, gold);
newsym(m, n);
} else if (m == x && n == y) {
mpickgold(grd); /* does a newsym */
} else {
/* just for insurance... */
gd_mv_monaway(grd, m,n);
remove_monster(grd->mx, grd->my);
newsym(grd->mx, grd->my);
place_monster(grd, m, n);
mpickgold(grd); /* does a newsym */
}
if (cansee(m, n))
pline("%s%s picks up the gold.", Monnam(grd),
grd->mpeaceful ? " calms down and" : "");
if (x != grd->mx || y != grd->my) {
remove_monster(grd->mx, grd->my);
newsym(grd->mx, grd->my);
place_monster(grd, x, y);
newsym(x, y);
}
gd_pick_corridor_gold(grd, m, n);
if (!grd->mpeaceful)
return -1;
egrd->warncnt = 5;