]> granicus.if.org Git - nethack/commitdiff
more #H4407 - #loot vs cockatrice corpse
authorPatR <rankin@nethack.org>
Sat, 25 Jun 2016 07:10:01 +0000 (00:10 -0700)
committerPatR <rankin@nethack.org>
Sat, 25 Jun 2016 07:10:01 +0000 (00:10 -0700)
Previous fix was 'me' to eat from inventory without checking current
location for edible items.  The report describing the need for that
also mentioned that you could #loot while blind and without gloves
and not touch any objects except for the container you pick to loot.
This adds a corpse touch check, plus `m#loot' to skip floor containers
and go directly to using #loot for adjacent saddled creature.  That,
as well as the open command, will reveal adjacent container in some
circumstances but I'm going to pretend that that doesn't matter.

doloot() has turned into spaghetti.  We should probably add #unsaddle
or something of the sort and return #loot to container-access only.

doc/Guidebook.mn
doc/Guidebook.tex
src/cmd.c
src/pickup.c

index 8b9f8e630f20f97272a1e16861e3b71a6626d3a0..9e1a4c5c14dc45a56983d302b5675b3175bff2b1 100644 (file)
@@ -582,7 +582,9 @@ so no opportunity to answer `m' at that prompt).
 .lp ""
 A few other commands (eat food, offer sacrifice, apply tinning-kit) use
 the `m' prefix to skip checking for applicable objects on the floor
-and go straight to checking inventory.
+and go straight to checking inventory,
+or (for ``#loot'' to remove a saddle),
+skip containers and go straight to adjacent monsters.
 .lp F[yuhjklbn]
 Prefix:  fight a monster (even if you only guess one is there).
 .lp M[yuhjklbn]
@@ -945,6 +947,8 @@ Kick something.
 .lp #loot
 Loot a box or bag on the floor beneath you, or the saddle
 from a steed standing next to you.
+Precede with the `m' prefix to skip containers at your location
+and go directly to removing a saddle.
 .lp #monster
 Use a monster's special ability (when polymorphed into monster form).
 .lp #name
@@ -1303,13 +1307,21 @@ have the right equipment and skill.  Convincing a wild beast to let
 you saddle it up is difficult to say the least.  Many a dungeoneer
 has had to resort to magic and wizardry in order to forge the alliance.
 Once you do have the beast under your control however, you can
-easily climb in and out of the saddle with the `#ride' command.  Lead
+easily climb in and out of the saddle with the ``#ride'' command.  Lead
 the beast around the dungeon when riding, in the same manner as
 you would move yourself.  It is the beast that you will see displayed
 on the map.
 .pg
-Riding skill is managed by the `#enhance' command.  See the section
+Riding skill is managed by the ``#enhance'' command.  See the section
 on Weapon proficiency for more information about that.
