Restore altar destruction from magical digging

Especially powerful magic is meant to be able to destroy altars
(breaking a wand of digging or using a drum of earthquake), but it was
being blocked by a check added to maketrap() in a7f6460 designed to
prevent wizard-mode trap wishing from overwriting stairs.  The check was
refined in 6a3d82c to add an exception for digging up graves, but
continued to prevent the destruction of other types of
previously-destructible terrain.

Since this block was a side effect of an attempt to add some guard rails
to wizmode terrain wishes, and the code to explicitly permit the
destruction of other furniture with especially powerful magic is still
present, it doesn't seem like it was actually intended.  Open up terrain
destruction by digging magic a bit more by excluding only
non-destructible terrain, not all furniture other than graves, from
being overwritten by pits and holes.

Also, use AM_SANCTUM to more precisely identify non-destructible high
altars in dig_check() rather than checking whether the hero is on the
Astral or Sanctum levels.
This commit is contained in:
Michael Meyer
2023-06-09 10:55:22 -04:00
committed by PatR
parent b914f79c2f
commit ab37888b36
2 changed files with 5 additions and 4 deletions

View File

@@ -194,8 +194,8 @@ dig_check(struct monst *madeby, boolean verbose, coordxy x, coordxy y)
pline_The("throne is too hard to break apart.");
return FALSE;
} else if (IS_ALTAR(levl[x][y].typ)
&& (madeby != BY_OBJECT || Is_astralevel(&u.uz)
|| Is_sanctum(&u.uz))) {
&& (madeby != BY_OBJECT
|| (altarmask_at(x, y) & AM_SANCTUM) != 0)) {
if (verbose)
pline_The("altar is too hard to break apart.");
return FALSE;

View File

@@ -470,8 +470,9 @@ maketrap(coordxy x, coordxy y, int typ)
|| (u.utraptype == TT_LAVA && !is_lava(x, y))))
reset_utrap(FALSE);
/* old <tx,ty> remain valid */
} else if ((IS_FURNITURE(lev->typ)
&& (!IS_GRAVE(lev->typ) || (typ != PIT && typ != HOLE)))
} else if (!CAN_OVERWRITE_TERRAIN(lev->typ)
|| (IS_FURNITURE(lev->typ)
&& (typ != PIT && typ != HOLE))
|| is_pool_or_lava(x, y)
|| (IS_AIR(lev->typ) && typ != MAGIC_PORTAL)
|| (typ == LEVEL_TELEP && single_level_branch(&u.uz))) {