From 5ac69ac845263d746411d5f6144457e05ecd649a Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Wed, 23 Jan 2008 03:32:09 +0000 Subject: [PATCH] buried ball enhancement (trunk only) Make being tethered to a buried iron ball be a bit more interesting than just being stuck in the floor. You can now move within a shortened chain radius (1 step from the ball's burial location rather than normal 2 that applies when it's on the floor). This has only been modestly tested, and the message gets to be annoying if you move around a bit while monster attack and object pickup/drop messages are being delivered. There ought to be some better way to override Norep. This would work nicer if the chain was actually visible at the ball's location instead of becoming implicit at the time of burial. But I don't want to try to figure out all the ramifications of having an object on the floor which can't be moved--perhaps uchain handling already suffices, but I suspect that there's a can of worms waiting to have its lid opened. --- src/do.c | 6 +++++- src/hack.c | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/do.c b/src/do.c index 5a856b3e0..5daf92024 100644 --- a/src/do.c +++ b/src/do.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)do.c 3.5 2007/05/21 */ +/* SCCS Id: @(#)do.c 3.5 2008/01/22 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1044,6 +1044,10 @@ boolean at_stairs, falling, portal; if (on_level(newlevel, &u.uz)) return; /* this can happen */ + /* tethered movement makes level change while trapped feasible */ + if (u.utrap && u.utraptype == TT_BURIEDBALL) + buried_ball_to_punishment(); /* (before we save/leave old level) */ + fd = currentlevel_rewrite(); if (fd < 0) return; diff --git a/src/hack.c b/src/hack.c index 5c0806de8..0ca5f1aac 100644 --- a/src/hack.c +++ b/src/hack.c @@ -1053,6 +1053,23 @@ struct trap *desttrap; /* nonnull if another trap at */ case TT_INFLOOR: case TT_BURIEDBALL: anchored = (u.utraptype == TT_BURIEDBALL); + if (anchored) { + coord cc; + + cc.x = u.ux, cc.y = u.uy; + /* can move normally within radius 1 of buried ball */ + if (buried_ball(&cc) && dist2(x, y, cc.x, cc.y) <= 2) { + /* ugly hack: we need to issue some message here + in case "you are chained to the buried ball" + was the most recent message given, otherwise + our next attempt to move out of tether range + after this successful move would have its + can't-do-that message suppressed by Norep */ + if (flags.verbose) + Norep("You move within the chain's reach."); + return TRUE; + } + } if (--u.utrap) { if (flags.verbose) { if (anchored) { -- 2.40.0