+.pg
+Use the `a' (apply) command and pick a saddle in your inventory to
+attempt to put that saddle on an adjacent creature.  If successful,
+it will be transferred to that creature's inventory.
+.pg
+Use the ``#loot'' command while adjacent to a saddled creature to
+try to remove the saddle from that creature.  If successful, it will
+be transferred to your inventory.
 .hn 2
 Bones levels
 .pg
index df4282d7e419f630129495eb513d92c106e2d718..cca387b25eeb9a2c5ebdfa6bd0974d010194bdd1 100644 (file)
@@ -702,7 +702,9 @@ so no opportunity to answer `{\tt m}' at that prompt).\\
 %.lp ""
 A few other commands (eat food, offer sacrifice, apply tinning-kit) use
 the `{\tt m}' prefix to skip checking for applicable objects on the floor
-and go straight to checking inventory.
+and go straight to checking inventory,
+or (for ``{\tt \#loot}'' to remove a saddle),
+skip containers and go straight to adjacent monsters.
 %.lp
 \item[\tb{F[yuhjklbn]}]
 Prefix:  fight a monster (even if you only guess one is there).
@@ -1136,6 +1138,8 @@ Kick something.
 \item[\tb{\#loot}]
 Loot a box or bag on the floor beneath you, or the saddle 
 from a steed standing next to you.
+Precede with the `{\tt m}' prefix to skip containers at your location
+and go directly to removing a saddle.
 %.lp
 \item[\tb{\#monster}]
 Use a monster's special ability (when polymorphed into monster form).
@@ -1591,15 +1595,25 @@ have the right equipment and skill.  Convincing a wild beast to let
 you saddle it up is difficult to say the least.  Many a dungeoneer
 has had to resort to magic and wizardry in order to forge the alliance.
 Once you do have the beast under your control however, you can
-easily climb in and out of the saddle with the `{\tt \#ride}' command.  Lead
+easily climb in and out of the saddle with the ``{\tt \#ride}'' command.  Lead
 the beast around the dungeon when riding, in the same manner as
 you would move yourself.  It is the beast that you will see displayed
 on the map.
 
 %.pg
-Riding skill is managed by the `{\tt \#enhance}' command.  See the section
+Riding skill is managed by the ``{\tt \#enhance}'' command.  See the section
 on Weapon proficiency for more information about that.
 
+%.pg
+Use the `{\tt a}' (apply) command and pick a saddle in your inventory to
+attempt to put that saddle on an adjacent creature.  If successful,
+it will be transferred to that creature's inventory.
+
+%.pg
+Use the ``{\tt \#loot}'' command while adjacent to a saddled creature to
+try to remove the saddle from that creature.  If successful, it will
+be transferred to your inventory.
+
 %.hn 2
 \subsection*{Bones levels}
 
index 5dfb3dbc78b1e8557d264fde621e3d7d36a69205..13086a9c23fca74d8b05b908a25dda35725c7c63 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -3455,6 +3455,9 @@ int NDECL((*cmd_func));
            an item on floor or in invent; 'm' skips picking from floor
            (ie, inventory only) rather than request use of menu operation */
         || cmd_func == doeat || cmd_func == dosacrifice || cmd_func == doapply
+        /* 'm' for removing saddle from adjacent monster without checking
+           for containers at <u.ux,u.uy> */
+        || cmd_func == doloot
         /* 'm' prefix allowed for some extended commands */
         || cmd_func == doextcmd || cmd_func == doextlist)
         return TRUE;
index 9be8c809fcddf13a3a2c8ea02dfd9c864a839633..1fccc65d6914b7e55d831d59fa4423a2644d87d0 100644 (file)
@@ -1630,7 +1630,7 @@ doloot()
     char qbuf[BUFSZ];
     int prev_inquiry = 0;
     boolean prev_loot = FALSE;
-    int num_conts;
+    int num_conts = 0;
 
     abort_looting = FALSE;
 
@@ -1653,13 +1653,30 @@ doloot()
     cc.x = u.ux;
     cc.y = u.uy;
 
-lootcont:
+    if (iflags.menu_requested)
+        goto lootmon;
+
+ lootcont:
     if ((num_conts = container_at(cc.x, cc.y, TRUE)) > 0) {
         boolean anyfound = FALSE;
 
         if (!able_to_loot(cc.x, cc.y, TRUE))
             return 0;
 
+        if (Blind && !uarmg) {
+            /* if blind and without gloves, attempting to #loot at the
+               location of a cockatrice corpse is fatal before asking
+               whether to manipulate any containers */
+            for (nobj = sobj_at(CORPSE, cc.x, cc.y); nobj;
+                 nobj = nxtobj(nobj, CORPSE, TRUE))
+                if (will_feel_cockatrice(nobj, FALSE)) {
+                    feel_cockatrice(nobj, FALSE);
+                    /* if life-saved (or poly'd into stone golem),
+                       terminate attempt to loot */
+                    return 1;
+                }
+        }
+
         if (num_conts > 1) {
             /* use a menu to loot many containers */
             int n, i;
@@ -1722,9 +1739,11 @@ lootcont:
     } else if (IS_GRAVE(levl[cc.x][cc.y].typ)) {
         You("need to dig up the grave to effectively loot it...");
     }
+
     /*
      * 3.3.1 introduced directional looting for some things.
      */
+ lootmon:
     if (c != 'y' && mon_beside(u.ux, u.uy)) {
         if (!get_adjacent_loc("Loot in what direction?",
                               "Invalid loot location", u.ux, u.uy, &cc))