#define is_vampshifter(mon) \
((mon)->cham == PM_VAMPIRE || (mon)->cham == PM_VAMPIRE_LORD \
|| (mon)->cham == PM_VLAD_THE_IMPALER)
+#define is_door_mappear(mon) ((mon)->m_ap_type == M_AP_FURNITURE \
+ && ((mon)->mappearance == S_hcdoor || (mon)->mappearance == S_vcdoor))
+#define is_obj_mappear(mon,otyp) ((mon)->m_ap_type == M_AP_OBJECT \
+ && (mon)->mappearance == (otyp))
#endif /* MONST_H */
for (mon = fmon; mon; mon = mon->nmon) {
if (DEADMONSTER(mon))
continue;
- if (mon->minvis && ((mon->m_ap_type == M_AP_FURNITURE
- && (mon->mappearance == S_vcdoor
- || mon->mappearance == S_hcdoor))
- || (mon->m_ap_type == M_AP_OBJECT
- && mon->mappearance == BOULDER))) {
+ if (mon->minvis && (is_door_mappear(mon)
+ || is_obj_mappear(mon,BOULDER))) {
if (See_invisible)
block_point(mon->mx, mon->my);
else
if (!eatmbuf || nomovemsg != eatmbuf)
return;
- if (youmonst.m_ap_type == M_AP_OBJECT && youmonst.mappearance == ORANGE
- && !Hallucination) {
+ if (is_obj_mappear(&youmonst,ORANGE) && !Hallucination) {
/* revert from hallucinatory to "normal" mimicking */
altmsg = "You now prefer mimicking yourself.";
altapp = GOLD_PIECE;
- } else if (youmonst.m_ap_type == M_AP_OBJECT
- && youmonst.mappearance == GOLD_PIECE && Hallucination) {
+ } else if (is_obj_mappear(&youmonst,GOLD_PIECE) && Hallucination) {
/* won't happen; anything which might make immobilized
hero begin hallucinating (black light attack, theft
of Grayswandir) will terminate the mimicry first */
|| IS_AIR(levl[x][y].typ))
continue;
else if (closed_door(x, y)
- || (mtmp && mtmp->m_ap_type == M_AP_FURNITURE
- && (mtmp->mappearance == S_hcdoor
- || mtmp->mappearance == S_vcdoor))) {
+ || (mtmp && is_door_mappear(mtmp))) {
if (x != u.ux && y != u.uy)
continue;
if (context.run != 1)
pline("I don't think %s would appreciate that.",
mon_nam(mtmp));
return PICKLOCK_LEARNED_SOMETHING;
- } else if (mtmp && mtmp->m_ap_type == M_AP_FURNITURE &&
- /* not IS_DOOR() here; for M_AP_FURNITURE, mappearance
- holds a map symbol rather than a topology type */
- (mtmp->mappearance == S_vcdoor
- || mtmp->mappearance == S_hcdoor)) {
+ } else if (mtmp && is_door_mappear(mtmp)) {
/* "The door actually was a <mimic>!" */
stumble_onto_mimic(mtmp);
/* mimic might keep the key (50% chance, 10% for PYEC) */
int x, y;
{
struct monst *mtmp;
- if ((mtmp = m_at(x, y)) && mtmp->m_ap_type == M_AP_FURNITURE
- && (mtmp->mappearance == S_hcdoor || mtmp->mappearance == S_vcdoor)
+ if ((mtmp = m_at(x, y)) && is_door_mappear(mtmp)
&& !Protection_from_shape_changers) {
stumble_onto_mimic(mtmp);
return TRUE;
point_msg = "all around, then curses";
else if ((Invis && !perceives(mtmp->data)
&& (mtmp->mux != u.ux || mtmp->muy != u.uy))
- || (youmonst.m_ap_type == M_AP_OBJECT
- && youmonst.mappearance == STRANGE_OBJECT)
+ || is_obj_mappear(&youmonst, STRANGE_OBJECT)
|| u.uundetected)
point_msg = "and curses in your general direction";
else if (Displaced && (mtmp->mux != u.ux || mtmp->muy != u.uy))
seemimic(mtmp)
register struct monst *mtmp;
{
- unsigned old_app = mtmp->mappearance;
- uchar old_ap_type = mtmp->m_ap_type;
+ boolean is_blocker_appear = is_door_mappear(mtmp) ||
+ is_obj_mappear(mtmp, BOULDER);
if (has_mcorpsenm(mtmp))
freemcorpsenm(mtmp);
/*
* Discovered mimics don't block light.
*/
- if (((old_ap_type == M_AP_FURNITURE
- && (old_app == S_hcdoor || old_app == S_vcdoor))
- || (old_ap_type == M_AP_OBJECT && old_app == BOULDER))
+ if (is_blocker_appear
&& !does_block(mtmp->mx, mtmp->my, &levl[mtmp->mx][mtmp->my]))
unblock_point(mtmp->mx, mtmp->my);
if (!mtmp->mcansee
|| (should_see && Invis && !perceives(ptr) && rn2(11))
- || (youmonst.m_ap_type == M_AP_OBJECT
- && youmonst.mappearance == STRANGE_OBJECT) || u.uundetected
- || (youmonst.m_ap_type == M_AP_OBJECT
- && youmonst.mappearance == GOLD_PIECE && !likes_gold(ptr))
+ || is_obj_mappear(&youmonst,STRANGE_OBJECT) || u.uundetected
+ || (is_obj_mappear(&youmonst,GOLD_PIECE) && !likes_gold(ptr))
|| (mtmp->mpeaceful && !mtmp->isshk) || /* allow shks to follow */
((monsndx(ptr) == PM_STALKER || ptr->mlet == S_BAT
|| ptr->mlet == S_LIGHT) && !rn2(3)))
*obj_p = (struct obj *) 0;
/* there might be a mimic here posing as an object */
mtmp = m_at(x, y);
- if (mtmp && mtmp->m_ap_type == M_AP_OBJECT
- && mtmp->mappearance == (unsigned) glyphotyp)
+ if (mtmp && is_obj_mappear(mtmp, (unsigned) glyphotyp))
otmp = 0;
else
mtmp = 0;
/* Mimics mimicing a door or boulder block light. */
if ((mon = m_at(x, y)) && (!mon->minvis || See_invisible)
- && ((mon->m_ap_type == M_AP_FURNITURE
- && (mon->mappearance == S_hcdoor
- || mon->mappearance == S_vcdoor))
- || (mon->m_ap_type == M_AP_OBJECT
- && mon->mappearance == BOULDER)))
+ && (is_door_mappear(mon) || is_obj_mappear(mon,BOULDER)))
return 1;
return 0;
}
if (canseemon(mtmp)) {
if (disguised_mimic) {
- if (mtmp->m_ap_type == M_AP_OBJECT
- && mtmp->mappearance == STRANGE_OBJECT) {
+ if (is_obj_mappear(mtmp,STRANGE_OBJECT)) {
/* it can do better now */
set_mimic_sym(mtmp);
newsym(mtmp->mx, mtmp->my);