OSDN Git Service

This commit was manufactured by cvs2svn to create tag
[hengbandforosx/hengbandosx.git] / src / spells2.c
index 3a7a9b2..e2b71e5 100644 (file)
@@ -1,16 +1,17 @@
 /* File: spells2.c */
 
-/* Purpose: Spell code (part 2) */
-
 /*
- * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
+ * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
  *
- * This software may be copied and distributed for educational, research, and
- * not for profit purposes provided that this copyright and statement are
- * included in all such copies.
+ * This software may be copied and distributed for educational, research,
+ * and not for profit purposes provided that this copyright and statement
+ * are included in all such copies.  Other copyrights may also apply.
  */
 
+/* Purpose: Spell code (part 2) */
+
 #include "angband.h"
+#include "grid.h"
 
 
 /*
@@ -748,7 +749,7 @@ info[i++] = "
                        break;
                case CLASS_BEASTMASTER:
 #ifdef JP
-info[i++] = "¤¢¤Ê¤¿¤Ï1ɤ¤ÎÀ¸Ì¿¤Î¤¢¤ë¥â¥ó¥¹¥¿¡¼¤ò»ÙÇÛ¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£(¥ì¥Ù¥ë/4 MP)";
+info[i++] = "¤¢¤Ê¤¿¤Ï1ÂΤÎÀ¸Ì¿¤Î¤¢¤ë¥â¥ó¥¹¥¿¡¼¤ò»ÙÇÛ¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£(¥ì¥Ù¥ë/4 MP)";
 #else
                        info[i++] = "You can dominate a monster (cost level/4).";
 #endif
@@ -813,14 +814,6 @@ info[i++] = "
                        }
                        break;
                case CLASS_BERSERKER:
-                       if (plev > 4)
-                       {
-#ifdef JP
-info[i++] = "¤¢¤Ê¤¿¤Ï¼«Ê¬¤Ç¶õÊ¢¤òËþ¤¿¤¹¤³¤È¤¬¤Ç¤­¤ë¡£";
-#else
-                               info[i++] = "You can satisfy hunger.";
-#endif
-                       }
                        if (plev > 9)
                        {
 #ifdef JP
@@ -1879,7 +1872,7 @@ info[i++] = "
 #ifdef JP
 info[i++] = "¤¢¤Ê¤¿¤ÎÉð´ï¤Ï¹¶·â¤ò³°¤·¤ä¤¹¤¤¡£";
 #else
-               info[i++] = "Your weapon causes you miss blows.";
+               info[i++] = "Your weapon causes you to miss blows.";
 #endif
 
        }
@@ -1928,7 +1921,7 @@ info[i++] = "
 #endif
 
        }
-       if (p_ptr->blessed)
+       if (IS_BLESSED())
        {
 #ifdef JP
 info[i++] = "¤¢¤Ê¤¿¤Ï¸øÀµ¤µ¤ò´¶¤¸¤Æ¤¤¤ë¡£";
@@ -1937,7 +1930,7 @@ info[i++] = "
 #endif
 
        }
-       if (p_ptr->hero)
+       if (IS_HERO())
        {
 #ifdef JP
 info[i++] = "¤¢¤Ê¤¿¤Ï¥Ò¡¼¥í¡¼µ¤Ê¬¤À¡£";
@@ -1973,7 +1966,7 @@ info[i++] = "
 #endif
 
        }
-       if (p_ptr->invuln)
+       if (IS_INVULN())
        {
 #ifdef JP
 info[i++] = "¤¢¤Ê¤¿¤Ï¸½ºß½ý¤Ä¤«¤Ê¤¤¡£";
@@ -2005,7 +1998,7 @@ info[i++] = "
 #ifdef JP
 info[i++] = "¤¢¤Ê¤¿¤Î¼ê¤Ï²Ð±ê¤Ëʤ¤ï¤ì¤Æ¤¤¤ë¡£";
 #else
-               info[i++] = "You can strike enemy with flame.";
+               info[i++] = "You can strike the enemy with flame.";
 #endif
 
        }
@@ -2014,7 +2007,7 @@ info[i++] = "
 #ifdef JP
 info[i++] = "¤¢¤Ê¤¿¤Î¼ê¤ÏÎ䵤¤Ëʤ¤ï¤ì¤Æ¤¤¤ë¡£";
 #else
-               info[i++] = "You can strike enemy with cold.";
+               info[i++] = "You can strike the enemy with cold.";
 #endif
 
        }
@@ -2023,7 +2016,7 @@ info[i++] = "
 #ifdef JP
 info[i++] = "¤¢¤Ê¤¿¤Î¼ê¤Ï»À¤Ëʤ¤ï¤ì¤Æ¤¤¤ë¡£";
 #else
-               info[i++] = "You can strike enemy with acid.";
+               info[i++] = "You can strike the enemy with acid.";
 #endif
 
        }
@@ -2032,7 +2025,7 @@ info[i++] = "
 #ifdef JP
 info[i++] = "¤¢¤Ê¤¿¤Î¼ê¤ÏÅÅ·â¤Ëʤ¤ï¤ì¤Æ¤¤¤ë¡£";
 #else
-               info[i++] = "You can strike enemy with electoric shock.";
+               info[i++] = "You can strike the enemy with electoric shock.";
 #endif
 
        }
@@ -2041,7 +2034,7 @@ info[i++] = "
 #ifdef JP
 info[i++] = "¤¢¤Ê¤¿¤Î¼ê¤ÏÆǤËʤ¤ï¤ì¤Æ¤¤¤ë¡£";
 #else
-               info[i++] = "You can strike enemy with poison.";
+               info[i++] = "You can strike the enemy with poison.";
 #endif
 
        }
@@ -2073,6 +2066,15 @@ info[i++] = "
 #endif
 
        }
+       if (p_ptr->alter_reality)
+       {
+#ifdef JP
+               info[i++] = "¤¢¤Ê¤¿¤Ï¤¹¤°¤Ë¤³¤ÎÀ¤³¦¤òÎ¥¤ì¤ë¤À¤í¤¦¡£";
+#else
+               info[i++] = "You will soon be altered.";
+#endif
+
+       }
        if (p_ptr->see_infra)
        {
 #ifdef JP
@@ -2339,7 +2341,7 @@ info[i++] = "
 #ifdef JP
 info[i++] = "¤¢¤Ê¤¿¤Ï¹ÔÆ°¤ÎÁ°¤Ë´í¸±¤ò»¡ÃΤ¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£";
 #else
-               info[i++] = "You will be warn before dangerous action.";
+               info[i++] = "You will be warned before dangerous actions.";
 #endif
 
        }
@@ -2348,7 +2350,7 @@ info[i++] = "
 #ifdef JP
 info[i++] = "¤¢¤Ê¤¿¤Ï¾¯¤Ê¤¤¾ÃÈñËâÎϤÇËâË¡¤ò¾§¤¨¤ë¤³¤È¤¬¤Ç¤­¤ë¡£";
 #else
-               info[i++] = "You can cast spell with fewer mana.";
+               info[i++] = "You can cast spells with fewer mana points.";
 #endif
 
        }
@@ -2366,7 +2368,7 @@ info[i++] = "
 #ifdef JP
 info[i++] = "¤¢¤Ê¤¿¤Ï¹â¤¤¼ºÇÔΨ¤ÇËâË¡¤ò¾§¤¨¤Ê¤±¤ì¤Ð¤¤¤±¤Ê¤¤¡£";
 #else
-               info[i++] = "Fail rate of your magic is incresed.";
+               info[i++] = "Fail rate of your magic is increased.";
 #endif
 
        }
@@ -2389,7 +2391,7 @@ info[i++] = "
 #endif
 
        }
-       else if ((p_ptr->resist_acid) && (p_ptr->oppose_acid))
+       else if (p_ptr->resist_acid && IS_OPPOSE_ACID())
        {
 #ifdef JP
 info[i++] = "¤¢¤Ê¤¿¤Ï»À¤Ø¤Î¶¯ÎϤÊÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
@@ -2398,7 +2400,7 @@ info[i++] = "
 #endif
 
        }
-       else if ((p_ptr->resist_acid) || (p_ptr->oppose_acid))
+       else if (p_ptr->resist_acid || IS_OPPOSE_ACID())
        {
 #ifdef JP
 info[i++] = "¤¢¤Ê¤¿¤Ï»À¤Ø¤ÎÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
@@ -2417,7 +2419,7 @@ info[i++] = "
 #endif
 
        }
-       else if ((p_ptr->resist_elec) && (p_ptr->oppose_elec))
+       else if (p_ptr->resist_elec && IS_OPPOSE_ELEC())
        {
 #ifdef JP
 info[i++] = "¤¢¤Ê¤¿¤ÏÅÅ·â¤Ø¤Î¶¯ÎϤÊÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
@@ -2426,7 +2428,7 @@ info[i++] = "
 #endif
 
        }
-       else if ((p_ptr->resist_elec) || (p_ptr->oppose_elec))
+       else if (p_ptr->resist_elec || IS_OPPOSE_ELEC())
        {
 #ifdef JP
 info[i++] = "¤¢¤Ê¤¿¤ÏÅÅ·â¤Ø¤ÎÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
@@ -2455,7 +2457,7 @@ info[i++] = "
 #endif
 
        }
-       else if ((p_ptr->resist_fire) && (p_ptr->oppose_fire))
+       else if (p_ptr->resist_fire && IS_OPPOSE_FIRE())
        {
 #ifdef JP
 info[i++] = "¤¢¤Ê¤¿¤Ï²Ð¤Ø¤Î¶¯ÎϤÊÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
@@ -2464,7 +2466,7 @@ info[i++] = "
 #endif
 
        }
-       else if ((p_ptr->resist_fire) || (p_ptr->oppose_fire))
+       else if (p_ptr->resist_fire || IS_OPPOSE_FIRE())
        {
 #ifdef JP
 info[i++] = "¤¢¤Ê¤¿¤Ï²Ð¤Ø¤ÎÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
@@ -2493,7 +2495,7 @@ info[i++] = "
 #endif
 
        }
-       else if ((p_ptr->resist_cold) && (p_ptr->oppose_cold))
+       else if (p_ptr->resist_cold && IS_OPPOSE_COLD())
        {
 #ifdef JP
 info[i++] = "¤¢¤Ê¤¿¤ÏÎ䵤¤Ø¤Î¶¯ÎϤÊÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
@@ -2502,7 +2504,7 @@ info[i++] = "
 #endif
 
        }
-       else if ((p_ptr->resist_cold) || (p_ptr->oppose_cold))
+       else if (p_ptr->resist_cold || IS_OPPOSE_COLD())
        {
 #ifdef JP
 info[i++] = "¤¢¤Ê¤¿¤ÏÎ䵤¤Ø¤ÎÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
@@ -2512,7 +2514,7 @@ info[i++] = "
 
        }
 
-       if ((p_ptr->resist_pois) && (p_ptr->oppose_pois))
+       if (p_ptr->resist_pois && IS_OPPOSE_POIS())
        {
 #ifdef JP
 info[i++] = "¤¢¤Ê¤¿¤ÏÆǤؤζ¯ÎϤÊÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
@@ -2521,7 +2523,7 @@ info[i++] = "
 #endif
 
        }
-       else if ((p_ptr->resist_pois) || (p_ptr->oppose_pois))
+       else if (p_ptr->resist_pois || IS_OPPOSE_POIS())
        {
 #ifdef JP
 info[i++] = "¤¢¤Ê¤¿¤ÏÆǤؤÎÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
@@ -3376,9 +3378,19 @@ info[i++] = "
        {
                info2[i]  = report_magics_aux(p_ptr->word_recall);
 #ifdef JP
-info[i++] = "¤³¤Î¸åµ¢´Ô¤Î¾Û¤òȯư¤¹¤ë¡£";
+               info[i++] = "¤³¤Î¸åµ¢´Ô¤Î¾Û¤òȯư¤¹¤ë¡£";
+#else
+               info[i++] = "You are waiting to be recalled";
+#endif
+
+       }
+       if (p_ptr->alter_reality)
+       {
+               info2[i]  = report_magics_aux(p_ptr->alter_reality);
+#ifdef JP
+               info[i++] = "¤³¤Î¸å¸½¼ÂÊÑÍƤ¬È¯Æ°¤¹¤ë¡£";
 #else
-               info[i++] = "You waiting to be recalled";
+               info[i++] = "You waiting to be altered";
 #endif
 
        }
@@ -3529,16 +3541,16 @@ bool detect_traps(int range, bool known)
                                /* Hack -- Memorize */
                                c_ptr->info |= (CAVE_MARK);
 
-                                if (c_ptr->mimic)
-                                {
-                                        /* Disclose a hidden trap */
-                                        disclose_grid(y, x);
-                                }
-                                else
-                                {
-                                        /* Redraw */
-                                        lite_spot(y, x);
-                                }
+                               if (c_ptr->mimic)
+                               {
+                                       /* Disclose a hidden trap */
+                                       disclose_grid(y, x);
+                               }
+                               else
+                               {
+                                       /* Redraw */
+                                       lite_spot(y, x);
+                               }
 
                                /* Obvious */
                                detect = TRUE;
@@ -3659,7 +3671,7 @@ bool detect_stairs(int range)
                            (c_ptr->feat == FEAT_LESS_LESS) ||
                            (c_ptr->feat == FEAT_MORE) ||
                            (c_ptr->feat == FEAT_MORE_MORE) ||
-                           (c_ptr->feat == FEAT_ENTRANCE))
+                           (c_ptr->feat == FEAT_ENTRANCE))
                        {
                                /* Hack -- Memorize */
                                c_ptr->info |= (CAVE_MARK);
@@ -4010,14 +4022,13 @@ bool detect_monsters_normal(int range)
                if (distance(py, px, y, x) > range) continue;
 
                /* Detect all non-invisible monsters */
-               if ((!(r_ptr->flags2 & RF2_INVISIBLE)) ||
-                   p_ptr->see_inv || p_ptr->tim_invis)
+               if (!(r_ptr->flags2 & RF2_INVISIBLE) || p_ptr->see_inv)
                {
                        /* Repair visibility later */
                        repair_monsters = TRUE;
 
                        /* Hack -- Detect monster */
-                       m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW);
+                       m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
 
                        /* Update the monster */
                        update_mon(i, FALSE);
@@ -4086,7 +4097,7 @@ bool detect_monsters_invis(int range)
                        repair_monsters = TRUE;
 
                        /* Hack -- Detect monster */
-                       m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW);
+                       m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
 
                        /* Update the monster */
                        update_mon(i, FALSE);
