Convert the vibrating square to a trap

Patch due to ais523 in NetHack 4.

This is not ready to be merged yet; the vibrating square needs a tile
image for tiles builds.
This commit is contained in:
Sean Hunt
2015-05-25 00:32:45 +09:00
parent 0e1a0d9bd9
commit 26ee7dc370
12 changed files with 44 additions and 14 deletions

View File

@@ -917,6 +917,7 @@ uncursed enchant weapon now correctly fixes erosion
scroll of earth messages cleaned up
long worms can no longer be leashed
the chest in the Castle containing the wishing wand can never be trapped
the vibrating square is now a trap
Platform- and/or Interface-Specific Fixes

View File

@@ -216,7 +216,7 @@
/* end effects */
#define MAXPCHARS 95 /* maximum number of mapped characters */
#define MAXPCHARS 96 /* maximum number of mapped characters */
#define MAXDCHARS 42 /* maximum of mapped dungeon characters */
#define MAXTCHARS 22 /* maximum of mapped trap characters */
#define MAXECHARS 31 /* maximum of mapped effects characters */

View File

@@ -78,6 +78,7 @@ extern struct trap *ftrap;
#define MAGIC_TRAP 20
#define ANTI_MAGIC 21
#define POLY_TRAP 22
#define TRAPNUM 23
#define VIBRATING_SQUARE 23
#define TRAPNUM 24
#endif /* TRAP_H */

View File

