Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7

This commit is contained in:
nhmall
2022-01-28 07:50:46 -05:00
9 changed files with 52 additions and 10 deletions
+1
View File
@@ -1365,6 +1365,7 @@ drinking blessed potion of full healing heals wounded legs, either hero's or
steed's (when riding, wounded leg injury applies to steed, not hero) steed's (when riding, wounded leg injury applies to steed, not hero)
drinking uncursed potion of full healing or blessed potion of extra healing drinking uncursed potion of full healing or blessed potion of extra healing
heal hero's wounded legs when not riding; no effect on steed if riding heal hero's wounded legs when not riding; no effect on steed if riding
cancellation explodes most magical traps
Platform- and/or Interface-Specific New Features Platform- and/or Interface-Specific New Features
+1
View File
@@ -147,6 +147,7 @@ enum objclass_syms {
#define BURNING_OIL (MAXOCLASSES + 1) /* Can be used as input to explode. */ #define BURNING_OIL (MAXOCLASSES + 1) /* Can be used as input to explode. */
#define MON_EXPLODE (MAXOCLASSES + 2) /* Exploding monster (e.g. gas spore) */ #define MON_EXPLODE (MAXOCLASSES + 2) /* Exploding monster (e.g. gas spore) */
#define TRAP_EXPLODE (MAXOCLASSES + 3)
#if 0 /* moved to decl.h so that makedefs.c won't see them */ #if 0 /* moved to decl.h so that makedefs.c won't see them */
extern const struct class_sym extern const struct class_sym
+7
View File
@@ -84,6 +84,13 @@ enum trap_types {
#define is_pit(ttyp) ((ttyp) == PIT || (ttyp) == SPIKED_PIT) #define is_pit(ttyp) ((ttyp) == PIT || (ttyp) == SPIKED_PIT)
#define is_hole(ttyp) ((ttyp) == HOLE || (ttyp) == TRAPDOOR) #define is_hole(ttyp) ((ttyp) == HOLE || (ttyp) == TRAPDOOR)
#define undestroyable_trap(ttyp) ((ttyp) == MAGIC_PORTAL \
|| (ttyp) == VIBRATING_SQUARE)
#define is_magical_trap(ttyp) ((ttyp) == TELEP_TRAP \
|| (ttyp) == LEVEL_TELEP \
|| (ttyp) == MAGIC_TRAP \
|| (ttyp) == ANTI_MAGIC \
|| (ttyp) == POLY_TRAP)
/* "transportation" traps */ /* "transportation" traps */
#define is_xport(ttyp) ((ttyp) >= TELEP_TRAP && (ttyp) <= MAGIC_PORTAL) #define is_xport(ttyp) ((ttyp) >= TELEP_TRAP && (ttyp) <= MAGIC_PORTAL)
+2 -4
View File
@@ -207,8 +207,7 @@ dig_check(struct monst *madeby, boolean verbose, int x, int y)
} else if ((IS_ROCK(levl[x][y].typ) && levl[x][y].typ != SDOOR } else if ((IS_ROCK(levl[x][y].typ) && levl[x][y].typ != SDOOR
&& (levl[x][y].wall_info & W_NONDIGGABLE) != 0) && (levl[x][y].wall_info & W_NONDIGGABLE) != 0)
|| (ttmp || (ttmp
&& (ttmp->ttyp == MAGIC_PORTAL && (undestroyable_trap(ttmp->ttyp)
|| ttmp->ttyp == VIBRATING_SQUARE
|| (!Can_dig_down(&u.uz) && !levl[x][y].candig)))) { || (!Can_dig_down(&u.uz) && !levl[x][y].candig)))) {
if (verbose) if (verbose)
pline_The("%s here is too hard to %s.", surface(x, y), verb); pline_The("%s here is too hard to %s.", surface(x, y), verb);
@@ -790,8 +789,7 @@ dighole(boolean pit_only, boolean by_magic, coord *cc)
nohole = (!Can_dig_down(&u.uz) && !lev->candig); nohole = (!Can_dig_down(&u.uz) && !lev->candig);
old_typ = lev->typ; old_typ = lev->typ;
if ((ttmp && (ttmp->ttyp == MAGIC_PORTAL if ((ttmp && (undestroyable_trap(ttmp->ttyp) || nohole))
|| ttmp->ttyp == VIBRATING_SQUARE || nohole))
|| (IS_ROCK(old_typ) && old_typ != SDOOR || (IS_ROCK(old_typ) && old_typ != SDOOR
&& (lev->wall_info & W_NONDIGGABLE) != 0)) { && (lev->wall_info & W_NONDIGGABLE) != 0)) {
pline_The("%s %shere is too hard to dig in.", surface(dig_x, dig_y), pline_The("%s %shere is too hard to dig in.", surface(dig_x, dig_y),
+1 -1
View File
@@ -314,7 +314,7 @@ explode(
tmp_at(DISP_END, 0); /* clear the explosion */ tmp_at(DISP_END, 0); /* clear the explosion */
} else { } else {
if (olet == MON_EXPLODE) { if (olet == MON_EXPLODE || olet == TRAP_EXPLODE) {
str = "explosion"; str = "explosion";
generic = TRUE; generic = TRUE;
} }
+1 -1
View File
@@ -320,7 +320,7 @@ put_lregion_here(
It might still fail if there's a dungeon feature here. */ It might still fail if there's a dungeon feature here. */
struct trap *t = t_at(x, y); struct trap *t = t_at(x, y);
if (t && t->ttyp != MAGIC_PORTAL && t->ttyp != VIBRATING_SQUARE) if (t && !undestroyable_trap(t->ttyp))
deltrap(t); deltrap(t);
if (bad_location(x, y, nlx, nly, nhx, nhy)) if (bad_location(x, y, nlx, nly, nhx, nhy))
return FALSE; return FALSE;
+1 -2
View File
@@ -5256,8 +5256,7 @@ ensure_way_out(void)
} }
while (ttmp) { while (ttmp) {
if ((ttmp->ttyp == MAGIC_PORTAL || ttmp->ttyp == VIBRATING_SQUARE if ((undestroyable_trap(ttmp->ttyp) || is_hole(ttmp->ttyp))
|| is_hole(ttmp->ttyp))
&& !selection_getpoint(ttmp->tx, ttmp->ty, ov)) && !selection_getpoint(ttmp->tx, ttmp->ty, ov))
selection_floodfill(ov, ttmp->tx, ttmp->ty, TRUE); selection_floodfill(ov, ttmp->tx, ttmp->ty, TRUE);
ttmp = ttmp->ntrap; ttmp = ttmp->ntrap;
+2 -2
View File
@@ -346,7 +346,7 @@ maketrap(int x, int y, int typ)
struct rm *lev = &levl[x][y]; struct rm *lev = &levl[x][y];
if ((ttmp = t_at(x, y)) != 0) { if ((ttmp = t_at(x, y)) != 0) {
if (ttmp->ttyp == MAGIC_PORTAL || ttmp->ttyp == VIBRATING_SQUARE) if (undestroyable_trap(ttmp->ttyp))
return (struct trap *) 0; return (struct trap *) 0;
oldplace = TRUE; oldplace = TRUE;
if (u.utrap && x == u.ux && y == u.uy if (u.utrap && x == u.ux && y == u.uy
@@ -2441,7 +2441,7 @@ dotrap(register struct trap* trap, unsigned int trflags)
trapname(ttype, FALSE)); trapname(ttype, FALSE));
return; return;
} }
if (!Fumbling && ttype != MAGIC_PORTAL && ttype != VIBRATING_SQUARE if (!Fumbling && !undestroyable_trap(ttype)
&& ttype != ANTI_MAGIC && !forcebungle && !plunged && ttype != ANTI_MAGIC && !forcebungle && !plunged
&& !conj_pit && !adj_pit && !conj_pit && !adj_pit
&& (!rn2(5) || (is_pit(ttype) && (!rn2(5) || (is_pit(ttype)
+36
View File
@@ -21,6 +21,7 @@ static void zhitu(int, int, const char *, xchar, xchar);
static void revive_egg(struct obj *); static void revive_egg(struct obj *);
static boolean zap_steed(struct obj *); static boolean zap_steed(struct obj *);
static void skiprange(int, int *, int *); static void skiprange(int, int *, int *);
static void maybe_explode_trap(struct trap *, struct obj *);
static int zap_hit(int, int); static int zap_hit(int, int);
static void disintegrate_mon(struct monst *, int, const char *); static void disintegrate_mon(struct monst *, int, const char *);
static int adtyp_to_prop(int); static int adtyp_to_prop(int);
@@ -3138,6 +3139,10 @@ zap_updown(struct obj *obj) /* wand or spell */
break; break;
} }
} }
maybe_explode_trap(ttmp, obj);
/* note: ttmp might be now gone */
} else if (u.dz < 0) { } else if (u.dz < 0) {
/* zapping upward */ /* zapping upward */
@@ -3335,6 +3340,34 @@ skiprange(int range, int *skipstart, int *skipend)
*skipend = tmp - 1; *skipend = tmp - 1;
} }
/* maybe explode a trap hit by object otmp's effect;
cancellation beam hitting a magical trap causes an explosion.
might delete the trap. */
static void
maybe_explode_trap(struct trap *ttmp, struct obj *otmp)
{
if (!ttmp || !otmp)
return;
if (otmp->otyp == WAN_CANCELLATION || otmp->otyp == SPE_CANCELLATION) {
xchar x = ttmp->tx, y = ttmp->ty;
if (undestroyable_trap(ttmp->ttyp)) {
shieldeff(x, y);
if (cansee(x, y)) {
ttmp->tseen = 1;
newsym(x, y);
}
} else if (is_magical_trap(ttmp->ttyp)) {
if (!Deaf)
pline("Kaboom!");
explode(x, y, -WAN_CANCELLATION,
20+d(3,6), TRAP_EXPLODE, EXPL_MAGICAL);
deltrap(ttmp);
newsym(x, y);
}
}
}
/* /*
* Called for the following distance effects: * Called for the following distance effects:
* when a weapon is thrown (weapon == THROWN_WEAPON) * when a weapon is thrown (weapon == THROWN_WEAPON)
@@ -3468,6 +3501,9 @@ bhit(int ddx, int ddy, int range, /* direction and range */
learnwand(obj); learnwand(obj);
} }
if (weapon == ZAPPED_WAND)
maybe_explode_trap(t_at(g.bhitpos.x, g.bhitpos.y), obj);
mtmp = m_at(g.bhitpos.x, g.bhitpos.y); mtmp = m_at(g.bhitpos.x, g.bhitpos.y);
/* /*