@@ -4145,21 +4156,24 @@ bool detect_monsters_evil(int range)
                /* Detect evil monsters */
                if (r_ptr->flags3 & RF3_EVIL)
                {
-                       /* Take note that they are evil */
-                       r_ptr->r_flags3 |= (RF3_EVIL);
-
-                       /* Update monster recall window */
-                       if (p_ptr->monster_race_idx == m_ptr->r_idx)
+                       if (is_original_ap(m_ptr))
                        {
-                               /* Window stuff */
-                               p_ptr->window |= (PW_MONSTER);
+                               /* Take note that they are evil */
+                               r_ptr->r_flags3 |= (RF3_EVIL);
+
+                               /* Update monster recall window */
+                               if (p_ptr->monster_race_idx == m_ptr->r_idx)
+                               {
+                                       /* Window stuff */
+                                       p_ptr->window |= (PW_MONSTER);
+                               }
                        }
 
                        /* Repair visibility later */
                        repair_monsters = TRUE;
 
                        /* Hack -- Detect monster */
-                       m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW);
+                       m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
 
                        /* Update the monster */
                        update_mon(i, FALSE);
@@ -4228,7 +4242,7 @@ bool detect_monsters_nonliving(int range)
                        repair_monsters = TRUE;
 
                        /* Hack -- Detect monster */
-                       m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW);
+                       m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
 
                        /* Update the monster */
                        update_mon(i, FALSE);
@@ -4295,7 +4309,7 @@ bool detect_monsters_mind(int range)
                        repair_monsters = TRUE;
 
                        /* Hack -- Detect monster */
-                       m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW);
+                       m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
 
                        /* Update the monster */
                        update_mon(i, FALSE);
@@ -4362,7 +4376,7 @@ bool detect_monsters_string(int range, cptr Match)
                        repair_monsters = TRUE;
 
                        /* Hack -- Detect monster */
-                       m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW);
+                       m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
 
                        /* Update the monster */
                        update_mon(i, FALSE);
@@ -4425,21 +4439,24 @@ cptr desc_monsters = "
                /* Detect evil monsters */
                if (r_ptr->flags3 & (match_flag))
                {
-                       /* Take note that they are something */
-                       r_ptr->r_flags3 |= (match_flag);
-
-                       /* Update monster recall window */
-                       if (p_ptr->monster_race_idx == m_ptr->r_idx)
+                       if (is_original_ap(m_ptr))
                        {
-                               /* Window stuff */
-                               p_ptr->window |= (PW_MONSTER);
+                               /* Take note that they are something */
+                               r_ptr->r_flags3 |= (match_flag);
+
+                               /* Update monster recall window */
+                               if (p_ptr->monster_race_idx == m_ptr->r_idx)
+                               {
+                                       /* Window stuff */
+                                       p_ptr->window |= (PW_MONSTER);
+                               }
                        }
 
                        /* Repair visibility later */
                        repair_monsters = TRUE;
 
                        /* Hack -- Detect monster */
-                       m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW);
+                       m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
 
                        /* Update the monster */
                        update_mon(i, FALSE);
@@ -4498,7 +4515,10 @@ bool detect_all(int range)
        if (detect_traps(range, TRUE)) detect = TRUE;
        if (detect_doors(range)) detect = TRUE;
        if (detect_stairs(range)) detect = TRUE;
-       if (detect_treasure(range)) detect = TRUE;
+
+       /* There are too many hidden treasure.  So... */
+       /* if (detect_treasure(range)) detect = TRUE; */
+
        if (detect_objects_gold(range)) detect = TRUE;
        if (detect_objects_normal(range)) detect = TRUE;
        if (detect_monsters_invis(range)) detect = TRUE;
@@ -4704,9 +4724,10 @@ void aggravate_monsters(int who)
                        {
                                /* Wake up */
                                m_ptr->csleep = 0;
+                               if (r_info[m_ptr->r_idx].flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
                                sleep = TRUE;
                        }
-                       if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG_NOPET;
+                       if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
                }
 
                /* Speed up monsters in line of sight */
@@ -4744,7 +4765,7 @@ bool symbol_genocide(int power, int player_cast)
        int     msec = delay_factor * delay_factor * delay_factor;
 
        /* Prevent genocide in quest levels */
-       if (p_ptr->inside_quest && !random_quest_number(dun_level))
+       if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
        {
                return (FALSE);
        }
