E struct obj *FDECL(mkgold, (long,int,int));
E struct obj *FDECL(mkcorpstat,
(int,struct monst *,struct permonst *,int,int,BOOLEAN_P));
+E int FDECL(corpse_revive_type, (struct obj *));
E struct obj *FDECL(obj_attach_mid, (struct obj *, unsigned));
E struct monst *FDECL(get_mtraits, (struct obj *, BOOLEAN_P));
E struct obj *FDECL(mk_tt_object, (int,int,int));
return(otmp);
}
+/*
+ * Return the type of monster that this corpse will
+ * revive as, even if it has a monster structure
+ * attached to it. In that case, you can't just
+ * use obj->corpsenm, because the stored monster
+ * type can, and often is, different.
+ * The return value is an index into mons[].
+ */
+int
+corpse_revive_type(obj)
+struct obj *obj;
+{
+ int revivetype;
+ struct monst *mtmp;
+ if (obj->oxlth && obj->oattached == OATTACHED_MONST &&
+ ((mtmp = get_mtraits(obj, FALSE)) != (struct monst *)0)) {
+ /* mtmp is a temporary pointer to a monster's stored
+ attributes, not a real monster */
+ revivetype = mtmp->mnum;
+ } else
+ revivetype = obj->corpsenm;
+ return revivetype;
+}
+
/*
* Attach a monster id to an object, to provide
* a lasting association between the two.
case SPE_TURN_UNDEAD:
if (obj->otyp == EGG)
revive_egg(obj);
- else
+ else {
+ int corpsenm = (obj->otyp == CORPSE) ?
+ corpse_revive_type(obj) : 0;
res = !!revive(obj);
+ if (res && corpsenm && Role_if(PM_HEALER)) {
+ boolean u_noticed = FALSE;
+ if (Hallucination) {
+ You_hear("the sound of a defibrillator.");
+ u_noticed = TRUE;
+ } else if (!Blind) {
+ You("observe %s %s change dramatically.",
+ s_suffix(an(mons[corpsenm].mname)),
+ nonliving(&mons[corpsenm]) ?
+ "motility" : "health");
+ }
+ if (u_noticed) {
+ makeknown(otmp->otyp);
+ exercise(A_WIS, TRUE);
+ }
+ }
+ }
break;
case WAN_OPENING:
case SPE_KNOCK: