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