@@ -4785,7 +4806,7 @@ while(!get_com("
 
                else if (player_cast && (r_ptr->level > randint0(power))) angry = TRUE;
 
-               else if (player_cast && (m_ptr->mflag2 & MFLAG_NOGENO)) angry = TRUE;
+               else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) angry = TRUE;
 
                /* Delete the monster */
                else delete_monster_idx(i);
@@ -4804,6 +4825,7 @@ msg_format("%^s
                        if (m_ptr->csleep)
                        {
                                m_ptr->csleep = 0;
+                               if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
                                if (m_ptr->ml && !p_ptr->blind)
                                {
 #ifdef JP
@@ -4825,7 +4847,7 @@ msg_format("%^s
                                }
                                set_hostile(m_ptr);
                        }
-                       if (one_in_(13)) m_ptr->mflag2 |= MFLAG_NOGENO;
+                       if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
                }
 
                if (player_cast)
@@ -4881,7 +4903,7 @@ bool mass_genocide(int power, int player_cast)
 
 
        /* Prevent mass genocide in quest levels */
-       if (p_ptr->inside_quest && !random_quest_number(dun_level))
+       if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
        {
                return (FALSE);
        }
@@ -4914,7 +4936,7 @@ bool mass_genocide(int power, int player_cast)
 
                else if (player_cast && (r_ptr->level > randint0(power))) angry = TRUE;
 
-               else if (player_cast && (m_ptr->mflag2 & MFLAG_NOGENO)) angry = TRUE;
+               else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) angry = TRUE;
 
                /* Delete the monster */
                else delete_monster_idx(i);
@@ -4933,6 +4955,7 @@ msg_format("%^s
                        if (m_ptr->csleep)
                        {
                                m_ptr->csleep = 0;
+                               if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
                                if (m_ptr->ml && !p_ptr->blind)
                                {
 #ifdef JP
@@ -4954,7 +4977,7 @@ msg_format("%^s
                                }
                                set_hostile(m_ptr);
                        }
-                       if (one_in_(13)) m_ptr->mflag2 |= MFLAG_NOGENO;
+                       if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
                }
 
                if (player_cast)
@@ -5011,7 +5034,7 @@ bool mass_genocide_undead(int power, int player_cast)
 
 
        /* Prevent mass genocide in quest levels */
-       if (p_ptr->inside_quest && !random_quest_number(dun_level))
+       if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
        {
                return (FALSE);
        }
@@ -5046,7 +5069,7 @@ bool mass_genocide_undead(int power, int player_cast)
 
                else if (player_cast && (r_ptr->level > randint0(power))) angry = TRUE;
 
-               else if (player_cast && (m_ptr->mflag2 & MFLAG_NOGENO)) angry = TRUE;
+               else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) angry = TRUE;
 
                /* Delete the monster */
                else delete_monster_idx(i);
@@ -5065,6 +5088,7 @@ msg_format("%^s
                        if (m_ptr->csleep)
                        {
                                m_ptr->csleep = 0;
+                               if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
                                if (m_ptr->ml && !p_ptr->blind)
                                {
 #ifdef JP
@@ -5086,7 +5110,7 @@ msg_format("%^s
                                }
                                set_hostile(m_ptr);
                        }
-                       if (one_in_(13)) m_ptr->mflag2 |= MFLAG_NOGENO;
+                       if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
                }
 
                if (player_cast)
@@ -5095,7 +5119,7 @@ msg_format("%^s
 #ifdef JP
 take_hit(DAMAGE_GENO, randint1(3), "¥¢¥ó¥Ç¥Ã¥É¾ÃÌǤμöʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
 #else
-                       take_hit(DAMAGE_GENO, randint1(3), "the strain of casting Mass Genocide", -1);
+                       take_hit(DAMAGE_GENO, randint1(3), "the strain of casting Annihilate Undead", -1);
 #endif
 
                }
@@ -5166,22 +5190,27 @@ bool probing(void)
                        char m_name[80];
 
                        /* Start the message */
+                       if (!probe)
+                       {
 #ifdef JP
-                       if (!probe) {msg_print("Ä´ººÃæ...");msg_print(NULL);}
+                               msg_print("Ä´ººÃæ...");
 #else
-                       if (!probe) {msg_print("Probing...");msg_print(NULL);}
+                               msg_print("Probing...");
 #endif
+                       }
+
+                       msg_print(NULL);
 
                        if (m_ptr->ap_r_idx != m_ptr->r_idx)
                        {
-                               if (m_ptr->mflag2 & MFLAG_KAGE)
-                                       m_ptr->mflag2 &= ~(MFLAG_KAGE);
+                               if (m_ptr->mflag2 & MFLAG2_KAGE)
+                                       m_ptr->mflag2 &= ~(MFLAG2_KAGE);
 
                                m_ptr->ap_r_idx = m_ptr->r_idx;
                                lite_spot(m_ptr->fy, m_ptr->fx);
                        }
                        /* Get "the monster" or "something" */
-                       monster_desc(m_name, m_ptr, 0x204);
+                       monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
 
                        speed = m_ptr->mspeed - 110;
                        if(m_ptr->fast) speed += 10;
@@ -5189,18 +5218,18 @@ bool probing(void)
 
                        /* Get the monster's alignment */
 #ifdef JP
-                       if ((r_ptr->flags3 & RF3_EVIL) && (r_ptr->flags3 & RF3_GOOD)) align = "Á±°­";
+                       if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = "Á±°­";
                        else if (r_ptr->flags3 & RF3_EVIL) align = "¼Ù°­";
                        else if (r_ptr->flags3 & RF3_GOOD) align = "Á±ÎÉ";
-                       else if ((m_ptr->sub_align & SUB_ALIGN_EVIL) && (m_ptr->sub_align & SUB_ALIGN_GOOD)) align = "ÃæΩ(Á±°­)";
+                       else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) align = "ÃæΩ(Á±°­)";
                        else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = "ÃæΩ(¼Ù°­)";
                        else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = "ÃæΩ(Á±ÎÉ)";
                        else align = "ÃæΩ";
 #else
-                       if ((r_ptr->flags3 & RF3_EVIL) && (r_ptr->flags3 & RF3_GOOD)) align = "good&evil";
+                       if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = "good&evil";
                        else if (r_ptr->flags3 & RF3_EVIL) align = "evil";
                        else if (r_ptr->flags3 & RF3_GOOD) align = "good";
-                       else if ((m_ptr->sub_align & SUB_ALIGN_EVIL) && (m_ptr->sub_align & SUB_ALIGN_GOOD)) align = "neutral(good&evil)";
+                       else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) align = "neutral(good&evil)";
                        else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = "neutral(evil)";
                        else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = "neutral(good)";
                        else align = "neutral";
@@ -5242,14 +5271,33 @@ sprintf(buf, "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:", m_name, align, m_
                        p_ptr->window |= (PW_MESSAGE);
                        window_stuff();
 
-                       /* Learn all of the non-spell, non-treasure flags */
-                       lore_do_probe(i);
-
                        if (m_ptr->ml) move_cursor_relative(m_ptr->fy, m_ptr->fx);
                        inkey();
 
                        Term_erase(0, 0, 255);
 
+                       /* Learn everything about this monster */
+                       if (lore_do_probe(m_ptr->r_idx))
+                       {
+                               char buf[80];
+
+                               /* Get base name of monster */
+                               strcpy(buf, (r_name + r_ptr->name));
+
+#ifdef JP
+                               /* Note that we learnt some new flags  -Mogami- */
+                               msg_format("%s¤Ë¤Ä¤¤¤Æ¤µ¤é¤Ë¾Ü¤·¤¯¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£", buf);
+#else
+                               /* Pluralize it */
+                               plural_aux(buf);
+
+                               /* Note that we learnt some new flags  -Mogami- */
+                               msg_format("You now know more about %s.", buf);
+#endif
+                               /* Clear -more- prompt */
+                               msg_print(NULL);
+                       }
+
                        /* Probe worked */
                        probe = TRUE;
                }
@@ -5286,27 +5334,26 @@ msg_print("
  * Later we may use one function for both "destruction" and
  * "earthquake" by using the "full" to select "destruction".
  */
-bool destroy_area(int y1, int x1, int r, int full)
+bool destroy_area(int y1, int x1, int r, bool in_generate)
 {
        int       y, x, k, t;
        cave_type *c_ptr;
        bool      flag = FALSE;
 
-
        /* Prevent destruction of quest levels and town */
-       if ((p_ptr->inside_quest && (p_ptr->inside_quest < MIN_RANDOM_QUEST)) || !dun_level)
+       if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
        {
                return (FALSE);
        }
 
+       /* Lose monster light */
+       clear_mon_lite();
+
        /* Big area of affect */
        for (y = (y1 - r); y <= (y1 + r); y++)
        {
                for (x = (x1 - r); x <= (x1 + r); x++)
                {
-                       monster_type *m_ptr;
-                       monster_race *r_ptr;
-
                        /* Skip illegal grids */
                        if (!in_bounds(y, x)) continue;
 
@@ -5318,53 +5365,82 @@ bool destroy_area(int y1, int x1, int r, int full)
 
                        /* Access the grid */
                        c_ptr = &cave[y][x];
-                       m_ptr = &m_list[c_ptr->m_idx];
-                       r_ptr = &r_info[m_ptr->r_idx];
 
                        /* Lose room and vault */
-                       c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE | CAVE_OBJECT);
+                       c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
 
                        /* Lose light and knowledge */
                        c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW);
 
-                       /* Hack -- Notice player affect */
-                       if ((x == px) && (y == py))
+                       if (!in_generate) /* Normal */
                        {
-                               /* Hurt the player later */
-                               flag = TRUE;
+                               /* Lose unsafety and runes/mirrors */
+                               c_ptr->info &= ~(CAVE_UNSAFE);
 
-                               /* Do not hurt this grid */
-                               continue;
+                               /* Hack -- Notice player affect */
+                               if (player_bold(y, x))
+                               {
+                                       /* Hurt the player later */
+                                       flag = TRUE;
+
+                                       /* Process "re-glowing" */
+                                       if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
+
+                                       /* Do not hurt this grid */
+                                       continue;
+                               }
                        }
 
                        /* Hack -- Skip the epicenter */
-                       if ((y == y1) && (x == x1)) continue;
-
-                       if ((r_ptr->flags1 & RF1_QUESTOR))
+                       if ((y == y1) && (x == x1))
                        {
-                               /* Heal the monster */
-                               m_list[c_ptr->m_idx].hp = m_list[c_ptr->m_idx].maxhp;
+                               /* Process "re-glowing" */
+                               if (!in_generate && is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
 
-                               /* Try to teleport away quest monsters */
-                               if (!teleport_away(c_ptr->m_idx, (r * 2) + 1, TRUE)) continue;
+                               continue;
                        }
-                       else
+
+                       if (c_ptr->m_idx)
                        {
-                               if (c_ptr->m_idx)
+                               monster_type *m_ptr = &m_list[c_ptr->m_idx];
+                               monster_race *r_ptr = &r_info[m_ptr->r_idx];
+
+                               if (in_generate) /* In generation */
+                               {
+                                       /* Delete the monster (if any) */
+                                       delete_monster(y, x);
+                               }
+                               else if (r_ptr->flags1 & RF1_QUESTOR)
                                {
-                                       if (record_named_pet && is_pet(&m_list[c_ptr->m_idx]) && m_list[c_ptr->m_idx].nickname)
+                                       /* Heal the monster */
+                                       m_ptr->hp = m_ptr->maxhp;
+
+                                       /* Try to teleport away quest monsters */
+                                       if (!teleport_away(c_ptr->m_idx, (r * 2) + 1, TRUE))
+                                       {
+                                               /* Process "re-glowing" */
+                                               if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
+
+                                               continue;
+                                       }
+                               }
+                               else
+                               {
+                                       if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
                                        {
                                                char m_name[80];
 
-                                               monster_desc(m_name, &m_list[c_ptr->m_idx], 0x08);
+                                               monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
                                                do_cmd_write_nikki(NIKKI_NAMED_PET, 6, m_name);
                                        }
+
+                                       /* Delete the monster (if any) */
+                                       delete_monster(y, x);
                                }
-                               /* Delete the monster (if any) */
-                               delete_monster(y, x);
                        }
 
-                       if (preserve_mode)
+                       /* During generation, destroyed artifacts are "preserved" */
+                       if (preserve_mode || in_generate)
                        {
                                s16b this_o_idx, next_o_idx = 0;
 
@@ -5380,88 +5456,133 @@ bool destroy_area(int y1, int x1, int r, int full)
                                        next_o_idx = o_ptr->next_o_idx;
 
                                        /* Hack -- Preserve unknown artifacts */
-                                       if (artifact_p(o_ptr) && !object_known_p(o_ptr))
+                                       if (artifact_p(o_ptr) && (!object_known_p(o_ptr) || in_generate))
                                        {
                                                /* Mega-Hack -- Preserve the artifact */
                                                a_info[o_ptr->name1].cur_num = 0;
+
+                                               if (in_generate && cheat_peek)
+                                               {
+                                                       char o_name[MAX_NLEN];
+                                                       object_desc_store(o_name, o_ptr, FALSE, 0);
+#ifdef JP
+                                                       msg_format("ÅÁÀâ¤Î¥¢¥¤¥Æ¥à (%s) ¤ÏÀ¸À®Ãæ¤Ë*Ç˲õ*¤µ¤ì¤¿¡£", o_name);
+#else
+                                                       msg_format("Artifact (%s) was *destroyed* during generation.", o_name);
+#endif
+                                               }
+                                       }
+                                       else if (in_generate && cheat_peek && o_ptr->art_name)
+                                       {
+#ifdef JP
+                                               msg_print("¥é¥ó¥À¥à¡¦¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Î1¤Ä¤ÏÀ¸À®Ãæ¤Ë*Ç˲õ*¤µ¤ì¤¿¡£");
+#else
+                                               msg_print("One of the random artifacts was *destroyed* during generation.");
+#endif
                                        }
                                }
                        }
+
+                       /* Delete objects */
                        delete_object(y, x);
 
-                       /* Destroy "valid" grids */
+                       /* Destroy "non-permanent" grids */
                        if (!cave_perma_bold(y, x))
                        {
                                /* Wall (or floor) type */
                                t = randint0(200);
 
-                               /* Granite */
-                               if (t < 20)
-                               {
-                                       /* Create granite wall */
-                                        cave_set_feat(y, x, FEAT_WALL_EXTRA);
-                               }
-
-                               /* Quartz */
-                               else if (t < 70)
+                               if (!in_generate) /* Normal */
                                {
-                                       /* Create quartz vein */
-                                        cave_set_feat(y, x, FEAT_QUARTZ);
+                                       if (t < 20)
+                                       {
+                                               /* Create granite wall */
+                                               cave_set_feat(y, x, FEAT_WALL_EXTRA);
+                                       }
+                                       else if (t < 70)
+                                       {
+                                               /* Create quartz vein */
+                                               cave_set_feat(y, x, FEAT_QUARTZ);
+                                       }
+                                       else if (t < 100)
+                                       {
+                                               /* Create magma vein */
+                                               cave_set_feat(y, x, FEAT_MAGMA);
+                                       }
+                                       else
+                                       {
+                                               /* Create floor */
+                                               cave_set_feat(y, x, floor_type[randint0(100)]);
+                                       }
                                }
-
-                               /* Magma */
-                               else if (t < 100)
+                               else /* In generation */
                                {
-                                       /* Create magma vein */
-                                        cave_set_feat(y, x, FEAT_MAGMA);
-                               }
+                                       if (t < 20)
+                                       {
+                                               /* Create granite wall */
+                                               place_extra_grid(c_ptr);
+                                       }
+                                       else if (t < 70)
+                                       {
+                                               /* Create quartz vein */
+                                               c_ptr->feat = FEAT_QUARTZ;
+                                       }
+                                       else if (t < 100)
+                                       {
+                                               /* Create magma vein */
+                                               c_ptr->feat = FEAT_MAGMA;
+                                       }
+                                       else
+                                       {
+                                               /* Create floor */
+                                               place_floor_grid(c_ptr);
+                                       }
 
-                               /* Floor */
-                               else
-                               {
-                                       /* Create floor */
-                                        cave_set_feat(y, x, floor_type[randint0(100)]);
+                                       /* Clear garbage of hidden trap or door */
+                                       c_ptr->mimic = 0;
                                }
                        }
                }
        }
 
 
-       /* Hack -- Affect player */
-       if (flag)
+       if (!in_generate)
        {
-               /* Message */
+               /* Hack -- Affect player */
+               if (flag)
+               {
+                       /* Message */
 #ifdef JP
-msg_print("dz¤¨¤ë¤è¤¦¤ÊÁ®¸÷¤¬È¯À¸¤·¤¿¡ª");
+                       msg_print("dz¤¨¤ë¤è¤¦¤ÊÁ®¸÷¤¬È¯À¸¤·¤¿¡ª");
 #else
-               msg_print("There is a searing blast of light!");
+                       msg_print("There is a searing blast of light!");
 #endif
 
-
-               /* Blind the player */
-               if (!p_ptr->resist_blind && !p_ptr->resist_lite)
-               {
-                       /* Become blind */
-                       (void)set_blind(p_ptr->blind + 10 + randint1(10));
+                       /* Blind the player */
+                       if (!p_ptr->resist_blind && !p_ptr->resist_lite)
+                       {
+                               /* Become blind */
+                               (void)set_blind(p_ptr->blind + 10 + randint1(10));
+                       }
                }
-       }
 
-       forget_flow();
+               forget_flow();
 
-       /* Mega-Hack -- Forget the view and lite */
-       p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
+               /* Mega-Hack -- Forget the view and lite */
+               p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
 
-       /* Update stuff */
-       p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
+               /* Update stuff */
+               p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
 
-       /* Update the monsters */
-       p_ptr->update |= (PU_MONSTERS);
+               /* Update the monsters */
+               p_ptr->update |= (PU_MONSTERS);
 
-       /* Redraw map */
-       p_ptr->redraw |= (PR_MAP);
+               /* Redraw map */
+               p_ptr->redraw |= (PR_MAP);
 
-       /* Window stuff */
-       p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+               /* Window stuff */
+               p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+       }
 
        /* Success */
        return (TRUE);
@@ -5497,7 +5618,7 @@ bool earthquake(int cy, int cx, int r)
 
 
        /* Prevent destruction of quest levels and town */
-       if ((p_ptr->inside_quest && (p_ptr->inside_quest < MIN_RANDOM_QUEST)) || !dun_level)
+       if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
        {
                return (FALSE);
        }
@@ -5539,21 +5660,33 @@ bool earthquake(int cy, int cx, int r)
                        c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK);
 
                        /* Skip the epicenter */
