]> granicus.if.org Git - nethack/commitdiff
fix #1727 - offering Rider corpses (trunk only)
authornethack.rankin <nethack.rankin>
Thu, 9 Oct 2008 23:55:43 +0000 (23:55 +0000)
committernethack.rankin <nethack.rankin>
Thu, 9 Oct 2008 23:55:43 +0000 (23:55 +0000)
     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.

include/extern.h
src/pickup.c
src/pray.c

index 96d78078aa461cb932dcad9bcdd4c85440560483..3123a000966b7407c668cff850c36ead55734b71 100644 (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 *));
index 4d6ff2faeb9dc9e9ca12a815cbc45108b72e39f7..5fa1a1044df6a7905c0c6a798c58cc649232394e 100644 (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;
index bfd0e3bf8793307e5bafebcb77d19959468c8bc6..034efbb4d48739c1c0240796bb13fb7e5ec862c3 100644 (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)) {