guardian corpse, statue animation follow-up

- fix ring of protection from shape changers causing
  real monster to be created.
- add ability to get the character class monster from
  genus() or the species.
- use the character class monster when animating
  guardian corpses.
This commit is contained in:
nethack.allison
2003-08-19 14:41:54 +00:00
parent 61c3188405
commit 48ab2a434c
5 changed files with 31 additions and 21 deletions

View File

@@ -1098,7 +1098,7 @@ E struct mkroom *FDECL(search_special, (SCHAR_P));
/* ### mon.c ### */
E int FDECL(undead_to_corpse, (int));
E int FDECL(genus, (int));
E int FDECL(genus, (int,int));
E int FDECL(pm_to_cham, (int));
E int FDECL(minliquid, (struct monst *));
E int NDECL(movemon);

View File

@@ -86,30 +86,31 @@ int mndx;
/* Convert the monster index of some monsters (such as quest guardians)
* to their generic species type.
*
* Return associated character class monster, rather than species
* if mode is 1.
*/
int
genus(mndx)
int mndx;
genus(mndx, mode)
int mndx, mode;
{
switch (mndx) {
/* Quest guardians */
case PM_STUDENT:
case PM_CHIEFTAIN:
case PM_NEANDERTHAL:
case PM_ATTENDANT:
case PM_PAGE:
case PM_ABBOT:
case PM_ACOLYTE:
case PM_HUNTER:
case PM_THUG:
case PM_ROSHI:
case PM_STUDENT: mndx = mode ? PM_VALKYRIE : PM_HUMAN; break;
case PM_CHIEFTAIN: mndx = mode ? PM_BARBARIAN : PM_HUMAN; break;
case PM_NEANDERTHAL: mndx = mode ? PM_CAVEMAN : PM_HUMAN; break;
case PM_ATTENDANT: mndx = mode ? PM_HEALER : PM_HUMAN; break;
case PM_PAGE: mndx = mode ? PM_KNIGHT : PM_HUMAN; break;
case PM_ABBOT: mndx = mode ? PM_MONK : PM_HUMAN; break;
case PM_ACOLYTE: mndx = mode ? PM_PRIEST : PM_HUMAN; break;
case PM_HUNTER: mndx = mode ? PM_RANGER : PM_HUMAN; break;
case PM_THUG: mndx = mode ? PM_ROGUE : PM_HUMAN; break;
case PM_ROSHI: mndx = mode ? PM_SAMURAI : PM_HUMAN; break;
#ifdef TOURIST
case PM_GUIDE:
case PM_GUIDE: mndx = mode ? PM_TOURIST : PM_HUMAN; break;
#endif
case PM_WARRIOR:
case PM_APPRENTICE:
mndx = PM_HUMAN;
break;
case PM_APPRENTICE: mndx = mode ? PM_WIZARD : PM_HUMAN; break;
case PM_WARRIOR: mndx = mode ? PM_VALKYRIE : PM_HUMAN; break;
default:
if (mndx >= LOW_PM && mndx < NUMMONS) {
struct permonst *ptr = &mons[mndx];

View File

@@ -2560,7 +2560,7 @@ typfnd:
or of ordinary one being forced to such */
if (otmp->timed) obj_stop_timers(otmp);
if (mons[mntmp].msound == MS_GUARDIAN)
otmp->corpsenm = genus(mntmp);
otmp->corpsenm = genus(mntmp,1);
else
otmp->corpsenm = mntmp;
start_corpse_timeout(otmp);

View File

@@ -438,7 +438,7 @@ register struct monst *mtmp;
/* Make sure its your role's quest quardian; adjust if not */
if (ptr->msound == MS_GUARDIAN && ptr != &mons[urole.guardnum]) {
int mndx = monsndx(ptr);
ptr = &mons[genus(mndx)];
ptr = &mons[genus(mndx,1)];
}
/* be sure to do this before talking; the monster might teleport away, in

View File

@@ -444,7 +444,16 @@ int *fail_reason;
*/
mon = makemon(&mons[PM_DOPPELGANGER], x, y,
NO_MINVENT|MM_NOCOUNTBIRTH|MM_ADJACENTOK);
if (mon) (void) newcham(mon, mptr, FALSE, FALSE);
if (mon) {
/* makemon() will set mon->cham to
* CHAM_ORDINARY if hero is wearing
* ring of protection from shape changers
* when makemon() is called, so we have to
* check the field before calling newcham().
*/
if (mon->cham == CHAM_DOPPELGANGER)
(void) newcham(mon, mptr, FALSE, FALSE);
}
} else
mon = makemon(mptr, x, y, (cause == ANIMATE_SPELL) ?
(NO_MINVENT | MM_ADJACENTOK) : NO_MINVENT);