class differentiation bit (trunk only)

Healers pick up on the fact that a wand of undead turning
revived a creature.
This commit is contained in:
nethack.allison
2003-10-25 22:20:24 +00:00
parent cd7e1163e1
commit b4c2f74c22
3 changed files with 45 additions and 1 deletions

View File

@@ -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));

View File

@@ -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.

View File

@@ -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: