-/* NetHack 3.6 muse.c $NHDT-Date: 1505181522 2017/09/12 01:58:42 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.80 $ */
+/* 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 $ */
/* Copyright (C) 1990 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */
#include "hack.h"
-extern const int monstr[];
-
boolean m_using = FALSE;
/* Let monsters use magic items. Arbitrary assumptions: Monsters only use
}
m_useup(mon, obj);
mon->mhp -= dam;
- if (mon->mhp <= 0) {
+ if (DEADMONSTER(mon)) {
monkilled(mon, "", AD_RBRE);
return 1;
}
|| onscary(xx, yy, mtmp))
continue;
/* use trap if it's the correct type */
- if ((t->ttyp == TRAPDOOR || t->ttyp == HOLE)
+ if (is_hole(t->ttyp)
&& !is_floater(mtmp->data)
&& !mtmp->isshk && !mtmp->isgd && !mtmp->ispriest
&& Can_fall_thru(&u.uz)) {
}
}
}
- toot:
+ toot:
;
}
/* kludge to cut down on trap destruction (particularly portals) */
t = t_at(x, y);
- if (t && (t->ttyp == PIT || t->ttyp == SPIKED_PIT || t->ttyp == WEB
+ if (t && (is_pit(t->ttyp) || t->ttyp == WEB
|| t->ttyp == BEAR_TRAP))
t = 0; /* ok for monster to dig here */
m.has_defense = MUSE_SCR_CREATE_MONSTER;
}
}
-botm:
+ botm:
return (boolean) !!m.has_defense;
#undef nomore
}
mzapmsg(mtmp, otmp, TRUE);
otmp->spe--;
how = WAN_TELEPORTATION;
- mon_tele:
+ mon_tele:
if (tele_restrict(mtmp)) { /* mysterious force... */
if (vismon && how) /* mentions 'teleport' */
makeknown(how);
case MUSE_SSTAIRS:
m_flee(mtmp);
if (ledger_no(&u.uz) == 1) {
- escape:
+ escape:
/* Monsters without the Amulet escape the dungeon and
* are gone for good when they leave up the up stairs.
* A monster with the Amulet would leave it behind
struct monst *mtmp;
{
struct permonst *pm = mtmp->data;
- int difficulty = monstr[(monsndx(pm))];
+ int difficulty = mons[(monsndx(pm))].difficulty;
int trycnt = 0;
if (is_animal(pm) || attacktype(pm, AT_EXPL) || mindless(mtmp->data)
|| pm->mlet == S_GHOST || pm->mlet == S_KOP)
return 0;
-try_again:
+ try_again:
switch (rn2(8 + (difficulty > 3) + (difficulty > 6) + (difficulty > 8))) {
case 6:
case 9:
break;
}
if (reveal_invis) {
- if (mtmp->mhp > 0 && cansee(bhitpos.x, bhitpos.y)
+ if (!DEADMONSTER(mtmp) && cansee(bhitpos.x, bhitpos.y)
&& !canspotmon(mtmp))
map_invisible(bhitpos.x, bhitpos.y);
}
(otmp->otyp == WAN_MAGIC_MISSILE) ? 2 : 6, mtmp->mx, mtmp->my,
sgn(mtmp->mux - mtmp->mx), sgn(mtmp->muy - mtmp->my));
m_using = FALSE;
- return (mtmp->mhp <= 0) ? 1 : 2;
+ return (DEADMONSTER(mtmp)) ? 1 : 2;
case MUSE_FIRE_HORN:
case MUSE_FROST_HORN:
if (oseen) {
rn1(6, 6), mtmp->mx, mtmp->my, sgn(mtmp->mux - mtmp->mx),
sgn(mtmp->muy - mtmp->my));
m_using = FALSE;
- return (mtmp->mhp <= 0) ? 1 : 2;
+ return (DEADMONSTER(mtmp)) ? 1 : 2;
case MUSE_WAN_TELEPORTATION:
case MUSE_WAN_STRIKING:
zap_oseen = oseen;
drop_boulder_on_player(confused, !is_cursed, FALSE, TRUE);
}
- return (mtmp->mhp <= 0) ? 1 : 2;
+ return (DEADMONSTER(mtmp)) ? 1 : 2;
}
#if 0
case MUSE_SCR_FIRE: {
mtmp2->mhp -= num;
if (resists_cold(mtmp2))
mtmp2->mhp -= 3 * num;
- if (mtmp2->mhp < 1) {
+ if (DEADMONSTER(mtmp2)) {
mondied(mtmp2);
break;
}
struct monst *mtmp;
{
struct permonst *pm = mtmp->data;
- int difficulty = monstr[(monsndx(pm))];
+ int difficulty = mons[(monsndx(pm))].difficulty;
if (is_animal(pm) || attacktype(pm, AT_EXPL) || mindless(mtmp->data)
|| pm->mlet == S_GHOST || pm->mlet == S_KOP)
return FALSE;
if (!stuck && !immobile && (mtmp->cham == NON_PM)
- && monstr[(pmidx = monsndx(mdat))] < 6) {
+ && mons[(pmidx = monsndx(mdat))].difficulty < 6) {
boolean ignore_boulders = (verysmall(mdat) || throws_rocks(mdat)
|| passes_walls(mdat)),
diag_ok = !NODIAG(pmidx);
}
nomore(MUSE_WAN_POLYMORPH);
if (obj->otyp == WAN_POLYMORPH && obj->spe > 0
- && (mtmp->cham == NON_PM) && monstr[monsndx(mdat)] < 6) {
+ && (mtmp->cham == NON_PM) && mons[monsndx(mdat)].difficulty < 6) {
m.misc = obj;
m.has_misc = MUSE_WAN_POLYMORPH;
}
nomore(MUSE_POT_POLYMORPH);
if (obj->otyp == POT_POLYMORPH && (mtmp->cham == NON_PM)
- && monstr[monsndx(mdat)] < 6) {
+ && mons[monsndx(mdat)].difficulty < 6) {
m.misc = obj;
m.has_misc = MUSE_POT_POLYMORPH;
}
(coord *) 0);
return 2;
} else {
- skipmsg:
+ skipmsg:
if (vismon) {
/*JP
pline("%s looks uneasy.", Monnam(mtmp));
#ifdef CLIPPING
cliparound(mtmp->mx, mtmp->my);
#endif
- show_glyph(mtmp->mx, mtmp->my, mon_to_glyph(mtmp));
+ show_glyph(mtmp->mx, mtmp->my, mon_to_glyph(mtmp, rn2));
display_self();
/*JP
You_feel("aggravated at %s.", noit_mon_nam(mtmp));
struct monst *mtmp;
{
struct permonst *pm = mtmp->data;
- int difficulty = monstr[(monsndx(pm))];
+ int difficulty = mons[(monsndx(pm))].difficulty;
if (is_animal(pm) || attacktype(pm, AT_EXPL) || mindless(mtmp->data)
|| pm->mlet == S_GHOST || pm->mlet == S_KOP)
if (typ == WAN_DIGGING)
return (boolean) !is_floater(mon->data);
if (typ == WAN_POLYMORPH)
- return (boolean) (monstr[monsndx(mon->data)] < 6);
+ return (boolean) (mons[monsndx(mon->data)].difficulty < 6);
if (objects[typ].oc_dir == RAY || typ == WAN_STRIKING
|| typ == WAN_TELEPORTATION || typ == WAN_CREATE_MONSTER)
return TRUE;
pline("%s has a very bad case of stomach acid.", Monnam(mon));
*/
pline("%s\82Í\88Ý\8e_\82Ì\92²\8eq\82ª\82Æ\82Ä\82à\88«\82¢\81D", Monnam(mon));
- if (mon->mhp <= 0) {
+ if (DEADMONSTER(mon)) {
/*JP
pline("%s dies!", Monnam(mon));
*/
}
}
if (t && t->ttyp == FIRE_TRAP)
- return muse_unslime(mon, &zeroobj, t, by_you);
+ return muse_unslime(mon, (struct obj *) &zeroobj, t, by_you);
} /* MUSE */
for fire breath, dmg is going to be 0 (fire breathers are
immune to fire damage) but for wand of fire or fire horn,
'mon' could have taken damage so might die */
- if (mon->mhp <= 0) {
+ if (DEADMONSTER(mon)) {
if (by_you) {
/* mon killed self but hero gets credit and blame (except
for pacifist conduct); xkilled()'s message would say
}
}
if (vis) {
- if (res && mon->mhp > 0)
+ if (res && !DEADMONSTER(mon))
/*JP
pline("%s slime is burned away!", s_suffix(Monnam(mon)));
*/