Merge branch 'NetHack-3.6'

This commit is contained in:
nhmall
2019-06-10 08:05:46 -04:00
6 changed files with 90 additions and 66 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 muse.c $NHDT-Date: 1547025167 2019/01/09 09:12:47 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.92 $ */
/* NetHack 3.6 muse.c $NHDT-Date: 1560161807 2019/06/10 10:16:47 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.96 $ */
/* Copyright (C) 1990 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */
@@ -16,7 +16,8 @@
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(mzapwand, (struct monst *, struct obj *, BOOLEAN_P));
STATIC_DCL void FDECL(mplayhorn, (struct monst *, struct obj *, BOOLEAN_P));
STATIC_DCL void FDECL(mreadmsg, (struct monst *, struct obj *));
STATIC_DCL void FDECL(mquaffmsg, (struct monst *, struct obj *));
STATIC_DCL boolean FDECL(m_use_healing, (struct monst *));
@@ -124,7 +125,7 @@ struct obj *obj;
pline("%s zaps %s, which suddenly explodes!", Monnam(mon),
an(xname(obj)));
} else {
/* same near/far threshold as mzapmsg() */
/* same near/far threshold as mzapwand() */
int range = couldsee(mon->mx, mon->my) /* 9 or 5 */
? (BOLT_LIM + 1) : (BOLT_LIM - 3);
@@ -144,8 +145,10 @@ struct obj *obj;
return 0;
}
/* when a monster zaps a wand give a message, deduct a charge, and if it
isn't directly seen, remove hero's memory of the number of charges */
STATIC_OVL void
mzapmsg(mtmp, otmp, self)
mzapwand(mtmp, otmp, self)
struct monst *mtmp;
struct obj *otmp;
boolean self;
@@ -156,6 +159,7 @@ boolean self;
You_hear("a %s zap.", (distu(mtmp->mx, mtmp->my) <= range * range)
? "nearby" : "distant");
otmp->known = 0;
} else if (self) {
pline("%s zaps %sself with %s!", Monnam(mtmp), mhim(mtmp),
doname(otmp));
@@ -163,6 +167,33 @@ boolean self;
pline("%s zaps %s!", Monnam(mtmp), an(xname(otmp)));
stop_occupation();
}
otmp->spe -= 1;
}
/* similar to mzapwand() but for magical horns (only instrument mons play) */
STATIC_OVL void
mplayhorn(mtmp, otmp, self)
struct monst *mtmp;
struct obj *otmp;
boolean self;
{
if (!canseemon(mtmp)) {
int range = couldsee(mtmp->mx, mtmp->my) /* 9 or 5 */
? (BOLT_LIM + 1) : (BOLT_LIM - 3);
You_hear("a horn being played %s.",
(distu(mtmp->mx, mtmp->my) <= range * range)
? "nearby" : "in the distance");
otmp->known = 0; /* hero doesn't know how many charges are left */
} else {
otmp->dknown = 1;
pline("%s plays a %s directed at %s!", Monnam(mtmp), xname(otmp),
self ? mon_nam_too(mtmp, mtmp) : (char *) "you");
makeknown(otmp->otyp); /* (wands handle this slightly differently) */
if (!self)
stop_occupation();
}
otmp->spe -= 1; /* use a charge */
}
STATIC_OVL void
@@ -626,8 +657,7 @@ struct monst *mtmp;
if ((mtmp->isshk && inhishop(mtmp)) || mtmp->isgd || mtmp->ispriest)
return 2;
m_flee(mtmp);
mzapmsg(mtmp, otmp, TRUE);
otmp->spe--;
mzapwand(mtmp, otmp, TRUE);
how = WAN_TELEPORTATION;
mon_tele:
if (tele_restrict(mtmp)) { /* mysterious force... */
@@ -649,8 +679,7 @@ struct monst *mtmp;
return 2;
case MUSE_WAN_TELEPORTATION:
g.zap_oseen = oseen;
mzapmsg(mtmp, otmp, FALSE);
otmp->spe--;
mzapwand(mtmp, otmp, FALSE);
g.m_using = TRUE;
mbhit(mtmp, rn1(8, 6), mbhitm, bhito, otmp);
/* monster learns that teleportation isn't useful here */
@@ -696,8 +725,7 @@ struct monst *mtmp;
struct trap *ttmp;
m_flee(mtmp);
mzapmsg(mtmp, otmp, FALSE);
otmp->spe--;
mzapwand(mtmp, otmp, FALSE);
if (oseen)
makeknown(WAN_DIGGING);
if (IS_FURNITURE(levl[mtmp->mx][mtmp->my].typ)
@@ -742,8 +770,7 @@ struct monst *mtmp;
if (!enexto(&cc, mtmp->mx, mtmp->my, pm))
return 0;
mzapmsg(mtmp, otmp, FALSE);
otmp->spe--;
mzapwand(mtmp, otmp, FALSE);
mon = makemon((struct permonst *) 0, cc.x, cc.y, NO_MM_FLAGS);
if (mon && canspotmon(mon) && oseen)
makeknown(WAN_CREATE_MONSTER);
@@ -1376,8 +1403,7 @@ struct monst *mtmp;
case MUSE_WAN_COLD:
case MUSE_WAN_LIGHTNING:
case MUSE_WAN_MAGIC_MISSILE:
mzapmsg(mtmp, otmp, FALSE);
otmp->spe--;
mzapwand(mtmp, otmp, FALSE);
if (oseen)
makeknown(otmp->otyp);
g.m_using = TRUE;
@@ -1388,12 +1414,7 @@ struct monst *mtmp;
return (DEADMONSTER(mtmp)) ? 1 : 2;
case MUSE_FIRE_HORN:
case MUSE_FROST_HORN:
if (oseen) {
makeknown(otmp->otyp);
pline("%s plays a %s!", Monnam(mtmp), xname(otmp));
} else
You_hear("a horn being played.");
otmp->spe--;
mplayhorn(mtmp, otmp, FALSE);
g.m_using = TRUE;
buzz(-30 - ((otmp->otyp == FROST_HORN) ? AD_COLD - 1 : AD_FIRE - 1),
rn1(6, 6), mtmp->mx, mtmp->my, sgn(mtmp->mux - mtmp->mx),
@@ -1403,8 +1424,7 @@ struct monst *mtmp;
case MUSE_WAN_TELEPORTATION:
case MUSE_WAN_STRIKING:
g.zap_oseen = oseen;
mzapmsg(mtmp, otmp, FALSE);
otmp->spe--;
mzapwand(mtmp, otmp, FALSE);
g.m_using = TRUE;
mbhit(mtmp, rn1(8, 6), mbhitm, bhito, otmp);
g.m_using = FALSE;
@@ -1795,8 +1815,7 @@ struct monst *mtmp;
case MUSE_WAN_MAKE_INVISIBLE:
case MUSE_POT_INVISIBILITY:
if (otmp->otyp == WAN_MAKE_INVISIBLE) {
mzapmsg(mtmp, otmp, TRUE);
otmp->spe--;
mzapwand(mtmp, otmp, TRUE);
} else
mquaffmsg(mtmp, otmp);
/* format monster's name before altering its visibility */
@@ -1822,8 +1841,7 @@ struct monst *mtmp;
}
return 2;
case MUSE_WAN_SPEED_MONSTER:
mzapmsg(mtmp, otmp, TRUE);
otmp->spe--;
mzapwand(mtmp, otmp, TRUE);
mon_adjust_speed(mtmp, 1, otmp);
return 2;
case MUSE_POT_SPEED:
@@ -1836,8 +1854,7 @@ struct monst *mtmp;
m_useup(mtmp, otmp);
return 2;
case MUSE_WAN_POLYMORPH:
mzapmsg(mtmp, otmp, TRUE);
otmp->spe--;
mzapwand(mtmp, otmp, TRUE);
(void) newcham(mtmp, muse_newcham_mon(mtmp), TRUE, FALSE);
if (oseen)
makeknown(WAN_POLYMORPH);
@@ -2470,8 +2487,7 @@ boolean by_you; /* true: if mon kills itself, hero gets credit/blame */
dmg = 0; /* damage has been applied by explode() */
}
} else { /* wand/horn of fire w/ positive charge count */
mzapmsg(mon, obj, TRUE);
obj->spe--;
mplayhorn(mon, obj, TRUE);
/* -1 => monster's wand of fire; 2 => # of damage dice */
dmg = zhitm(mon, by_you ? 1 : -1, 2, &odummyp);
}