-                       if (!dx && !dy) continue;
+                       if (!dx && !dy)
+                       {
+                               /* Process "re-glowing" */
+                               if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
+
+                               continue;
+                       }
 
                        /* Skip most grids */
-                       if (randint0(100) < 85) continue;
+                       if (randint0(100) < 85)
+                       {
+                               /* Process "re-glowing" */
+                               if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
+
+                               continue;
+                       }
 
                        /* Damage this grid */
                        map[16+yy-cy][16+xx-cx] = TRUE;
 
                        /* Hack -- Take note of player damage */
-                       if ((yy == py) && (xx == px)) hurt = TRUE;
+                       if (player_bold(yy, xx)) hurt = TRUE;
                }
        }
 
        /* First, affect the player (if necessary) */
-       if (hurt && !(p_ptr->prace == RACE_SPECTRE) && !(p_ptr->wraith_form) && !(p_ptr->kabenuke))
+       if (hurt && !prace_is_(RACE_SPECTRE) && !p_ptr->wraith_form && !p_ptr->kabenuke)
        {
                /* Check around the player */
                for (i = 0; i < 8; i++)
@@ -5780,7 +5913,7 @@ if (damage) take_hit(DAMAGE_ATTACK, damage, "
                                                        if (map[16+y-cy][16+x-cx]) continue;
 
                                                        if (cave[y][x].m_idx) continue;
-                                                       if ((y == py) && (x == px)) continue;
+                                                       if (player_bold(y, x)) continue;
 
                                                        /* Count "safe" grids */
                                                        sn++;
@@ -5829,7 +5962,7 @@ msg_format("%^s
                                                        {
                                                                char m2_name[80];
 
-                                                               monster_desc(m2_name, m_ptr, 0x08);
+                                                               monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
                                                                do_cmd_write_nikki(NIKKI_NAMED_PET, 7, m2_name);
                                                        }
                                                }
@@ -5870,6 +6003,8 @@ msg_format("%^s
                }
        }
 
+       /* Lose monster light */
+       clear_mon_lite();
 
        /* Examine the quaked region */
        for (dy = -r; dy <= r; dy++)
@@ -5887,7 +6022,7 @@ msg_format("%^s
                        c_ptr = &cave[yy][xx];
 
                        /* Paranoia -- never affect player */
-/*                     if ((yy == py) && (xx == px)) continue; */
+/*                     if (player_bold(yy, xx)) continue; */
 
                        /* Destroy location (if valid) */
                        if (cave_valid_bold(yy, xx))
@@ -5897,9 +6032,6 @@ msg_format("%^s
                                /* Delete objects */
                                delete_object(yy, xx);
 
-                                /* Clear mirror, runes flag */
-                                c_ptr->info &= ~CAVE_OBJECT;
-
                                /* Wall (or floor) type */
                                t = (floor ? randint0(100) : 200);
 
@@ -5907,28 +6039,28 @@ msg_format("%^s
                                if (t < 20)
                                {
                                        /* Create granite wall */
-                                        cave_set_feat(y, x, FEAT_WALL_EXTRA);
+                                       cave_set_feat(yy, xx, FEAT_WALL_EXTRA);
                                }
 
                                /* Quartz */
                                else if (t < 70)
                                {
                                        /* Create quartz vein */
-                                        cave_set_feat(y, x, FEAT_QUARTZ);
+                                       cave_set_feat(yy, xx, FEAT_QUARTZ);
                                }
 
                                /* Magma */
                                else if (t < 100)
                                {
                                        /* Create magma vein */
-                                        cave_set_feat(y, x, FEAT_MAGMA);
+                                       cave_set_feat(yy, xx, FEAT_MAGMA);
                                }
 
                                /* Floor */
                                else
                                {
                                        /* Create floor */
-                                        cave_set_feat(y, x, floor_type[randint0(100)]);
+                                       cave_set_feat(yy, xx, floor_type[randint0(100)]);
                                }
                        }
                }
@@ -6000,13 +6132,13 @@ void discharge_minion(void)
                        delete_monster_idx(i);
                        continue;
                }
-               dam = m_ptr->hp / 2;
+               dam = m_ptr->maxhp / 2;
                if (dam > 100) dam = (dam-100)/2 + 100;
                if (dam > 400) dam = (dam-400)/2 + 400;
                if (dam > 800) dam = 800;
                project(i, 2+(r_ptr->level/20), m_ptr->fy,
                        m_ptr->fx, dam, GF_PLASMA, 
-                       PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_MONSTER, -1);
+                       PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
                delete_monster_idx(i);
        }
 }
