More interesting rolling boulder traps

Rolling boulder traps now react to having boulders pushed onto them;
the boulder will roll until reaching the trap's launch spot
(resetting the trap if the boulder was removed), or until it hits a
wall otherwise.

Because they can now be reset, they aren't removed when stepping on
them with a misplaced boulder (although no boulder moves unless
there's one on the appropriate spot).
This commit is contained in:
Alex Smith
2026-04-14 11:28:07 +01:00
parent 10a47c0713
commit bc94d7a355
3 changed files with 31 additions and 5 deletions

View File

@@ -592,6 +592,26 @@ moverock_core(coordxy sx, coordxy sy)
}
seetrap(ttmp);
return sobj_at(BOULDER, sx, sy) ? -1 : 0;
case ROLLING_BOULDER_TRAP:
{
int tox = rx;
int toy = ry;
/* the boulder continues until it reaches one of
the trap's launch spots or hits a wall / out-of-bounds */
while (isok(tox + u.dx, toy + u.dy)) {
tox += u.dx;
toy += u.dy;
if (tox == ttmp->launch.x && toy == ttmp->launch.y)
break;
if (tox == ttmp->launch2.x && toy == ttmp->launch2.y)
break;
}
pline("%s away from you!",
Tobjnam(otmp, "suddenly roll"));
feeltrap(ttmp);
launch_obj(BOULDER, sx, sy, tox, toy, ROLL | LAUNCH_KNOWN);
return sobj_at(BOULDER, sx, sy) ? -1 : 0;
}
default:
break; /* boulder not affected by this trap */
}