@@ -220,6 +220,7 @@ int x, y;
&& (levl[x][y].wall_info & W_NONDIGGABLE) != 0)
|| (ttmp
&& (ttmp->ttyp == MAGIC_PORTAL
|| ttmp->ttyp == VIBRATING_SQUARE
|| (!Can_dig_down(&u.uz) && !levl[x][y].candig)))) {
if (verbose)
pline_The("%s here is too hard to %s.", surface(x, y), verb);
@@ -778,7 +779,8 @@ coord *cc;
lev = &levl[dig_x][dig_y];
nohole = (!Can_dig_down(&u.uz) && !lev->candig);
if ((ttmp && (ttmp->ttyp == MAGIC_PORTAL || nohole))
if ((ttmp && (ttmp->ttyp == MAGIC_PORTAL
|| ttmp->ttyp == VIBRATING_SQUARE || nohole))
|| (IS_ROCK(lev->typ) && lev->typ != SDOOR
&& (lev->wall_info & W_NONDIGGABLE) != 0)) {
pline_The("%s %shere is too hard to dig in.", surface(dig_x, dig_y),

View File

@@ -619,6 +619,9 @@ int x, y;
if (ttmp->ttyp == MAGIC_PORTAL) {
dotrap(ttmp, 0);
return FALSE;
} else if (ttmp->ttyp == VIBRATING_SQUARE) {
pline("The ground vibrates as you pass it.");
dotrap(ttmp, 0); /* doesn't print messages */
} else if (ttmp->ttyp == FIRE_TRAP) {
dotrap(ttmp, 0);
} else if ((ttmp->ttyp == PIT || ttmp->ttyp == SPIKED_PIT

View File

@@ -204,14 +204,15 @@ const struct symdef defsyms[MAXPCHARS] = {
{ '^', "magic trap", C(HI_ZAP) }, /* trap */
{ '^', "anti-magic field", C(HI_ZAP) }, /* trap */
{ '^', "polymorph trap", C(CLR_BRIGHT_GREEN) }, /* trap */
{ '^', "vibrating square", C(CLR_YELLOW) }, /* trap */
{ '|', "wall", C(CLR_GRAY) }, /* vbeam */
{ '-', "wall", C(CLR_GRAY) }, /* hbeam */
{ '\\', "wall", C(CLR_GRAY) }, /* lslant */
{ '/', "wall", C(CLR_GRAY) }, /* rslant */
{ '*', "", C(CLR_WHITE) }, /* dig beam */
{ '!', "", C(CLR_WHITE) }, /* camera flash beam */
/*70*/ { ')', "", C(HI_WOOD) }, /* boomerang open left */
{ '(', "", C(HI_WOOD) }, /* boomerang open right */
{ ')', "", C(HI_WOOD) }, /* boomerang open left */
/*70*/ { '(', "", C(HI_WOOD) }, /* boomerang open right */
{ '0', "", C(HI_ZAP) }, /* 4 magic shield symbols */
{ '#', "", C(HI_ZAP) },
{ '@', "", C(HI_ZAP) },
@@ -222,8 +223,8 @@ const struct symdef defsyms[MAXPCHARS] = {
C(CLR_BRIGHT_GREEN) }, /* valid position for targeting */
{ '/', "", C(CLR_GREEN) }, /* swallow top left */
{ '-', "", C(CLR_GREEN) }, /* swallow top center */
/*80*/ { '\\', "", C(CLR_GREEN) }, /* swallow top right */
{ '|', "", C(CLR_GREEN) }, /* swallow middle left */
{ '\\', "", C(CLR_GREEN) }, /* swallow top right */
/*80*/ { '|', "", C(CLR_GREEN) }, /* swallow middle left */
{ '|', "", C(CLR_GREEN) }, /* swallow middle right */
{ '\\', "", C(CLR_GREEN) }, /* swallow bottom left */
{ '-', "", C(CLR_GREEN) }, /* swallow bottom center*/
@@ -232,8 +233,8 @@ const struct symdef defsyms[MAXPCHARS] = {
{ '-', "", C(CLR_ORANGE) }, /* explosion top center */
{ '\\', "", C(CLR_ORANGE) }, /* explosion top right */
{ '|', "", C(CLR_ORANGE) }, /* explosion middle left */
/*90*/ { ' ', "", C(CLR_ORANGE) }, /* explosion middle center*/
{ '|', "", C(CLR_ORANGE) }, /* explosion middle right */
{ ' ', "", C(CLR_ORANGE) }, /* explosion middle center*/
/*90*/ { '|', "", C(CLR_ORANGE) }, /* explosion middle right */
{ '\\', "", C(CLR_ORANGE) }, /* explosion bottom left */
{ '-', "", C(CLR_ORANGE) }, /* explosion bottom center*/
{ '/', "", C(CLR_ORANGE) }, /* explosion bottom right */

View File

@@ -476,7 +476,7 @@ static NEARDATA const char *trap_engravings[TRAPNUM] = {
(char *) 0, (char *) 0, (char *) 0, (char *) 0,
/* 14..16: trap door, teleport, level-teleport */
"Vlad was here", "ad aerarium", "ad aerarium", (char *) 0, (char *) 0,
(char *) 0, (char *) 0, (char *) 0, (char *) 0,
(char *) 0, (char *) 0, (char *) 0, (char *) 0, (char *) 0,
};
STATIC_OVL void
@@ -1295,6 +1295,7 @@ coord *tm;
/* reject "too hard" traps */
switch (kind) {
case MAGIC_PORTAL:
case VIBRATING_SQUARE:
kind = NO_TRAP;
break;
case ROLLING_BOULDER_TRAP:

View File

@@ -298,7 +298,7 @@ d_level *lev;
It might still fail if there's a dungeon feature here. */
struct trap *t = t_at(x, y);
if (t && t->ttyp != MAGIC_PORTAL)
if (t && t->ttyp != MAGIC_PORTAL && t->ttyp != VIBRATING_SQUARE)
deltrap(t);
if (bad_location(x, y, nlx, nly, nhx, nhy))
return FALSE;
@@ -619,6 +619,7 @@ register const char *s;
|| !SPACE_POS(levl[x][y].typ) || occupied(x, y));
inv_pos.x = x;
inv_pos.y = y;
maketrap(inv_pos.x, inv_pos.y, VIBRATING_SQUARE);
#undef INVPOS_X_MARGIN
#undef INVPOS_Y_MARGIN
#undef INVPOS_DISTANCE

View File

@@ -1173,6 +1173,7 @@ dospinweb()
case TELEP_TRAP:
case LEVEL_TELEP:
case MAGIC_PORTAL:
case VIBRATING_SQUARE:
Your("webbing vanishes!");
return (0);
case WEB:

View File

@@ -735,6 +735,7 @@ rndtrap()
rtrap = rnd(TRAPNUM - 1);
switch (rtrap) {
case HOLE: /* no random holes on special levels */
case VIBRATING_SQUARE:
case MAGIC_PORTAL:
rtrap = NO_TRAP;
break;

View File

@@ -314,7 +314,7 @@ register int x, y, typ;
register boolean oldplace;
if ((ttmp = t_at(x, y)) != 0) {
if (ttmp->ttyp == MAGIC_PORTAL)
if (ttmp->ttyp == MAGIC_PORTAL || ttmp->ttyp == VIBRATING_SQUARE)
return (struct trap *) 0;
oldplace = TRUE;
if (u.utrap && (x == u.ux) && (y == u.uy)
@@ -826,8 +826,8 @@ unsigned trflags;
defsyms[trap_to_defsym(ttype)].explanation);
return;
}
if (!Fumbling && ttype != MAGIC_PORTAL && ttype != ANTI_MAGIC
&& !forcebungle && !plunged && !adj_pit
if (!Fumbling && ttype != MAGIC_PORTAL && ttype != VIBRATING_SQUARE
&& ttype != ANTI_MAGIC && !forcebungle && !plunged && !adj_pit
&& (!rn2(5) || ((ttype == PIT || ttype == SPIKED_PIT)
&& is_clinger(youmonst.data)))) {
You("escape %s %s.", (ttype == ARROW_TRAP && !trap->madeby_u)
@@ -1426,6 +1426,11 @@ unsigned trflags;
feeltrap(trap);
domagicportal(trap);
break;
case VIBRATING_SQUARE:
seetrap(trap);
/* messages handled elsewhere; the trap symbol is merely to mark the
* square for future reference */
break;
default:
feeltrap(trap);
@@ -2590,6 +2595,18 @@ 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);
}
break;
default:
impossible("Some monster encountered a strange trap of type %d.",
tt);

View File

@@ -173,6 +173,7 @@ static struct {
{ "magic", MAGIC_TRAP },
{ "anti magic", ANTI_MAGIC },
{ "polymorph", POLY_TRAP },
{ "vibrating square", VIBRATING_SQUARE },
{ 0, 0 } };
static struct {