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.
This commit is contained in:
@@ -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;
|
||||
|
||||
23
src/pickup.c
23
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))
|
||||
|
||||
Reference in New Issue
Block a user