From a bug report: monsters hit by polymorph

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
This commit is contained in:
nethack.allison
2002-01-09 13:10:13 +00:00
parent ef26fdaeb4
commit 9b7d9f29b5
6 changed files with 71 additions and 13 deletions

View 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

View 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)

View File

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

View 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");

View 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.");

View File

@@ -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 */
}
}