From b4c2f74c223b823e8b31ded9298f80f9156b3463 Mon Sep 17 00:00:00 2001 From: "nethack.allison" Date: Sat, 25 Oct 2003 22:20:24 +0000 Subject: [PATCH] class differentiation bit (trunk only) Healers pick up on the fact that a wand of undead turning revived a creature. --- include/extern.h | 1 + src/mkobj.c | 24 ++++++++++++++++++++++++ src/zap.c | 21 ++++++++++++++++++++- 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/include/extern.h b/include/extern.h index eb492c320..64cbb2803 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1057,6 +1057,7 @@ E int FDECL(weight, (struct obj *)); 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)); diff --git a/src/mkobj.c b/src/mkobj.c index 73f5a8397..cb5102b6a 100644 --- a/src/mkobj.c +++ b/src/mkobj.c @@ -926,6 +926,30 @@ boolean init; 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. diff --git a/src/zap.c b/src/zap.c index 0a3bd88e5..a7760496a 100644 --- a/src/zap.c +++ b/src/zap.c @@ -1559,8 +1559,27 @@ struct obj *obj, *otmp; 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: -- 2.40.0