OSDN Git Service

ガラスの地形であることを示す地形フラグGLASSを実装. ガラスの地形は以下
[hengband/hengband.git] / src / melee2.c
index ac12138..4ee3b46 100644 (file)
@@ -194,7 +194,7 @@ void mon_take_hit_mon(int m_idx, int dam, bool *fear, cptr note, int who)
 
        char m_name[160];
 
-       bool seen = m_ptr->ml;
+       bool seen = is_seen(m_ptr);
 
        /* Can the player be aware of this attack? */
        bool known = (m_ptr->cdis <= MAX_SIGHT);
@@ -203,17 +203,18 @@ void mon_take_hit_mon(int m_idx, int dam, bool *fear, cptr note, int who)
        monster_desc(m_name, m_ptr, 0);
 
        /* Redraw (later) if needed */
-       if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
-       if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
+       if (m_ptr->ml)
+       {
+               if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
+               if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
+       }
 
        /* Wake it up */
-       m_ptr->csleep = 0;
-
-       if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+       (void)set_monster_csleep(m_idx, 0);
 
        if (p_ptr->riding && (m_idx == p_ptr->riding)) disturb(1, 0);
 
-       if (m_ptr->invulner && randint0(PENETRATE_INVULNERABILITY))
+       if (MON_INVULNER(m_ptr) && randint0(PENETRATE_INVULNERABILITY))
        {
                if (seen)
                {
@@ -333,35 +334,21 @@ msg_format("%^s
 #ifdef ALLOW_FEAR
 
        /* Mega-Hack -- Pain cancels fear */
-       if (m_ptr->monfear && (dam > 0))
+       if (MON_MONFEAR(m_ptr) && (dam > 0))
        {
-               int tmp = randint1(dam / 4);
-
-               /* Cure a little fear */
-               if (tmp < m_ptr->monfear)
-               {
-                       /* Reduce fear */
-                       m_ptr->monfear -= tmp;
-               }
-
-               /* Cure all the fear */
-               else
+               /* Cure fear */
+               if (set_monster_monfear(m_idx, MON_MONFEAR(m_ptr) - randint1(dam / 4)))
                {
-                       /* Cure fear */
-                       m_ptr->monfear = 0;
-
                        /* No more fear */
                        (*fear) = FALSE;
                }
        }
 
        /* Sometimes a monster gets scared by damage */
-       if (!m_ptr->monfear && !(r_ptr->flags3 & RF3_NO_FEAR))
+       if (!MON_MONFEAR(m_ptr) && !(r_ptr->flags3 & RF3_NO_FEAR))
        {
-               int             percentage;
-
                /* Percentage of fully healthy */
-               percentage = (100L * m_ptr->hp) / m_ptr->maxhp;
+               int percentage = (100L * m_ptr->hp) / m_ptr->maxhp;
 
                /*
                * Run (sometimes) if at 10% or less of max hit points,
@@ -374,9 +361,9 @@ msg_format("%^s
                        (*fear) = TRUE;
 
                        /* XXX XXX XXX Hack -- Add some timed fear */
-                       m_ptr->monfear += (randint1(10) +
+                       (void)set_monster_monfear(m_idx, (randint1(10) +
                                (((dam >= m_ptr->hp) && (percentage > 7)) ?
-                               20 : ((11 - percentage) * 5)));
+                               20 : ((11 - percentage) * 5))));
                }
        }
 
@@ -453,7 +440,7 @@ static int mon_will_run(int m_idx)
        if (m_ptr->cdis > MAX_SIGHT + 5) return (FALSE);
 
        /* All "afraid" monsters will run away */
-       if (m_ptr->monfear) return (TRUE);
+       if (MON_MONFEAR(m_ptr)) return (TRUE);
 
 #ifdef ALLOW_TERROR
 
@@ -1021,8 +1008,6 @@ static bool find_hiding(int m_idx, int *yp, int *xp)
        int gy = 0, gx = 0, gdis = 999;
 
        sint *y_offsets, *x_offsets;
-       
-       cave_type *c_ptr;
 
        /* Start with adjacent locations, spread further */
        for (d = 1; d < 10; d++)
@@ -1038,17 +1023,15 @@ static bool find_hiding(int m_idx, int *yp, int *xp)
                {
                        y = fy + dy;
                        x = fx + dx;
-                       
+
                        /* Skip illegal locations */
                        if (!in_bounds(y, x)) continue;
 
-                       c_ptr = &cave[y][x];
-
                        /* Skip occupied locations */
                        if (!monster_can_enter(y, x, r_ptr, 0)) continue;
 
                        /* Check for hidden, available grid */
-                       if (!player_has_los_grid(c_ptr) && clean_shot(fy, fx, y, x, FALSE))
+                       if (!projectable(py, px, y, x) && clean_shot(fy, fx, y, x, FALSE))
                        {
                                /* Calculate distance from player */
                                dis = distance(y, x, py, px);
@@ -1433,6 +1416,12 @@ static int check_hit2(int power, int level, int ac, int stun)
 }
 
 
+#define BLOW_EFFECT_TYPE_NONE  0
+#define BLOW_EFFECT_TYPE_FEAR  1
+#define BLOW_EFFECT_TYPE_SLEEP 2
+#define BLOW_EFFECT_TYPE_HEAL  3
+
+
 /* Monster attacks monster */
 static bool monst_attack_monst(int m_idx, int t_idx)
 {
@@ -1446,13 +1435,14 @@ static bool monst_attack_monst(int m_idx, int t_idx)
        int             ac, rlev, pt;
        char            m_name[80], t_name[80];
        char            temp[80];
-       bool            blinked, heal_effect;
+       bool            blinked;
        bool            explode = FALSE, touched = FALSE, fear = FALSE;
        int             y_saver = t_ptr->fy;
        int             x_saver = t_ptr->fx;
+       int             effect_type;
 
-       bool see_m = m_ptr->ml;
-       bool see_t = t_ptr->ml;
+       bool see_m = is_seen(m_ptr);
+       bool see_t = is_seen(t_ptr);
        bool see_either = see_m || see_t;
 
        /* Can the player be aware of this attack? */
@@ -1514,23 +1504,23 @@ static bool monst_attack_monst(int m_idx, int t_idx)
                /* Hack -- no more attacks */
                if (!method) break;
 
-               if (blinked) /* Stop! */
-               {
-                       /* break; */
-               }
-
                if (method == RBM_SHOOT) continue;
 
                /* Extract the attack "power" */
                power = mbe_info[effect].power;
 
                /* Monster hits */
-               if (!effect || check_hit2(power, rlev, ac, m_ptr->stunned))
+               if (!effect || check_hit2(power, rlev, ac, MON_STUNNED(m_ptr)))
                {
                        /* Wake it up */
-                       t_ptr->csleep = 0;
+                       (void)set_monster_csleep(t_idx, 0);
 
-                       if (tr_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+                       if (t_ptr->ml)
+                       {
+                               /* Redraw the health bar */
+                               if (p_ptr->health_who == t_idx) p_ptr->redraw |= (PR_HEALTH);
+                               if (p_ptr->riding == t_idx) p_ptr->redraw |= (PR_UHEALTH);
+                       }
 
                        /* Describe the attack method */
                        switch (method)
@@ -1849,8 +1839,8 @@ act = "%s
                        /* Roll out the damage */
                        damage = damroll(d_dice, d_side);
 
-                       /* Assume no healing effect */
-                       heal_effect = FALSE;
+                       /* Assume no effect */
+                       effect_type = BLOW_EFFECT_TYPE_NONE;
 
                        pt = GF_MISSILE;
 
@@ -1858,147 +1848,103 @@ act = "%s
                        switch (effect)
                        {
                        case 0:
-                               {
-                                       damage = 0;
-                                       pt = 0;
-                                       break;
-                               }
+                       case RBE_DR_MANA:
+                               damage = pt = 0;
+                               break;
 
                        case RBE_SUPERHURT:
+                               if ((randint1(rlev*2+250) > (ac+200)) || one_in_(13))
                                {
-                                       if ((randint1(rlev*2+250) > (ac+200)) || one_in_(13)) {
-                                               int tmp_damage = damage-(damage*((ac < 150) ? ac : 150)/250);
-                                               damage = MAX(damage, tmp_damage*2);
-                                               break;
-                                       }
-                               }
-                       case RBE_HURT:
-                               {
-                                       damage -= (damage * ((ac < 150) ? ac : 150) / 250);
+                                       int tmp_damage = damage - (damage * ((ac < 150) ? ac : 150) / 250);
+                                       damage = MAX(damage, tmp_damage * 2);
                                        break;
                                }
 
+                               /* Fall through */
+
+                       case RBE_HURT:
+                               damage -= (damage * ((ac < 150) ? ac : 150) / 250);
+                               break;
+
                        case RBE_POISON:
                        case RBE_DISEASE:
-                               {
-                                       pt = GF_POIS;
-                                       break;
-                               }
+                               pt = GF_POIS;
+                               break;
 
                        case RBE_UN_BONUS:
                        case RBE_UN_POWER:
-                               {
-                                       pt = GF_DISENCHANT;
-                                       break;
-                               }
-
-                       case RBE_EAT_FOOD:
-                       case RBE_EAT_LITE:
-                       case RBE_DR_MANA:
-                               {
-                                       pt = damage = 0;
-                                       break;
-                               }
+                               pt = GF_DISENCHANT;
+                               break;
 
                        case RBE_EAT_ITEM:
                        case RBE_EAT_GOLD:
-                               {
-                                       pt = damage = 0;
-                                       if (one_in_(2)) blinked = TRUE;
-                                       break;
-                               }
+                               if ((p_ptr->riding != m_idx) && one_in_(2)) blinked = TRUE;
+                               break;
+
+                       case RBE_EAT_FOOD:
+                       case RBE_EAT_LITE:
+                       case RBE_BLIND:
+                       case RBE_LOSE_STR:
+                       case RBE_LOSE_INT:
+                       case RBE_LOSE_WIS:
+                       case RBE_LOSE_DEX:
+                       case RBE_LOSE_CON:
+                       case RBE_LOSE_CHR:
+                       case RBE_LOSE_ALL:
+                               break;
 
                        case RBE_ACID:
-                               {
-                                       pt = GF_ACID;
-                                       break;
-                               }
+                               pt = GF_ACID;
+                               break;
 
                        case RBE_ELEC:
-                               {
-                                       pt = GF_ELEC;
-                                       break;
-                               }
+                               pt = GF_ELEC;
+                               break;
 
                        case RBE_FIRE:
-                               {
-                                       pt = GF_FIRE;
-                                       break;
-                               }
+                               pt = GF_FIRE;
+                               break;
 
                        case RBE_COLD:
-                               {
-                                       pt = GF_COLD;
-                                       break;
-                               }
-
-                       case RBE_BLIND:
-                               {
-                                       break;
-                               }
+                               pt = GF_COLD;
+                               break;
 
                        case RBE_CONFUSE:
-                               {
-                                       pt = GF_CONFUSION;
-                                       break;
-                               }
+                               pt = GF_CONFUSION;
+                               break;
 
                        case RBE_TERRIFY:
-                               {
-                                       pt = GF_TURN_ALL;
-                                       break;
-                               }
+                               effect_type = BLOW_EFFECT_TYPE_FEAR;
+                               break;
 
                        case RBE_PARALYZE:
-                               {
-                                       pt = GF_OLD_SLEEP; /* sort of close... */
-                                       break;
-                               }
+                               effect_type = BLOW_EFFECT_TYPE_SLEEP;
+                               break;
 
-                       case RBE_LOSE_STR:
-                       case RBE_LOSE_INT:
-                       case RBE_LOSE_WIS:
-                       case RBE_LOSE_DEX:
-                       case RBE_LOSE_CON:
-                       case RBE_LOSE_CHR:
-                       case RBE_LOSE_ALL:
-                               {
-                                       break;
-                               }
                        case RBE_SHATTER:
-                               {
-                                       damage -= (damage * ((ac < 150) ? ac : 150) / 250);
-                                       if (damage > 23)
-                                       {
-                                               earthquake(m_ptr->fy, m_ptr->fx, 8);
-                                       }
-                                       break;
-                               }
+                               damage -= (damage * ((ac < 150) ? ac : 150) / 250);
+                               if (damage > 23) earthquake_aux(m_ptr->fy, m_ptr->fx, 8, m_idx);
+                               break;
+
                        case RBE_EXP_10:
                        case RBE_EXP_20:
                        case RBE_EXP_40:
                        case RBE_EXP_80:
-                               {
-                                       pt = GF_NETHER;
-                                       break;
-                               }
+                               pt = GF_NETHER;
+                               break;
+
                        case RBE_TIME:
-                               {
-                                       pt = GF_TIME;
-                                       break;
-                               }
+                               pt = GF_TIME;
+                               break;
+
                        case RBE_EXP_VAMP:
-                               {
-                                       pt = GF_OLD_DRAIN;
-                                       heal_effect = TRUE;
-                                       break;
-                               }
+                               pt = GF_OLD_DRAIN;
+                               effect_type = BLOW_EFFECT_TYPE_HEAL;
+                               break;
 
                        default:
-                               {
-                                       pt = 0;
-                                       break;
-                               }
+                               pt = 0;
+                               break;
                        }
 
                        if (pt)
@@ -2007,11 +1953,22 @@ act = "%s
                                if (!explode)
                                {
                                        project(m_idx, 0, t_ptr->fy, t_ptr->fx,
-                                               (pt == GF_OLD_SLEEP ? r_ptr->level : damage), pt, PROJECT_KILL | PROJECT_STOP | PROJECT_AIMED, -1);
+                                               damage, pt, PROJECT_KILL | PROJECT_STOP | PROJECT_AIMED, -1);
                                }
 
-                               if (heal_effect)
+                               switch (effect_type)
                                {
+                               case BLOW_EFFECT_TYPE_FEAR:
+                                       project(m_idx, 0, t_ptr->fy, t_ptr->fx,
+                                               damage, GF_TURN_ALL, PROJECT_KILL | PROJECT_STOP | PROJECT_AIMED, -1);
+                                       break;
+
+                               case BLOW_EFFECT_TYPE_SLEEP:
+                                       project(m_idx, 0, t_ptr->fy, t_ptr->fx,
+                                               r_ptr->level, GF_OLD_SLEEP, PROJECT_KILL | PROJECT_STOP | PROJECT_AIMED, -1);
+                                       break;
+
+                               case BLOW_EFFECT_TYPE_HEAL:
                                        if ((monster_living(tr_ptr)) && (damage > 2))
                                        {
                                                bool did_heal = FALSE;
@@ -2030,13 +1987,13 @@ act = "%s
                                                if (see_m && did_heal)
                                                {
 #ifdef JP
-msg_format("%s¤ÏÂÎÎϤò²óÉü¤·¤¿¤è¤¦¤À¡£", m_name);
+                                                       msg_format("%s¤ÏÂÎÎϤò²óÉü¤·¤¿¤è¤¦¤À¡£", m_name);
 #else
                                                        msg_format("%^s appears healthier.", m_name);
 #endif
-
                                                }
                                        }
+                                       break;
                                }
 
                                if (touched)
@@ -2048,15 +2005,13 @@ msg_format("%s
                                                {
                                                        if (see_either)
                                                        {
-                                                               blinked = FALSE;
 #ifdef JP
                                                                msg_format("%^s¤ÏÆÍÁ³Ç®¤¯¤Ê¤Ã¤¿¡ª", m_name);
 #else
                                                                msg_format("%^s is suddenly very hot!", m_name);
 #endif
-
-                                                               if (see_t && is_original_ap(t_ptr)) tr_ptr->r_flags2 |= RF2_AURA_FIRE;
                                                        }
+                                                       if (m_ptr->ml && is_original_ap_and_seen(t_ptr)) tr_ptr->r_flags2 |= RF2_AURA_FIRE;
                                                        project(t_idx, 0, m_ptr->fy, m_ptr->fx,
                                                                damroll (1 + ((tr_ptr->level) / 26),
                                                                1 + ((tr_ptr->level) / 17)),
@@ -2064,7 +2019,7 @@ msg_format("%s
                                                }
                                                else
                                                {
-                                                       if (see_m && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
+                                                       if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
                                                }
                                        }
 
@@ -2075,15 +2030,13 @@ msg_format("%s
                                                {
                                                        if (see_either)
                                                        {
-                                                               blinked = FALSE;
 #ifdef JP
                                                                msg_format("%^s¤ÏÆÍÁ³´¨¤¯¤Ê¤Ã¤¿¡ª", m_name);
 #else
                                                                msg_format("%^s is suddenly very cold!", m_name);
 #endif
-
-                                                               if (see_t && is_original_ap(t_ptr)) tr_ptr->r_flags3 |= RF3_AURA_COLD;
                                                        }
+                                                       if (m_ptr->ml && is_original_ap_and_seen(t_ptr)) tr_ptr->r_flags3 |= RF3_AURA_COLD;
                                                        project(t_idx, 0, m_ptr->fy, m_ptr->fx,
                                                                damroll (1 + ((tr_ptr->level) / 26),
                                                                1 + ((tr_ptr->level) / 17)),
@@ -2091,7 +2044,7 @@ msg_format("%s
                                                }
                                                else
                                                {
-                                                       if (see_m && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK);
+                                                       if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK);
                                                }
                                        }
 
@@ -2102,15 +2055,13 @@ msg_format("%s
                                                {
                                                        if (see_either)
                                                        {
-                                                               blinked = FALSE;
 #ifdef JP
                                                                msg_format("%^s¤ÏÅÅ·â¤ò¿©¤é¤Ã¤¿¡ª", m_name);
 #else
                                                                msg_format("%^s gets zapped!", m_name);
 #endif
-
-                                                               if (see_t && is_original_ap(t_ptr)) tr_ptr->r_flags2 |= RF2_AURA_ELEC;
                                                        }
+                                                       if (m_ptr->ml && is_original_ap_and_seen(t_ptr)) tr_ptr->r_flags2 |= RF2_AURA_ELEC;
                                                        project(t_idx, 0, m_ptr->fy, m_ptr->fx,
                                                                damroll (1 + ((tr_ptr->level) / 26),
                                                                1 + ((tr_ptr->level) / 17)),
@@ -2118,7 +2069,7 @@ msg_format("%s
                                                }
                                                else
                                                {
-                                                       if (see_m && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
+                                                       if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
                                                }
                                        }
                                }
@@ -2145,20 +2096,17 @@ msg_format("%s
                        case RBM_CHARGE:
                                {
                                        /* Wake it up */
-                                       t_ptr->csleep = 0;
-
-                                       if (tr_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+                                       (void)set_monster_csleep(t_idx, 0);
 
                                        /* Visible monsters */
                                        if (see_m)
                                        {
                                                /* Message */
 #ifdef JP
-msg_format("%s¤Ï%^s¤Î¹¶·â¤ò¤«¤ï¤·¤¿¡£", t_name,m_name);
+                                               msg_format("%s¤Ï%^s¤Î¹¶·â¤ò¤«¤ï¤·¤¿¡£", t_name,m_name);
 #else
                                                msg_format("%^s misses %s.", m_name, t_name);
 #endif
-
                                        }
 
                                        break;
@@ -2168,7 +2116,7 @@ msg_format("%s
 
 
                /* Analyze "visible" monsters only */
-               if (see_m && !do_silly_attack)
+               if (is_original_ap_and_seen(m_ptr) && !do_silly_attack)
                {
                        /* Count "obvious" attacks (and ones that cause damage) */
                        if (obvious || damage || (r_ptr->r_blows[ap_cnt] > 10))
@@ -2187,37 +2135,34 @@ msg_format("%s
                sound(SOUND_EXPLODE);
 
                /* Cancel Invulnerability */
-               if (m_ptr->invulner) m_ptr->invulner = 0;
+               (void)set_monster_invulner(m_idx, 0, FALSE);
 
 #ifdef JP
-mon_take_hit_mon(m_idx, m_ptr->hp + 1, &fear, "¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£", m_idx);
+               mon_take_hit_mon(m_idx, m_ptr->hp + 1, &fear, "¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£", m_idx);
 #else
                mon_take_hit_mon(m_idx, m_ptr->hp + 1, &fear, " explodes into tiny shreds.", m_idx);
 #endif
 
-
                blinked = FALSE;
        }
 
-
        /* Blink away */
-       if (blinked)
+       if (blinked && m_ptr->r_idx)
        {
                if (see_m)
                {
 #ifdef JP
-msg_print("Å¥ËÀ¤Ï¾Ð¤Ã¤Æƨ¤²¤¿¡ª");
+                       msg_print("Å¥ËÀ¤Ï¾Ð¤Ã¤Æƨ¤²¤¿¡ª");
 #else
                        msg_print("The thief flees laughing!");
 #endif
-
                }
                else if (known)
                {
                        mon_fight = TRUE;
                }
 
-               teleport_away(m_idx, MAX_SIGHT * 2 + 5, FALSE);
+               teleport_away(m_idx, MAX_SIGHT * 2 + 5, 0L);
        }
 
        return TRUE;
@@ -2268,6 +2213,7 @@ static void process_monster(int m_idx)
        bool            do_turn;
        bool            do_move;
        bool            do_view;
+       bool            must_alter_to_move;
 
        bool            did_open_door;
        bool            did_bash_door;
@@ -2284,6 +2230,8 @@ static void process_monster(int m_idx)
 
        bool            is_riding_mon = (m_idx == p_ptr->riding);
 
+       bool            see_m = is_seen(m_ptr);
+
        if (is_riding_mon && !(r_ptr->flags7 & RF7_RIDING))
        {
                if (rakuba(0, TRUE))
@@ -2298,7 +2246,7 @@ static void process_monster(int m_idx)
                }
        }
 
-       if ((m_ptr->mflag2 & MFLAG2_CHAMELEON) && one_in_(13) && !m_ptr->csleep)
+       if ((m_ptr->mflag2 & MFLAG2_CHAMELEON) && one_in_(13) && !MON_CSLEEP(m_ptr))
        {
                choose_new_monster(m_idx, FALSE, 0);
                r_ptr = &r_info[m_ptr->r_idx];
@@ -2320,10 +2268,10 @@ static void process_monster(int m_idx)
        {
                /* Its parent have gone, it also goes away. */
 
-               if (m_ptr->ml)
+               if (see_m)
                {
                        char m_name[80];
-                       
+
                        /* Acquire the monster name */
                        monster_desc(m_name, m_ptr, 0);
 
@@ -2354,7 +2302,7 @@ static void process_monster(int m_idx)
                        if (is_pet(m_ptr) && !(m_ptr->ml))
                                sad = TRUE;
 
-                       if (m_ptr->ml)
+                       if (see_m)
                        {
                                char m_name[80];
 
@@ -2363,11 +2311,10 @@ static void process_monster(int m_idx)
 
                                /* Oops */
 #ifdef JP
-msg_format("%s¤Ï¾Ã¤¨µî¤Ã¤¿¡ª", m_name);
+                               msg_format("%s¤Ï¾Ã¤¨µî¤Ã¤¿¡ª", m_name);
 #else
                                msg_format("%^s disappears!", m_name);
 #endif
-
                        }
 
                        /* Generate treasure, etc */
@@ -2379,11 +2326,10 @@ msg_format("%s
                        if (sad)
                        {
 #ifdef JP
-msg_print("¾¯¤·¤Î´ÖÈᤷ¤¤µ¤Ê¬¤Ë¤Ê¤Ã¤¿¡£");
+                               msg_print("¾¯¤·¤Î´ÖÈᤷ¤¤µ¤Ê¬¤Ë¤Ê¤Ã¤¿¡£");
 #else
                                msg_print("You feel sad for a moment.");
 #endif
-
                        }
 
                        return;
@@ -2435,9 +2381,10 @@ msg_print("
                                        }
                                }
 
-                               if (m_ptr->ml)
+                               if (see_m)
                                {
-                                       if ((r_ptr->flags2 & RF2_CAN_SPEAK) && (m_ptr->r_idx != MON_GRIP) && (m_ptr->r_idx != MON_WOLF) && (m_ptr->r_idx != MON_FANG))
+                                       if ((r_ptr->flags2 & RF2_CAN_SPEAK) && (m_ptr->r_idx != MON_GRIP) && (m_ptr->r_idx != MON_WOLF) && (m_ptr->r_idx != MON_FANG) &&
+                                           player_has_los_bold(m_ptr->fy, m_ptr->fx) && projectable(m_ptr->fy, m_ptr->fx, py, px))
                                        {
 #ifdef JP
                                                msg_format("%^s¡Ö¥Ô¥ó¥Á¤À¡ªÂàµÑ¤µ¤»¤Æ¤â¤é¤¦¡ª¡×", m_name);
@@ -2479,7 +2426,7 @@ msg_print("
        }
 
        /* Handle "sleep" */
-       if (m_ptr->csleep)
+       if (MON_CSLEEP(m_ptr))
        {
                /* Handle non-aggravation - Still sleeping */
                if (!(p_ptr->cursed & TRC_AGGRAVATE)) return;
@@ -2487,12 +2434,10 @@ msg_print("
                /* Handle aggravation */
 
                /* Reset sleep counter */
-               m_ptr->csleep = 0;
-
-               if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+               (void)set_monster_csleep(m_idx, 0);
 
                /* Notice the "waking up" */
-               if (m_ptr->ml)
+               if (see_m)
                {
                        char m_name[80];
 
@@ -2505,13 +2450,12 @@ msg_print("
 #else
                        msg_format("%^s wakes up.", m_name);
 #endif
+               }
 
-                       /* Redraw the health bar */
-                       if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
-                       if (is_riding_mon) p_ptr->redraw |= (PR_UHEALTH);
-
+               if (m_ptr->ml)
+               {
                        /* Hack -- Count the wakings */
-                       if (r_ptr->r_wake < MAX_UCHAR)
+                       if ((r_ptr->r_wake < MAX_UCHAR) && is_original_ap(m_ptr))
                        {
                                r_ptr->r_wake++;
                        }
@@ -2519,7 +2463,7 @@ msg_print("
        }
 
        /* Handle "stun" */
-       if (m_ptr->stunned)
+       if (MON_STUNNED(m_ptr))
        {
                /* Sometimes skip move */
                if (one_in_(2)) return;
@@ -2547,13 +2491,16 @@ msg_print("
 
        if (gets_angry)
        {
-               char m_name[80];
-               monster_desc(m_name, m_ptr, 0);
+               if (is_pet(m_ptr) || see_m)
+               {
+                       char m_name[80];
+                       monster_desc(m_name, m_ptr, is_pet(m_ptr) ? MD_ASSUME_VISIBLE : 0);
 #ifdef JP
-msg_format("%^s¤ÏÆÍÁ³Å¨¤Ë¤Þ¤ï¤Ã¤¿¡ª", m_name);
+                       msg_format("%^s¤ÏÆÍÁ³Å¨¤Ë¤Þ¤ï¤Ã¤¿¡ª", m_name);
 #else
-               msg_format("%^s suddenly becomes hostile!", m_name);
+                       msg_format("%^s suddenly becomes hostile!", m_name);
 #endif
+               }
 
                set_hostile(m_ptr);
        }
@@ -2587,7 +2534,7 @@ msg_format("%^s
                        if (multiply_monster(m_idx, FALSE, (is_pet(m_ptr) ? PM_FORCE_PET : 0)))
                        {
                                /* Take note if visible */
-                               if (m_ptr->ml && m_list[hack_m_idx_ii].ml && is_original_ap(m_ptr))
+                               if (m_list[hack_m_idx_ii].ml && is_original_ap_and_seen(m_ptr))
                                {
                                        r_ptr->r_flags2 |= (RF2_MULTIPLY);
                                }
@@ -2620,7 +2567,7 @@ msg_format("%^s
                                                }
                                        }
 
-                                       if (count && m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flags6 |= (RF6_SPECIAL);
+                                       if (count && is_original_ap_and_seen(m_ptr)) r_ptr->r_flags6 |= (RF6_SPECIAL);
                                }
                        }
                }
@@ -2636,11 +2583,10 @@ msg_format("%^s
                {
                        if (disturb_minor) disturb(FALSE, FALSE);
 #ifdef JP
-msg_print("½Å¸ü¤Ê­²»¤¬Ê¹¤³¤¨¤¿¡£");
+                       msg_print("½Å¸ü¤Ê­²»¤¬Ê¹¤³¤¨¤¿¡£");
 #else
                        msg_print("You hear heavy steps.");
 #endif
-
                }
 
                /* Some monsters can speak */
@@ -2658,42 +2604,36 @@ msg_print("
                                monster_desc(m_name, m_ptr, 0);
                        else
 #ifdef JP
-strcpy(m_name, "¤½¤ì");
+                               strcpy(m_name, "¤½¤ì");
 #else
                                strcpy(m_name, "It");
 #endif
 
-
                        /* Select the file for monster quotes */
-                       if (m_ptr->monfear)
+                       if (MON_MONFEAR(m_ptr))
 #ifdef JP
-filename = "monfear_j.txt";
+                               filename = "monfear_j.txt";
 #else
                                filename = "monfear.txt";
 #endif
-
                        else if (is_pet(m_ptr))
 #ifdef JP
-filename = "monpet_j.txt";
+                               filename = "monpet_j.txt";
 #else
                                filename = "monpet.txt";
 #endif
-
                        else if (is_friendly(m_ptr))
 #ifdef JP
-filename = "monfrien_j.txt";
+                               filename = "monfrien_j.txt";
 #else
                                filename = "monfrien.txt";
 #endif
-
                        else
 #ifdef JP
                                filename = "monspeak_j.txt";
 #else
                                filename = "monspeak.txt";
 #endif
-
-
                        /* Get the monster line */
                        if (get_rnd_line(filename, m_ptr->ap_r_idx, monmessage) == 0)
                        {
@@ -2753,7 +2693,7 @@ msg_format("%^s%s", m_name, monmessage);
 
 
        /* Confused -- 100% random */
-       if (m_ptr->confused || !aware)
+       if (MON_CONFUSED(m_ptr) || !aware)
        {
                /* Try four "random" directions */
                mm[0] = mm[1] = mm[2] = mm[3] = 5;
@@ -2764,7 +2704,7 @@ msg_format("%^s%s", m_name, monmessage);
                 (randint0(100) < 75))
        {
                /* Memorize flags */
-               if (m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flags1 |= (RF1_RAND_50 | RF1_RAND_25);
+               if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags1 |= (RF1_RAND_50 | RF1_RAND_25);
 
                /* Try four "random" directions */
                mm[0] = mm[1] = mm[2] = mm[3] = 5;
@@ -2775,7 +2715,7 @@ msg_format("%^s%s", m_name, monmessage);
                                (randint0(100) < 50))
        {
                /* Memorize flags */
-               if (m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flags1 |= (RF1_RAND_50);
+               if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags1 |= (RF1_RAND_50);
 
                /* Try four "random" directions */
                mm[0] = mm[1] = mm[2] = mm[3] = 5;
@@ -2786,7 +2726,7 @@ msg_format("%^s%s", m_name, monmessage);
                                (randint0(100) < 25))
        {
                /* Memorize flags */
-               if (m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flags1 |= RF1_RAND_25;
+               if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags1 |= RF1_RAND_25;
 
                /* Try four "random" directions */
                mm[0] = mm[1] = mm[2] = mm[3] = 5;
@@ -2864,6 +2804,7 @@ msg_format("%^s%s", m_name, monmessage);
        do_turn = FALSE;
        do_move = FALSE;
        do_view = FALSE;
+       must_alter_to_move = FALSE;
 
        /* Assume nothing */
        did_open_door = FALSE;
@@ -2905,12 +2846,26 @@ msg_format("%^s%s", m_name, monmessage);
                        do_move = TRUE;
                }
 
+               /* Possibly a monster to attack */
                else if (c_ptr->m_idx)
                {
-                       /* Possibly a monster to attack */
                        do_move = TRUE;
                }
 
+               /* Monster destroys walls (and doors) */
+               else if ((r_ptr->flags2 & RF2_KILL_WALL) &&
+                        (can_cross ? !have_flag(f_ptr->flags, FF_LOS) : !is_riding_mon) &&
+                        have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT) &&
+                        (!have_flag(f_ptr->flags, FF_GLASS) || (r_ptr->flags2 & RF2_STUPID) || (m_ptr->hp >= MAX(m_ptr->maxhp / 3, 200))))
+               {
+                       /* Eat through walls/doors/rubble */
+                       do_move = TRUE;
+                       if (!can_cross) must_alter_to_move = TRUE;
+
+                       /* Monster destroyed a wall (later) */
+                       did_kill_wall = TRUE;
+               }
+
                /* Floor is open? */
                else if (can_cross)
                {
@@ -2919,36 +2874,17 @@ msg_format("%^s%s", m_name, monmessage);
 
                        /* Monster moves through walls (and doors) */
                        if ((r_ptr->flags2 & RF2_PASS_WALL) && (!is_riding_mon || p_ptr->pass_wall) &&
-                           !have_flag(f_ptr->flags, FF_MOVE))
+                           have_flag(f_ptr->flags, FF_CAN_PASS))
                        {
                                /* Monster went through a wall */
                                did_pass_wall = TRUE;
                        }
-
-                       if ((r_ptr->flags2 & RF2_KILL_WALL) && have_flag(f_ptr->flags, FF_TUNNEL) &&
-                           !have_flag(f_ptr->flags, FF_LOS) && !have_flag(f_ptr->flags, FF_PERMANENT))
-                       {
-                               /* Monster destroyed a wall (later) */
-                               did_kill_wall = TRUE;
-                       }
-               }
-
-               /* Monster destroys walls (and doors) */
-               else if ((r_ptr->flags2 & RF2_KILL_WALL) && !is_riding_mon &&
-                        have_flag(f_ptr->flags, FF_TUNNEL) && !have_flag(f_ptr->flags, FF_PERMANENT))
-               {
-                       /* Eat through walls/doors/rubble */
-                       do_move = TRUE;
-
-                       /* Monster destroyed a wall (later) */
-                       did_kill_wall = TRUE;
                }
 
                /* Handle doors and secret doors */
                else if (is_closed_door(c_ptr->feat))
                {
                        bool may_bash = TRUE;
-                       feature_type *f_ptr = &f_info[c_ptr->feat];
 
                        /* Assume no move allowed */
                        do_move = FALSE;
@@ -2966,8 +2902,8 @@ msg_format("%^s%s", m_name, monmessage);
                                        /* Do not bash the door */
                                        may_bash = FALSE;
 
-                                       /* Assume no move allowed */
-                                       do_move = TRUE;
+                                       /* Take a turn */
+                                       do_turn = TRUE;
                                }
 
                                /* Locked doors (not jammed) */
@@ -2977,10 +2913,13 @@ msg_format("%^s%s", m_name, monmessage);
                                        if (randint0(m_ptr->hp / 10) > f_ptr->power)
                                        {
                                                /* Unlock the door */
-                                               cave_alter_feat(ny, nx, FF_OPEN);
+                                               cave_alter_feat(ny, nx, FF_DISARM);
 
                                                /* Do not bash the door */
                                                may_bash = FALSE;
+
+                                               /* Take a turn */
+                                               do_turn = TRUE;
                                        }
                                }
                        }
@@ -2993,10 +2932,17 @@ msg_format("%^s%s", m_name, monmessage);
                                if (randint0(m_ptr->hp / 10) > f_ptr->power)
                                {
                                        /* Message */
+                                       if (have_flag(f_ptr->flags, FF_GLASS))
+#ifdef JP
+                                               msg_print("¥¬¥é¥¹¤¬ºÕ¤±¤ë²»¤¬¤·¤¿¡ª");
+#else
+                                               msg_print("You hear a glass was crashed!");
+#endif
+                                       else
 #ifdef JP
-                                       msg_print("¥É¥¢¤ò᤭³«¤±¤ë²»¤¬¤·¤¿¡ª");
+                                               msg_print("¥É¥¢¤ò᤭³«¤±¤ë²»¤¬¤·¤¿¡ª");
 #else
-                                       msg_print("You hear a door burst open!");
+                                               msg_print("You hear a door burst open!");
 #endif
 
                                        /* Disturb (sometimes) */
@@ -3007,6 +2953,7 @@ msg_format("%^s%s", m_name, monmessage);
 
                                        /* Hack -- fall into doorway */
                                        do_move = TRUE;
+                                       must_alter_to_move = TRUE;
                                }
                        }
 
@@ -3015,9 +2962,19 @@ msg_format("%^s%s", m_name, monmessage);
                        if (did_open_door || did_bash_door)
                        {
                                /* Break down the door */
-                               if (did_bash_door && ((randint0(100) < 50) || (feat_state(c_ptr->feat, FF_OPEN) == c_ptr->feat)))
+                               if (did_bash_door && ((randint0(100) < 50) || (feat_state(c_ptr->feat, FF_OPEN) == c_ptr->feat) || have_flag(f_ptr->flags, FF_GLASS)))
                                {
                                        cave_alter_feat(ny, nx, FF_BASH);
+
+                                       if (!m_ptr->r_idx) /* Killed by shards of glass, etc. */
+                                       {
+                                               /* Update some things */
+                                               p_ptr->update |= (PU_FLOW);
+                                               p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+                                               if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_BASH_DOOR);
+
+                                               return;
+                                       }
                                }
 
                                /* Open the door */
@@ -3026,8 +2983,10 @@ msg_format("%^s%s", m_name, monmessage);
                                        cave_alter_feat(ny, nx, FF_OPEN);
                                }
 
+                               f_ptr = &f_info[c_ptr->feat];
+
                                /* Handle viewable doors */
-                               if (player_has_los_bold(ny, nx)) do_view = TRUE;
+                               do_view = TRUE;
                        }
                }
 
@@ -3121,7 +3080,7 @@ msg_format("%^s%s", m_name, monmessage);
                        if (r_ptr->flags1 & RF1_NEVER_BLOW)
                        {
                                /* Hack -- memorize lack of attacks */
-                               if (m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flags1 |= (RF1_NEVER_BLOW);
+                               if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags1 |= (RF1_NEVER_BLOW);
 
                                /* Do not move */
                                do_move = FALSE;
@@ -3130,12 +3089,12 @@ msg_format("%^s%s", m_name, monmessage);
                        /* In anti-melee dungeon, stupid or confused monster takes useless turn */
                        if (do_move && (d_info[dungeon_type].flags1 & DF1_NO_MELEE))
                        {
-                               if (!m_ptr->confused)
+                               if (!MON_CONFUSED(m_ptr))
                                {
                                        if (!(r_ptr->flags2 & RF2_STUPID)) do_move = FALSE;
                                        else
                                        {
-                                               if (m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flags2 |= (RF2_STUPID);
+                                               if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_STUPID);
                                        }
                                }
                        }
@@ -3169,13 +3128,13 @@ msg_format("%^s%s", m_name, monmessage);
                        if (((r_ptr->flags2 & RF2_KILL_BODY) && !(r_ptr->flags1 & RF1_NEVER_BLOW) &&
                                 (r_ptr->mexp * r_ptr->level > z_ptr->mexp * z_ptr->level) &&
                                 can_cross && (c_ptr->m_idx != p_ptr->riding)) ||
-                               are_enemies(m_ptr, y_ptr) || m_ptr->confused)
+                               are_enemies(m_ptr, y_ptr) || MON_CONFUSED(m_ptr))
                        {
                                if (!(r_ptr->flags1 & RF1_NEVER_BLOW))
                                {
                                        if (r_ptr->flags2 & RF2_KILL_BODY)
                                        {
-                                               if (is_original_ap(m_ptr)) r_ptr->r_flags2 |= (RF2_KILL_BODY);
+                                               if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_KILL_BODY);
                                        }
 
                                        /* attack */
@@ -3186,10 +3145,10 @@ msg_format("%^s%s", m_name, monmessage);
                                                /* In anti-melee dungeon, stupid or confused monster takes useless turn */
                                                else if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
                                                {
-                                                       if (m_ptr->confused) return;
+                                                       if (MON_CONFUSED(m_ptr)) return;
                                                        else if (r_ptr->flags2 & RF2_STUPID)
                                                        {
-                                                               if (m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flags2 |= (RF2_STUPID);
+                                                               if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_STUPID);
                                                                return;
                                                        }
                                                }
@@ -3198,7 +3157,7 @@ msg_format("%^s%s", m_name, monmessage);
                        }
 
                        /* Push past weaker monsters (unless leaving a wall) */
-                       else if ((r_ptr->flags2 & RF2_MOVE_BODY) &&
+                       else if ((r_ptr->flags2 & RF2_MOVE_BODY) && !(r_ptr->flags1 & RF1_NEVER_MOVE) &&
                                (r_ptr->mexp > z_ptr->mexp) &&
                                can_cross && (c_ptr->m_idx != p_ptr->riding) &&
                                monster_can_cross_terrain(cave[m_ptr->fy][m_ptr->fx].feat, z_ptr, 0))
@@ -3209,17 +3168,73 @@ msg_format("%^s%s", m_name, monmessage);
                                /* Monster pushed past another monster */
                                did_move_body = TRUE;
 
+                               /* Wake up the moved monster */
+                               (void)set_monster_csleep(c_ptr->m_idx, 0);
+
                                /* XXX XXX XXX Message */
                        }
                }
 
+               if (is_riding_mon)
+               {
+                       if (!p_ptr->riding_ryoute && !MON_MONFEAR(&m_list[p_ptr->riding])) do_move = FALSE;
+               }
+
+               if (did_kill_wall && do_move)
+               {
+                       if (one_in_(GRINDNOISE))
+                       {
+                               if (have_flag(f_ptr->flags, FF_GLASS))
+#ifdef JP
+                                       msg_print("²¿¤«¤ÎºÕ¤±¤ë²»¤¬Ê¹¤³¤¨¤ë¡£");
+#else
+                                       msg_print("There is a crashing sound.");
+#endif
+                               else
+#ifdef JP
+                                       msg_print("¥®¥·¥®¥·¤¤¤¦²»¤¬Ê¹¤³¤¨¤ë¡£");
+#else
+                                       msg_print("There is a grinding sound.");
+#endif
+                       }
+
+                       cave_alter_feat(ny, nx, FF_HURT_DISI);
+
+                       if (!m_ptr->r_idx) /* Killed by shards of glass, etc. */
+                       {
+                               /* Update some things */
+                               p_ptr->update |= (PU_FLOW);
+                               p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+                               if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_KILL_WALL);
+
+                               return;
+                       }
+
+                       f_ptr = &f_info[c_ptr->feat];
+
+                       /* Note changes to viewable region */
+                       do_view = TRUE;
+
+                       /* Take a turn */
+                       do_turn = TRUE;
+               }
+
+               if (must_alter_to_move && (r_ptr->flags7 & RF7_AQUATIC))
+               {
+                       if (!monster_can_cross_terrain(c_ptr->feat, r_ptr, is_riding_mon ? CEM_RIDING : 0))
+                       {
+                               /* Assume no move allowed */
+                               do_move = FALSE;
+                       }
+               }
+
                /*
                 * Check if monster can cross terrain
                 * This is checked after the normal attacks
                 * to allow monsters to attack an enemy,
                 * even if it can't enter the terrain.
                 */
-               if (do_move && !can_cross && !did_kill_wall)
+               if (do_move && !can_cross && !did_kill_wall && !did_bash_door)
                {
                        /* Assume no move allowed */
                        do_move = FALSE;
@@ -3228,18 +3243,13 @@ msg_format("%^s%s", m_name, monmessage);
                /* Some monsters never move */
                if (do_move && (r_ptr->flags1 & RF1_NEVER_MOVE))
                {
-                       /* Hack -- memorize lack of attacks */
-                       if (m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flags1 |= (RF1_NEVER_MOVE);
+                       /* Hack -- memorize lack of moves */
+                       if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags1 |= (RF1_NEVER_MOVE);
 
                        /* Do not move */
                        do_move = FALSE;
                }
 
-               if (is_riding_mon)
-               {
-                       if (!p_ptr->riding_ryoute && !(m_list[p_ptr->riding].monfear)) do_move = FALSE;
-               }
-
                /* Creature has been allowed move */
                if (do_move)
                {
@@ -3248,84 +3258,53 @@ msg_format("%^s%s", m_name, monmessage);
                        /* Take a turn */
                        do_turn = TRUE;
 
-                       /* Hack -- Update the old location */
-                       cave[oy][ox].m_idx = c_ptr->m_idx;
+                       if (have_flag(f_ptr->flags, FF_TREE))
+                       {
+                               if (!(r_ptr->flags7 & RF7_CAN_FLY) && !(r_ptr->flags8 & RF8_WILD_WOOD))
+                               {
+                                       m_ptr->energy_need += ENERGY_NEED();
+                               }
+                       }
 
-                       if (did_kill_wall)
+                       if (!is_riding_mon)
                        {
-                               if (one_in_(GRINDNOISE))
+                               /* Hack -- Update the old location */
+                               cave[oy][ox].m_idx = c_ptr->m_idx;
+
+                               /* Mega-Hack -- move the old monster, if any */
+                               if (c_ptr->m_idx)
                                {
-#ifdef JP
-                                       msg_print("¥®¥·¥®¥·¤¤¤¦²»¤¬Ê¹¤³¤¨¤ë¡£");
-#else
-                                       msg_print("There is a grinding sound.");
-#endif
-                               }
-
-                               cave_alter_feat(ny, nx, FF_HURT_DISI);
+                                       /* Move the old monster */
+                                       y_ptr->fy = oy;
+                                       y_ptr->fx = ox;
 
-                               /* Note changes to viewable region */
-                               if (player_has_los_bold(ny, nx)) do_view = TRUE;
-                       }
-                       else if (have_flag(f_ptr->flags, FF_TREE))
-                       {
-                               if (!(r_ptr->flags7 & RF7_CAN_FLY) && (!is_riding_mon || !p_ptr->ffall) && !(r_ptr->flags8 & RF8_WILD_WOOD))
-                               {
-                                       m_ptr->energy_need += ENERGY_NEED();
+                                       /* Update the old monster */
+                                       update_mon(c_ptr->m_idx, TRUE);
                                }
-                       }
-
-                       /* Mega-Hack -- move the old monster, if any */
-                       if (c_ptr->m_idx)
-                       {
-                               /* Move the old monster */
-                               y_ptr->fy = oy;
-                               y_ptr->fx = ox;
-
-                               /* Update the old monster */
-                               update_mon(c_ptr->m_idx, TRUE);
 
-                               /* Wake up the moved monster */
-                               y_ptr->csleep = 0;
+                               /* Hack -- Update the new location */
+                               c_ptr->m_idx = m_idx;
 
-                               if (r_info[y_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
-                                       p_ptr->update |= (PU_MON_LITE);
-                       }
+                               /* Move the monster */
+                               m_ptr->fy = ny;
+                               m_ptr->fx = nx;
 
-                       /* Hack -- Update the new location */
-                       c_ptr->m_idx = m_idx;
+                               /* Update the monster */
+                               update_mon(m_idx, TRUE);
 
-                       /* Move the monster */
-                       m_ptr->fy = ny;
-                       m_ptr->fx = nx;
+                               /* Redraw the old grid */
+                               lite_spot(oy, ox);
 
-                       /* Update the monster */
-                       update_mon(m_idx, TRUE);
-
-                       if (is_riding_mon)
-                       {
-                               py = ny;
-                               px = nx;
+                               /* Redraw the new grid */
+                               lite_spot(ny, nx);
                        }
-
-                       /* Redraw the old grid */
-                       lite_spot(oy, ox);
-
-                       /* Redraw the new grid */
-                       lite_spot(ny, nx);
-
-                       if (is_riding_mon)
+                       else
                        {
-                               verify_panel();
-
-                               /* Update stuff */
-                               p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
-
-                               /* Update the monsters */
-                               p_ptr->update |= (PU_DISTANCE);
+                               /* Sound */
+                               /* sound(SOUND_WALK); */
 
-                               /* Update sub-windows */
-                               p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+                               /* Move the player */
+                               if (!move_player_effect(ny, nx, MPE_DONT_PICKUP)) break;
                        }
 
                        /* Possible disturb */
@@ -3403,8 +3382,7 @@ msg_format("%^s%s", m_name, monmessage);
                                        if (have_flag(flgs, TR_KILL_HUMAN))  flg2 |= (RF2_HUMAN);
 
                                        /* The object cannot be picked up by the monster */
-                                       if (artifact_p(o_ptr) || (r_ptr->flags3 & flg3) || (r_ptr->flags2 & flg2) ||
-                                               (o_ptr->art_name))
+                                       if (object_is_artifact(o_ptr) || (r_ptr->flags3 & flg3) || (r_ptr->flags2 & flg2))
                                        {
                                                /* Only give a message for "take_item" */
                                                if ((r_ptr->flags2 & (RF2_TAKE_ITEM)) && (r_ptr->flags2 & (RF2_STUPID)))
@@ -3497,7 +3475,7 @@ msg_format("%^s%s", m_name, monmessage);
                m_ptr->mflag2 &= ~MFLAG2_NOFLOW;
 
        /* If we haven't done anything, try casting a spell again */
-       if (!do_turn && !do_move && !m_ptr->monfear && !is_riding_mon && aware)
+       if (!do_turn && !do_move && !MON_MONFEAR(m_ptr) && !is_riding_mon && aware)
        {
                /* Try to cast spell again */
                if (r_ptr->freq_spell && randint1(100) <= r_ptr->freq_spell)
@@ -3511,7 +3489,7 @@ msg_format("%^s%s", m_name, monmessage);
        if (do_view)
        {
                /* Update some things */
-               p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
+               p_ptr->update |= (PU_FLOW);
 
                /* Window stuff */
                p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
@@ -3526,7 +3504,7 @@ msg_format("%^s%s", m_name, monmessage);
        }
 
        /* Learn things from observable monster */
-       if (m_ptr->ml && is_original_ap(m_ptr))
+       if (is_original_ap_and_seen(m_ptr))
        {
                /* Monster opened a door */
                if (did_open_door) r_ptr->r_flags2 |= (RF2_OPEN_DOOR);
@@ -3552,13 +3530,13 @@ msg_format("%^s%s", m_name, monmessage);
 
 
        /* Hack -- get "bold" if out of options */
-       if (!do_turn && !do_move && m_ptr->monfear && aware)
+       if (!do_turn && !do_move && MON_MONFEAR(m_ptr) && aware)
        {
                /* No longer afraid */
-               m_ptr->monfear = 0;
+               (void)set_monster_monfear(m_idx, 0);
 
                /* Message if seen */
-               if (m_ptr->ml)
+               if (see_m)
                {
                        char m_name[80];
 
@@ -3567,17 +3545,14 @@ msg_format("%^s%s", m_name, monmessage);
 
                        /* Dump a message */
 #ifdef JP
-msg_format("%^s¤ÏÀ襤¤ò·è°Õ¤·¤¿¡ª", m_name);
+                       msg_format("%^s¤ÏÀ襤¤ò·è°Õ¤·¤¿¡ª", m_name);
 #else
                        msg_format("%^s turns to fight!", m_name);
 #endif
-
-                       /* Redraw (later) if needed */
-                       if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
-
-                       chg_virtue(V_COMPASSION, -1);
                }
 
+               if (m_ptr->ml) chg_virtue(V_COMPASSION, -1);
+
                /* XXX XXX XXX Actually do something now (?) */
        }
 }
@@ -3737,7 +3712,7 @@ void process_monsters(void)
                /* Hack -- Monsters can "smell" the player from far away */
                /* Note that most monsters have "aaf" of "20" or so */
                else if (!(m_ptr->mflag2 & MFLAG2_NOFLOW) &&
-                       have_flag(f_flags_bold(py, px), FF_MOVE) &&
+                       cave_have_flag_bold(py, px, FF_MOVE) &&
                        (cave[py][px].when == cave[fy][fx].when) &&
                        (cave[fy][fx].dist < MONSTER_FLOW_DEPTH) &&
                        (cave[fy][fx].dist < r_ptr->aaf))
@@ -3761,8 +3736,8 @@ void process_monsters(void)
                        /* Monsters move quickly in Nightmare mode */
                        if (ironman_nightmare) speed += 5;
 
-                       if (m_ptr->fast) speed += 10;
-                       if (m_ptr->slow) speed -= 10;
+                       if (MON_FAST(m_ptr)) speed += 10;
+                       if (MON_SLOW(m_ptr)) speed -= 10;
                }
 
                /* Give this monster some energy */
@@ -3825,6 +3800,655 @@ void process_monsters(void)
 }
 
 
+int get_mproc_idx(int m_idx, int mproc_type)
+{
+       s16b *cur_mproc_list = mproc_list[mproc_type];
+       int i;
+
+       for (i = mproc_max[mproc_type] - 1; i >= 0; i--)
+       {
+               if (cur_mproc_list[i] == m_idx) return i;
+       }
+
+       return -1;
+}
+
+
+static void mproc_add(int m_idx, int mproc_type)
+{
+       if (mproc_max[mproc_type] < max_m_idx) mproc_list[mproc_type][mproc_max[mproc_type]++] = m_idx;
+}
+
+
+static void mproc_remove(int m_idx, int mproc_type)
+{
+       int mproc_idx = get_mproc_idx(m_idx, mproc_type);
+       if (mproc_idx >= 0) mproc_list[mproc_type][mproc_idx] = mproc_list[mproc_type][--mproc_max[mproc_type]];
+}
+
+
+/*
+ * Initialize monster process
+ */
+void mproc_init(void)
+{
+       monster_type *m_ptr;
+       int          i, cmi;
+
+       /* Reset "mproc_max[]" */
+       for (cmi = 0; cmi < MAX_MTIMED; cmi++) mproc_max[cmi] = 0;
+
+       /* Process the monsters (backwards) */
+       for (i = m_max - 1; i >= 1; i--)
+       {
+               /* Access the monster */
+               m_ptr = &m_list[i];
+
+               /* Ignore "dead" monsters */
+               if (!m_ptr->r_idx) continue;
+
+               for (cmi = 0; cmi < MAX_MTIMED; cmi++)
+               {
+                       if (m_ptr->mtimed[cmi]) mproc_add(i, cmi);
+               }
+       }
+}
+
+
+/*
+ * Set "m_ptr->mtimed[MTIMED_CSLEEP]", notice observable changes
+ */
+bool set_monster_csleep(int m_idx, int v)
+{
+       monster_type *m_ptr = &m_list[m_idx];
+       bool notice = FALSE;
+
+       /* Hack -- Force good values */
+       v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
+
+       /* Open */
+       if (v)
+       {
+               if (!MON_CSLEEP(m_ptr))
+               {
+                       mproc_add(m_idx, MTIMED_CSLEEP);
+                       notice = TRUE;
+               }
+       }
+
+       /* Shut */
+       else
+       {
+               if (MON_CSLEEP(m_ptr))
+               {
+                       mproc_remove(m_idx, MTIMED_CSLEEP);
+                       notice = TRUE;
+               }
+       }
+
+       /* Use the value */
+       m_ptr->mtimed[MTIMED_CSLEEP] = v;
+
+       if (!notice) return FALSE;
+
+       if (m_ptr->ml)
+       {
+               /* Update health bar as needed */
+               if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
+               if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
+       }
+
+       if (r_info[m_ptr->r_idx].flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+
+       return TRUE;
+}
+
+
+/*
+ * Set "m_ptr->mtimed[MTIMED_FAST]", notice observable changes
+ */
+bool set_monster_fast(int m_idx, int v)
+{
+       monster_type *m_ptr = &m_list[m_idx];
+       bool notice = FALSE;
+
+       /* Hack -- Force good values */
+       v = (v > 200) ? 200 : (v < 0) ? 0 : v;
+
+       /* Open */
+       if (v)
+       {
+               if (!MON_FAST(m_ptr))
+               {
+                       mproc_add(m_idx, MTIMED_FAST);
+                       notice = TRUE;
+               }
+       }
+
+       /* Shut */
+       else
+       {
+               if (MON_FAST(m_ptr))
+               {
+                       mproc_remove(m_idx, MTIMED_FAST);
+                       notice = TRUE;
+               }
+       }
+
+       /* Use the value */
+       m_ptr->mtimed[MTIMED_FAST] = v;
+
+       if (!notice) return FALSE;
+
+       if ((p_ptr->riding == m_idx) && !p_ptr->leaving) p_ptr->update |= (PU_BONUS);
+
+       return TRUE;
+}
+
+
+/*
+ * Set "m_ptr->mtimed[MTIMED_SLOW]", notice observable changes
+ */
+bool set_monster_slow(int m_idx, int v)
+{
+       monster_type *m_ptr = &m_list[m_idx];
+       bool notice = FALSE;
+
+       /* Hack -- Force good values */
+       v = (v > 200) ? 200 : (v < 0) ? 0 : v;
+
+       /* Open */
+       if (v)
+       {
+               if (!MON_SLOW(m_ptr))
+               {
+                       mproc_add(m_idx, MTIMED_SLOW);
+                       notice = TRUE;
+               }
+       }
+
+       /* Shut */
+       else
+       {
+               if (MON_SLOW(m_ptr))
+               {
+                       mproc_remove(m_idx, MTIMED_SLOW);
+                       notice = TRUE;
+               }
+       }
+
+       /* Use the value */
+       m_ptr->mtimed[MTIMED_SLOW] = v;
+
+       if (!notice) return FALSE;
+
+       if ((p_ptr->riding == m_idx) && !p_ptr->leaving) p_ptr->update |= (PU_BONUS);
+
+       return TRUE;
+}
+
+
+/*
+ * Set "m_ptr->mtimed[MTIMED_STUNNED]", notice observable changes
+ */
+bool set_monster_stunned(int m_idx, int v)
+{
+       monster_type *m_ptr = &m_list[m_idx];
+       bool notice = FALSE;
+
+       /* Hack -- Force good values */
+       v = (v > 200) ? 200 : (v < 0) ? 0 : v;
+
+       /* Open */
+       if (v)
+       {
+               if (!MON_STUNNED(m_ptr))
+               {
+                       mproc_add(m_idx, MTIMED_STUNNED);
+                       notice = TRUE;
+               }
+       }
+
+       /* Shut */
+       else
+       {
+               if (MON_STUNNED(m_ptr))
+               {
+                       mproc_remove(m_idx, MTIMED_STUNNED);
+                       notice = TRUE;
+               }
+       }
+
+       /* Use the value */
+       m_ptr->mtimed[MTIMED_STUNNED] = v;
+
+       return notice;
+}
+
+
+/*
+ * Set "m_ptr->mtimed[MTIMED_CONFUSED]", notice observable changes
+ */
+bool set_monster_confused(int m_idx, int v)
+{
+       monster_type *m_ptr = &m_list[m_idx];
+       bool notice = FALSE;
+
+       /* Hack -- Force good values */
+       v = (v > 200) ? 200 : (v < 0) ? 0 : v;
+
+       /* Open */
+       if (v)
+       {
+               if (!MON_CONFUSED(m_ptr))
+               {
+                       mproc_add(m_idx, MTIMED_CONFUSED);
+                       notice = TRUE;
+               }
+       }
+
+       /* Shut */
+       else
+       {
+               if (MON_CONFUSED(m_ptr))
+               {
+                       mproc_remove(m_idx, MTIMED_CONFUSED);
+                       notice = TRUE;
+               }
+       }
+
+       /* Use the value */
+       m_ptr->mtimed[MTIMED_CONFUSED] = v;
+
+       return notice;
+}
+
+
+/*
+ * Set "m_ptr->mtimed[MTIMED_MONFEAR]", notice observable changes
+ */
+bool set_monster_monfear(int m_idx, int v)
+{
+       monster_type *m_ptr = &m_list[m_idx];
+       bool notice = FALSE;
+
+       /* Hack -- Force good values */
+       v = (v > 200) ? 200 : (v < 0) ? 0 : v;
+
+       /* Open */
+       if (v)
+       {
+               if (!MON_MONFEAR(m_ptr))
+               {
+                       mproc_add(m_idx, MTIMED_MONFEAR);
+                       notice = TRUE;
+               }
+       }
+
+       /* Shut */
+       else
+       {
+               if (MON_MONFEAR(m_ptr))
+               {
+                       mproc_remove(m_idx, MTIMED_MONFEAR);
+                       notice = TRUE;
+               }
+       }
+
+       /* Use the value */
+       m_ptr->mtimed[MTIMED_MONFEAR] = v;
+
+       if (!notice) return FALSE;
+
+       if (m_ptr->ml)
+       {
+               /* Update health bar as needed */
+               if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
+               if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
+       }
+
+       return TRUE;
+}
+
+
+/*
+ * Set "m_ptr->mtimed[MTIMED_INVULNER]", notice observable changes
+ */
+bool set_monster_invulner(int m_idx, int v, bool energy_need)
+{
+       monster_type *m_ptr = &m_list[m_idx];
+       bool notice = FALSE;
+
+       /* Hack -- Force good values */
+       v = (v > 200) ? 200 : (v < 0) ? 0 : v;
+
+       /* Open */
+       if (v)
+       {
+               if (!MON_INVULNER(m_ptr))
+               {
+                       mproc_add(m_idx, MTIMED_INVULNER);
+                       notice = TRUE;
+               }
+       }
+
+       /* Shut */
+       else
+       {
+               if (MON_INVULNER(m_ptr))
+               {
+                       mproc_remove(m_idx, MTIMED_INVULNER);
+                       if (energy_need && !p_ptr->wild_mode) m_ptr->energy_need += ENERGY_NEED();
+                       notice = TRUE;
+               }
+       }
+
+       /* Use the value */
+       m_ptr->mtimed[MTIMED_INVULNER] = v;
+
+       if (!notice) return FALSE;
+
+       if (m_ptr->ml)
+       {
+               /* Update health bar as needed */
+               if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
+               if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
+       }
+
+       return TRUE;
+}
+
+
+static u32b csleep_noise;
+
+static void process_monsters_mtimed_aux(int m_idx, int mtimed_idx)
+{
+       monster_type *m_ptr = &m_list[m_idx];
+
+       switch (mtimed_idx)
+       {
+       case MTIMED_CSLEEP:
+       {
+               monster_race *r_ptr = &r_info[m_ptr->r_idx];
+
+               /* Assume does not wake up */
+               bool test = FALSE;
+
+               /* Hack -- Require proximity */
+               if (m_ptr->cdis < AAF_LIMIT)
+               {
+                       /* Handle "sensing radius" */
+                       if (m_ptr->cdis <= (is_pet(m_ptr) ? ((r_ptr->aaf > MAX_SIGHT) ? MAX_SIGHT : r_ptr->aaf) : r_ptr->aaf))
+                       {
+                               /* We may wake up */
+                               test = TRUE;
+                       }
+
+                       /* Handle "sight" and "aggravation" */
+                       else if ((m_ptr->cdis <= MAX_SIGHT) && (player_has_los_bold(m_ptr->fy, m_ptr->fx)))
+                       {
+                               /* We may wake up */
+                               test = TRUE;
+                       }
+               }
+
+               if (test)
+               {
+                       u32b notice = randint0(1024);
+
+                       /* Nightmare monsters are more alert */
+                       if (ironman_nightmare) notice /= 2;
+
+                       /* Hack -- See if monster "notices" player */
+                       if ((notice * notice * notice) <= csleep_noise)
+                       {
+                               /* Hack -- amount of "waking" */
+                               /* Wake up faster near the player */
+                               int d = (m_ptr->cdis < AAF_LIMIT / 2) ? (AAF_LIMIT / m_ptr->cdis) : 1;
+
+                               /* Hack -- amount of "waking" is affected by speed of player */
+                               d = (d * SPEED_TO_ENERGY(p_ptr->pspeed)) / 10;
+                               if (d < 0) d = 1;
+
+                               /* Monster wakes up "a little bit" */
+
+                               /* Still asleep */
+                               if (!set_monster_csleep(m_idx, MON_CSLEEP(m_ptr) - d))
+                               {
+                                       /* Notice the "not waking up" */
+                                       if (is_original_ap_and_seen(m_ptr))
+                                       {
+                                               /* Hack -- Count the ignores */
+                                               if (r_ptr->r_ignore < MAX_UCHAR) r_ptr->r_ignore++;
+                                       }
+                               }
+
+                               /* Just woke up */
+                               else
+                               {
+                                       /* Notice the "waking up" */
+                                       if (is_seen(m_ptr))
+                                       {
+                                               char m_name[80];
+
+                                               /* Acquire the monster name */
+                                               monster_desc(m_name, m_ptr, 0);
+
+                                               /* Dump a message */
+#ifdef JP
+                                               msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
+#else
+                                               msg_format("%^s wakes up.", m_name);
+#endif
+                                       }
+
+                                       if (is_original_ap_and_seen(m_ptr))
+                                       {
+                                               /* Hack -- Count the wakings */
+                                               if (r_ptr->r_wake < MAX_UCHAR) r_ptr->r_wake++;
+                                       }
+                               }
+                       }
+               }
+               break;
+       }
+
+       case MTIMED_FAST:
+               /* Reduce by one, note if expires */
+               if (set_monster_fast(m_idx, MON_FAST(m_ptr) - 1))
+               {
+                       if (is_seen(m_ptr))
+                       {
+                               char m_name[80];
+
+                               /* Acquire the monster name */
+                               monster_desc(m_name, m_ptr, 0);
+
+                               /* Dump a message */
+#ifdef JP
+                               msg_format("%^s¤Ï¤â¤¦²Ã®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
+#else
+                               msg_format("%^s is no longer fast.", m_name);
+#endif
+                       }
+               }
+               break;
+
+       case MTIMED_SLOW:
+               /* Reduce by one, note if expires */
+               if (set_monster_slow(m_idx, MON_SLOW(m_ptr) - 1))
+               {
+                       if (is_seen(m_ptr))
+                       {
+                               char m_name[80];
+
+                               /* Acquire the monster name */
+                               monster_desc(m_name, m_ptr, 0);
+
+                               /* Dump a message */
+#ifdef JP
+                               msg_format("%^s¤Ï¤â¤¦¸ºÂ®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
+#else
+                               msg_format("%^s is no longer slow.", m_name);
+#endif
+                       }
+               }
+               break;
+
+       case MTIMED_STUNNED:
+       {
+               int rlev = r_info[m_ptr->r_idx].level;
+
+               /* Recover from stun */
+               if (set_monster_stunned(m_idx, (randint0(10000) <= rlev * rlev) ? 0 : (MON_STUNNED(m_ptr) - 1)))
+               {
+                       /* Message if visible */
+                       if (is_seen(m_ptr))
+                       {
+                               char m_name[80];
+
+                               /* Acquire the monster name */
+                               monster_desc(m_name, m_ptr, 0);
+
+                               /* Dump a message */
+#ifdef JP
+                               msg_format("%^s¤ÏÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤Ã¤¿¡£", m_name);
+#else
+                               msg_format("%^s is no longer stunned.", m_name);
+#endif
+                       }
+               }
+               break;
+       }
+
+       case MTIMED_CONFUSED:
+               /* Reduce the confusion */
+               if (set_monster_confused(m_idx, MON_CONFUSED(m_ptr) - randint1(r_info[m_ptr->r_idx].level / 20 + 1)))
+               {
+                       /* Message if visible */
+                       if (is_seen(m_ptr))
+                       {
+                               char m_name[80];
+
+                               /* Acquire the monster name */
+                               monster_desc(m_name, m_ptr, 0);
+
+                               /* Dump a message */
+#ifdef JP
+                               msg_format("%^s¤Ïº®Í𤫤éΩ¤Áľ¤Ã¤¿¡£", m_name);
+#else
+                               msg_format("%^s is no longer confused.", m_name);
+#endif
+                       }
+               }
+               break;
+
+       case MTIMED_MONFEAR:
+               /* Reduce the fear */
+               if (set_monster_monfear(m_idx, MON_MONFEAR(m_ptr) - randint1(r_info[m_ptr->r_idx].level / 20 + 1)))
+               {
+                       /* Visual note */
+                       if (is_seen(m_ptr))
+                       {
+                               char m_name[80];
+#ifndef JP
+                               char m_poss[80];
+
+                               /* Acquire the monster possessive */
+                               monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
+#endif
+
+                               /* Acquire the monster name */
+                               monster_desc(m_name, m_ptr, 0);
+
+                               /* Dump a message */
+#ifdef JP
+                               msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
+#else
+                               msg_format("%^s recovers %s courage.", m_name, m_poss);
+#endif
+                       }
+               }
+               break;
+
+       case MTIMED_INVULNER:
+               /* Reduce by one, note if expires */
+               if (set_monster_invulner(m_idx, MON_INVULNER(m_ptr) - 1, TRUE))
+               {
+                       if (is_seen(m_ptr))
+                       {
+                               char m_name[80];
+
+                               /* Acquire the monster name */
+                               monster_desc(m_name, m_ptr, 0);
+
+                               /* Dump a message */
+#ifdef JP
+                               msg_format("%^s¤Ï¤â¤¦ÌµÅ¨¤Ç¤Ê¤¤¡£", m_name);
+#else
+                               msg_format("%^s is no longer invulnerable.", m_name);
+#endif
+                       }
+               }
+               break;
+       }
+}
+
+
+/*
+ * Process the counters of monsters (once per 10 game turns)
+ *
+ * These functions are to process monsters' counters same as player's.
+ */
+void process_monsters_mtimed(int mtimed_idx)
+{
+       int  i;
+       s16b *cur_mproc_list = mproc_list[mtimed_idx];
+
+       /* Hack -- calculate the "player noise" */
+       if (mtimed_idx == MTIMED_CSLEEP) csleep_noise = (1L << (30 - p_ptr->skill_stl));
+
+       /* Process the monsters (backwards) */
+       for (i = mproc_max[mtimed_idx] - 1; i >= 0; i--)
+       {
+               /* Access the monster */
+               process_monsters_mtimed_aux(cur_mproc_list[i], mtimed_idx);
+       }
+}
+
+
+void dispel_monster_status(int m_idx)
+{
+       monster_type *m_ptr = &m_list[m_idx];
+       char         m_name[80];
+
+       monster_desc(m_name, m_ptr, 0);
+       if (set_monster_invulner(m_idx, 0, TRUE))
+       {
+#ifdef JP
+               if (m_ptr->ml) msg_format("%s¤Ï¤â¤¦ÌµÅ¨¤Ç¤Ï¤Ê¤¤¡£", m_name);
+#else
+               if (m_ptr->ml) msg_format("%^s is no longer invulnerable.", m_name);
+#endif
+       }
+       if (set_monster_fast(m_idx, 0))
+       {
+#ifdef JP
+               if (m_ptr->ml) msg_format("%s¤Ï¤â¤¦²Ã®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
+#else
+               if (m_ptr->ml) msg_format("%^s is no longer fast.", m_name);
+#endif
+       }
+       if (set_monster_slow(m_idx, 0))
+       {
+#ifdef JP
+               if (m_ptr->ml) msg_format("%s¤Ï¤â¤¦¸ºÂ®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
+#else
+               if (m_ptr->ml) msg_format("%^s is no longer slow.", m_name);
+#endif
+       }
+}
+
 
 bool process_the_world(int num, int who, bool vs_player)
 {
@@ -3892,7 +4516,7 @@ bool process_the_world(int num, int who, bool vs_player)
        p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
 
        world_monster = 0;
-       if (vs_player || (los(py, px, m_ptr->fy, m_ptr->fx) && projectable(py, px, m_ptr->fy, m_ptr->fx)))
+       if (vs_player || (player_has_los_bold(m_ptr->fy, m_ptr->fx) && projectable(py, px, m_ptr->fy, m_ptr->fx)))
        {
 #ifdef JP
                msg_print("¡Ö»þ¤ÏÆ°¤­¤À¤¹¡Ä¡×");
@@ -3979,11 +4603,15 @@ void monster_gain_exp(int m_idx, int s_idx)
 
                if (is_pet(m_ptr) || m_ptr->ml)
                {
+                       if (!ignore_unview || player_can_see_bold(m_ptr->fy, m_ptr->fx))
+                       {
 #ifdef JP
-                       msg_format("%s¤Ï%s¤Ë¿Ê²½¤·¤¿¡£", m_name, r_name + r_ptr->name);
+                               msg_format("%s¤Ï%s¤Ë¿Ê²½¤·¤¿¡£", m_name, r_name + r_ptr->name);
 #else
-                       msg_format("%^s evolved into %s.", m_name, r_name + r_ptr->name);
+                               msg_format("%^s evolved into %s.", m_name, r_name + r_ptr->name);
 #endif
+                       }
+
                        r_info[old_r_idx].r_xtra1 |= MR1_SINKA;
 
                        /* Now you feel very close to this pet. */