From: nethack.rankin Date: Sat, 24 Mar 2007 04:45:24 +0000 (+0000) Subject: polymorphed quest leader X-Git-Tag: MOVE2GIT~658 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=63b3e70ba721bffff4791d349e21d762e00c6e15;p=nethack polymorphed quest leader From the newsgroup: player chatted with leader and was ejected for not being high enough level, then when he came back later there was no leader to be found, but there was a polymorph trap on quest home level. This makes quest leaders and nemesis be aware of all trap types--rather than just having leaders be aware of magic portals--so they'll be able to avoid polymorph traps. It also makes chatting with a polymorphed leader work as long as the new form is able to speak (use same criteria as with poly'd shopkeepers: can't be in a form that's limited to animal sounds). --- diff --git a/doc/fixes34.4 b/doc/fixes34.4 index e9d76c0b4..768d55c8e 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -341,6 +341,7 @@ lit candle or potion of oil which burned out while equipped would leave stale weapon/alternate-weapon/quiver pointer that could cause panic or crash wielded/worn figurine which auto-transformed had same stale pointer bug format names of not yet id'd artifacts such that obj type shows for non-weapons +make quest leader be unlikely to be affected by polymorph traps Platform- and/or Interface-Specific Fixes diff --git a/src/makemon.c b/src/makemon.c index b3f1f6f2a..3cc915f44 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)makemon.c 3.5 2007/01/19 */ +/* SCCS Id: @(#)makemon.c 3.5 2007/03/23 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -964,8 +964,7 @@ register int mmflags; mtmp->m_id = context.ident++; if (!mtmp->m_id) mtmp->m_id = context.ident++; /* ident overflowed */ set_mon_data(mtmp, ptr, 0); - if (mtmp->data->msound == MS_LEADER && - quest_info(MS_LEADER) == mndx) + if (ptr->msound == MS_LEADER && quest_info(MS_LEADER) == mndx) quest_status.leader_m_id = mtmp->m_id; mtmp->mnum = mndx; @@ -978,8 +977,9 @@ register int mmflags; if (In_sokoban(&u.uz) && !mindless(ptr)) /* know about traps here */ mtmp->mtrapseen = (1L << (PIT - 1)) | (1L << (HOLE - 1)); - if (ptr->msound == MS_LEADER) /* leader knows about portal */ - mtmp->mtrapseen |= (1L << (MAGIC_PORTAL-1)); + /* quest leader and nemesis both know about all trap types */ + if (ptr->msound == MS_LEADER || ptr->msound == MS_NEMESIS) + mtmp->mtrapseen = ~0; place_monster(mtmp, x, y); mtmp->mcansee = mtmp->mcanmove = TRUE; diff --git a/src/sounds.c b/src/sounds.c index b0548ee8a..6dac8f1e2 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)sounds.c 3.5 2005/08/29 */ +/* SCCS Id: @(#)sounds.c 3.5 2007/03/23 */ /* Copyright (c) 1989 Janet Walz, Mike Threepoint */ /* NetHack may be freely redistributed. See license for details. */ @@ -467,21 +467,23 @@ STATIC_OVL int domonnoise(mtmp) register struct monst *mtmp; { + char verbuf[BUFSZ]; register const char *pline_msg = 0, /* Monnam(mtmp) will be prepended */ *verbl_msg = 0, /* verbalize() */ *verbl_msg_mcan = 0; /* verbalize() if cancelled */ struct permonst *ptr = mtmp->data; - char verbuf[BUFSZ]; + int msound = ptr->msound; /* presumably nearness and sleep checks have already been made */ if (Deaf) return(0); if (is_silent(ptr)) return(0); - /* 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,1)]; - } + /* leader might be poly'd; if he can still speak, give leader speach */ + if (mtmp->m_id == quest_status.leader_m_id && msound > MS_ANIMAL) + msound = MS_LEADER; + /* make sure its your role's quest quardian; adjust if not */ + else if (msound == MS_GUARDIAN && ptr != &mons[urole.guardnum]) + msound = mons[genus(monsndx(ptr), 1)].msound; /* be sure to do this before talking; the monster might teleport away, in * which case we want to check its pre-teleport position @@ -489,7 +491,7 @@ register struct monst *mtmp; if (!canspotmon(mtmp)) map_invisible(mtmp->mx, mtmp->my); - switch (ptr->msound) { + switch (msound) { case MS_ORACLE: return doconsult(mtmp); case MS_PRIEST: