From: PatR Date: Sat, 25 Jun 2016 07:10:01 +0000 (-0700) Subject: more #H4407 - #loot vs cockatrice corpse X-Git-Tag: NetHack-3.6.1_RC01~650 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=98a90e353b329281cb46f1eb92333f3e1b701fa0;p=nethack more #H4407 - #loot vs cockatrice corpse 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. --- diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index 8b9f8e630..9e1a4c5c1 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -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 diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index df4282d7e..cca387b25 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -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} diff --git a/src/cmd.c b/src/cmd.c index 5dfb3dbc7..13086a9c2 100644 --- 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 */ + || cmd_func == doloot /* 'm' prefix allowed for some extended commands */ || cmd_func == doextcmd || cmd_func == doextlist) return TRUE; diff --git a/src/pickup.c b/src/pickup.c index 9be8c809f..1fccc65d6 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -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))