more follow-up related to #1320
This commit is contained in:
4
src/do.c
4
src/do.c
@@ -941,10 +941,10 @@ better_not_try_to_drop_that(struct obj *otmp)
|
||||
{
|
||||
char buf[BUFSZ];
|
||||
|
||||
/* u_safe_from_fatal_corpse() with 0xF checks for gloves and stoning
|
||||
/* u_safe_from_fatal_corpse() with st_all checks for gloves and stoning
|
||||
* resistance before bothering to prompt you.
|
||||
*/
|
||||
if (otmp->otyp == CORPSE && !u_safe_from_fatal_corpse(otmp, 0xF)) {
|
||||
if (otmp->otyp == CORPSE && !u_safe_from_fatal_corpse(otmp, st_all)) {
|
||||
Snprintf(
|
||||
buf, sizeof buf,
|
||||
"Drop the %s corpse without any protection while handling it?",
|
||||
|
||||
@@ -2895,12 +2895,15 @@ better_not_take_that_off(struct obj *otmp)
|
||||
struct obj *corpse = carrying_stoning_corpse();
|
||||
char buf[BUFSZ];
|
||||
|
||||
/* u_safe_from_fatal_corpse() with 0x4e instead of 0x6
|
||||
/* u_safe_from_fatal_corpse() with
|
||||
(st_corpse | st_petrifies | st_resists) instead of
|
||||
(st_corpse | st_petrifies)
|
||||
would also check for no stoning resistance before
|
||||
bothering to prompt, but losing stoning resistance
|
||||
later, without the gloves on could prove dangerous,
|
||||
so we won't factor that in */
|
||||
if (corpse && !u_safe_from_fatal_corpse(corpse, 0x6)) {
|
||||
if (corpse
|
||||
&& !u_safe_from_fatal_corpse(corpse, st_corpse | st_petrifies)) {
|
||||
Snprintf(buf, sizeof buf,
|
||||
"Take off your %s despite carrying a dead %s?",
|
||||
gloves_simple_name(otmp), obj_pmname(corpse));
|
||||
|
||||
@@ -1232,7 +1232,7 @@ hold_another_object(
|
||||
obj = addinv_core0(obj, (struct obj *) 0, FALSE);
|
||||
goto drop_it;
|
||||
} else if (obj->otyp == CORPSE
|
||||
&& !u_safe_from_fatal_corpse(obj, 0xF)
|
||||
&& !u_safe_from_fatal_corpse(obj, st_all)
|
||||
&& obj->wishedfor) {
|
||||
obj->wishedfor = 0;
|
||||
obj = addinv_core0(obj, (struct obj *) 0, FALSE);
|
||||
|
||||
19
src/pickup.c
19
src/pickup.c
@@ -263,18 +263,19 @@ query_classes(
|
||||
|
||||
/*
|
||||
* tests:
|
||||
* 1 = gloves
|
||||
* 2 = is_corpse
|
||||
* 4 = does corpse petrify
|
||||
* 8 = stone resistance
|
||||
* st_gloves wearing gloves?
|
||||
* st_corpse is it a corpse obj?
|
||||
* st_petrifies does the corpse petrify on touch?
|
||||
* st_resists does hero have stoning resistance?
|
||||
* st_all st_gloves | st_corpse | st_petrifies | st_resists
|
||||
*/
|
||||
boolean
|
||||
u_safe_from_fatal_corpse(struct obj *obj, int tests)
|
||||
{
|
||||
if (((tests & 1) && uarmg)
|
||||
|| ((tests & 2) && obj->otyp != CORPSE)
|
||||
|| ((tests & 4) && !touch_petrifies(&mons[obj->corpsenm]))
|
||||
|| ((tests & 8) && Stone_resistance))
|
||||
if (((tests & st_gloves) && uarmg)
|
||||
|| ((tests & st_corpse) && obj->otyp != CORPSE)
|
||||
|| ((tests & st_petrifies) && !touch_petrifies(&mons[obj->corpsenm]))
|
||||
|| ((tests & st_resists) && Stone_resistance))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
@@ -283,7 +284,7 @@ u_safe_from_fatal_corpse(struct obj *obj, int tests)
|
||||
staticfn boolean
|
||||
fatal_corpse_mistake(struct obj *obj, boolean remotely)
|
||||
{
|
||||
if (u_safe_from_fatal_corpse(obj, 0xF) || remotely)
|
||||
if (u_safe_from_fatal_corpse(obj, st_all) || remotely)
|
||||
return FALSE;
|
||||
|
||||
if (poly_when_stoned(gy.youmonst.data) && polymon(PM_STONE_GOLEM)) {
|
||||
|
||||
@@ -6189,7 +6189,7 @@ makewish(void)
|
||||
/* TODO? maybe generate a second event describing what was received since
|
||||
these just echo player's request rather than show actual result */
|
||||
|
||||
if (otmp->otyp == CORPSE && !u_safe_from_fatal_corpse(otmp, 0xF))
|
||||
if (otmp->otyp == CORPSE && !u_safe_from_fatal_corpse(otmp, st_all))
|
||||
otmp->wishedfor = 1;
|
||||
|
||||
const char *verb = ((Is_airlevel(&u.uz) || u.uinwater)
|
||||
|
||||
Reference in New Issue
Block a user