-/* 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: 1561053256 2019/06/20 17:54:16 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.97 $ */
/* 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 *));
an(xname(obj)));
#endif
} 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;
(distu(mtmp->mx, mtmp->my) <= range * range)
? "\8bß" : "\89\93");
#endif
+ otmp->known = 0;
} else if (self) {
#if 0 /*JP:T*/
pline("%s zaps %sself with %s!", Monnam(mtmp), mhim(mtmp),
pline("%s\82Í%s\82ð\82Ó\82è\82©\82´\82µ\82½\81I", 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);
+
+#if 0 /*JP:T*/
+ You_hear("a horn being played %s.",
+ (distu(mtmp->mx, mtmp->my) <= range * range)
+ ? "nearby" : "in the distance");
+#else
+ You_hear("%s\82\82Å\83z\83\8b\83\93\82Ì\89¹\82ð\95·\82¢\82½\81D",
+ (distu(mtmp->mx, mtmp->my) <= range * range)
+ ? "\8bß" : "\89\93");
+#endif
+ otmp->known = 0; /* hero doesn't know how many charges are left */
+ } else {
+ otmp->dknown = 1;
+#if 0 /*JP:T*/
+ pline("%s plays a %s directed at %s!", Monnam(mtmp), xname(otmp),
+ self ? mon_nam_too(mtmp, mtmp) : (char *) "you");
+#else
+ pline("%s\82Í%s\82É\8cü\82¯\82Ä%s\82ð\90\81\82¢\82½\81I", Monnam(mtmp),
+ self ? mon_nam_too(mtmp, mtmp) : (char *) "\82 \82È\82½",
+ xname(otmp));
+#endif
+ 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);
Mnam = Monnam(mtmp);
#if 0 /*JP:T*/
pline("%s %s into a %s!", Mnam,
- vtense(Mnam, locomotion(mtmp->data, "jump")),
+ vtense(fakename[0], locomotion(mtmp->data, "jump")),
(t->ttyp == TRAPDOOR) ? "trap door" : "hole");
#else
pline("%s\82Í%s\82É%s\93ü\82Á\82½\81I", Mnam,
Mnam = Monnam(mtmp);
#if 0 /*JP:T*/
pline("%s %s onto a teleport trap!", Mnam,
- vtense(Mnam, locomotion(mtmp->data, "jump")));
+ vtense(fakename[0], locomotion(mtmp->data, "jump")));
#else
/* \93ú\96{\8cê\82Å\82Í\91S\82Ä\81u\94ò\82Ñ\8d\9e\82ñ\82¾\81v */
pline("%s\82Í\8fu\8aÔ\88Ú\93®\82Ìã©\82É\94ò\82Ñ\8d\9e\82ñ\82¾\81I", Mnam);
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);
-/*JP
- pline("%s plays a %s!", Monnam(mtmp), xname(otmp));
-*/
- pline("%s\82Í%s\82ð\90\81\82¢\82½\81I", Monnam(mtmp), xname(otmp));
- } else
-/*JP
- You_hear("a horn being played.");
-*/
- You_hear("\83z\83\8b\83\93\82Ì\89¹\82ð\95·\82¢\82½\81D");
- 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);
#if 0 /*JP:T*/
pline("%s deliberately %s onto a polymorph trap!", Mnam,
- vtense(Mnam, locomotion(mtmp->data, "jump")));
+ vtense(fakename[0], locomotion(mtmp->data, "jump")));
#else
pline("%s\82Í\82í\82´\82Æ\95Ï\89»\82Ìã©\82É\94ò\82Ñ\82±\82ñ\82¾\81I", Mnam);
#endif
#ifdef CLIPPING
cliparound(mtmp->mx, mtmp->my);
#endif
- show_glyph(mtmp->mx, mtmp->my, mon_to_glyph(mtmp, rn2));
+ show_glyph(mtmp->mx, mtmp->my, mon_to_glyph(mtmp, rn2_on_display_rng));
display_self();
/*JP
You_feel("aggravated at %s.", noit_mon_nam(mtmp));
if (obj->otyp != CORPSE && (obj->otyp != TIN || !tinok))
return FALSE;
/* corpse, or tin that mon can open */
+ if (obj->corpsenm == NON_PM) /* empty/special tin */
+ return FALSE;
return (boolean) (obj->corpsenm == PM_LIZARD
|| (acidic(&mons[obj->corpsenm])
&& (obj->corpsenm != PM_GREEN_SLIME
if (vis)
#if 0 /*JP:T*/
pline("%s %s %s %s fire trap!", Mnam,
- vtense(Mnam, locomotion(mon->data, "move")),
+ vtense(fakename[0], locomotion(mon->data, "move")),
is_floater(mon->data) ? "over" : "onto",
trap->tseen ? "the" : "a");
#else
vis = FALSE; /* skip makeknown() below */
res = FALSE; /* failed to cure sliming */
} else {
- m_useup(mon, obj); /* before explode() */
dmg = (2 * (rn1(3, 3) + 2 * bcsign(obj)) + 1) / 3;
+ m_useup(mon, obj); /* before explode() */
/* -11 => monster's fireball */
explode(mon->mx, mon->my, -11, dmg, SCROLL_CLASS,
/* by_you: override -11 for mon but not others */
dmg = 0; /* damage has been applied by explode() */
}
} else { /* wand/horn of fire w/ positive charge count */
- mzapmsg(mon, obj, TRUE);
- obj->spe--;
+ if (obj->otyp == FIRE_HORN)
+ mplayhorn(mon, obj, TRUE);
+ else
+ mzapwand(mon, obj, TRUE);
/* -1 => monster's wand of fire; 2 => # of damage dice */
dmg = zhitm(mon, by_you ? 1 : -1, 2, &odummyp);
}