let monsters use wand of undead turning

when hero is wielding a cockatrice corpse.  Wands of undead turning
aren't generated as starting equipment but they will now be picked
up if come across while the hero is carrying any corpse, and used
in preference to any other item when carried and non-empty and hero
is wielding a petrifier's corpse.
This commit is contained in:
PatR
2020-04-10 18:39:46 -07:00
parent 05028b4c3e
commit dc6b2f5de1
4 changed files with 99 additions and 31 deletions

View File

@@ -989,6 +989,19 @@ struct monst *mon;
return res;
}
void
unturn_you()
{
(void) unturn_dead(&g.youmonst); /* hit carried corpses and eggs */
if (is_undead(g.youmonst.data)) {
You_feel("frightened and %sstunned.", Stunned ? "even more " : "");
make_stunned((HStun & TIMEOUT) + (long) rnd(30), FALSE);
} else {
You("shudder in dread.");
}
}
/* cancel obj, possibly carried by you or a monster */
void
cancel_item(obj)
@@ -1998,6 +2011,7 @@ struct obj *obj, *otmp;
} else if (obj->otyp == CORPSE) {
struct monst *mtmp;
xchar ox, oy;
boolean by_u = !g.context.mon_moving;
int corpsenm = corpse_revive_type(obj);
char *corpsname = cxname_singular(obj);
@@ -2013,7 +2027,7 @@ struct obj *obj, *otmp;
if (canspotmon(mtmp)) {
pline("%s is resurrected!",
upstart(noname_monnam(mtmp, ARTICLE_THE)));
learn_it = TRUE;
learn_it = by_u ? TRUE : g.zap_oseen;
} else {
/* saw corpse but don't see monster: maybe
mtmp is invisible, or has been placed at
@@ -2032,7 +2046,7 @@ struct obj *obj, *otmp;
You_hear("%s reviving.", corpsname);
else
You_hear("a defibrillator.");
learn_it = TRUE;
learn_it = by_u ? TRUE : g.zap_oseen;
}
if (canspotmon(mtmp))
/* didn't see corpse but do see monster: it
@@ -2479,13 +2493,7 @@ boolean ordinary;
case WAN_UNDEAD_TURNING:
case SPE_TURN_UNDEAD:
learn_it = TRUE;
(void) unturn_dead(&g.youmonst);
if (is_undead(g.youmonst.data)) {
You_feel("frightened and %sstunned.",
Stunned ? "even more " : "");
make_stunned((HStun & TIMEOUT) + (long) rnd(30), FALSE);
} else
You("shudder in dread.");
unturn_you();
break;
case SPE_HEALING:
case SPE_EXTRA_HEALING: