fix #1727 - offering Rider corpses (trunk only)

The report that killing a Rider on an altar allowed you to sacrifice
its corpse was a wizard mode-only phenomenon in 3.4.3 (because you needed
to use an altar at some location other than the Astral Plane, hence also
needed to use ^G to get the Rider there), so not really a bug.  But a
post-3.4.3 change has made it possible to offer corpses from the floor on
the astral level, unintentionally making it possible to sacrifice Rider
corpses.  This makdes #offer check specifically for them and trigger their
revival if the attempt is made, same as done by pickup.
This commit is contained in:
nethack.rankin
2008-10-09 23:55:43 +00:00
parent 426894d813
commit 6202d5971e
3 changed files with 22 additions and 10 deletions

View File

@@ -1683,6 +1683,7 @@ E int FDECL(collect_obj_classes,
E int FDECL(collect_obj_classes,
(char *,struct obj *,BOOLEAN_P,BOOLEAN_P,boolean FDECL((*),(OBJ_P)), int *));
#endif
E boolean FDECL(rider_corpse_revival, (struct obj *,BOOLEAN_P));
E void FDECL(add_valid_menu_class, (int));
E boolean FDECL(allow_all, (struct obj *));
E boolean FDECL(allow_category, (struct obj *));

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)pickup.c 3.5 2008/03/19 */
/* SCCS Id: @(#)pickup.c 3.5 2008/10/09 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -289,6 +289,22 @@ boolean remotely;
return TRUE;
}
/* attempting to manipulate a Rider's corpse triggers its revival */
boolean
rider_corpse_revival(obj, remotely)
struct obj *obj;
boolean remotely;
{
if (!obj || obj->otyp != CORPSE || !is_rider(&mons[obj->corpsenm]))
return FALSE;
pline("At your %s, the corpse suddenly moves...",
remotely ? "attempted acquisition" : "touch");
(void)revive_corpse(obj);
exercise(A_WIS, FALSE);
return TRUE;
}
/* look at the objects at our location, unless there are too many of them */
STATIC_OVL void
check_here(picked_some)
@@ -1353,15 +1369,9 @@ boolean telekinesis; /* not picking it up directly by hand */
return 1;
#endif
} else if (obj->otyp == CORPSE) {
if (fatal_corpse_mistake(obj, telekinesis)) {
if (fatal_corpse_mistake(obj, telekinesis) ||
rider_corpse_revival(obj, telekinesis))
return -1;
} else if (is_rider(&mons[obj->corpsenm])) {
pline("At your %s, the corpse suddenly moves...",
telekinesis ? "attempted acquisition" : "touch");
(void) revive_corpse(obj);
exercise(A_WIS, FALSE);
return -1;
}
} else if (obj->otyp == SCR_SCARE_MONSTER) {
if (obj->blessed) obj->blessed = 0;
else if (!obj->spe && !obj->cursed) obj->spe = 1;

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)pray.c 3.5 2008/01/21 */
/* SCCS Id: @(#)pray.c 3.5 2008/10/09 */
/* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1206,6 +1206,7 @@ dosacrifice()
/* you're handling this corpse, even if it was killed upon the altar */
feel_cockatrice(otmp, TRUE);
if (rider_corpse_revival(otmp, FALSE)) return 1;
if (otmp->corpsenm == PM_ACID_BLOB
|| (monstermoves <= peek_at_iced_corpse_age(otmp) + 50)) {