]> granicus.if.org Git - nethack/commitdiff
From a bug report: monsters hit by polymorph
authornethack.allison <nethack.allison>
Wed, 9 Jan 2002 13:10:13 +0000 (13:10 +0000)
committernethack.allison <nethack.allison>
Wed, 9 Jan 2002 13:10:13 +0000 (13:10 +0000)
magic while wearing dragon scales/scale mail were being turned
into random monsters instead of into dragons.

Also

Two items from <Someone>'s list.

Files patched:
  include/obj.h
  src/mon.c, muse.c, worn.c, zap.c

doc/fixes33.2
include/obj.h
src/mon.c
src/muse.c
src/worn.c
src/zap.c

index e17b0abe1f6512381b87cdd6623b0334fd9c4ac1..52a1a1643b988ba3aebde4baeaaee23ec09b22e8 100644 (file)
@@ -369,6 +369,10 @@ rocks/gems shouldn't be hard to throw by hand because they are ammo
 avoid all cases where splitting an object would result in two objects being
        quivered, wielded or otherwise having its owornflag set
 allow 'a' prompt when dropping many objects in shop for credit (Wingnut)
+monsters who get polymorphed while wearing dragon armor turn into dragons
+shape changers can't be killed by system shock when hit by polymorph
+Chromatic Dragon has silver scales too (she reflects)
+being killed when wishing for an artifact should retain that item in bones data
 
 
 Platform- and/or Interface-Specific Fixes
index a0868be6c4ecbb28c6cd3a2c2b376cd9eb1557a3..fce90350f966f4c0ce89923c7abaa49cb099817c 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)obj.h      3.3     1999/12/13      */
+/*     SCCS Id: @(#)obj.h      3.3     2002/01/07      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -199,6 +199,18 @@ struct obj {
 #define Is_mbag(otmp)  (otmp->otyp == BAG_OF_HOLDING || \
                         otmp->otyp == BAG_OF_TRICKS)
 
+/* dragon gear */
+#define Is_dragon_scales(obj)  ((obj)->otyp >= GRAY_DRAGON_SCALES && \
+                                (obj)->otyp <= YELLOW_DRAGON_SCALES)
+#define Is_dragon_mail(obj)    ((obj)->otyp >= GRAY_DRAGON_SCALE_MAIL && \
+                                (obj)->otyp <= YELLOW_DRAGON_SCALE_MAIL)
+#define Is_dragon_armor(obj)   (Is_dragon_scales(obj) || Is_dragon_mail(obj))
+#define Dragon_scales_to_pm(obj) &mons[PM_GRAY_DRAGON + (obj)->otyp \
+                                      - GRAY_DRAGON_SCALES]
+#define Dragon_mail_to_pm(obj) &mons[PM_GRAY_DRAGON + (obj)->otyp \
+                                     - GRAY_DRAGON_SCALE_MAIL]
+#define Dragon_to_scales(pm)   (GRAY_DRAGON_SCALES + (pm - mons))
+
 /* Light sources */
 #define Is_candle(otmp) (otmp->otyp == TALLOW_CANDLE || \
                         otmp->otyp == WAX_CANDLE)
index 44bc14d2482343ba5bf583ef10fbeb5e727a5093..3074a9c3228f2220afd754def23d3dfb7fe857d4 100644 (file)
--- a/src/mon.c
+++ b/src/mon.c
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)mon.c      3.3     2001/09/06      */
+/*     SCCS Id: @(#)mon.c      3.3     2002/01/07      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -2153,6 +2153,14 @@ struct monst *mon;
                if (!rn2(3)) mndx = pick_animal();
                break;
            case CHAM_ORDINARY:
+             {
+               struct obj *m_armr = which_armor(mon, W_ARM);
+
+               if (m_armr && Is_dragon_scales(m_armr))
+                   mndx = Dragon_scales_to_pm(m_armr) - mons;
+               else if (m_armr && Is_dragon_mail(m_armr))
+                   mndx = Dragon_mail_to_pm(m_armr) - mons;
+             }
                break;
        }
 #ifdef WIZARD
index a600cb1e335c5432377a6e5c80fb137afdf0423c..bdf3acb825ea81f830f649600a55777b782aaa57 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)muse.c     3.3     2001/11/19      */
+/*     SCCS Id: @(#)muse.c     3.3     2002/01/07      */
 /*     Copyright (C) 1990 by Ken Arromdee                         */
 /* NetHack may be freely redistributed.  See license for details.  */
 
@@ -19,6 +19,7 @@ boolean m_using = FALSE;
  * don't know not to read scrolls, etc....
  */
 
+STATIC_DCL struct permonst *FDECL(muse_newcham_mon, (struct monst *));
 STATIC_DCL int FDECL(precheck, (struct monst *,struct obj *));
 STATIC_DCL void FDECL(mzapmsg, (struct monst *,struct obj *,BOOLEAN_P));
 STATIC_DCL void FDECL(mreadmsg, (struct monst *,struct obj *));
@@ -1637,6 +1638,23 @@ struct monst *mtmp;
 #undef nomore
 }
 