@@ -6072,6 +6204,8 @@ static void cave_temp_room_lite(void)
                                /* Wake up! */
                                m_ptr->csleep = 0;
 
+                               if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+
                                /* Notice the "waking up" */
                                if (m_ptr->ml)
                                {
@@ -6086,8 +6220,8 @@ msg_format("%^s
 #else
                                        msg_format("%^s wakes up.", m_name);
 #endif
-                                        /* Redraw the health bar */
-                                        if (p_ptr->health_who == c_ptr->m_idx)
+                                       /* Redraw the health bar */
+                                       if (p_ptr->health_who == c_ptr->m_idx)
                                                p_ptr->redraw |= (PR_HEALTH);
 
                                }
@@ -6140,7 +6274,7 @@ static void cave_temp_room_unlite(void)
                if ((c_ptr->feat <= FEAT_INVIS) || (c_ptr->feat == FEAT_DIRT) || (c_ptr->feat == FEAT_GRASS))
                {
                        /* Forget the grid */
-                        if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
+                       if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
 
                        /* Notice */
                        note_spot(y, x);
@@ -6255,7 +6389,7 @@ static void cave_temp_room_aux(int y, int x, bool only_room)
                 * This leaves only a check for 6 bounding walls!
                 */
                if (in_bounds(y, x) && cave_floor_bold(y, x) &&
-                    (next_to_walls_adj(y, x) == 6) && (next_to_open(y, x) <= 1)) return;
+                   (next_to_walls_adj(y, x) == 6) && (next_to_open(y, x) <= 1)) return;
        }
 
        /* Paranoia -- verify space */
