From f9be7a4b8a72d11f87a76a8d95c0d365715e66de Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 18 Oct 2021 12:55:28 -0700 Subject: [PATCH] boulders vs vault walls Noticed when testing the "wall_angle: unknown" fix, if there is a boulder rather than a door in the breach in a vault's walls at the spot where the guard arrives, the guard would walk onto it, tell the hero to drop any gold and follow, then move back. The boulder would remain in the hero's way and couldn't be pushed because the guard was in the boulder's way. Have the guard smash any such boulder(s) into rocks when arriving (with no explanation for how that is accomplished, just a message about seeing or hearing boulder(s) shatter). Later when repairing the walls, delete any rocks or boulders at all vault wall locations (even when no gap-to-wall repair is needed). --- doc/fixes37.0 | 7 ++++++- src/vault.c | 39 +++++++++++++++++++++++++++++++++++++-- src/zap.c | 9 +-------- 3 files changed, 44 insertions(+), 11 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 20f2ebfb6..9c2e729a2 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -645,7 +645,12 @@ can now use m to try to move to an adjacent boulder's spot without breaching a shop wall, using locking magic to put a door there, then unlocking that door yielded a situation where subsequent shop damage repair produced invalid map data which resulted in an impossible() warning - about "wall_angle: unknown" during map display + about "wall_angle: unknown" during map display; similar for a vault + wall if it's the spot where the guard arrives to lead hero out +if vault guard arrives on a boulder in a breach in the vault wall when coming + to lead the hero out, smash that boulder into rocks so that the hero + won't try--and fail, because the guard will be in its way--to push it +when vault walls are repaired, destroy any rocks or boulders at their spots melting ice timer could persist after the ice was gone from digging or from an exploding land mine diff --git a/src/vault.c b/src/vault.c index 125cf90da..9430cb9e5 100644 --- a/src/vault.c +++ b/src/vault.c @@ -293,6 +293,7 @@ void invault(void) { struct monst *guard; + struct obj *otmp; boolean gsensed; int trycount, vaultroom = (int) vault_occupied(u.urooms); @@ -381,6 +382,25 @@ invault(void) EGD(guard)->warncnt = 0; reset_faint(); /* if fainted - wake up */ + /* if there are any boulders in the guard's way, destroy them; + perhaps the guard knows a touch equivalent of force bolt; + otherwise the hero wouldn't be able to push one to follow the + guard out of the vault because that guard would be in its way */ + if ((otmp = sobj_at(BOULDER, guard->mx, guard->my)) != 0) { + void (*func)(const char *, ...) PRINTF_F(1, 2); + const char *bname = simpleonames(otmp); + int bcnt = 0; + + do { + ++bcnt; + fracture_rock(otmp); + otmp = sobj_at(BOULDER, guard->mx, guard->my); + } while (otmp); + /* You_hear() will handle Deaf/!Deaf */ + func = !Blind ? You_see : You_hear; + (*func)("%s shatter.", + (bcnt == 1) ? an(bname) : makeplural(bname)); + } gsensed = !canspotmon(guard); if (!gsensed) pline("Suddenly one of the Vault's %s enters!", @@ -388,6 +408,7 @@ invault(void) else pline("Someone else has entered the Vault."); newsym(guard->mx, guard->my); + if (u.uswallow) { /* can't interrogate hero, don't interrogate engulfer */ if (!Deaf) @@ -569,7 +590,7 @@ wallify_vault(struct monst *grd) xchar lox = g.rooms[vlt].lx - 1, hix = g.rooms[vlt].hx + 1, loy = g.rooms[vlt].ly - 1, hiy = g.rooms[vlt].hy + 1; struct monst *mon; - struct obj *gold; + struct obj *gold, *rocks; struct trap *trap; boolean fixed = FALSE; boolean movedgold = FALSE; @@ -580,18 +601,32 @@ wallify_vault(struct monst *grd) if (x != lox && x != hix && y != loy && y != hiy) continue; - if (!IS_WALL(levl[x][y].typ) && !in_fcorridor(grd, x, y)) { + if ((!IS_WALL(levl[x][y].typ) || g_at(x, y) + || sobj_at(ROCK, x, y) || sobj_at(BOULDER, x, y)) + && !in_fcorridor(grd, x, y)) { if ((mon = m_at(x, y)) != 0 && mon != grd) { if (mon->mtame) yelp(mon); (void) rloc(mon, FALSE); } + /* move gold at wall locations into the vault */ if ((gold = g_at(x, y)) != 0) { move_gold(gold, EGD(grd)->vroom); movedgold = TRUE; } + /* destroy rocks and boulders (subsume them into the walls); + other objects present stay intact and become embedded */ + while ((rocks = sobj_at(ROCK, x, y)) != 0) { + obj_extract_self(rocks); + obfree(rocks, (struct obj *) 0); + } + while ((rocks = sobj_at(BOULDER, x, y)) != 0) { + obj_extract_self(rocks); + obfree(rocks, (struct obj *) 0); + } if ((trap = t_at(x, y)) != 0) deltrap(trap); + if (x == lox) typ = (y == loy) ? TLCORNER : (y == hiy) ? BLCORNER diff --git a/src/zap.c b/src/zap.c index 301b655dd..31ebc3b6c 100644 --- a/src/zap.c +++ b/src/zap.c @@ -4466,14 +4466,7 @@ melt_ice(xchar x, xchar y, const char *msg) if (lev->typ == DRAWBRIDGE_UP || lev->typ == DRAWBRIDGE_DOWN) { lev->drawbridgemask &= ~DB_ICE; /* revert to DB_MOAT */ } else { /* lev->typ == ICE */ -#ifdef STUPID - if (lev->icedpool == ICED_POOL) - lev->typ = POOL; - else - lev->typ = MOAT; -#else lev->typ = (lev->icedpool == ICED_POOL ? POOL : MOAT); -#endif lev->icedpool = 0; } spot_stop_timers(x, y, MELT_ICE_AWAY); /* no more ice to melt away */ @@ -4877,7 +4870,7 @@ zap_over_floor(xchar x, xchar y, int type, boolean *shopdamage, return rangemod; } -/* fractured by pick-axe or wand of striking */ +/* fractured by pick-axe or wand of striking or by vault guard */ void fracture_rock(struct obj *obj) /* no texts here! */ {