autounlock:untrap

Implement 'untrap' as an 'autounlock' action.  Quite a bit more work
than anticipated.  The new documentation is rather clumsy; too many
if-this and if-not-that clauses have intruded.

I'll be astonished if all the return values are correct....

[A couple of places were checking for (rx != 0 && ry != 0) to decide
whether they were performating an autounlock action at <rx,ry> but
that erroneously excludes the top line of the map if the current
level extends that far.  Just check rx for zero/non-zero.]
This commit is contained in:
PatR
2022-05-06 14:44:57 -07:00
parent a31dd26d8a
commit 02207b967a
10 changed files with 268 additions and 126 deletions

View File

@@ -3662,15 +3662,26 @@ Persistent.
Controls what action to take when attempting to walk into a locked door
or to loot a locked container.
Takes a plus-sign separated list of values:
\fIapply-key\fP which will attempt to use a key or other unlocking tool
if you have one;
\fIkick\fP which will kick the door (if you lack a key or omit apply-key;
.PS Apply-Key
.PL Untrap
prompt about whether to attempt to find a trap;
it might fail to find one even when present; if it does find one, it
will ask whether you want to try to disarm the trap; if you decline,
your character will forget that the door or box is trapped;
.PL Apply-Key
if carrying a key or other unlocking tool, prompt about using it;
.PL Kick
kick the door (if you omit untrap or decline to attempt untrap and
you omit apply-key or you lack a key or you decline to use the key;
has no effect on containers);
\fIforce\fP which will try to force a container's lid with your currently
wielded weapon (if you lack a key or omit apply-key; has no effect on
doors); or
\fInone\fP which can't be combined with the other choices.
.lp ""
.PL Force
try to force a container's lid with your currently
wielded weapon (if you omit untrap or decline to attempt untrap and
you omit apply-key or you lack a key or you decline to use the key;
has no effect on doors);
.PL None
none of the above; can't be combined with the other choices.
.PE
Omitting the value is treated as if \f(CRautounlock:apply-key\fP.
Preceding \f(CRautounlock\fP with \(oq!\(cq or \(lqno\(rq is treated as
\f(CRautounlock:none\fP.
@@ -3680,7 +3691,7 @@ Successfully kicking a door will break it and wake up nearby monsters.
Successfully forcing a container open will break its lock and might also
destroy some of its contents or damage your weapon or both.
.lp ""
The default is \fIapply-key\fP.
The default is Apply-Key.
Persistent.
.lp blind
Start the character permanently blind (default false).