adjust wish for cockatrice corpse

Wishing is powerful, so if you cannot safely handle a cockatrice
corpse, then have a wish for one result in the corpse materializing
on the floor rather than in your inventory.

Resolves #1320
This commit is contained in:
nhmall
2024-11-09 14:06:43 -05:00
parent 36d8998edb
commit 9c554895b1
5 changed files with 28 additions and 4 deletions

View File

@@ -261,12 +261,20 @@ query_classes(
return TRUE;
}
boolean
u_safe_from_fatal_corpse(struct obj *obj)
{
if (uarmg || obj->otyp != CORPSE
|| !touch_petrifies(&mons[obj->corpsenm]) || Stone_resistance)
return TRUE;
return FALSE;
}
/* check whether hero is bare-handedly touching a cockatrice corpse */
staticfn boolean
fatal_corpse_mistake(struct obj *obj, boolean remotely)
{
if (uarmg || remotely || obj->otyp != CORPSE
|| !touch_petrifies(&mons[obj->corpsenm]) || Stone_resistance)
if (u_safe_from_fatal_corpse(obj) || remotely)
return FALSE;
if (poly_when_stoned(gy.youmonst.data) && polymon(PM_STONE_GOLEM)) {