@@ -6322,6 +6456,11 @@ void lite_room(int y1, int x1)
 
        /* Now, lite them all up at once */
        cave_temp_room_lite();
+
+       if (p_ptr->special_defense & NINJA_S_STEALTH)
+       {
+               if (cave[py][px].info & CAVE_GLOW) set_superstealth(FALSE);
+       }
 }
 
 
@@ -6397,11 +6536,6 @@ msg_print("
        /* Lite up the room */
        lite_room(py, px);
 
-       if (p_ptr->special_defense & NINJA_S_STEALTH)
-       {
-               set_superstealth(FALSE);
-       }
-
        /* Assume seen */
        return (TRUE);
 }
@@ -6657,7 +6791,7 @@ msg_print("
        m_ptr = &m_list[c_ptr->m_idx];
        r_ptr = &r_info[m_ptr->r_idx];
 
-       if (r_ptr->flags3 & RF3_RES_TELE)
+       if (r_ptr->flagsr & RFR_RES_TELE)
        {
 #ifdef JP
 msg_print("¥Æ¥ì¥Ý¡¼¥È¤ò¼ÙË⤵¤ì¤¿¡ª");
@@ -6665,7 +6799,11 @@ msg_print("
                msg_print("Your teleportation is blocked!");
 #endif
 
+               if (m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
+
                m_ptr->csleep = 0;
+               if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+
                /* Failure */
                return FALSE;
        }
@@ -6712,14 +6850,7 @@ msg_print("
        verify_panel();
 
        /* Update stuff */
-       p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW);
-
-       /* Notice changes in view */
-       if (r_ptr->flags7 & (RF7_HAS_LITE_1 | RF7_HAS_LITE_2 | RF7_SELF_LITE_1 | RF7_SELF_LITE_2))
-       {
-               /* Update some things */
-               p_ptr->update |= (PU_MON_LITE);
-       }
+       p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
 
        /* Update the monsters */
        p_ptr->update |= (PU_DISTANCE);
@@ -6766,9 +6897,9 @@ bool project_hook(int typ, int dir, int dam, int flg)
 
 
 /*
- * Cast a bolt spell
- * Stop if we hit a monster, as a "bolt"
- * Affect monsters (not grids or objects)
+ * Cast a bolt spell.
+ * Stop if we hit a monster, as a "bolt".
+ * Affect monsters and grids (not objects).
  */
 bool fire_bolt(int typ, int dir, int dam)
 {
@@ -6778,9 +6909,9 @@ bool fire_bolt(int typ, int dir, int dam)
 
 
 /*
- * Cast a beam spell
- * Pass through monsters, as a "beam"
- * Affect monsters (not grids or objects)
+ * Cast a beam spell.
+ * Pass through monsters, as a "beam".
+ * Affect monsters, grids and objects.
  */
 bool fire_beam(int typ, int dir, int dam)
 {
@@ -6979,7 +7110,7 @@ bool wall_stone(void)
        bool dummy = (project(0, 1, py, px, 0, GF_STONE_WALL, flg, -1));
 
        /* Update stuff */
-       p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW);
+       p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
 
        /* Update the monsters */
        p_ptr->update |= (PU_MONSTERS);
@@ -7336,13 +7467,13 @@ void wall_breaker(void)
 
        if (randint1(80 + p_ptr->lev) < 70)
        {
-               while(attempts--)
+               while (attempts--)
                {
                        scatter(&y, &x, py, px, 4, 0);
 
                        if (!cave_floor_bold(y, x)) continue;
 
-                       if ((y != py) || (x != px)) break;
+                       if (!player_bold(y, x)) break;
                }
 
                project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
@@ -7358,11 +7489,11 @@ void wall_breaker(void)
 
                for (i = 0; i < num; i++)
                {
-                       while(1)
+                       while (1)
                        {
                                scatter(&y, &x, py, px, 10, 0);
 
-                               if ((y != py) && (x != px)) break;
+                               if (!player_bold(y, x)) break;
                        }
 
                        project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
@@ -7543,3 +7674,154 @@ void kawarimi(bool success)
        p_ptr->special_defense &= ~(NINJA_KAWARIMI);
        p_ptr->redraw |= (PR_STATUS);
 }
+
+
+/*
+ * "Rush Attack" routine for Samurai or Ninja
+ * Return value is for checking "done"
+ */
+bool rush_attack(bool *mdeath)
+{
+       int dir;
+       int tx, ty;
+       int tm_idx = 0;
+       u16b path_g[32];
+       int path_n, i;
+       bool tmp_mdeath = FALSE;
+       bool moved = FALSE;
+
+       if (mdeath) *mdeath = FALSE;
+
+       project_length = 5;
+       if (!get_aim_dir(&dir)) return FALSE;
+
+       /* Use the given direction */
+       tx = px + project_length * ddx[dir];
+       ty = py + project_length * ddy[dir];
+
+       /* Hack -- Use an actual "target" */
+       if ((dir == 5) && target_okay())
+       {
+               tx = target_col;
+               ty = target_row;
+       }
+
+       if (in_bounds(ty, tx)) tm_idx = cave[ty][tx].m_idx;
+
+       path_n = project_path(path_g, project_length, py, px, ty, tx, PROJECT_STOP | PROJECT_KILL);
+       project_length = 0;
+
+       /* No need to move */
+       if (!path_n) return TRUE;
+
+       /* Use ty and tx as to-move point */
+       ty = py;
+       tx = px;
+
+       /* Project along the path */
+       for (i = 0; i < path_n; i++)
+       {
+               monster_type *m_ptr;
+
+               int ny = GRID_Y(path_g[i]);
+               int nx = GRID_X(path_g[i]);
+
+               if (cave_empty_bold(ny, nx) && player_can_enter(cave[ny][nx].feat))
+               {
+                       ty = ny;
+                       tx = nx;
+
+                       /* Go to next grid */
+                       continue;
+               }
+
+               if (!cave[ny][nx].m_idx)
+               {
+                       if (tm_idx)
+                       {
+#ifdef JP
+                               msg_print("¼ºÇÔ¡ª");
+#else
+                               msg_print("Failed!");
+#endif
+                       }
+                       else
+                       {
+#ifdef JP
+                               msg_print("¤³¤³¤Ë¤ÏÆþ¿È¤Ç¤ÏÆþ¤ì¤Ê¤¤¡£");
+#else
+                               msg_print("You can't move to that place.");
+#endif
+                       }
+
+                       /* Exit loop */
+                       break;
+               }
+
+               /* Move player before updating the monster */
+               if (!player_bold(ty, tx)) teleport_player_to(ty, tx, FALSE);
+
+               /* Update the monster */
+               update_mon(cave[ny][nx].m_idx, TRUE);
+
+               /* Found a monster */
+               m_ptr = &m_list[cave[ny][nx].m_idx];
+
+               if (tm_idx != cave[ny][nx].m_idx)
+               {
+#ifdef JP
+                       msg_format("%s%s¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª", tm_idx ? "Ê̤Î" : "",
+                                  m_ptr->ml ? "¥â¥ó¥¹¥¿¡¼" : "²¿¤«");
+#else
+                       msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
+#endif
+               }
+               else if (!player_bold(ty, tx))
+               {
+                       /* Hold the monster name */
+                       char m_name[80];
+
+                       /* Get the monster name (BEFORE polymorphing) */
+                       monster_desc(m_name, m_ptr, 0);
+#ifdef JP
+                       msg_format("ÁÇÁ᤯%s¤Î²û¤ËÆþ¤ê¹þ¤ó¤À¡ª", m_name);
+#else
+                       msg_format("You quickly jump in and attack %s!", m_name);
+#endif
+               }
+
+               if (!player_bold(ty, tx)) teleport_player_to(ty, tx, FALSE);
+               moved = TRUE;
+               tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
+
+               break;
+       }
+
+       if (!moved && !player_bold(ty, tx)) teleport_player_to(ty, tx, FALSE);
+
+       if (mdeath) *mdeath = tmp_mdeath;
+       return TRUE;
+}
+
+
+/*
+ * Remove all mirrors in this floor
+ */
+void remove_all_mirrors(bool explode)
+{
+       int x, y;
+
+       for (x = 0; x < cur_wid; x++)
+       {
+               for (y = 0; y < cur_hgt; y++)
+               {
+                       if (is_mirror_grid(&cave[y][x]))
+                       {
+                               remove_mirror(y, x);
+                               if (explode)
+                                       project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS,
+                                               (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
+                       }
+               }
+       }
+}