+/* type of monster to polymorph into; defaults to one suitable for the
+   current level rather than the totally arbitrary choice of newcham() */
+static struct permonst *
+muse_newcham_mon(mon)
+struct monst *mon;
+{
+       struct obj *m_armr;
+
+       if ((m_armr = which_armor(mon, W_ARM)) != 0) {
+           if (Is_dragon_scales(m_armr))
+               return Dragon_scales_to_pm(m_armr);
+           else if (Is_dragon_mail(m_armr))
+               return Dragon_mail_to_pm(m_armr);
+       }
+       return rndmonst();
+}
+
 int
 use_misc(mtmp)
 struct monst *mtmp;
@@ -1735,13 +1753,13 @@ skipmsg:
        case MUSE_WAN_POLYMORPH:
                mzapmsg(mtmp, otmp, TRUE);
                otmp->spe--;
-               (void) newcham(mtmp, rndmonst(), TRUE);
+               (void) newcham(mtmp, muse_newcham_mon(mtmp), TRUE);
                if (oseen) makeknown(WAN_POLYMORPH);
                return 2;
        case MUSE_POT_POLYMORPH:
                mquaffmsg(mtmp, otmp);
                if (vismon) pline("%s suddenly mutates!", Monnam(mtmp));
-               (void) newcham(mtmp, rndmonst(), FALSE);
+               (void) newcham(mtmp, muse_newcham_mon(mtmp), FALSE);
                if (oseen) makeknown(POT_POLYMORPH);
                m_useup(mtmp, otmp);
                return 2;
@@ -1999,7 +2017,8 @@ const char *str;
            if (str)
                pline(str, s_suffix(mon_nam(mon)), "armor");
            return TRUE;
-       } else if (mon->data == &mons[PM_SILVER_DRAGON]) {
+       } else if (mon->data == &mons[PM_SILVER_DRAGON] ||
+               mon->data == &mons[PM_CHROMATIC_DRAGON]) {
            /* Silver dragons only reflect when mature; babies do not */
            if (str)
                pline(str, s_suffix(mon_nam(mon)), "scales");
index 8c1aa14fe7b0dbcc60f3ef1a9f33d1a247dd686a..ead443e629cd094a752bef6a03371d4ee3490ce5 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)worn.c     3.3     2001/09/05      */
+/*     SCCS Id: @(#)worn.c     3.3     2002/01/07      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -530,7 +530,13 @@ boolean polyspot;
 
        if (breakarm(mdat)) {
            if ((otmp = which_armor(mon, W_ARM)) != 0) {
-               if (vis)
+               if ((Is_dragon_scales(otmp) &&
+                       mdat == Dragon_scales_to_pm(otmp)) ||
+                   (Is_dragon_mail(otmp) && mdat == Dragon_mail_to_pm(otmp)))
+                   ;   /* no message here;
+                          "the dragon merges with his scaly armor" is odd
+                          and the monster's previous form is already gone */
+               else if (vis)
                    pline("%s breaks out of %s armor!", Monnam(mon), ppronoun);
                else
                    You_hear("a cracking sound.");
index 8c44d94f41ad011431f8d9bdab9b29543fc71063..36c2c8f54aafb94442ee2575c78b8d30e37bfc62 100644 (file)
--- a/src/zap.c
+++ b/src/zap.c
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)zap.c      3.3     2001/12/29      */
+/*     SCCS Id: @(#)zap.c      3.3     2002/01/07      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -178,7 +178,10 @@ struct obj *otmp;
                       it guard against involuntary polymorph attacks too... */
                    shieldeff(mtmp->mx, mtmp->my);
                } else if (!resist(mtmp, otmp->oclass, 0, NOTELL)) {
-                   if (!rn2(25)) {
+                   /* natural shapechangers aren't affected by system shock
+                      (unless protection from shapechangers is interfering
+                      with their metabolism...) */
+                   if (mtmp->cham == CHAM_ORDINARY && !rn2(25)) {
                        if (canseemon(mtmp)) {
                            pline("%s shudders!", Monnam(mtmp));
                            makeknown(otyp);
@@ -4029,9 +4032,14 @@ retry:
        u.uconduct.wishes++;
 
        if (otmp != &zeroobj) {
-           if(otmp->oartifact && !touch_artifact(otmp,&youmonst))
-               dropy(otmp);
-           else
+           /* in case touching this object turns out to be fatal */
+           place_object(otmp, u.ux, u.uy);
+
+           if (otmp->oartifact && !touch_artifact(otmp,&youmonst)) {
+               obj_extract_self(otmp); /* remove it from the floor */
+               dropy(otmp);            /* now put it back again :-) */
+           } else {
+               obj_extract_self(otmp);
                /* The(aobjnam()) is safe since otmp is unidentified -dlc */
                (void) hold_another_object(otmp, u.uswallow ?
                                       "Oops!  %s out of your reach!" :
@@ -4042,6 +4050,7 @@ retry:
                                             Is_airlevel(&u.uz) || u.uinwater ?
                                                   "slip" : "drop")),
                                       (const char *)0);
+           }
            u.ublesscnt += rn1(100,50);  /* the gods take notice */
        }
 }