-/* NetHack 3.6 mhitm.c $NHDT-Date: 1555720096 2019/04/20 00:28:16 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.113 $ */
+/* NetHack 3.6 mhitm.c $NHDT-Date: 1560161806 2019/06/10 10:16:46 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.116 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
static const char brief_feeling[] =
"have a %s feeling for a moment, then it passes.";
-STATIC_DCL char *FDECL(mon_nam_too, (char *, struct monst *, struct monst *));
STATIC_DCL int FDECL(hitmm, (struct monst *, struct monst *,
struct attack *));
STATIC_DCL int FDECL(gazemm, (struct monst *, struct monst *,
*/
static int dieroll;
-/* returns mon_nam(mon) relative to other_mon; normal name unless they're
- the same, in which case the reference is to {him|her|it} self */
-STATIC_OVL char *
-mon_nam_too(outbuf, mon, other_mon)
-char *outbuf;
-struct monst *mon, *other_mon;
-{
- if (mon != other_mon)
- Strcpy(outbuf, mon_nam(mon));
- else
- switch (pronoun_gender(mon, FALSE)) {
- case 0:
- Strcpy(outbuf, "himself");
- break;
- case 1:
- Strcpy(outbuf, "herself");
- break;
- default:
- Strcpy(outbuf, "itself");
- break;
- }
- return outbuf;
-}
-
STATIC_OVL void
noises(magr, mattk)
register struct monst *magr;
struct attack *mattk;
{
const char *fmt;
- char buf[BUFSZ], mdef_name[BUFSZ];
+ char buf[BUFSZ];
if (vis) {
if (!canspotmon(magr))
? "%s pretends to be friendly to"
: "%s misses";
Sprintf(buf, fmt, Monnam(magr));
- pline("%s %s.", buf, mon_nam_too(mdef_name, mdef, magr));
+ pline("%s %s.", buf, mon_nam_too(mdef, magr));
} else
noises(magr, mattk);
}
{
if (vis) {
int compat;
- char buf[BUFSZ], mdef_name[BUFSZ];
+ char buf[BUFSZ];
if (!canspotmon(magr))
map_invisible(magr->mx, magr->my);
default:
Sprintf(buf, "%s hits", magr_name);
}
- pline("%s %s.", buf, mon_nam_too(mdef_name, mdef, magr));
+ pline("%s %s.", buf, mon_nam_too(mdef, magr));
}
} else
noises(magr, mattk);
-/* 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. */
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 *));
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);
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;
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));
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
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... */
return 2;
case MUSE_WAN_TELEPORTATION:
zap_oseen = oseen;
- mzapmsg(mtmp, otmp, FALSE);
- otmp->spe--;
+ mzapwand(mtmp, otmp, FALSE);
m_using = TRUE;
mbhit(mtmp, rn1(8, 6), mbhitm, bhito, otmp);
/* monster learns that teleportation isn't useful here */
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)
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);
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);
m_using = TRUE;
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);
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),
case MUSE_WAN_TELEPORTATION:
case MUSE_WAN_STRIKING:
zap_oseen = oseen;
- mzapmsg(mtmp, otmp, FALSE);
- otmp->spe--;
+ mzapwand(mtmp, otmp, FALSE);
m_using = TRUE;
mbhit(mtmp, rn1(8, 6), mbhitm, bhito, otmp);
m_using = FALSE;
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 */
}
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:
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);
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);
}