OSDN Git Service

New Magic-Eater's class power, 'Powerful Activation' is added
[hengband/hengband.git] / src / spells2.c
index 8f89ee8..ae68634 100644 (file)
@@ -109,9 +109,9 @@ sprintf(Dummy, "
        info[i++] = "";
 
 #ifdef JP
-       sprintf(Dummy, "¸½ºß¤Î°À­ : %s(%ld)", your_alignment(), p_ptr->align);
+       sprintf(Dummy, "¸½ºß¤Î°À­ : %s(%ld)", your_alignment(), (long int)p_ptr->align);
 #else
-       sprintf(Dummy, "Your alighnment : %s(%ld)", your_alignment(), p_ptr->align);
+       sprintf(Dummy, "Your alighnment : %s(%ld)", your_alignment(), (long int)p_ptr->align);
 #endif
        strcpy(buf[1], Dummy);
        info[i++] = buf[1];
@@ -528,7 +528,7 @@ sprintf(Dummy, "
 
                        info[i++] = Dummy;
                        break;
-               case RACE_KUTA:
+               case RACE_KUTAR:
                        if (plev > 19)
 #ifdef JP
 info[i++] = "¤¢¤Ê¤¿¤Ï d20+30 ¥¿¡¼¥ó¤Î´Ö²£¤Ë¿­¤Ó¤ë¤³¤È¤¬¤Ç¤­¤ë¡£(15 MP)";
@@ -588,8 +588,9 @@ info[i++] = "
 #endif
                        }
                        break;
-               case CLASS_MAGE:
                case CLASS_HIGH_MAGE:
+                       if (p_ptr->realm1 == REALM_HEX) break;
+               case CLASS_MAGE:
                case CLASS_SORCERER:
                        if (plev > 24)
                        {
@@ -749,7 +750,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
@@ -773,9 +774,9 @@ info[i++] = "
                        if (plev > 47)
                        {
 #ifdef JP
-info[i++] = "¤¢¤Ê¤¿¤Ï1¥¿¡¼¥ó¤Ë2²óËâË¡¤ò¾§¤¨¤ë¤³¤È¤¬¤Ç¤­¤ë¡£(77 MP)";
+info[i++] = "¤¢¤Ê¤¿¤Ï1¥¿¡¼¥ó¤Ë2²óËâË¡¤ò¾§¤¨¤ë¤³¤È¤¬¤Ç¤­¤ë¡£(20 MP)";
 #else
-                               info[i++] = "You can cast two spells in one time (cost 77).";
+                               info[i++] = "You can cast two spells in one time (cost 20).";
 #endif
                        }
                        break;
@@ -1924,7 +1925,7 @@ info[i++] = "
        if (IS_BLESSED())
        {
 #ifdef JP
-info[i++] = "¤¢¤Ê¤¿¤Ï¸øÀµ¤µ¤ò´¶¤¸¤Æ¤¤¤ë¡£";
+info[i++] = "¤¢¤Ê¤¿¤Ï¹â·é¤µ¤ò´¶¤¸¤Æ¤¤¤ë¡£";
 #else
                info[i++] = "You feel rightous.";
 #endif
@@ -2093,7 +2094,7 @@ info[i++] = "
 #endif
 
        }
-       if (p_ptr->ffall)
+       if (p_ptr->levitation)
        {
 #ifdef JP
 info[i++] = "¤¢¤Ê¤¿¤ÏÈô¤Ö¤³¤È¤¬¤Ç¤­¤ë¡£";
@@ -3248,7 +3249,7 @@ void report_magics(void)
        {
                info2[i]  = report_magics_aux(p_ptr->blind);
 #ifdef JP
-info[i++] = "¤¢¤Ê¤¿¤ÏÌܤ¬¸«¤¨¤Ê¤¤¡£";
+info[i++] = "¤¢¤Ê¤¿¤ÏÌܤ¬¸«¤¨¤Ê¤¤";
 #else
                info[i++] = "You cannot see";
 #endif
@@ -3258,7 +3259,7 @@ info[i++] = "
        {
                info2[i]  = report_magics_aux(p_ptr->confused);
 #ifdef JP
-info[i++] = "¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë¡£";
+info[i++] = "¤¢¤Ê¤¿¤Ïº®Í𤷤Ƥ¤¤ë";
 #else
                info[i++] = "You are confused";
 #endif
@@ -3268,7 +3269,7 @@ info[i++] = "
        {
                info2[i]  = report_magics_aux(p_ptr->afraid);
 #ifdef JP
-info[i++] = "¤¢¤Ê¤¿¤Ï¶²Éݤ˿¯¤µ¤ì¤Æ¤¤¤ë¡£";
+info[i++] = "¤¢¤Ê¤¿¤Ï¶²Éݤ˿¯¤µ¤ì¤Æ¤¤¤ë";
 #else
                info[i++] = "You are terrified";
 #endif
@@ -3278,7 +3279,7 @@ info[i++] = "
        {
                info2[i]  = report_magics_aux(p_ptr->poisoned);
 #ifdef JP
-info[i++] = "¤¢¤Ê¤¿¤ÏÆǤ˿¯¤µ¤ì¤Æ¤¤¤ë¡£";
+info[i++] = "¤¢¤Ê¤¿¤ÏÆǤ˿¯¤µ¤ì¤Æ¤¤¤ë";
 #else
                info[i++] = "You are poisoned";
 #endif
@@ -3288,7 +3289,7 @@ info[i++] = "
        {
                info2[i]  = report_magics_aux(p_ptr->image);
 #ifdef JP
-info[i++] = "¤¢¤Ê¤¿¤Ï¸¸³Ð¤ò¸«¤Æ¤¤¤ë¡£";
+info[i++] = "¤¢¤Ê¤¿¤Ï¸¸³Ð¤ò¸«¤Æ¤¤¤ë";
 #else
                info[i++] = "You are hallucinating";
 #endif
@@ -3298,7 +3299,7 @@ info[i++] = "
        {
                info2[i]  = report_magics_aux(p_ptr->blessed);
 #ifdef JP
-info[i++] = "¤¢¤Ê¤¿¤Ï¸øÀµ¤µ¤ò´¶¤¸¤Æ¤¤¤ë¡£";
+info[i++] = "¤¢¤Ê¤¿¤Ï¹â·é¤µ¤ò´¶¤¸¤Æ¤¤¤ë";
 #else
                info[i++] = "You feel rightous";
 #endif
@@ -3308,7 +3309,7 @@ info[i++] = "
        {
                info2[i]  = report_magics_aux(p_ptr->hero);
 #ifdef JP
-info[i++] = "¤¢¤Ê¤¿¤Ï¥Ò¡¼¥í¡¼µ¤Ê¬¤À¡£";
+info[i++] = "¤¢¤Ê¤¿¤Ï¥Ò¡¼¥í¡¼µ¤Ê¬¤À";
 #else
                info[i++] = "You feel heroic";
 #endif
@@ -3318,7 +3319,7 @@ info[i++] = "
        {
                info2[i]  = report_magics_aux(p_ptr->shero);
 #ifdef JP
-info[i++] = "¤¢¤Ê¤¿¤ÏÀïÆ®¶¸¤À¡£";
+info[i++] = "¤¢¤Ê¤¿¤ÏÀïÆ®¶¸¤À";
 #else
                info[i++] = "You are in a battle rage";
 #endif
@@ -3328,7 +3329,7 @@ info[i++] = "
        {
                info2[i]  = report_magics_aux(p_ptr->protevil);
 #ifdef JP
-info[i++] = "¤¢¤Ê¤¿¤Ï¼Ù°­¤Ê¤ë¸ºß¤«¤é¼é¤é¤ì¤Æ¤¤¤ë¡£";
+info[i++] = "¤¢¤Ê¤¿¤Ï¼Ù°­¤Ê¤ë¸ºß¤«¤é¼é¤é¤ì¤Æ¤¤¤ë";
 #else
                info[i++] = "You are protected from evil";
 #endif
@@ -3338,7 +3339,7 @@ info[i++] = "
        {
                info2[i]  = report_magics_aux(p_ptr->shield);
 #ifdef JP
-info[i++] = "¤¢¤Ê¤¿¤Ï¿ÀÈë¤Î¥·¡¼¥ë¥É¤Ç¼é¤é¤ì¤Æ¤¤¤ë¡£";
+info[i++] = "¤¢¤Ê¤¿¤Ï¿ÀÈë¤Î¥·¡¼¥ë¥É¤Ç¼é¤é¤ì¤Æ¤¤¤ë";
 #else
                info[i++] = "You are protected by a mystic shield";
 #endif
@@ -3348,7 +3349,7 @@ info[i++] = "
        {
                info2[i]  = report_magics_aux(p_ptr->invuln);
 #ifdef JP
-info[i++] = "̵Ũ¤Ç¤¤¤é¤ì¤ë¡£";
+info[i++] = "¤¢¤Ê¤¿¤Ï̵Ũ¤À";
 #else
                info[i++] = "You are invulnerable";
 #endif
@@ -3358,7 +3359,7 @@ info[i++] = "̵Ũ
        {
                info2[i]  = report_magics_aux(p_ptr->wraith_form);
 #ifdef JP
-info[i++] = "Í©Âβ½¤Ç¤­¤ë¡£";
+info[i++] = "¤¢¤Ê¤¿¤ÏÍ©Â⽤·¤Æ¤¤¤ë";
 #else
                info[i++] = "You are incorporeal";
 #endif
@@ -3368,7 +3369,7 @@ info[i++] = "ͩ
        {
                info2[i]  = 7;
 #ifdef JP
-info[i++] = "¤¢¤Ê¤¿¤Î¼ê¤ÏÀÖ¤¯µ±¤¤¤Æ¤¤¤ë¡£";
+info[i++] = "¤¢¤Ê¤¿¤Î¼ê¤ÏÀÖ¤¯µ±¤¤¤Æ¤¤¤ë";
 #else
                info[i++] = "Your hands are glowing dull red.";
 #endif
@@ -3378,7 +3379,7 @@ 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
@@ -3388,7 +3389,7 @@ info[i++] = "
        {
                info2[i]  = report_magics_aux(p_ptr->alter_reality);
 #ifdef JP
-               info[i++] = "¤³¤Î¸å¸½¼ÂÊÑÍƤ¬È¯Æ°¤¹¤ë¡£";
+               info[i++] = "¤³¤Î¸å¸½¼ÂÊÑÍƤ¬È¯Æ°¤¹¤ë";
 #else
                info[i++] = "You waiting to be altered";
 #endif
@@ -3398,7 +3399,7 @@ info[i++] = "
        {
                info2[i]  = report_magics_aux(p_ptr->oppose_acid);
 #ifdef JP
-info[i++] = "¤¢¤Ê¤¿¤Ï»À¤Ø¤ÎÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
+info[i++] = "¤¢¤Ê¤¿¤Ï»À¤Ø¤ÎÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë";
 #else
                info[i++] = "You are resistant to acid";
 #endif
@@ -3408,7 +3409,7 @@ info[i++] = "
        {
                info2[i]  = report_magics_aux(p_ptr->oppose_elec);
 #ifdef JP
-info[i++] = "¤¢¤Ê¤¿¤ÏÅÅ·â¤Ø¤ÎÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
+info[i++] = "¤¢¤Ê¤¿¤ÏÅÅ·â¤Ø¤ÎÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë";
 #else
                info[i++] = "You are resistant to lightning";
 #endif
@@ -3418,7 +3419,7 @@ info[i++] = "
        {
                info2[i]  = report_magics_aux(p_ptr->oppose_fire);
 #ifdef JP
-info[i++] = "¤¢¤Ê¤¿¤Ï²Ð¤Ø¤ÎÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
+info[i++] = "¤¢¤Ê¤¿¤Ï²Ð¤Ø¤ÎÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë";
 #else
                info[i++] = "You are resistant to fire";
 #endif
@@ -3428,7 +3429,7 @@ info[i++] = "
        {
                info2[i]  = report_magics_aux(p_ptr->oppose_cold);
 #ifdef JP
-info[i++] = "¤¢¤Ê¤¿¤ÏÎ䵤¤Ø¤ÎÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
+info[i++] = "¤¢¤Ê¤¿¤ÏÎ䵤¤Ø¤ÎÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë";
 #else
                info[i++] = "You are resistant to cold";
 #endif
@@ -3438,7 +3439,7 @@ info[i++] = "
        {
                info2[i]  = report_magics_aux(p_ptr->oppose_pois);
 #ifdef JP
-info[i++] = "¤¢¤Ê¤¿¤ÏÆǤؤÎÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡£";
+info[i++] = "¤¢¤Ê¤¿¤ÏÆǤؤÎÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë";
 #else
                info[i++] = "You are resistant to poison";
 #endif
@@ -3453,7 +3454,7 @@ info[i++] = "
 
        /* Label the information */
 #ifdef JP
-prt("           ËâË¡        :", 1, 15);
+prt("    ¸½ºß¤«¤«¤Ã¤Æ¤¤¤ëËâË¡     :", 1, 15);
 #else
        prt("     Your Current Magic:", 1, 15);
 #endif
@@ -3464,7 +3465,7 @@ prt("           
        {
                /* Show the info */
 #ifdef JP
-sprintf(Dummy, "¤¢¤Ê¤¿¤Ï%s%s", info[j],
+               sprintf(Dummy, "%-28s : ´ü´Ö - %s ", info[j],
 #else
                sprintf(Dummy, "%s %s.", info[j],
 #endif
@@ -3535,7 +3536,7 @@ static bool detect_feat_flag(int range, int flag, bool known)
                        }
 
                        /* Detect flags */
-                       if (have_flag(f_flags_grid(c_ptr), flag))
+                       if (cave_have_flag_grid(c_ptr, flag))
                        {
                                /* Detect secrets */
                                disclose_grid(y, x);
@@ -3566,7 +3567,7 @@ bool detect_traps(int range, bool known)
 
        if (known) p_ptr->dtrap = TRUE;
 
-       if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT)) detect = FALSE;
+       if (music_singing(MUSIC_DETECT) && p_ptr->magic_num1[2] > 0) detect = FALSE;
 
        /* Describe */
        if (detect)
@@ -3590,7 +3591,7 @@ bool detect_doors(int range)
 {
        bool detect = detect_feat_flag(range, FF_DOOR, TRUE);
 
-       if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT)) detect = FALSE;
+       if (music_singing(MUSIC_DETECT) && p_ptr->magic_num1[2] > 0) detect = FALSE;
 
        /* Describe */
        if (detect)
@@ -3614,7 +3615,7 @@ bool detect_stairs(int range)
 {
        bool detect = detect_feat_flag(range, FF_STAIRS, TRUE);
 
-       if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT)) detect = FALSE;
+       if (music_singing(MUSIC_DETECT) && p_ptr->magic_num1[2] > 0) detect = FALSE;
 
        /* Describe */
        if (detect)
@@ -3638,7 +3639,7 @@ bool detect_treasure(int range)
 {
        bool detect = detect_feat_flag(range, FF_HAS_GOLD, TRUE);
 
-       if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT+6)) detect = FALSE;
+       if (music_singing(MUSIC_DETECT) && p_ptr->magic_num1[2] > 6) detect = FALSE;
 
        /* Describe */
        if (detect)
@@ -3699,7 +3700,7 @@ bool detect_objects_gold(int range)
                }
        }
 
-       if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT+6)) detect = FALSE;
+       if (music_singing(MUSIC_DETECT) && p_ptr->magic_num1[2] > 6) detect = FALSE;
 
        /* Describe */
        if (detect)
@@ -3766,7 +3767,7 @@ bool detect_objects_normal(int range)
                }
        }
 
-       if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT+6)) detect = FALSE;
+       if (music_singing(MUSIC_DETECT) && p_ptr->magic_num1[2] > 6) detect = FALSE;
 
        /* Describe */
        if (detect)
@@ -3828,9 +3829,8 @@ bool detect_objects_magic(int range)
                tv = o_ptr->tval;
 
                /* Artifacts, misc magic items, or enchanted wearables */
-               if (artifact_p(o_ptr) ||
-                       ego_item_p(o_ptr) ||
-                       o_ptr->art_name ||
+               if (object_is_artifact(o_ptr) ||
+                       object_is_ego(o_ptr) ||
                    (tv == TV_WHISTLE) ||
                    (tv == TV_AMULET) ||
                        (tv == TV_RING) ||
@@ -3846,11 +3846,12 @@ bool detect_objects_magic(int range)
                    (tv == TV_DEATH_BOOK) ||
                    (tv == TV_TRUMP_BOOK) ||
                        (tv == TV_ARCANE_BOOK) ||
-                       (tv == TV_ENCHANT_BOOK) ||
+                       (tv == TV_CRAFT_BOOK) ||
                        (tv == TV_DAEMON_BOOK) ||
                        (tv == TV_CRUSADE_BOOK) ||
                        (tv == TV_MUSIC_BOOK) ||
                        (tv == TV_HISSATSU_BOOK) ||
+                       (tv == TV_HEX_BOOK) ||
                    ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
                {
                        /* Memorize the item */
@@ -3924,7 +3925,7 @@ bool detect_monsters_normal(int range)
                }
        }
 
-       if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT+3)) flag = FALSE;
+       if (music_singing(MUSIC_DETECT) && p_ptr->magic_num1[2] > 3) flag = FALSE;
 
        /* Describe */
        if (flag)
@@ -3993,7 +3994,7 @@ bool detect_monsters_invis(int range)
                }
        }
 
-       if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT+3)) flag = FALSE;
+       if (music_singing(MUSIC_DETECT) && p_ptr->magic_num1[2] > 3) flag = FALSE;
 
        /* Describe */
        if (flag)
@@ -4272,7 +4273,7 @@ bool detect_monsters_string(int range, cptr Match)
                }
        }
 
-       if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT+3)) flag = FALSE;
+       if (music_singing(MUSIC_DETECT) && p_ptr->magic_num1[2] > 3) flag = FALSE;
 
        /* Describe */
        if (flag)
@@ -4443,7 +4444,7 @@ bool project_hack(int typ, int dam)
                x = m_ptr->fx;
 
                /* Require line of sight */
-               if (!player_has_los_bold(y, x)) continue;
+               if (!player_has_los_bold(y, x) || !projectable(py, px, y, x)) continue;
 
                /* Mark the monster */
                m_ptr->mflag |= (MFLAG_TEMP);
@@ -4484,17 +4485,17 @@ bool speed_monsters(void)
 /*
  * Slow monsters
  */
-bool slow_monsters(void)
+bool slow_monsters(int power)
 {
-       return (project_hack(GF_OLD_SLOW, p_ptr->lev));
+       return (project_hack(GF_OLD_SLOW, power));
 }
 
 /*
  * Sleep monsters
  */
-bool sleep_monsters(void)
+bool sleep_monsters(int power)
 {
-       return (project_hack(GF_OLD_SLEEP, p_ptr->lev));
+       return (project_hack(GF_OLD_SLEEP, power));
 }
 
 
@@ -4606,11 +4607,9 @@ void aggravate_monsters(int who)
                if (m_ptr->cdis < MAX_SIGHT * 2)
                {
                        /* Wake up */
-                       if (m_ptr->csleep)
+                       if (MON_CSLEEP(m_ptr))
                        {
-                               /* Wake up */
-                               m_ptr->csleep = 0;
-                               if (r_info[m_ptr->r_idx].flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+                               (void)set_monster_csleep(i, 0);
                                sleep = TRUE;
                        }
                        if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
@@ -4621,7 +4620,7 @@ void aggravate_monsters(int who)
                {
                        if (!is_pet(m_ptr))
                        {
-                               m_ptr->fast = MIN(200, m_ptr->fast + 100);
+                               (void)set_monster_fast(i, MON_FAST(m_ptr) + 100);
                                speed = TRUE;
                        }
                }
@@ -4629,8 +4628,8 @@ void aggravate_monsters(int who)
 
        /* Messages */
 #ifdef JP
-if (speed) msg_print("ÉÕ¶á¤Ç²¿¤«¤¬ÆÍÇ¡¶½Ê³¤·¤¿¤è¤¦¤Ê´¶¤¸¤ò¼õ¤±¤¿¡ª");
-else if (sleep) msg_print("²¿¤«¤¬ÆÍÇ¡¶½Ê³¤·¤¿¤è¤¦¤ÊÁû¡¹¤·¤¤²»¤¬±ó¤¯¤Ëʹ¤³¤¨¤¿¡ª");
+       if (speed) msg_print("ÉÕ¶á¤Ç²¿¤«¤¬ÆÍÇ¡¶½Ê³¤·¤¿¤è¤¦¤Ê´¶¤¸¤ò¼õ¤±¤¿¡ª");
+       else if (sleep) msg_print("²¿¤«¤¬ÆÍÇ¡¶½Ê³¤·¤¿¤è¤¦¤ÊÁû¡¹¤·¤¤²»¤¬±ó¤¯¤Ëʹ¤³¤¨¤¿¡ª");
 #else
        if (speed) msg_print("You feel a sudden stirring nearby!");
        else if (sleep) msg_print("You hear a sudden stirring in the distance!");
@@ -4639,157 +4638,180 @@ else if (sleep) msg_print("
 }
 
 
-
 /*
- * Delete all non-unique/non-quest monsters of a given "type" from the level
+ * Delete a non-unique/non-quest monster
  */
-bool symbol_genocide(int power, int player_cast)
+bool genocide_aux(int m_idx, int power, bool player_cast, int dam_side, cptr spell_name)
 {
-       int     i;
-       char    typ;
-       bool    result = FALSE;
-       int     msec = delay_factor * delay_factor * delay_factor;
+       int          msec = delay_factor * delay_factor * delay_factor;
+       monster_type *m_ptr = &m_list[m_idx];
+       monster_race *r_ptr = &r_info[m_ptr->r_idx];
+       bool         resist = FALSE;
 
-       /* Prevent genocide in quest levels */
-       if (p_ptr->inside_quest && !random_quest_number(dun_level))
-       {
-               return (FALSE);
-       }
+       if (is_pet(m_ptr) && !player_cast) return FALSE;
 
-       /* Mega-Hack -- Get a monster symbol */
-#ifdef JP
-while(!get_com("¤É¤Î¼ïÎà(ʸ»ú)¤Î¥â¥ó¥¹¥¿¡¼¤òËõ»¦¤·¤Þ¤¹¤«: ", &typ, FALSE));
-#else
-       while(!get_com("Choose a monster race (by symbol) to genocide: ", &typ, FALSE));
-#endif
-
-
-       /* Delete the monsters of that "type" */
-       for (i = 1; i < m_max; i++)
-       {
-               monster_type    *m_ptr = &m_list[i];
-               monster_race    *r_ptr = &r_info[m_ptr->r_idx];
-               bool angry = FALSE;
-               char m_name[80];
-
-               /* Paranoia -- Skip dead monsters */
-               if (!m_ptr->r_idx) continue;
+       /* Hack -- Skip Unique Monsters or Quest Monsters */
+       if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
 
-               /* Skip "wrong" monsters */
-               if (r_ptr->d_char != typ) continue;
+       else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
 
-               if (is_pet(m_ptr) && !player_cast) continue;
+       else if (m_idx == p_ptr->riding) resist = TRUE;
 
-               /* Hack -- Skip Unique Monsters */
-               if (r_ptr->flags1 & (RF1_UNIQUE)) angry = TRUE;
+       else if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle) resist = TRUE;
 
-               /* Hack -- Skip Quest Monsters */
-               else if (r_ptr->flags1 & RF1_QUESTOR) angry = TRUE;
+       else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
 
-               else if (r_ptr->flags7 & RF7_UNIQUE2) angry = TRUE;
+       else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
 
-               else if (i == p_ptr->riding) angry = TRUE;
+       /* Delete the monster */
+       else
+       {
+               if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
+               {
+                       char m_name[80];
 
-               else if (player_cast && (r_ptr->level > randint0(power))) angry = TRUE;
+                       monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
+                       do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
+               }
 
-               else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) angry = TRUE;
+               delete_monster_idx(m_idx);
+       }
 
-               /* Delete the monster */
-               else delete_monster_idx(i);
+       if (resist && player_cast)
+       {
+               bool see_m = is_seen(m_ptr);
+               char m_name[80];
 
-               if (angry && player_cast)
+               monster_desc(m_name, m_ptr, 0);
+               if (see_m)
                {
-                       monster_desc(m_name, m_ptr, 0);
-                       if (m_ptr->ml && !p_ptr->blind)
-                       {
 #ifdef JP
-msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
+                       msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
 #else
-                               msg_format("%^s is unaffected.", m_name);
+                       msg_format("%^s is unaffected.", m_name);
 #endif
-                       }
-                       if (m_ptr->csleep)
+               }
+               if (MON_CSLEEP(m_ptr))
+               {
+                       (void)set_monster_csleep(m_idx, 0);
+                       if (m_ptr->ml)
                        {
-                               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
-msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
+                               msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
 #else
-                                       msg_format("%^s wakes up.", m_name);
+                               msg_format("%^s wakes up.", m_name);
 #endif
-                               }
                        }
-                       if (is_friendly(m_ptr) && !is_pet(m_ptr))
+               }
+               if (is_friendly(m_ptr) && !is_pet(m_ptr))
+               {
+                       if (see_m)
                        {
-                               if (m_ptr->ml && !p_ptr->blind)
-                               {
 #ifdef JP
-                                       msg_format("%s¤ÏÅܤä¿¡ª", m_name);
+                               msg_format("%s¤ÏÅܤä¿¡ª", m_name);
 #else
-                                       msg_format("%^s gets angry!", m_name);
+                               msg_format("%^s gets angry!", m_name);
 #endif
-                               }
-                               set_hostile(m_ptr);
                        }
-                       if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
+                       set_hostile(m_ptr);
                }
+               if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
+       }
 
-               if (player_cast)
-               {
-                       /* Take damage */
+       if (player_cast)
+       {
+               /* Take damage */
 #ifdef JP
-take_hit(DAMAGE_GENO, randint1(4), "Ëõ»¦¤Î¼öʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
+               take_hit(DAMAGE_GENO, randint1(dam_side), format("%^s¤Î¼öʸ¤ò¾§¤¨¤¿ÈèÏ«", spell_name), -1);
 #else
-                       take_hit(DAMAGE_GENO, randint1(4), "the strain of casting Genocide", -1);
+               take_hit(DAMAGE_GENO, randint1(dam_side), format("the strain of casting %^s", spell_name), -1);
 #endif
+       }
 
-               }
+       /* Visual feedback */
+       move_cursor_relative(py, px);
 
-               /* Visual feedback */
-               move_cursor_relative(py, px);
+       /* Redraw */
+       p_ptr->redraw |= (PR_HP);
 
-               /* Redraw */
-               p_ptr->redraw |= (PR_HP);
+       /* Window stuff */
+       p_ptr->window |= (PW_PLAYER);
 
-               /* Window stuff */
-               p_ptr->window |= (PW_PLAYER);
+       /* Handle */
+       handle_stuff();
+
+       /* Fresh */
+       Term_fresh();
+
+       /* Delay */
+       Term_xtra(TERM_XTRA_DELAY, msec);
+
+       return !resist;
+}
+
+
+/*
+ * Delete all non-unique/non-quest monsters of a given "type" from the level
+ */
+bool symbol_genocide(int power, bool player_cast)
+{
+       int  i;
+       char typ;
+       bool result = FALSE;
+
+       /* Prevent genocide in quest levels */
+       if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
+       {
+               return (FALSE);
+       }
 
-               /* Handle */
-               handle_stuff();
+       /* Mega-Hack -- Get a monster symbol */
+#ifdef JP
+       while (!get_com("¤É¤Î¼ïÎà(ʸ»ú)¤Î¥â¥ó¥¹¥¿¡¼¤òËõ»¦¤·¤Þ¤¹¤«: ", &typ, FALSE)) ;
+#else
+       while (!get_com("Choose a monster race (by symbol) to genocide: ", &typ, FALSE)) ;
+#endif
+
+       /* Delete the monsters of that "type" */
+       for (i = 1; i < m_max; i++)
+       {
+               monster_type *m_ptr = &m_list[i];
+               monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
-               /* Fresh */
-               Term_fresh();
+               /* Paranoia -- Skip dead monsters */
+               if (!m_ptr->r_idx) continue;
 
-               /* Delay */
-               Term_xtra(TERM_XTRA_DELAY, msec);
+               /* Skip "wrong" monsters */
+               if (r_ptr->d_char != typ) continue;
 
                /* Take note */
-               result = TRUE;
+#ifdef JP
+               result |= genocide_aux(i, power, player_cast, 4, "Ëõ»¦");
+#else
+               result |= genocide_aux(i, power, player_cast, 4, "Genocide");
+#endif
        }
+
        if (result)
        {
                chg_virtue(V_VITALITY, -2);
                chg_virtue(V_CHANCE, -1);
        }
 
-       return (result);
+       return result;
 }
 
 
 /*
  * Delete all nearby (non-unique) monsters
  */
-bool mass_genocide(int power, int player_cast)
+bool mass_genocide(int power, bool player_cast)
 {
-       int     i;
-       bool    result = FALSE;
-       int     msec = delay_factor * delay_factor * delay_factor;
-
+       int  i;
+       bool result = FALSE;
 
        /* 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);
        }
@@ -4797,10 +4819,7 @@ bool mass_genocide(int power, int player_cast)
        /* Delete the (nearby) monsters */
        for (i = 1; i < m_max; i++)
        {
-               monster_type    *m_ptr = &m_list[i];
-               monster_race    *r_ptr = &r_info[m_ptr->r_idx];
-               bool angry = FALSE;
-               char m_name[80];
+               monster_type *m_ptr = &m_list[i];
 
                /* Paranoia -- Skip dead monsters */
                if (!m_ptr->r_idx) continue;
@@ -4808,94 +4827,12 @@ bool mass_genocide(int power, int player_cast)
                /* Skip distant monsters */
                if (m_ptr->cdis > MAX_SIGHT) continue;
 
-               if (is_pet(m_ptr) && !player_cast) continue;
-
-               /* Hack -- Skip unique monsters */
-               if (r_ptr->flags1 & (RF1_UNIQUE)) angry = TRUE;
-
-               /* Hack -- Skip Quest Monsters */
-               else if (r_ptr->flags1 & RF1_QUESTOR) angry = TRUE;
-
-               else if (r_ptr->flags7 & RF7_UNIQUE2) angry = TRUE;
-
-               else if (i == p_ptr->riding) angry = TRUE;
-
-               else if (player_cast && (r_ptr->level > randint0(power))) angry = TRUE;
-
-               else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) angry = TRUE;
-
-               /* Delete the monster */
-               else delete_monster_idx(i);
-
-               if (angry && player_cast)
-               {
-                       monster_desc(m_name, m_ptr, 0);
-                       if (m_ptr->ml && !p_ptr->blind)
-                       {
-#ifdef JP
-msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
-#else
-                               msg_format("%^s is unaffected.", m_name);
-#endif
-                       }
-                       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
-msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
-#else
-                                       msg_format("%^s wakes up.", m_name);
-#endif
-                               }
-                       }
-                       if (is_friendly(m_ptr) && !is_pet(m_ptr))
-                       {
-                               if (m_ptr->ml && !p_ptr->blind)
-                               {
-#ifdef JP
-                                       msg_format("%s¤ÏÅܤä¿¡ª", m_name);
-#else
-                                       msg_format("%^s gets angry!", m_name);
-#endif
-                               }
-                               set_hostile(m_ptr);
-                       }
-                       if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
-               }
-
-               if (player_cast)
-               {
-                       /* Hack -- visual feedback */
+               /* Note effect */
 #ifdef JP
-take_hit(DAMAGE_GENO, randint1(3), "¼þÊÕËõ»¦¤Î¼öʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
+               result |= genocide_aux(i, power, player_cast, 3, "¼þÊÕËõ»¦");
 #else
-                       take_hit(DAMAGE_GENO, randint1(3), "the strain of casting Mass Genocide", -1);
+               result |= genocide_aux(i, power, player_cast, 3, "Mass Genocide");
 #endif
-
-               }
-
-               move_cursor_relative(py, px);
-
-               /* Redraw */
-               p_ptr->redraw |= (PR_HP);
-
-               /* Window stuff */
-               p_ptr->window |= (PW_PLAYER);
-
-               /* Handle */
-               handle_stuff();
-
-               /* Fresh */
-               Term_fresh();
-
-               /* Delay */
-               Term_xtra(TERM_XTRA_DELAY, msec);
-
-               /* Note effect */
-               result = TRUE;
        }
 
        if (result)
@@ -4904,7 +4841,7 @@ take_hit(DAMAGE_GENO, randint1(3), "
                chg_virtue(V_CHANCE, -1);
        }
 
-       return (result);
+       return result;
 }
 
 
@@ -4912,15 +4849,13 @@ take_hit(DAMAGE_GENO, randint1(3), "
 /*
  * Delete all nearby (non-unique) undead
  */
-bool mass_genocide_undead(int power, int player_cast)
+bool mass_genocide_undead(int power, bool player_cast)
 {
-       int     i;
-       bool    result = FALSE;
-       int     msec = delay_factor * delay_factor * delay_factor;
-
+       int  i;
+       bool result = FALSE;
 
        /* 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);
        }
@@ -4928,10 +4863,8 @@ bool mass_genocide_undead(int power, int player_cast)
        /* Delete the (nearby) monsters */
        for (i = 1; i < m_max; i++)
        {
-               monster_type    *m_ptr = &m_list[i];
-               monster_race    *r_ptr = &r_info[m_ptr->r_idx];
-               bool angry = FALSE;
-               char m_name[80];
+               monster_type *m_ptr = &m_list[i];
+               monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
                /* Paranoia -- Skip dead monsters */
                if (!m_ptr->r_idx) continue;
@@ -4941,94 +4874,12 @@ bool mass_genocide_undead(int power, int player_cast)
                /* Skip distant monsters */
                if (m_ptr->cdis > MAX_SIGHT) continue;
 
-               if (is_pet(m_ptr) && !player_cast) continue;
-
-               /* Hack -- Skip unique monsters */
-               if (r_ptr->flags1 & (RF1_UNIQUE)) angry = TRUE;
-
-               /* Hack -- Skip Quest Monsters */
-               else if (r_ptr->flags1 & RF1_QUESTOR) angry = TRUE;
-
-               else if (r_ptr->flags7 & RF7_UNIQUE2) angry = TRUE;
-
-               else if (i == p_ptr->riding) angry = TRUE;
-
-               else if (player_cast && (r_ptr->level > randint0(power))) angry = TRUE;
-
-               else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) angry = TRUE;
-
-               /* Delete the monster */
-               else delete_monster_idx(i);
-
-               if (angry && player_cast)
-               {
-                       monster_desc(m_name, m_ptr, 0);
-                       if (m_ptr->ml && !p_ptr->blind)
-                       {
-#ifdef JP
-msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
-#else
-                               msg_format("%^s is unaffected.", m_name);
-#endif
-                       }
-                       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
-msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
-#else
-                                       msg_format("%^s wakes up.", m_name);
-#endif
-                               }
-                       }
-                       if (is_friendly(m_ptr) && !is_pet(m_ptr))
-                       {
-                               if (m_ptr->ml && !p_ptr->blind)
-                               {
-#ifdef JP
-                                       msg_format("%s¤ÏÅܤä¿¡ª", m_name);
-#else
-                                       msg_format("%^s gets angry!", m_name);
-#endif
-                               }
-                               set_hostile(m_ptr);
-                       }
-                       if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
-               }
-
-               if (player_cast)
-               {
-                       /* Hack -- visual feedback */
+               /* Note effect */
 #ifdef JP
-take_hit(DAMAGE_GENO, randint1(3), "¥¢¥ó¥Ç¥Ã¥É¾ÃÌǤμöʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
+               result |= genocide_aux(i, power, player_cast, 3, "¥¢¥ó¥Ç¥Ã¥É¾ÃÌÇ");
 #else
-                       take_hit(DAMAGE_GENO, randint1(3), "the strain of casting Mass Genocide", -1);
+               result |= genocide_aux(i, power, player_cast, 3, "Annihilate Undead");
 #endif
-
-               }
-
-               move_cursor_relative(py, px);
-
-               /* Redraw */
-               p_ptr->redraw |= (PR_HP);
-
-               /* Window stuff */
-               p_ptr->window |= (PW_PLAYER);
-
-               /* Handle */
-               handle_stuff();
-
-               /* Fresh */
-               Term_fresh();
-
-               /* Delay */
-               Term_xtra(TERM_XTRA_DELAY, msec);
-
-               /* Note effect */
-               result = TRUE;
        }
 
        if (result)
@@ -5037,7 +4888,7 @@ take_hit(DAMAGE_GENO, randint1(3), "
                chg_virtue(V_CHANCE, -1);
        }
 
-       return (result);
+       return result;
 }
 
 
@@ -5087,7 +4938,7 @@ bool probing(void)
 
                        msg_print(NULL);
 
-                       if (m_ptr->ap_r_idx != m_ptr->r_idx)
+                       if (!is_original_ap(m_ptr))
                        {
                                if (m_ptr->mflag2 & MFLAG2_KAGE)
                                        m_ptr->mflag2 &= ~(MFLAG2_KAGE);
@@ -5099,8 +4950,8 @@ bool probing(void)
                        monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
 
                        speed = m_ptr->mspeed - 110;
-                       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;
 
                        /* Get the monster's alignment */
 #ifdef JP
@@ -5137,17 +4988,17 @@ sprintf(buf, "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:", m_name, align, m_
                        }
 
 #ifdef JP
-                       if (m_ptr->csleep) strcat(buf,"¿ç̲ ");
-                       if (m_ptr->stunned) strcat(buf,"ۯ۰ ");
-                       if (m_ptr->monfear) strcat(buf,"¶²ÉÝ ");
-                       if (m_ptr->confused) strcat(buf,"º®Íð ");
-                       if (m_ptr->invulner) strcat(buf,"̵Ũ ");
+                       if (MON_CSLEEP(m_ptr)) strcat(buf,"¿ç̲ ");
+                       if (MON_STUNNED(m_ptr)) strcat(buf,"ۯ۰ ");
+                       if (MON_MONFEAR(m_ptr)) strcat(buf,"¶²ÉÝ ");
+                       if (MON_CONFUSED(m_ptr)) strcat(buf,"º®Íð ");
+                       if (MON_INVULNER(m_ptr)) strcat(buf,"̵Ũ ");
 #else
-                       if (m_ptr->csleep) strcat(buf,"sleeping ");
-                       if (m_ptr->stunned) strcat(buf,"stunned ");
-                       if (m_ptr->monfear) strcat(buf,"scared ");
-                       if (m_ptr->confused) strcat(buf,"confused ");
-                       if (m_ptr->invulner) strcat(buf,"invulnerable ");
+                       if (MON_CSLEEP(m_ptr)) strcat(buf,"sleeping ");
+                       if (MON_STUNNED(m_ptr)) strcat(buf,"stunned ");
+                       if (MON_MONFEAR(m_ptr)) strcat(buf,"scared ");
+                       if (MON_CONFUSED(m_ptr)) strcat(buf,"confused ");
+                       if (MON_INVULNER(m_ptr)) strcat(buf,"invulnerable ");
 #endif
                        buf[strlen(buf)-1] = '\0';
                        prt(buf,0,0);
@@ -5232,6 +5083,9 @@ bool destroy_area(int y1, int x1, int r, bool in_generate)
                return (FALSE);
        }
 
+       /* Lose monster light */
+       if (!in_generate) clear_mon_lite();
+
        /* Big area of affect */
        for (y = (y1 - r); y <= (y1 + r); y++)
        {
@@ -5257,8 +5111,8 @@ bool destroy_area(int y1, int x1, int r, bool in_generate)
 
                        if (!in_generate) /* Normal */
                        {
-                               /* Lose unsafety and runes/mirrors */
-                               c_ptr->info &= ~(CAVE_UNSAFE | CAVE_OBJECT);
+                               /* Lose unsafety */
+                               c_ptr->info &= ~(CAVE_UNSAFE);
 
                                /* Hack -- Notice player affect */
                                if (player_bold(y, x))
@@ -5290,7 +5144,7 @@ bool destroy_area(int y1, int x1, int r, bool in_generate)
                                        m_ptr->hp = m_ptr->maxhp;
 
                                        /* Try to teleport away quest monsters */
-                                       if (!teleport_away(c_ptr->m_idx, (r * 2) + 1, TRUE)) continue;
+                                       if (!teleport_away(c_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
                                }
                                else
                                {
@@ -5299,7 +5153,7 @@ bool destroy_area(int y1, int x1, int r, bool in_generate)
                                                char m_name[80];
 
                                                monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
-                                               do_cmd_write_nikki(NIKKI_NAMED_PET, 6, m_name);
+                                               do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
                                        }
 
                                        /* Delete the monster (if any) */
@@ -5324,7 +5178,7 @@ bool destroy_area(int y1, int x1, int r, bool in_generate)
                                        next_o_idx = o_ptr->next_o_idx;
 
                                        /* Hack -- Preserve unknown artifacts */
-                                       if (artifact_p(o_ptr) && (!object_known_p(o_ptr) || in_generate))
+                                       if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
                                        {
                                                /* Mega-Hack -- Preserve the artifact */
                                                a_info[o_ptr->name1].cur_num = 0;
@@ -5355,7 +5209,7 @@ bool destroy_area(int y1, int x1, int r, bool in_generate)
                        delete_object(y, x);
 
                        /* Destroy "non-permanent" grids */
-                       if (!cave_perma_bold(y, x))
+                       if (!cave_perma_grid(c_ptr))
                        {
                                /* Wall (or floor) type */
                                t = randint0(200);
@@ -5365,17 +5219,17 @@ bool destroy_area(int y1, int x1, int r, bool in_generate)
                                        if (t < 20)
                                        {
                                                /* Create granite wall */
-                                               cave_set_feat(y, x, FEAT_WALL);
+                                               cave_set_feat(y, x, feat_granite);
                                        }
                                        else if (t < 70)
                                        {
                                                /* Create quartz vein */
-                                               cave_set_feat(y, x, FEAT_QUARTZ);
+                                               cave_set_feat(y, x, feat_quartz_vein);
                                        }
                                        else if (t < 100)
                                        {
                                                /* Create magma vein */
-                                               cave_set_feat(y, x, FEAT_MAGMA);
+                                               cave_set_feat(y, x, feat_magma_vein);
                                        }
                                        else
                                        {
@@ -5393,12 +5247,12 @@ bool destroy_area(int y1, int x1, int r, bool in_generate)
                                        else if (t < 70)
                                        {
                                                /* Create quartz vein */
-                                               c_ptr->feat = FEAT_QUARTZ;
+                                               c_ptr->feat = feat_quartz_vein;
                                        }
                                        else if (t < 100)
                                        {
                                                /* Create magma vein */
-                                               c_ptr->feat = FEAT_MAGMA;
+                                               c_ptr->feat = feat_magma_vein;
                                        }
                                        else
                                        {
@@ -5413,9 +5267,47 @@ bool destroy_area(int y1, int x1, int r, bool in_generate)
                }
        }
 
-
        if (!in_generate)
        {
+               /* Process "re-glowing" */
+               for (y = (y1 - r); y <= (y1 + r); y++)
+               {
+                       for (x = (x1 - r); x <= (x1 + r); x++)
+                       {
+                               /* Skip illegal grids */
+                               if (!in_bounds(y, x)) continue;
+
+                               /* Extract the distance */
+                               k = distance(y1, x1, y, x);
+
+                               /* Stay in the circle of death */
+                               if (k > r) continue;
+
+                               /* Access the grid */
+                               c_ptr = &cave[y][x];
+
+                               if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
+                               else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
+                               {
+                                       int i, yy, xx;
+                                       cave_type *cc_ptr;
+
+                                       for (i = 0; i < 9; i++)
+                                       {
+                                               yy = y + ddy_ddd[i];
+                                               xx = x + ddx_ddd[i];
+                                               if (!in_bounds2(yy, xx)) continue;
+                                               cc_ptr = &cave[yy][xx];
+                                               if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
+                                               {
+                                                       c_ptr->info |= CAVE_GLOW;
+                                                       break;
+                                               }
+                                       }
+                               }
+                       }
+               }
+
                /* Hack -- Affect player */
                if (flag)
                {
@@ -5440,16 +5332,18 @@ bool destroy_area(int y1, int x1, int r, bool in_generate)
                p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
 
                /* Update stuff */
-               p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
-
-               /* Update the monsters */
-               p_ptr->update |= (PU_MONSTERS);
+               p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
 
                /* Redraw map */
                p_ptr->redraw |= (PR_MAP);
 
                /* Window stuff */
                p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+
+               if (p_ptr->special_defense & NINJA_S_STEALTH)
+               {
+                       if (cave[py][px].info & CAVE_GLOW) set_superstealth(FALSE);
+               }
        }
 
        /* Success */
@@ -5475,9 +5369,9 @@ bool destroy_area(int y1, int x1, int r, bool in_generate)
  * for a single turn, unless that monster can pass_walls or kill_walls.
  * This has allowed massive simplification of the "monster" code.
  */
-bool earthquake(int cy, int cx, int r)
+bool earthquake_aux(int cy, int cx, int r, int m_idx)
 {
-       int             i, t, y, x, yy, xx, dy, dx, oy, ox;
+       int             i, t, y, x, yy, xx, dy, dx;
        int             damage = 0;
        int             sn = 0, sy = 0, sx = 0;
        bool            hurt = FALSE;
@@ -5575,31 +5469,28 @@ bool earthquake(int cy, int cx, int r)
                        case 1:
                        {
 #ifdef JP
-msg_print("¥À¥ó¥¸¥ç¥ó¤ÎÊɤ¬Êø¤ì¤¿¡ª");
+                               msg_print("¥À¥ó¥¸¥ç¥ó¤ÎÊɤ¬Êø¤ì¤¿¡ª");
 #else
                                msg_print("The cave ceiling collapses!");
 #endif
-
                                break;
                        }
                        case 2:
                        {
 #ifdef JP
-msg_print("¥À¥ó¥¸¥ç¥ó¤Î¾²¤¬ÉÔ¼«Á³¤Ë¤Í¤¸¶Ê¤¬¤Ã¤¿¡ª");
+                               msg_print("¥À¥ó¥¸¥ç¥ó¤Î¾²¤¬ÉÔ¼«Á³¤Ë¤Í¤¸¶Ê¤¬¤Ã¤¿¡ª");
 #else
                                msg_print("The cave floor twists in an unnatural way!");
 #endif
-
                                break;
                        }
                        default:
                        {
 #ifdef JP
-msg_print("¥À¥ó¥¸¥ç¥ó¤¬Íɤ줿¡ªÊø¤ì¤¿´ä¤¬Æ¬¤Ë¹ß¤Ã¤Æ¤­¤¿¡ª");
+                               msg_print("¥À¥ó¥¸¥ç¥ó¤¬Íɤ줿¡ªÊø¤ì¤¿´ä¤¬Æ¬¤Ë¹ß¤Ã¤Æ¤­¤¿¡ª");
 #else
                                msg_print("The cave quakes!  You are pummeled with debris!");
 #endif
-
                                break;
                        }
                }
@@ -5609,11 +5500,10 @@ msg_print("
                {
                        /* Message and damage */
 #ifdef JP
-msg_print("¤¢¤Ê¤¿¤Ï¤Ò¤É¤¤²ø²æ¤òÉé¤Ã¤¿¡ª");
+                       msg_print("¤¢¤Ê¤¿¤Ï¤Ò¤É¤¤²ø²æ¤òÉé¤Ã¤¿¡ª");
 #else
                        msg_print("You are severely crushed!");
 #endif
-
                        damage = 200;
                }
 
@@ -5626,22 +5516,20 @@ msg_print("
                                case 1:
                                {
 #ifdef JP
-msg_print("¹ß¤êÃí¤°´ä¤ò¤¦¤Þ¤¯Èò¤±¤¿¡ª");
+                                       msg_print("¹ß¤êÃí¤°´ä¤ò¤¦¤Þ¤¯Èò¤±¤¿¡ª");
 #else
                                        msg_print("You nimbly dodge the blast!");
 #endif
-
                                        damage = 0;
                                        break;
                                }
                                case 2:
                                {
 #ifdef JP
-msg_print("´äÀФ¬¤¢¤Ê¤¿¤Ëľ·â¤·¤¿!");
+                                       msg_print("´äÀФ¬¤¢¤Ê¤¿¤Ëľ·â¤·¤¿!");
 #else
                                        msg_print("You are bashed by rubble!");
 #endif
-
                                        damage = damroll(10, 4);
                                        (void)set_stun(p_ptr->stun + randint1(50));
                                        break;
@@ -5649,57 +5537,55 @@ msg_print("
                                case 3:
                                {
 #ifdef JP
-msg_print("¤¢¤Ê¤¿¤Ï¾²¤ÈÊɤȤδ֤˶´¤Þ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
+                                       msg_print("¤¢¤Ê¤¿¤Ï¾²¤ÈÊɤȤδ֤˶´¤Þ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
 #else
                                        msg_print("You are crushed between the floor and ceiling!");
 #endif
-
                                        damage = damroll(10, 4);
                                        (void)set_stun(p_ptr->stun + randint1(50));
                                        break;
                                }
                        }
 
-                       /* Save the old location */
-                       oy = py;
-                       ox = px;
-
                        /* Move the player to the safe location */
-                       py = sy;
-                       px = sx;
-
-                       if (p_ptr->riding)
-                       {
-                               cave[oy][ox].m_idx = cave[py][px].m_idx;
-                               cave[py][px].m_idx = p_ptr->riding;
-                               m_list[p_ptr->riding].fy = py;
-                               m_list[p_ptr->riding].fx = px;
-                               update_mon(p_ptr->riding, TRUE);
-                       }
-
-                       /* Redraw the old spot */
-                       lite_spot(oy, ox);
-
-                       /* Redraw the new spot */
-                       lite_spot(py, px);
-
-                       /* Check for new panel */
-                       verify_panel();
+                       (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
                }
 
                /* Important -- no wall on player */
                map[16+py-cy][16+px-cx] = FALSE;
 
                /* Take some damage */
+               if (damage)
+               {
+                       char *killer;
+
+                       if (m_idx)
+                       {
+                               char m_name[80];
+                               monster_type *m_ptr = &m_list[m_idx];
+
+                               /* Get the monster's real name */
+                               monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
+
+#ifdef JP
+                               killer = format("%s¤Îµ¯¤³¤·¤¿ÃÏ¿Ì", m_name);
+#else
+                               killer = format("an earthquake caused by %s", m_name);
+#endif
+                       }
+                       else
+                       {
 #ifdef JP
-if (damage) take_hit(DAMAGE_ATTACK, damage, "ÃÏ¿Ì", -1);
+                               killer = "ÃÏ¿Ì";
 #else
-               if (damage) take_hit(DAMAGE_ATTACK, damage, "an earthquake", -1);
+                               killer = "an earthquake";
 #endif
+                       }
 
+                       take_hit(DAMAGE_ATTACK, damage, killer, -1);
+               }
        }
 
-
        /* Examine the quaked region */
        for (dy = -r; dy <= r; dy++)
        {
@@ -5783,17 +5669,16 @@ if (damage) take_hit(DAMAGE_ATTACK, damage, "
 
                                        /* Scream in pain */
 #ifdef JP
-msg_format("%^s¤Ï¶ìÄˤǵ㤭¤ï¤á¤¤¤¿¡ª", m_name);
+                                       if (!ignore_unview || is_seen(m_ptr)) msg_format("%^s¤Ï¶ìÄˤǵ㤭¤ï¤á¤¤¤¿¡ª", m_name);
 #else
-                                       msg_format("%^s wails out in pain!", m_name);
+                                       if (!ignore_unview || is_seen(m_ptr)) msg_format("%^s wails out in pain!", m_name);
 #endif
 
-
                                        /* Take damage from the quake */
                                        damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
 
                                        /* Monster is certainly awake */
-                                       m_ptr->csleep = 0;
+                                       (void)set_monster_csleep(c_ptr->m_idx, 0);
 
                                        /* Apply damage directly */
                                        m_ptr->hp -= damage;
@@ -5803,9 +5688,9 @@ msg_format("%^s
                                        {
                                                /* Message */
 #ifdef JP
-msg_format("%^s¤Ï´äÀФËËä¤â¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
+                                               if (!ignore_unview || is_seen(m_ptr)) msg_format("%^s¤Ï´äÀФËËä¤â¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
 #else
-                                               msg_format("%^s is embedded in the rock!", m_name);
+                                               if (!ignore_unview || is_seen(m_ptr)) msg_format("%^s is embedded in the rock!", m_name);
 #endif
 
                                                if (c_ptr->m_idx)
@@ -5815,7 +5700,7 @@ msg_format("%^s
                                                                char m2_name[80];
 
                                                                monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
-                                                               do_cmd_write_nikki(NIKKI_NAMED_PET, 7, m2_name);
+                                                               do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
                                                        }
                                                }
 
@@ -5831,12 +5716,12 @@ msg_format("%^s
                                        {
                                                int m_idx = cave[yy][xx].m_idx;
 
-                                               /* Update the new location */
-                                               cave[sy][sx].m_idx = m_idx;
-
                                                /* Update the old location */
                                                cave[yy][xx].m_idx = 0;
 
+                                               /* Update the new location */
+                                               cave[sy][sx].m_idx = m_idx;
+
                                                /* Move the monster */
                                                m_ptr->fy = sy;
                                                m_ptr->fx = sx;
@@ -5855,6 +5740,8 @@ msg_format("%^s
                }
        }
 
+       /* Lose monster light */
+       clear_mon_lite();
 
        /* Examine the quaked region */
        for (dy = -r; dy <= r; dy++)
@@ -5877,36 +5764,31 @@ msg_format("%^s
                        /* Destroy location (if valid) */
                        if (cave_valid_bold(yy, xx))
                        {
-                               bool floor = cave_floor_bold(yy, xx);
-
                                /* Delete objects */
                                delete_object(yy, xx);
 
-                               /* Clear mirror, runes flag */
-                               c_ptr->info &= ~CAVE_OBJECT;
-
                                /* Wall (or floor) type */
-                               t = (floor ? randint0(100) : 200);
+                               t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
 
                                /* Granite */
                                if (t < 20)
                                {
                                        /* Create granite wall */
-                                       cave_set_feat(yy, xx, FEAT_WALL);
+                                       cave_set_feat(yy, xx, feat_granite);
                                }
 
                                /* Quartz */
                                else if (t < 70)
                                {
                                        /* Create quartz vein */
-                                       cave_set_feat(yy, xx, FEAT_QUARTZ);
+                                       cave_set_feat(yy, xx, feat_quartz_vein);
                                }
 
                                /* Magma */
                                else if (t < 100)
                                {
                                        /* Create magma vein */
-                                       cave_set_feat(yy, xx, FEAT_MAGMA);
+                                       cave_set_feat(yy, xx, feat_magma_vein);
                                }
 
                                /* Floor */
@@ -5920,14 +5802,52 @@ msg_format("%^s
        }
 
 
+       /* Process "re-glowing" */
+       for (dy = -r; dy <= r; dy++)
+       {
+               for (dx = -r; dx <= r; dx++)
+               {
+                       /* Extract the location */
+                       yy = cy + dy;
+                       xx = cx + dx;
+
+                       /* Skip illegal grids */
+                       if (!in_bounds(yy, xx)) continue;
+
+                       /* Skip distant grids */
+                       if (distance(cy, cx, yy, xx) > r) continue;
+
+                       /* Access the grid */
+                       c_ptr = &cave[yy][xx];
+
+                       if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
+                       else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
+                       {
+                               int ii, yyy, xxx;
+                               cave_type *cc_ptr;
+
+                               for (ii = 0; ii < 9; ii++)
+                               {
+                                       yyy = yy + ddy_ddd[ii];
+                                       xxx = xx + ddx_ddd[ii];
+                                       if (!in_bounds2(yyy, xxx)) continue;
+                                       cc_ptr = &cave[yyy][xxx];
+                                       if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
+                                       {
+                                               c_ptr->info |= CAVE_GLOW;
+                                               break;
+                                       }
+                               }
+                       }
+               }
+       }
+
+
        /* 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 the monsters */
-       p_ptr->update |= (PU_DISTANCE);
+       p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
 
        /* Update the health bar */
        p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH);
@@ -5938,10 +5858,20 @@ msg_format("%^s
        /* Window stuff */
        p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
 
+       if (p_ptr->special_defense & NINJA_S_STEALTH)
+       {
+               if (cave[py][px].info & CAVE_GLOW) set_superstealth(FALSE);
+       }
+
        /* Success */
        return (TRUE);
 }
 
+bool earthquake(int cy, int cx, int r)
+{
+       return earthquake_aux(cy, cx, r, 0);
+}
+
 
 void discharge_minion(void)
 {
@@ -5992,6 +5922,15 @@ void discharge_minion(void)
                project(i, 2+(r_ptr->level/20), m_ptr->fy,
                        m_ptr->fx, dam, GF_PLASMA, 
                        PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
+
+               if (record_named_pet && m_ptr->nickname)
+               {
+                       char m_name[80];
+
+                       monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
+                       do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
+               }
+
                delete_monster_idx(i);
        }
 }
@@ -6052,12 +5991,10 @@ static void cave_temp_room_lite(void)
                        if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
 
                        /* Sometimes monsters wake up */
-                       if (m_ptr->csleep && (randint0(100) < chance))
+                       if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
                        {
                                /* Wake up! */
-                               m_ptr->csleep = 0;
-
-                               if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+                               (void)set_monster_csleep(c_ptr->m_idx, 0);
 
                                /* Notice the "waking up" */
                                if (m_ptr->ml)
@@ -6069,14 +6006,10 @@ static void cave_temp_room_lite(void)
 
                                        /* Dump a message */
 #ifdef JP
-msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
+                                       msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
 #else
                                        msg_format("%^s wakes up.", m_name);
 #endif
-                                       /* Redraw the health bar */
-                                       if (p_ptr->health_who == c_ptr->m_idx)
-                                               p_ptr->redraw |= (PR_HEALTH);
-
                                }
                        }
                }
@@ -6086,6 +6019,8 @@ msg_format("%^s
 
                /* Redraw */
                lite_spot(y, x);
+
+               update_local_illumination(y, x);
        }
 
        /* None left */
@@ -6114,15 +6049,39 @@ static void cave_temp_room_unlite(void)
        {
                int y = temp_y[i];
                int x = temp_x[i];
+               int j;
 
                cave_type *c_ptr = &cave[y][x];
+               bool do_dark = !is_mirror_grid(c_ptr);
 
                /* No longer in the array */
                c_ptr->info &= ~(CAVE_TEMP);
 
                /* Darken the grid */
-               if (!is_mirror_grid(c_ptr))
+               if (do_dark)
                {
+                       if (dun_level || !is_daytime())
+                       {
+                               for (j = 0; j < 9; j++)
+                               {
+                                       int by = y + ddy_ddd[j];
+                                       int bx = x + ddx_ddd[j];
+
+                                       if (in_bounds2(by, bx))
+                                       {
+                                               cave_type *cc_ptr = &cave[by][bx];
+
+                                               if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
+                                               {
+                                                       do_dark = FALSE;
+                                                       break;
+                                               }
+                                       }
+                               }
+
+                               if (!do_dark) continue;
+                       }
+
                        c_ptr->info &= ~(CAVE_GLOW);
 
                        /* Hack -- Forget "boring" grids */
@@ -6144,6 +6103,8 @@ static void cave_temp_room_unlite(void)
 
                        /* Redraw */
                        lite_spot(y, x);
+
+                       update_local_illumination(y, x);
                }
        }
 
@@ -6152,15 +6113,10 @@ static void cave_temp_room_unlite(void)
 }
 
 
-#define cave_pass_lite_bold(Y,X) \
-       (cave_los_bold((Y), (X)) && \
-        have_flag(f_flags_bold((Y), (X)), FF_PROJECT))
-
-
 /*
  * Determine how much contiguous open space this grid is next to
  */
-static int next_to_open(int cy, int cx)
+static int next_to_open(int cy, int cx, bool (*pass_bold)(int, int))
 {
        int i;
 
@@ -6175,7 +6131,7 @@ static int next_to_open(int cy, int cx)
                x = cx + ddx_cdd[i % 8];
 
                /* Found a wall, break the length */
-               if (!cave_pass_lite_bold(y, x))
+               if (!pass_bold(y, x))
                {
                        /* Track best length */
                        if (len > blen)
@@ -6195,7 +6151,7 @@ static int next_to_open(int cy, int cx)
 }
 
 
-static int next_to_walls_adj(int cy, int cx)
+static int next_to_walls_adj(int cy, int cx, bool (*pass_bold)(int, int))
 {
        int i;
 
@@ -6208,7 +6164,7 @@ static int next_to_walls_adj(int cy, int cx)
                y = cy + ddy_ddd[i];
                x = cx + ddx_ddd[i];
 
-               if (!cave_pass_lite_bold(y, x)) c++;
+               if (!pass_bold(y, x)) c++;
        }
 
        return c;
@@ -6218,7 +6174,7 @@ static int next_to_walls_adj(int cy, int cx)
 /*
  * Aux function -- see below
  */
-static void cave_temp_room_aux(int y, int x, bool only_room)
+static void cave_temp_room_aux(int y, int x, bool only_room, bool (*pass_bold)(int, int))
 {
        cave_type *c_ptr;
 
@@ -6248,8 +6204,8 @@ static void cave_temp_room_aux(int y, int x, bool only_room)
                 * properly.
                 * This leaves only a check for 6 bounding walls!
                 */
-               if (in_bounds(y, x) && cave_pass_lite_bold(y, x) &&
-                   (next_to_walls_adj(y, x) == 6) && (next_to_open(y, x) <= 1)) return;
+               if (in_bounds(y, x) && pass_bold(y, x) &&
+                   (next_to_walls_adj(y, x, pass_bold) == 6) && (next_to_open(y, x, pass_bold) <= 1)) return;
        }
 
        /* Paranoia -- verify space */
@@ -6267,9 +6223,25 @@ static void cave_temp_room_aux(int y, int x, bool only_room)
 /*
  * Aux function -- see below
  */
+static bool cave_pass_lite_bold(int y, int x)
+{
+       return cave_los_bold(y, x);
+}
+
+/*
+ * Aux function -- see below
+ */
 static void cave_temp_lite_room_aux(int y, int x)
 {
-       cave_temp_room_aux(y, x, FALSE);
+       cave_temp_room_aux(y, x, FALSE, cave_pass_lite_bold);
+}
+
+/*
+ * Aux function -- see below
+ */
+static bool cave_pass_dark_bold(int y, int x)
+{
+       return cave_have_flag_bold(y, x, FF_PROJECT);
 }
 
 /*
@@ -6277,7 +6249,7 @@ static void cave_temp_lite_room_aux(int y, int x)
  */
 static void cave_temp_unlite_room_aux(int y, int x)
 {
-       cave_temp_room_aux(y, x, TRUE);
+       cave_temp_room_aux(y, x, TRUE, cave_pass_dark_bold);
 }
 
 
@@ -6316,6 +6288,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);
+       }
 }
 
 
@@ -6335,7 +6312,7 @@ void unlite_room(int y1, int x1)
                x = temp_x[i], y = temp_y[i];
 
                /* Walls get dark, but stop darkness */
-               if (!cave_pass_lite_bold(y, x)) continue;
+               if (!cave_pass_dark_bold(y, x)) continue;
 
                /* Spread adjacent */
                cave_temp_unlite_room_aux(y + 1, x);
@@ -6391,11 +6368,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);
 }
@@ -6555,7 +6527,7 @@ bool fire_blast(int typ, int dir, int dd, int ds, int num, int dev)
        }
 
        /* Use an actual "target" */
-       else if (dir == 5)
+       else /* if (dir == 5) */
        {
                tx = target_col;
                ty = target_row;
@@ -6651,18 +6623,17 @@ msg_print("
        m_ptr = &m_list[c_ptr->m_idx];
        r_ptr = &r_info[m_ptr->r_idx];
 
+       (void)set_monster_csleep(c_ptr->m_idx, 0);
+
        if (r_ptr->flagsr & RFR_RES_TELE)
        {
 #ifdef JP
-msg_print("¥Æ¥ì¥Ý¡¼¥È¤ò¼ÙË⤵¤ì¤¿¡ª");
+               msg_print("¥Æ¥ì¥Ý¡¼¥È¤ò¼ÙË⤵¤ì¤¿¡ª");
 #else
                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);
+               if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
 
                /* Failure */
                return FALSE;
@@ -6670,60 +6641,8 @@ msg_print("
 
        sound(SOUND_TELEPORT);
 
-       cave[py][px].m_idx = c_ptr->m_idx;
-
-       /* Update the old location */
-       c_ptr->m_idx = p_ptr->riding;
-
-       /* Move the monster */
-       m_ptr->fy = py;
-       m_ptr->fx = px;
-
-       /* Move the player */
-       px = tx;
-       py = ty;
-
-       if (p_ptr->riding)
-       {
-               m_list[p_ptr->riding].fy = ty;
-               m_list[p_ptr->riding].fx = tx;
-
-               /* Update the monster (new location) */
-               update_mon(p_ptr->riding, TRUE);
-       }
-
-       tx = m_ptr->fx;
-       ty = m_ptr->fy;
-
-       m_ptr->csleep = 0;
-
-       /* Update the monster (new location) */
-       update_mon(cave[ty][tx].m_idx, TRUE);
-
-       /* Redraw the old grid */
-       lite_spot(ty, tx);
-
-       /* Redraw the new grid */
-       lite_spot(py, px);
-
-       /* Check for new panel (redraw map) */
-       verify_panel();
-
-       /* Update stuff */
-       p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
-
-       /* Update the monsters */
-       p_ptr->update |= (PU_DISTANCE);
-
-       /* Window stuff */
-       p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
-       /* Redraw the health bar */
-       if (p_ptr->health_who == cave[ty][tx].m_idx)
-               p_ptr->redraw |= (PR_HEALTH);
-
-       /* Handle stuff XXX XXX XXX */
-       handle_stuff();
+       /* Swap the player and monster */
+       (void)move_player_effect(ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
 
        /* Success */
        return TRUE;
@@ -6763,7 +6682,8 @@ bool project_hook(int typ, int dir, int dam, int flg)
  */
 bool fire_bolt(int typ, int dir, int dam)
 {
-       int flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
+       int flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
+       if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
        return (project_hook(typ, dir, dam, flg));
 }
 
@@ -6799,10 +6719,10 @@ bool fire_bolt_or_beam(int prob, int typ, int dir, int dam)
 /*
  * Some of the old functions
  */
-bool lite_line(int dir)
+bool lite_line(int dir, int dam)
 {
        int flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
-       return (project_hook(GF_LITE_WEAK, dir, damroll(6, 8), flg));
+       return (project_hook(GF_LITE_WEAK, dir, dam, flg));
 }
 
 
@@ -6813,10 +6733,10 @@ bool drain_life(int dir, int dam)
 }
 
 
-bool wall_to_mud(int dir)
+bool wall_to_mud(int dir, int dam)
 {
        int flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
-       return (project_hook(GF_KILL_WALL, dir, 20 + randint1(30), flg));
+       return (project_hook(GF_KILL_WALL, dir, dam, flg));
 }
 
 
@@ -6848,24 +6768,24 @@ bool heal_monster(int dir, int dam)
 }
 
 
-bool speed_monster(int dir)
+bool speed_monster(int dir, int power)
 {
        int flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
-       return (project_hook(GF_OLD_SPEED, dir, p_ptr->lev, flg));
+       return (project_hook(GF_OLD_SPEED, dir, power, flg));
 }
 
 
-bool slow_monster(int dir)
+bool slow_monster(int dir, int power)
 {
        int flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
-       return (project_hook(GF_OLD_SLOW, dir, p_ptr->lev, flg));
+       return (project_hook(GF_OLD_SLOW, dir, power, flg));
 }
 
 
-bool sleep_monster(int dir)
+bool sleep_monster(int dir, int power)
 {
        int flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
-       return (project_hook(GF_OLD_SLEEP, dir, p_ptr->lev, flg));
+       return (project_hook(GF_OLD_SLEEP, dir, power, flg));
 }
 
 
@@ -6895,10 +6815,10 @@ bool stun_monster(int dir, int plev)
 }
 
 
-bool poly_monster(int dir)
+bool poly_monster(int dir, int power)
 {
        int flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
-       bool tester = (project_hook(GF_OLD_POLY, dir, p_ptr->lev, flg));
+       bool tester = (project_hook(GF_OLD_POLY, dir, power, flg));
        if (tester)
                chg_virtue(V_CHANCE, 1);
        return(tester);
@@ -6926,10 +6846,10 @@ bool death_ray(int dir, int plev)
 }
 
 
-bool teleport_monster(int dir)
+bool teleport_monster(int dir, int distance)
 {
        int flg = PROJECT_BEAM | PROJECT_KILL;
-       return (project_hook(GF_AWAY_ALL, dir, MAX_SIGHT * 5, flg));
+       return (project_hook(GF_AWAY_ALL, dir, distance, flg));
 }
 
 /*
@@ -6970,17 +6890,11 @@ 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 | PU_MON_LITE);
-
-       /* Update the monsters */
-       p_ptr->update |= (PU_MONSTERS);
+       p_ptr->update |= (PU_FLOW);
 
        /* Redraw map */
        p_ptr->redraw |= (PR_MAP);
 
-       /* Window stuff */
-       p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
        return dummy;
 }
 
@@ -6991,6 +6905,11 @@ bool destroy_doors_touch(void)
        return (project(0, 1, py, px, 0, GF_KILL_DOOR, flg, -1));
 }
 
+bool disarm_traps_touch(void)
+{
+       int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
+       return (project(0, 1, py, px, 0, GF_KILL_TRAP, flg, -1));
+}
 
 bool sleep_monsters_touch(void)
 {
@@ -7102,14 +7021,14 @@ msg_print("
                        }
                case 32: case 33:
                        if (!(*count))
-               {
+                       {
 #ifdef JP
 msg_print("¼þ°Ï¤Î¶õ´Ö¤¬ÏĤó¤À¡ª");
 #else
                                msg_print("Space warps about you!");
 #endif
 
-                               teleport_player(damroll(10, 10));
+                               teleport_player(damroll(10, 10), TELEPORT_PASSIVE);
                                if (randint0(13)) (*count) += activate_hi_summon(py, px, FALSE);
                                if (!one_in_(6)) break;
                        }
@@ -7331,7 +7250,7 @@ void wall_breaker(void)
                {
                        scatter(&y, &x, py, px, 4, 0);
 
-                       if (!have_flag(f_flags_bold(y, x), FF_PROJECT)) continue;
+                       if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
 
                        if (!player_bold(y, x)) break;
                }
@@ -7488,14 +7407,15 @@ bool charm_living(int dir, int plev)
 }
 
 
-void kawarimi(bool success)
+bool kawarimi(bool success)
 {
        object_type forge;
        object_type *q_ptr = &forge;
        int y, x;
 
-       if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return;
-       if (randint0(200) < p_ptr->stun) return;
+       if (p_ptr->is_dead) return FALSE;
+       if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return FALSE;
+       if (randint0(200) < p_ptr->stun) return FALSE;
 
        if (!success && one_in_(3))
        {
@@ -7506,13 +7426,13 @@ void kawarimi(bool success)
 #endif
                p_ptr->special_defense &= ~(NINJA_KAWARIMI);
                p_ptr->redraw |= (PR_STATUS);
-               return;
+               return FALSE;
        }
 
        y = py;
        x = px;
 
-       teleport_player(10+randint1(90));
+       teleport_player(10 + randint1(90), 0L);
 
        object_wipe(q_ptr);
 
@@ -7533,6 +7453,9 @@ void kawarimi(bool success)
 
        p_ptr->special_defense &= ~(NINJA_KAWARIMI);
        p_ptr->redraw |= (PR_STATUS);
+
+       /* Teleported */
+       return TRUE;
 }
 
 
@@ -7548,6 +7471,7 @@ bool rush_attack(bool *mdeath)
        u16b path_g[32];
        int path_n, i;
        bool tmp_mdeath = FALSE;
+       bool moved = FALSE;
 
        if (mdeath) *mdeath = FALSE;
 
@@ -7618,7 +7542,7 @@ bool rush_attack(bool *mdeath)
                }
 
                /* Move player before updating the monster */
-               if (!player_bold(ty, tx)) teleport_player_to(ty, tx, FALSE);
+               if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
 
                /* Update the monster */
                update_mon(cave[ny][nx].m_idx, TRUE);
@@ -7649,12 +7573,14 @@ bool rush_attack(bool *mdeath)
 #endif
                }
 
+               if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
+               moved = TRUE;
                tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
 
                break;
        }
 
-       if (!player_bold(ty, tx)) teleport_player_to(ty, tx, FALSE);
+       if (!moved && !player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
 
        if (mdeath) *mdeath = tmp_mdeath;
        return TRUE;