OSDN Git Service

一般形のナズグルに与えられるフラグUNIQUE_7をNAZGULと置き換えた. この
[hengband/hengband.git] / src / spells1.c
index 2a198b1..52f218a 100644 (file)
@@ -391,7 +391,7 @@ sint project_path(u16b *gp, int range, int y1, int x1, int y2, int x2, int flg)
                        if (flg & (PROJECT_STOP))
                        {
                                if ((n > 0) &&
-                                   ((y == py && x == px) || cave[y][x].m_idx != 0))
+                                   (player_bold(y, x) || cave[y][x].m_idx != 0))
                                        break;
                        }
 
@@ -476,7 +476,7 @@ sint project_path(u16b *gp, int range, int y1, int x1, int y2, int x2, int flg)
                        if (flg & (PROJECT_STOP))
                        {
                                if ((n > 0) &&
-                                   ((y == py && x == px) || cave[y][x].m_idx != 0))
+                                   (player_bold(y, x) || cave[y][x].m_idx != 0))
                                        break;
                        }
 
@@ -543,7 +543,7 @@ sint project_path(u16b *gp, int range, int y1, int x1, int y2, int x2, int flg)
                        if (flg & (PROJECT_STOP))
                        {
                                if ((n > 0) &&
-                                   ((y == py && x == px) || cave[y][x].m_idx != 0))
+                                   (player_bold(y, x) || cave[y][x].m_idx != 0))
                                        break;
                        }
 
@@ -778,6 +778,17 @@ msg_print("
                                }
                        }
 
+                       /* Remove "unsafe" flag if player is not blind */
+                       if (!p_ptr->blind && player_has_los_bold(y, x))
+                       {
+                               c_ptr->info &= ~(CAVE_UNSAFE);
+
+                               /* Redraw */
+                               lite_spot(y, x);
+
+                               obvious = TRUE;
+                       }
+
                        break;
                }
 
@@ -822,6 +833,17 @@ msg_print("
                        /* Notice */
                        note_spot(y, x);
 
+                       /* Remove "unsafe" flag if player is not blind */
+                       if (!p_ptr->blind && player_has_los_bold(y, x))
+                       {
+                               c_ptr->info &= ~(CAVE_UNSAFE);
+
+                               /* Redraw */
+                               lite_spot(y, x);
+
+                               obvious = TRUE;
+                       }
+
                        break;
                }
 
@@ -968,8 +990,8 @@ msg_print("
                                                obvious = TRUE;
                                        }
 
-                                       /* Place gold */
-                                       place_object(y, x, AM_OKAY);
+                                       /* Place object */
+                                       place_object(y, x, 0L);
                                }
                        }
 
@@ -1011,7 +1033,7 @@ msg_print("
                        if (!cave_naked_bold(y, x)) break;
 
                        /* Not on the player */
-                       if ((y == py) && (x == px)) break;
+                       if (player_bold(y, x)) break;
 
                        /* Create a closed door */
                        cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x00);
@@ -1049,7 +1071,7 @@ msg_print("
                        if (!cave_naked_bold(y, x)) break;
 
                        /* Not on the player */
-                       if ((y == py) && (x == px)) break;
+                       if (player_bold(y, x)) break;
 
                        /* Create a closed door */
                        cave_set_feat(y, x, FEAT_TREES);
@@ -1087,7 +1109,7 @@ msg_print("
                        if (!cave_naked_bold(y, x)) break;
 
                        /* Not on the player */
-                       if ((y == py) && (x == px)) break;
+                       if (player_bold(y, x)) break;
 
                        /* Place a trap */
                        cave_set_feat(y, x, FEAT_WALL_EXTRA);
@@ -1756,7 +1778,7 @@ static bool project_m(int who, int r, int y, int x, int dam, int typ , int flg)
        bool get_angry = FALSE;
 
        /* Polymorph setting (true or false) */
-       int do_poly = 0;
+       bool do_poly = FALSE;
 
        /* Teleport setting (max distance) */
        int do_dist = 0;
@@ -1781,7 +1803,9 @@ static bool project_m(int who, int r, int y, int x, int dam, int typ , int flg)
        /* Hold the monster name */
        char m_name[80];
 
+#ifndef JP
        char m_poss[10];
+#endif
 
        int photo = 0;
 
@@ -1789,11 +1813,7 @@ static bool project_m(int who, int r, int y, int x, int dam, int typ , int flg)
        cptr note = NULL;
 
        /* Assume a default death */
-#ifdef JP
-       cptr note_dies = "¤Ï»à¤ó¤À¡£";
-#else
-       cptr note_dies = " dies.";
-#endif
+       cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
 
        int ty = m_ptr->fy;
        int tx = m_ptr->fx;
@@ -1819,35 +1839,11 @@ static bool project_m(int who, int r, int y, int x, int dam, int typ , int flg)
        /* Get the monster name (BEFORE polymorphing) */
        monster_desc(m_name, m_ptr, 0);
 
+#ifndef JP
        /* Get the monster possessive ("his"/"her"/"its") */
-       monster_desc(m_poss, m_ptr, 0x22);
-
-
-       /* Some monsters get "destroyed" */
-       if (!monster_living(r_ptr))
-       {
-               int i;
-               bool explode = FALSE;
-
-               for (i = 0; i < 4; i++)
-               {
-                       if (r_ptr->blow[i].method == RBM_EXPLODE) explode = TRUE;
-               }
-
-               /* Special note at death */
-               if (explode)
-#ifdef JP
-note_dies = "¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£";
-#else
-                       note_dies = " explodes into tiny shreds.";
+       monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
 #endif
-               else
-#ifdef JP
-note_dies = "¤òÅݤ·¤¿¡£";
-#else
-                       note_dies = " is destroyed.";
-#endif
-       }
+
 
        if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(1, 0);
 
@@ -1858,7 +1854,8 @@ note_dies = "
                case GF_MISSILE:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -1866,7 +1863,7 @@ note_dies = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
                        break;
@@ -1876,7 +1873,8 @@ note_dies = "
                case GF_ACID:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -1884,10 +1882,10 @@ note_dies = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
-                       if (r_ptr->flags3 & (RF3_IM_ACID))
+                       if (r_ptr->flagsr & RFR_IM_ACID)
                        {
 #ifdef JP
 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -1896,7 +1894,7 @@ note = "
 #endif
 
                                dam /= 9;
-                               if (seen) r_ptr->r_flags3 |= (RF3_IM_ACID);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
                        }
                        break;
                }
@@ -1905,7 +1903,8 @@ note = "
                case GF_ELEC:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -1913,10 +1912,10 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
-                       if (r_ptr->flags3 & (RF3_IM_ELEC))
+                       if (r_ptr->flagsr & RFR_IM_ELEC)
                        {
 #ifdef JP
 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -1925,7 +1924,7 @@ note = "
 #endif
 
                                dam /= 9;
-                               if (seen) r_ptr->r_flags3 |= (RF3_IM_ELEC);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
                        }
                        break;
                }
@@ -1934,7 +1933,8 @@ note = "
                case GF_FIRE:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -1942,10 +1942,10 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
-                       if (r_ptr->flags3 & (RF3_IM_FIRE))
+                       if (r_ptr->flagsr & RFR_IM_FIRE)
                        {
 #ifdef JP
 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -1954,7 +1954,7 @@ note = "
 #endif
 
                                dam /= 9;
-                               if (seen) r_ptr->r_flags3 |= (RF3_IM_FIRE);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
                        }
                        else if (r_ptr->flags3 & (RF3_HURT_FIRE))
                        {
@@ -1965,7 +1965,7 @@ note = "
 #endif
 
                                dam *= 2;
-                               if (seen) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
                        }
                        break;
                }
@@ -1974,7 +1974,8 @@ note = "
                case GF_COLD:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -1982,10 +1983,10 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
-                       if (r_ptr->flags3 & (RF3_IM_COLD))
+                       if (r_ptr->flagsr & RFR_IM_COLD)
                        {
 #ifdef JP
 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -1994,7 +1995,7 @@ note = "
 #endif
 
                                dam /= 9;
-                               if (seen) r_ptr->r_flags3 |= (RF3_IM_COLD);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
                        }
                        else if (r_ptr->flags3 & (RF3_HURT_COLD))
                        {
@@ -2005,7 +2006,7 @@ note = "
 #endif
 
                                dam *= 2;
-                               if (seen) r_ptr->r_flags3 |= (RF3_HURT_COLD);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
                        }
                        break;
                }
@@ -2014,7 +2015,8 @@ note = "
                case GF_POIS:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2022,10 +2024,10 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
-                       if (r_ptr->flags3 & RF3_IM_POIS)
+                       if (r_ptr->flagsr & RFR_IM_POIS)
                        {
 #ifdef JP
 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2034,7 +2036,7 @@ note = "
 #endif
 
                                dam /= 9;
-                               if (seen) r_ptr->r_flags3 |= (RF3_IM_POIS);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
                        }
                        break;
                }
@@ -2044,7 +2046,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2052,10 +2054,10 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
-                       if (r_ptr->flags3 & RF3_IM_POIS)
+                       if (r_ptr->flagsr & RFR_IM_POIS)
                        {
 #ifdef JP
 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
@@ -2064,7 +2066,7 @@ note = "
 #endif
 
                                dam *= 3; dam /= randint1(6) + 6;
-                               if (seen) r_ptr->r_flags3 |= (RF3_IM_POIS);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
                        }
                        else if (one_in_(3)) do_poly = TRUE;
                        break;
@@ -2074,7 +2076,8 @@ note = "
                case GF_HELL_FIRE:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2082,7 +2085,7 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
                        if (r_ptr->flags3 & RF3_GOOD)
@@ -2094,7 +2097,7 @@ note = "
                                note = " is hit hard.";
 #endif
 
-                               if (seen) r_ptr->r_flags3 |= (RF3_GOOD);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
                        }
                        break;
                }
@@ -2103,7 +2106,8 @@ note = "
                case GF_HOLY_FIRE:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2111,7 +2115,7 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
                        if (r_ptr->flags3 & RF3_GOOD)
@@ -2123,7 +2127,7 @@ note = "
                                note = " is immune.";
 #endif
 
-                               if (seen) r_ptr->r_flags3 |= RF3_GOOD;
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
                        }
                        else if (r_ptr->flags3 & RF3_EVIL)
                        {
@@ -2134,7 +2138,7 @@ note = "
                                note = " is hit hard.";
 #endif
 
-                               if (seen) r_ptr->r_flags3 |= RF3_EVIL;
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
                        }
                        else
                        {
@@ -2153,7 +2157,8 @@ note = "
                case GF_ARROW:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2161,7 +2166,7 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
                        break;
@@ -2171,7 +2176,8 @@ note = "
                case GF_PLASMA:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2179,10 +2185,10 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
-                       if (r_ptr->flags3 & RF3_RES_PLAS)
+                       if (r_ptr->flagsr & RFR_RES_PLAS)
                        {
 #ifdef JP
 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
@@ -2191,8 +2197,7 @@ note = "
 #endif
 
                                dam *= 3; dam /= randint1(6) + 6;
-                               if (seen)
-                                       r_ptr->r_flags3 |= (RF3_RES_PLAS);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
                        }
                        break;
                }
@@ -2201,7 +2206,8 @@ note = "
                case GF_NETHER:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2209,42 +2215,44 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
-                       if (r_ptr->flags3 & RF3_UNDEAD)
+                       if (r_ptr->flagsr & RFR_RES_NETH)
                        {
+                               if (r_ptr->flags3 & RF3_UNDEAD)
+                               {
 #ifdef JP
-note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡£";
+                                       note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡£";
 #else
-                               note = " is immune.";
+                                       note = " is immune.";
 #endif
 
-                               dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
-                       }
-                       else if (r_ptr->flags3 & RF3_RES_NETH)
-                       {
+                                       dam = 0;
+                                       if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
+                               }
+                               else
+                               {
 #ifdef JP
-note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
+                                       note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
 #else
-                               note = " resists.";
+                                       note = " resists.";
 #endif
 
-                               dam *= 3; dam /= randint1(6) + 6;
-
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_NETH);
+                                       dam *= 3; dam /= randint1(6) + 6;
+                               }
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
                        }
                        else if (r_ptr->flags3 & RF3_EVIL)
                        {
                                dam /= 2;
 #ifdef JP
-note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ­¤ò¼¨¤·¤¿¡£";
+                               note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ­¤ò¼¨¤·¤¿¡£";
 #else
                                note = " resists somewhat.";
 #endif
 
-                               if (seen) r_ptr->r_flags3 |= (RF3_EVIL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
                        }
                        break;
                }
@@ -2253,7 +2261,8 @@ note = "
                case GF_WATER:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2261,29 +2270,32 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
-                       if (m_ptr->r_idx == MON_WATER_ELEM || m_ptr->r_idx == MON_UNMAKER)
+                       if (r_ptr->flagsr & RFR_RES_WATE)
                        {
+                               if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
+                               {
 #ifdef JP
-note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡£";
+                                       note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡£";
 #else
-                               note = " is immune.";
+                                       note = " is immune.";
 #endif
 
-                               dam = 0;
-                       }
-                       else if (r_ptr->flags3 & RF3_RES_WATE)
-                       {
+                                       dam = 0;
+                               }
+                               else
+                               {
 #ifdef JP
-note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
+                                       note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
 #else
-                               note = " resists.";
+                                       note = " resists.";
 #endif
 
-                               dam *= 3; dam /= randint1(6) + 6;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_WATE);
+                                       dam *= 3; dam /= randint1(6) + 6;
+                               }
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
                        }
                        break;
                }
@@ -2292,7 +2304,8 @@ note = "
                case GF_CHAOS:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2300,23 +2313,35 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
-                       do_poly = TRUE;
-                       do_conf = (5 + randint1(11) + r) / (r + 1);
-                       if ((r_ptr->flags4 & RF4_BR_CHAO) ||
-                           (m_ptr->r_idx == MON_STORMBRINGER) ||
-                           ((r_ptr->flags3 & RF3_DEMON) && one_in_(3)))
+                       if (r_ptr->flagsr & RFR_RES_CHAO)
                        {
 #ifdef JP
-note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
+                               note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
 #else
                                note = " resists.";
 #endif
 
                                dam *= 3; dam /= randint1(6) + 6;
-                               do_poly = FALSE;
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
+                       }
+                       else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
+                       {
+#ifdef JP
+                               note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ­¤ò¼¨¤·¤¿¡£";
+#else
+                               note = " resists somewhat.";
+#endif
+
+                               dam *= 3; dam /= randint1(6) + 6;
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
+                       }
+                       else
+                       {
+                               do_poly = TRUE;
+                               do_conf = (5 + randint1(11) + r) / (r + 1);
                        }
                        break;
                }
@@ -2325,7 +2350,8 @@ note = "
                case GF_SHARDS:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2333,18 +2359,19 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
-                       if (r_ptr->flags4 & RF4_BR_SHAR)
+                       if (r_ptr->flagsr & RFR_RES_SHAR)
                        {
 #ifdef JP
-note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
+                               note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
 #else
                                note = " resists.";
 #endif
 
                                dam *= 3; dam /= randint1(6) + 6;
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
                        }
                        break;
                }
@@ -2354,7 +2381,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2362,18 +2389,19 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
-                       if (r_ptr->flags4 & RF4_BR_SHAR)
+                       if (r_ptr->flagsr & RFR_RES_SHAR)
                        {
 #ifdef JP
-note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ­¤ò¼¨¤·¤¿¡£";
+                               note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ­¤ò¼¨¤·¤¿¡£";
 #else
                                note = " resists somewhat.";
 #endif
 
                                dam /= 2;
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
                        }
                        break;
                }
@@ -2383,7 +2411,8 @@ note = "
                case GF_SOUND:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2391,20 +2420,21 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
-                       do_stun = (10 + randint1(15) + r) / (r + 1);
-                       if (r_ptr->flags4 & RF4_BR_SOUN)
+                       if (r_ptr->flagsr & RFR_RES_SOUN)
                        {
 #ifdef JP
-note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
+                               note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
 #else
                                note = " resists.";
 #endif
 
                                dam *= 2; dam /= randint1(6) + 6;
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
                        }
+                       else do_stun = (10 + randint1(15) + r) / (r + 1);
                        break;
                }
 
@@ -2412,7 +2442,8 @@ note = "
                case GF_CONFUSION:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2420,30 +2451,21 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
-                       do_conf = (10 + randint1(15) + r) / (r + 1);
-                       if (r_ptr->flags4 & RF4_BR_CONF)
+                       if (r_ptr->flags3 & RF3_NO_CONF)
                        {
 #ifdef JP
-note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
+                               note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
 #else
                                note = " resists.";
 #endif
 
-                               dam *= 2; dam /= randint1(6) + 6;
-                       }
-                       else if (r_ptr->flags3 & RF3_NO_CONF)
-                       {
-#ifdef JP
-note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ­¤ò¼¨¤·¤¿¡£";
-#else
-                               note = " resists somewhat.";
-#endif
-
-                               dam /= 2;
+                               dam *= 3; dam /= randint1(6) + 6;
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
                        }
+                       else do_conf = (10 + randint1(15) + r) / (r + 1);
                        break;
                }
 
@@ -2451,7 +2473,8 @@ note = "
                case GF_DISENCHANT:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2459,19 +2482,19 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
-                       if (r_ptr->flags3 & RF3_RES_DISE)
+                       if (r_ptr->flagsr & RFR_RES_DISE)
                        {
 #ifdef JP
-note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
+                               note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
 #else
                                note = " resists.";
 #endif
 
                                dam *= 3; dam /= randint1(6) + 6;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_DISE);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
                        }
                        break;
                }
@@ -2480,7 +2503,8 @@ note = "
                case GF_NEXUS:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2488,19 +2512,19 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
-                       if (r_ptr->flags3 & RF3_RES_NEXU)
+                       if (r_ptr->flagsr & RFR_RES_NEXU)
                        {
 #ifdef JP
-note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
+                               note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
 #else
                                note = " resists.";
 #endif
 
                                dam *= 3; dam /= randint1(6) + 6;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_NEXU);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
                        }
                        break;
                }
@@ -2509,7 +2533,8 @@ note = "
                case GF_FORCE:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2517,20 +2542,21 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
-                       do_stun = (randint1(15) + r) / (r + 1);
-                       if (r_ptr->flags4 & RF4_BR_WALL)
+                       if (r_ptr->flagsr & RFR_RES_WALL)
                        {
 #ifdef JP
-note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
+                               note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
 #else
                                note = " resists.";
 #endif
 
                                dam *= 3; dam /= randint1(6) + 6;
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
                        }
+                       else do_stun = (randint1(15) + r) / (r + 1);
                        break;
                }
 
@@ -2538,7 +2564,8 @@ note = "
                case GF_INERTIA:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2546,18 +2573,19 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
-                       if (r_ptr->flags4 & (RF4_BR_INER))
+                       if (r_ptr->flagsr & RFR_RES_INER)
                        {
 #ifdef JP
-note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
+                               note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
 #else
                                note = " resists.";
 #endif
 
                                dam *= 3; dam /= randint1(6) + 6;
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
                        }
                        else
                        {
@@ -2573,7 +2601,7 @@ note = "
                                        if (!m_ptr->slow)
                                        {
 #ifdef JP
-note = "¤ÎÆ°¤­¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
+                                               note = "¤ÎÆ°¤­¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
 #else
                                                note = " starts moving slower.";
 #endif
@@ -2590,7 +2618,8 @@ note = "
                case GF_TIME:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2598,20 +2627,21 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
-                       if (r_ptr->flags4 & (RF4_BR_TIME))
+                       if (r_ptr->flagsr & RFR_RES_TIME)
                        {
 #ifdef JP
-note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
+                               note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
 #else
                                note = " resists.";
 #endif
 
                                dam *= 3; dam /= randint1(6) + 6;
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
                        }
-                       else do_time = (dam+1)/2;
+                       else do_time = (dam + 1) / 2;
                        break;
                }
 
@@ -2622,7 +2652,7 @@ note = "
 
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2630,14 +2660,14 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
-                       if (r_ptr->flags3 & (RF3_RES_TELE))
+                       if (r_ptr->flagsr & RFR_RES_TELE)
                        {
                                if (r_ptr->flags1 & (RF1_UNIQUE))
                                {
-                                       if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
+                                       if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
 #ifdef JP
 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
 #else
@@ -2648,7 +2678,7 @@ note = "
                                }
                                else if (r_ptr->level > randint1(100))
                                {
-                                       if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
+                                       if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
 #ifdef JP
 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡ª";
 #else
@@ -2663,16 +2693,17 @@ note = "
                        else do_dist = 0;
                        if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
 
-                       if (r_ptr->flags4 & (RF4_BR_GRAV))
+                       if (r_ptr->flagsr & RFR_RES_GRAV)
                        {
 #ifdef JP
-note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
+                               note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
 #else
                                note = " resists.";
 #endif
 
                                dam *= 3; dam /= randint1(6) + 6;
                                do_dist = 0;
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
                        }
                        else
                        {
@@ -2710,7 +2741,7 @@ note = "
                                        do_stun = 0;
                                        /* No obvious effect */
 #ifdef JP
-note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
+                                       note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
 #else
                                        note = " is unaffected!";
 #endif
@@ -2727,7 +2758,8 @@ note = "
                case GF_SUPER_RAY:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2735,7 +2767,7 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
                        break;
@@ -2746,7 +2778,8 @@ note = "
                case GF_DISINTEGRATE:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2754,12 +2787,12 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
                        if (r_ptr->flags3 & RF3_HURT_ROCK)
                        {
-                               if (seen) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
 #ifdef JP
 note = "¤ÎÈéÉ椬¤¿¤À¤ì¤¿¡ª";
 note_dies = "¤Ï¾øȯ¤·¤¿¡ª";
@@ -2789,7 +2822,7 @@ note_dies = "
                                break;
                        }
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2797,28 +2830,27 @@ note_dies = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
                        if (r_ptr->flags2 & RF2_EMPTY_MIND)
                        {
                                dam = 0;
 #ifdef JP
-note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
+                               note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
 #else
                                note = " is immune!";
 #endif
-                               if (seen) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
 
                        }
-                       else if ((r_ptr->flags2 & RF2_STUPID) ||
-                                               (r_ptr->flags2 & RF2_WEIRD_MIND) ||
-                                               (r_ptr->flags3 & RF3_ANIMAL) ||
-                                               (r_ptr->level > randint1(3 * dam)))
+                       else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
+                                (r_ptr->flags3 & RF3_ANIMAL) ||
+                                (r_ptr->level > randint1(3 * dam)))
                        {
                                dam /= 3;
 #ifdef JP
-note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
+                               note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
 #else
                                note = " resists.";
 #endif
@@ -2828,15 +2860,13 @@ note = "
                                 * Powerful demons & undead can turn a mindcrafter's
                                 * attacks back on them
                                 */
-                               if (((r_ptr->flags3 & RF3_UNDEAD) ||
-                                         (r_ptr->flags3 & RF3_DEMON)) &&
-                                         (r_ptr->level > p_ptr->lev / 2) &&
-                                         one_in_(2))
+                               if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
+                                   (r_ptr->level > p_ptr->lev / 2) &&
+                                   one_in_(2))
                                {
                                        note = NULL;
 #ifdef JP
-msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
-    m_name);
+                                       msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª", m_name);
 #else
                                        msg_format("%^s%s corrupted mind backlashes your attack!",
                                            m_name, (seen ? "'s" : "s"));
@@ -2846,7 +2876,7 @@ msg_format("%^s
                                        if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
                                        {
 #ifdef JP
-msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
+                                               msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
 #else
                                                msg_print("You resist the effects!");
 #endif
@@ -2855,7 +2885,7 @@ msg_print("
                                        else
                                        {
                                                /* Injure +/- confusion */
-                                               monster_desc(killer, m_ptr, 0x288);
+                                               monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
                                                take_hit(DAMAGE_ATTACK, dam, killer, -1);  /* has already been /3 */
                                                if (one_in_(4))
                                                {
@@ -2871,7 +2901,7 @@ msg_print("
                                                                {
                                                                        if (r_ptr->flags3 & RF3_NO_FEAR)
 #ifdef JP
-note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
+                                                                               note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
 #else
                                                                                note = " is unaffected.";
 #endif
@@ -2906,7 +2936,7 @@ note = "
                                                break;
                                        default:
 #ifdef JP
-note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
+                                               note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
 #else
                                                note = " falls asleep!";
 #endif
@@ -2917,7 +2947,7 @@ note = "
                        }
 
 #ifdef JP
-note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
+                       note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
 #else
                        note_dies = " collapses, a mindless husk.";
 #endif
@@ -2928,7 +2958,8 @@ note_dies = "
                case GF_PSI_DRAIN:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2936,27 +2967,26 @@ note_dies = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
                        if (r_ptr->flags2 & RF2_EMPTY_MIND)
                        {
                                dam = 0;
 #ifdef JP
-note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
+                               note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
 #else
                                note = " is immune!";
 #endif
 
                        }
-                       else if ((r_ptr->flags2 & RF2_STUPID) ||
-                                (r_ptr->flags2 & RF2_WEIRD_MIND) ||
-                                (r_ptr->flags3 & RF3_ANIMAL) ||
-                                               (r_ptr->level > randint1(3 * dam)))
+                       else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
+                                (r_ptr->flags3 & RF3_ANIMAL) ||
+                                (r_ptr->level > randint1(3 * dam)))
                        {
                                dam /= 3;
 #ifdef JP
-note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
+                               note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
 #else
                                note = " resists.";
 #endif
@@ -2966,15 +2996,13 @@ note = "
                                 * Powerful demons & undead can turn a mindcrafter's
                                 * attacks back on them
                                 */
-                               if (((r_ptr->flags3 & RF3_UNDEAD) ||
-                                    (r_ptr->flags3 & RF3_DEMON)) &&
+                               if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
                                     (r_ptr->level > p_ptr->lev / 2) &&
                                     (one_in_(2)))
                                {
                                        note = NULL;
 #ifdef JP
-msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
-    m_name);
+                                       msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª", m_name);
 #else
                                        msg_format("%^s%s corrupted mind backlashes your attack!",
                                            m_name, (seen ? "'s" : "s"));
@@ -2984,7 +3012,7 @@ msg_format("%^s
                                        if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
                                        {
 #ifdef JP
-msg_print("¤¢¤Ê¤¿¤Ï¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
+                                               msg_print("¤¢¤Ê¤¿¤Ï¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
 #else
                                                msg_print("You resist the effects!");
 #endif
@@ -2993,9 +3021,9 @@ msg_print("
                                        else
                                        {
                                                /* Injure + mana drain */
-                                               monster_desc(killer, m_ptr, 0x288);
+                                               monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
 #ifdef JP
-msg_print("ĶǽÎϥѥ¤òµÛ¤¤¤È¤é¤ì¤¿¡ª");
+                                               msg_print("ĶǽÎϥѥ¤òµÛ¤¤¤È¤é¤ì¤¿¡ª");
 #else
                                                msg_print("Your psychic energy is drained!");
 #endif
@@ -3013,8 +3041,7 @@ msg_print("Ķǽ
                        {
                                int b = damroll(5, dam) / 4;
 #ifdef JP
-msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¶ìÄˤòĶǽÎϥѥ¤ËÊÑ´¹¤·¤¿¡ª",
-    m_name);
+                               msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¶ìÄˤòĶǽÎϥѥ¤ËÊÑ´¹¤·¤¿¡ª", m_name);
 #else
                                msg_format("You convert %s%s pain into psychic energy!",
                                    m_name, (seen ? "'s" : "s"));
@@ -3027,7 +3054,7 @@ msg_format("
                        }
 
 #ifdef JP
-note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
+                       note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
 #else
                        note_dies = " collapses, a mindless husk.";
 #endif
@@ -3038,7 +3065,8 @@ note_dies = "
                case GF_TELEKINESIS:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -3046,7 +3074,7 @@ note_dies = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
                        if (one_in_(4))
@@ -3074,7 +3102,8 @@ note_dies = "
                case GF_PSY_SPEAR:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -3082,7 +3111,7 @@ note_dies = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
                        break;
@@ -3092,7 +3121,8 @@ note_dies = "
                case GF_METEOR:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -3100,7 +3130,7 @@ note_dies = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
                        break;
@@ -3109,9 +3139,10 @@ note_dies = "
                case GF_DOMINATION:
                {
                        if (!is_hostile(m_ptr)) break;
+
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -3119,19 +3150,18 @@ note_dies = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
                        /* Attempt a saving throw */
-                       if ((r_ptr->flags1 & RF1_UNIQUE) ||
-                           (r_ptr->flags1 & RF1_QUESTOR) ||
+                       if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
                            (r_ptr->flags3 & RF3_NO_CONF) ||
                            (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
                        {
                                /* Memorize a flag */
                                if (r_ptr->flags3 & RF3_NO_CONF)
                                {
-                                       if (seen) r_ptr->r_flags3 |= (RF3_NO_CONF);
+                                       if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
                                }
 
                                /* Resist */
@@ -3141,15 +3171,13 @@ note_dies = "
                                 * Powerful demons & undead can turn a mindcrafter's
                                 * attacks back on them
                                 */
-                               if (((r_ptr->flags3 & RF3_UNDEAD) ||
-                                    (r_ptr->flags3 & RF3_DEMON)) &&
-                                    (r_ptr->level > p_ptr->lev / 2) &&
-                                    (one_in_(2)))
+                               if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
+                                   (r_ptr->level > p_ptr->lev / 2) &&
+                                   (one_in_(2)))
                                {
                                        note = NULL;
 #ifdef JP
-msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
-    m_name);
+                                       msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª", m_name);
 #else
                                        msg_format("%^s%s corrupted mind backlashes your attack!",
                                            m_name, (seen ? "'s" : "s"));
@@ -3159,7 +3187,7 @@ msg_format("%^s
                                        if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
                                        {
 #ifdef JP
-msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
+                                               msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
 #else
                                                msg_print("You resist the effects!");
 #endif
@@ -3180,7 +3208,7 @@ msg_print("
                                                        {
                                                                if (r_ptr->flags3 & RF3_NO_FEAR)
 #ifdef JP
-note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
+                                                                       note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
 #else
                                                                        note = " is unaffected.";
 #endif
@@ -3242,7 +3270,8 @@ note = "
                case GF_ICE:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -3250,31 +3279,31 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
                        do_stun = (randint1(15) + 1) / (r + 1);
-                       if (r_ptr->flags3 & RF3_IM_COLD)
+                       if (r_ptr->flagsr & RFR_IM_COLD)
                        {
 #ifdef JP
-note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ­¤¬¤¢¤ë¡£";
+                               note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ­¤¬¤¢¤ë¡£";
 #else
                                note = " resists a lot.";
 #endif
 
                                dam /= 9;
-                               if (seen) r_ptr->r_flags3 |= (RF3_IM_COLD);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
                        }
                        else if (r_ptr->flags3 & (RF3_HURT_COLD))
                        {
 #ifdef JP
-note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
+                               note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
 #else
                                note = " is hit hard.";
 #endif
 
                                dam *= 2;
-                               if (seen) r_ptr->r_flags3 |= (RF3_HURT_COLD);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
                        }
                        break;
                }
@@ -3285,7 +3314,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -3293,19 +3322,19 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
                        if (!monster_living(r_ptr))
                        {
-                               if (r_ptr->flags3 & RF3_UNDEAD)
-                               {
-                                       if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
-                               }
-
-                               if (r_ptr->flags3 & (RF3_DEMON))
+                               if (seen)
                                {
-                                       if (seen) r_ptr->r_flags3 |= (RF3_DEMON);
+                                       if (is_original_ap(m_ptr))
+                                       {
+                                               if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
+                                               if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
+                                               if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
+                                       }
                                }
 
 #ifdef JP
@@ -3327,7 +3356,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -3335,15 +3364,19 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
-                       if ((r_ptr->flags3 & RF3_UNDEAD) ||
-                           (r_ptr->flags3 & RF3_NONLIVING))
+                       if (!monster_living(r_ptr))
                        {
-                               if (r_ptr->flags3 & RF3_UNDEAD)
+                               if (seen)
                                {
-                                       if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
+                                       if (is_original_ap(m_ptr))
+                                       {
+                                               if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
+                                               if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
+                                               if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
+                                       }
                                }
 
 #ifdef JP
@@ -3378,7 +3411,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -3386,7 +3419,7 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
                        /* Attempt to polymorph (see below) */
@@ -3419,7 +3452,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_UNIQUE_7 | RF7_UNIQUE2)))
+                       if (is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
                        {
 #ifdef JP
 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
@@ -3459,6 +3492,8 @@ note = "
                        /* Wake up */
                        m_ptr->csleep = 0;
 
+                       if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+
                        if (m_ptr->maxhp < m_ptr->max_maxhp)
                        {
 #ifdef JP
@@ -3477,6 +3512,8 @@ msg_format("%^s
                        /* Wake up */
                        m_ptr->csleep = 0;
 
+                       if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+
                        if (m_ptr->stunned)
                        {
 #ifdef JP
@@ -3588,7 +3625,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -3596,7 +3633,7 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
                        /* Powerful monsters can resist */
@@ -3640,7 +3677,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -3648,7 +3685,7 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
                        /* Attempt a saving throw */
@@ -3659,7 +3696,7 @@ note = "
                                /* Memorize a flag */
                                if (r_ptr->flags3 & RF3_NO_SLEEP)
                                {
-                                       if (seen) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
+                                       if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
                                }
 
                                /* No obvious effect */
@@ -3694,7 +3731,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -3702,7 +3739,7 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
                        /* Attempt a saving throw */
@@ -3740,7 +3777,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -3748,7 +3785,7 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
                        /* Attempt a saving throw */
@@ -3799,7 +3836,7 @@ note = "
 
                        if (seen) obvious = TRUE;
 
-                       if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
+                       if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -3807,11 +3844,11 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
 
-                       if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
+                       if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
                                dam = dam * 2 / 3;
 
                        /* Attempt a saving throw */
@@ -3823,7 +3860,7 @@ note = "
                                /* Memorize a flag */
                                if (r_ptr->flags3 & RF3_NO_CONF)
                                {
-                                       if (seen) r_ptr->r_flags3 |= (RF3_NO_CONF);
+                                       if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
                                }
 
                                /* Resist */
@@ -3886,7 +3923,7 @@ note = "
                                dam -= p_ptr->virtues[vir-1]/20;
                        }
 
-                       if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
+                       if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -3894,11 +3931,11 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
 
-                       if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
+                       if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
                                dam = dam * 2 / 3;
 
                        /* Attempt a saving throw */
@@ -3961,7 +3998,7 @@ note = "
                                dam -= p_ptr->virtues[vir-1]/20;
                        }
 
-                       if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
+                       if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -3969,11 +4006,11 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
 
-                       if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
+                       if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
                                dam = dam * 2 / 3;
 
                        /* Attempt a saving throw */
@@ -4037,7 +4074,7 @@ note = "
                                dam -= p_ptr->virtues[vir-1]/20;
                        }
 
-                       if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
+                       if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -4045,11 +4082,11 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
 
-                       if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
+                       if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
                                dam = dam * 2 / 3;
 
                        /* Attempt a saving throw */
@@ -4062,7 +4099,7 @@ note = "
                                /* Memorize a flag */
                                if (r_ptr->flags3 & (RF3_NO_CONF))
                                {
-                                       if (seen) r_ptr->r_flags3 |= (RF3_NO_CONF);
+                                       if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
                                }
 
                                /* Resist */
@@ -4133,7 +4170,7 @@ msg_format("%s
 #else
                        msg_format("You stare into %s.", m_name);
 #endif
-                       if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
+                       if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -4141,17 +4178,17 @@ msg_format("%s
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
 
-                       if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
+                       if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
                                dam = dam * 2 / 3;
 
                        /* Attempt a saving throw */
                        if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
                            (m_ptr->mflag2 & MFLAG2_NOPET) ||
-                                (r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)) ||
+                                !monster_living(r_ptr) ||
                                 ((r_ptr->level+10) > randint1(dam)))
                        {
                                /* Resist */
@@ -4199,7 +4236,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -4207,7 +4244,7 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
                        /* Get confused later */
@@ -4221,7 +4258,7 @@ note = "
                                /* Memorize a flag */
                                if (r_ptr->flags3 & (RF3_NO_CONF))
                                {
-                                       if (seen) r_ptr->r_flags3 |= (RF3_NO_CONF);
+                                       if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
                                }
 
                                /* Resist */
@@ -4246,7 +4283,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -4254,7 +4291,7 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
                        do_stun = damroll((caster_lev / 10) + 3 , (dam)) + 1;
@@ -4292,7 +4329,7 @@ note = "
                                skipped = TRUE;
                                break;
                        }
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
                                dam = 0;
                                break;
@@ -4300,11 +4337,14 @@ note = "
                        /* Hurt by light */
                        if (r_ptr->flags3 & (RF3_HURT_LITE))
                        {
-                               /* Obvious effect */
-                               if (seen) obvious = TRUE;
+                               if (seen)
+                               {
+                                       /* Obvious effect */
+                                       obvious = TRUE;
 
-                               /* Memorize the effects */
-                               if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
+                                       /* Memorize the effects */
+                                       if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
+                               }
 
                                /* Special effect */
 #ifdef JP
@@ -4333,7 +4373,8 @@ note_dies = "
                case GF_LITE:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -4341,25 +4382,26 @@ note_dies = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
-                       if (r_ptr->flags4 & (RF4_BR_LITE))
+                       if (r_ptr->flagsr & RFR_RES_LITE)
                        {
 #ifdef JP
-note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡ª";
+                               note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡ª";
 #else
                                note = " resists.";
 #endif
 
                                dam *= 2; dam /= (randint1(6)+6);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
                        }
                        else if (r_ptr->flags3 & (RF3_HURT_LITE))
                        {
-                               if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
 #ifdef JP
-note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
-note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
+                               note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
+                               note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
 #else
                                note = " cringes from the light!";
                                note_dies = " shrivels away in the light!";
@@ -4376,7 +4418,7 @@ note_dies = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -4384,21 +4426,19 @@ note_dies = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
-                       /* Likes darkness... */
-                       if ((r_ptr->flags4 & (RF4_BR_DARK)) ||
-                           (r_ptr->flags3 & RF3_ORC) ||
-                           (r_ptr->flags3 & RF3_HURT_LITE))
+                       if (r_ptr->flagsr & RFR_RES_DARK)
                        {
 #ifdef JP
-note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡ª";
+                               note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡ª";
 #else
                                note = " resists.";
 #endif
 
                                dam *= 2; dam /= (randint1(6)+6);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
                        }
                        break;
                }
@@ -4407,7 +4447,7 @@ note = "
                /* Stone to Mud */
                case GF_KILL_WALL:
                {
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
                                dam = 0;
                                break;
@@ -4415,11 +4455,14 @@ note = "
                        /* Hurt by rock remover */
                        if (r_ptr->flags3 & (RF3_HURT_ROCK))
                        {
-                               /* Notice effect */
-                               if (seen) obvious = TRUE;
+                               if (seen)
+                               {
+                                       /* Notice effect */
+                                       obvious = TRUE;
 
-                               /* Memorize the effects */
-                               if (seen) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
+                                       /* Memorize the effects */
+                                       if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
+                               }
 
                                /* Cute little message */
 #ifdef JP
@@ -4451,11 +4494,11 @@ note_dies = "
                        {
                                bool resists_tele = FALSE;
 
-                               if (r_ptr->flags3 & (RF3_RES_TELE))
+                               if (r_ptr->flagsr & RFR_RES_TELE)
                                {
-                                       if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags3 & (RF3_RES_ALL)))
+                                       if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
                                        {
-                                               if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
+                                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
 #ifdef JP
 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
 #else
@@ -4466,7 +4509,7 @@ note = "
                                        }
                                        else if (r_ptr->level > randint1(100))
                                        {
-                                               if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
+                                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
 #ifdef JP
 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡ª";
 #else
@@ -4479,8 +4522,11 @@ note = "
 
                                if (!resists_tele)
                                {
-                                       if (seen) obvious = TRUE;
-                                       if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
+                                       if (seen)
+                                       {
+                                               obvious = TRUE;
+                                               if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
+                                       }
                                        do_dist = dam;
                                }
                        }
@@ -4506,11 +4552,11 @@ note = "
                        {
                                bool resists_tele = FALSE;
 
-                               if (r_ptr->flags3 & (RF3_RES_TELE))
+                               if (r_ptr->flagsr & RFR_RES_TELE)
                                {
-                                       if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags3 & (RF3_RES_ALL)))
+                                       if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
                                        {
-                                               if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
+                                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
 #ifdef JP
 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
 #else
@@ -4521,7 +4567,7 @@ note = "
                                        }
                                        else if (r_ptr->level > randint1(100))
                                        {
-                                               if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
+                                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
 #ifdef JP
 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡ª";
 #else
@@ -4534,8 +4580,11 @@ note = "
 
                                if (!resists_tele)
                                {
-                                       if (seen) obvious = TRUE;
-                                       if (seen) r_ptr->r_flags3 |= (RF3_EVIL);
+                                       if (seen)
+                                       {
+                                               obvious = TRUE;
+                                               if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
+                                       }
                                        do_dist = dam;
                                }
                        }
@@ -4557,11 +4606,11 @@ note = "
                case GF_AWAY_ALL:
                {
                        bool resists_tele = FALSE;
-                       if (r_ptr->flags3 & (RF3_RES_TELE))
+                       if (r_ptr->flagsr & RFR_RES_TELE)
                        {
-                               if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags3 & (RF3_RES_ALL)))
+                               if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
                                {
-                                       if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
+                                       if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
 #ifdef JP
 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
 #else
@@ -4572,7 +4621,7 @@ note = "
                                }
                                else if (r_ptr->level > randint1(100))
                                {
-                                       if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
+                                       if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
 #ifdef JP
 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡ª";
 #else
@@ -4601,7 +4650,7 @@ note = "
                /* Turn undead (Use "dam" as "power") */
                case GF_TURN_UNDEAD:
                {
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
                                skipped = TRUE;
                                break;
@@ -4609,11 +4658,14 @@ note = "
                        /* Only affect undead */
                        if (r_ptr->flags3 & (RF3_UNDEAD))
                        {
-                               /* Learn about type */
-                               if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
+                               if (seen)
+                               {
+                                       /* Learn about type */
+                                       if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
 
-                               /* Obvious */
-                               if (seen) obvious = TRUE;
+                                       /* Obvious */
+                                       obvious = TRUE;
+                               }
 
                                /* Apply some fear */
                                do_fear = damroll(3, (dam / 2)) + 1;
@@ -4649,7 +4701,7 @@ note = "
                /* Turn evil (Use "dam" as "power") */
                case GF_TURN_EVIL:
                {
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
                                skipped = TRUE;
                                break;
@@ -4657,11 +4709,14 @@ note = "
                        /* Only affect evil */
                        if (r_ptr->flags3 & (RF3_EVIL))
                        {
-                               /* Learn about type */
-                               if (seen) r_ptr->r_flags3 |= (RF3_EVIL);
+                               if (seen)
+                               {
+                                       /* Learn about type */
+                                       if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
 
-                               /* Obvious */
-                               if (seen) obvious = TRUE;
+                                       /* Obvious */
+                                       obvious = TRUE;
+                               }
 
                                /* Apply some fear */
                                do_fear = damroll(3, (dam / 2)) + 1;
@@ -4697,7 +4752,7 @@ note = "
                /* Turn monster (Use "dam" as "power") */
                case GF_TURN_ALL:
                {
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
                                skipped = TRUE;
                                break;
@@ -4733,7 +4788,7 @@ note = "
                /* Dispel undead */
                case GF_DISP_UNDEAD:
                {
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
                                skipped = TRUE;
                                dam = 0;
@@ -4742,11 +4797,14 @@ note = "
                        /* Only affect undead */
                        if (r_ptr->flags3 & (RF3_UNDEAD))
                        {
-                               /* Learn about type */
-                               if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
+                               if (seen)
+                               {
+                                       /* Learn about type */
+                                       if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
 
-                               /* Obvious */
-                               if (seen) obvious = TRUE;
+                                       /* Obvious */
+                                       obvious = TRUE;
+                               }
 
                                /* Message */
 #ifdef JP
@@ -4776,7 +4834,7 @@ note_dies = "
                /* Dispel evil */
                case GF_DISP_EVIL:
                {
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
                                skipped = TRUE;
                                dam = 0;
@@ -4785,11 +4843,14 @@ note_dies = "
                        /* Only affect evil */
                        if (r_ptr->flags3 & (RF3_EVIL))
                        {
-                               /* Learn about type */
-                               if (seen) r_ptr->r_flags3 |= (RF3_EVIL);
+                               if (seen)
+                               {
+                                       /* Learn about type */
+                                       if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
 
-                               /* Obvious */
-                               if (seen) obvious = TRUE;
+                                       /* Obvious */
+                                       obvious = TRUE;
+                               }
 
                                /* Message */
 #ifdef JP
@@ -4818,7 +4879,7 @@ note_dies = "
                /* Dispel good */
                case GF_DISP_GOOD:
                {
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
                                skipped = TRUE;
                                dam = 0;
@@ -4827,11 +4888,14 @@ note_dies = "
                        /* Only affect good */
                        if (r_ptr->flags3 & (RF3_GOOD))
                        {
-                               /* Learn about type */
-                               if (seen) r_ptr->r_flags3 |= (RF3_GOOD);
+                               if (seen)
+                               {
+                                       /* Learn about type */
+                                       if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
 
-                               /* Obvious */
-                               if (seen) obvious = TRUE;
+                                       /* Obvious */
+                                       obvious = TRUE;
+                               }
 
                                /* Message */
 #ifdef JP
@@ -4860,7 +4924,7 @@ note_dies = "
                /* Dispel living */
                case GF_DISP_LIVING:
                {
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
                                skipped = TRUE;
                                dam = 0;
@@ -4899,7 +4963,7 @@ note_dies = "
                /* Dispel demons */
                case GF_DISP_DEMON:
                {
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
                                skipped = TRUE;
                                dam = 0;
@@ -4908,11 +4972,14 @@ note_dies = "
                        /* Only affect demons */
                        if (r_ptr->flags3 & (RF3_DEMON))
                        {
-                               /* Learn about type */
-                               if (seen) r_ptr->r_flags3 |= (RF3_DEMON);
+                               if (seen)
+                               {
+                                       /* Learn about type */
+                                       if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
 
-                               /* Obvious */
-                               if (seen) obvious = TRUE;
+                                       /* Obvious */
+                                       obvious = TRUE;
+                               }
 
                                /* Message */
 #ifdef JP
@@ -4941,7 +5008,7 @@ note_dies = "
                /* Dispel monster */
                case GF_DISP_ALL:
                {
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
                                skipped = TRUE;
                                dam = 0;
@@ -4967,7 +5034,8 @@ note_dies = "
                case GF_DRAIN_MANA:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -4975,7 +5043,7 @@ note_dies = "
                                note = " is immune.";
 #endif
                                skipped = TRUE;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
 
@@ -5013,7 +5081,7 @@ msg_format("%s
                        msg_format("You gaze intently at %s.", m_name);
 #endif
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -5021,7 +5089,7 @@ msg_format("%s
                                note = " is immune.";
 #endif
                                skipped = TRUE;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
 
@@ -5033,7 +5101,7 @@ msg_format("%s
                                /* Memorize a flag */
                                if (r_ptr->flags3 & (RF3_NO_CONF))
                                {
-                                       r_ptr->r_flags3 |= (RF3_NO_CONF);
+                                       if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
                                }
 #ifdef JP
 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
@@ -5068,7 +5136,7 @@ msg_format("%s
                        msg_format("You gaze intently at %s.", m_name);
 #endif
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -5076,7 +5144,7 @@ msg_format("%s
                                note = " is immune.";
 #endif
                                skipped = TRUE;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
 
@@ -5088,7 +5156,7 @@ msg_format("%s
                                /* Memorize a flag */
                                if (r_ptr->flags3 & (RF3_NO_CONF))
                                {
-                                       r_ptr->r_flags3 |= (RF3_NO_CONF);
+                                       if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
                                }
 #ifdef JP
 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
@@ -5127,7 +5195,7 @@ msg_format("%s
                        msg_format("You point at %s and curses.", m_name);
 #endif
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -5135,7 +5203,7 @@ msg_format("%s
                                note = " is immune.";
 #endif
                                skipped = TRUE;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
 
@@ -5164,7 +5232,7 @@ msg_format("%s
                        msg_format("You point at %s and curses horribly.", m_name);
 #endif
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -5172,7 +5240,7 @@ msg_format("%s
                                note = " is immune.";
 #endif
                                skipped = TRUE;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
 
@@ -5201,7 +5269,7 @@ msg_format("%s
                        msg_format("You point at %s, incanting terribly!", m_name);
 #endif
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -5209,7 +5277,7 @@ msg_format("%s
                                note = " is immune.";
 #endif
                                skipped = TRUE;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
 
@@ -5238,7 +5306,7 @@ msg_format("%s
                        msg_format("You point at %s, screaming th word, 'DIE!'.", m_name);
 #endif
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -5246,7 +5314,7 @@ msg_format("%s
                                note = " is immune.";
 #endif
                                skipped = TRUE;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
 
@@ -5269,7 +5337,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -5277,7 +5345,7 @@ note = "
                                note = " is immune.";
 #endif
                                skipped = TRUE;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
 
@@ -5317,7 +5385,7 @@ note = "
                {
                        int nokori_hp;
                        if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
-                           (r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags7 & (RF7_UNIQUE_7)) || (r_ptr->flags7 & (RF7_UNIQUE2)) || (r_ptr->flags1 & RF1_QUESTOR))
+                           (r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags7 & (RF7_NAZGUL)) || (r_ptr->flags7 & (RF7_UNIQUE2)) || (r_ptr->flags1 & RF1_QUESTOR))
                        {
 #ifdef JP
 msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£",m_name);
@@ -5329,11 +5397,11 @@ msg_format("%s
                        }
 
                        if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp*4L;
-                       else if ((p_ptr->pclass == CLASS_BEASTMASTER) && (r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)))
+                       else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
                                nokori_hp = m_ptr->maxhp * 3 / 10;
                        else
                                nokori_hp = m_ptr->maxhp * 3 / 20;
-                       
+
                        if (m_ptr->hp >= nokori_hp)
                        {
 #ifdef JP
@@ -5387,60 +5455,11 @@ msg_format("
                        break;
                }
 
+               /* Attack (Use "dam" as attack type) */
                case GF_ATTACK:
                {
-                       if (seen) obvious = TRUE;
-                       skipped = TRUE;
-                       if (dam == HISSATSU_NYUSIN)
-                       {
-                               int i;
-                               int ny = y, nx = x;
-                               bool success = FALSE;
-                               for (i = 0; i < 8; i++)
-                               {
-                                       if (cave_empty_bold(y+ddy[i], x+ddx[i]) || ((y+ddy[i] == py) && (x+ddx[i] == px)))
-                                       {
-                                               success = TRUE;
-                                               if (distance(py, px, ny, nx) > distance(py, px, y+ddy[i], x+ddx[i]))
-                                               {
-                                                       ny = y+ddy[i];
-                                                       nx = x+ddx[i];
-                                               }
-                                       }
-                               }
-                               if (success)
-                               {
-                                       if ((ny != py) || (nx != px))
-                                       {
-                                               teleport_player_to(ny, nx, FALSE);
-#ifdef JP
-                                               msg_print("ÁÇÁ᤯Áê¼ê¤Î²û¤ËÆþ¤ê¹þ¤ó¤À¡ª");
-#else
-                                               msg_format("You quickly jump in and attack %s!", m_name);
-#endif
-                                       }
-                               }
-                               else
-                               {
-#ifdef JP
-                                       msg_print("¼ºÇÔ¡ª");
-#else
-                                       msg_print("Failed!");
-#endif
-                                       dam = 0;
-                                       break;
-                               }
-                       }
-                       if (c_ptr->m_idx)
-                               return (py_attack(y, x, dam));
-                       else
-#ifdef JP
-                               msg_print("¹¶·â¤Ï¶õ¤òÀڤä¿¡£");
-#else
-                               msg_print("You attack the empty air.");
-#endif
-                       dam = 0;
-                       break;
+                       /* Return this monster's death */
+                       return py_attack(y, x, dam);
                }
 
                /* Sleep (Use "dam" as "power") */
@@ -5451,7 +5470,7 @@ msg_format("
 
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -5459,7 +5478,7 @@ msg_format("
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
                        if (r_ptr->flags2 & RF2_EMPTY_MIND)
@@ -5471,7 +5490,7 @@ note = "
 #endif
                                dam = 0;
                                skipped = TRUE;
-                               if (seen) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
                                break;
                        }
                        if (m_ptr->csleep)
@@ -5556,7 +5575,7 @@ note = "
                                        /* Memorize a flag */
                                        if (r_ptr->flags3 & RF3_NO_SLEEP)
                                        {
-                                               if (seen) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
+                                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
                                        }
 
                                        /* No obvious effect */
@@ -5601,7 +5620,7 @@ note = "
                        bool angry = FALSE;
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -5609,7 +5628,7 @@ note = "
                                note = " is immune.";
 #endif
                                skipped = TRUE;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
 
@@ -5676,11 +5695,14 @@ note = "
                        /* Hurt by light */
                        if (r_ptr->flags3 & (RF3_HURT_LITE))
                        {
-                               /* Obvious effect */
-                               if (seen) obvious = TRUE;
+                               if (seen)
+                               {
+                                       /* Obvious effect */
+                                       obvious = TRUE;
 
-                               /* Memorize the effects */
-                               if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
+                                       /* Memorize the effects */
+                                       if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
+                               }
 
                                /* Special effect */
 #ifdef JP
@@ -5710,7 +5732,8 @@ note_dies = "
                case GF_BLOOD_CURSE:
                {
                        if (seen) obvious = TRUE;
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -5718,7 +5741,7 @@ note_dies = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
                        break;
@@ -5769,7 +5792,7 @@ note = "
                                        m_ptr->fast = MIN(200, m_ptr->fast + 100);
 
                                        /* Learn about type */
-                                       if (seen) r_ptr->r_flags3 |= (RF3_GOOD);
+                                       if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
                                        success = TRUE;
                                }
                        }
@@ -5782,7 +5805,7 @@ note = "
                                }
                                else if (seen)
                                {
-                                       r_ptr->r_flags3 |= (RF3_NO_FEAR);
+                                       if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
                                }
                        }
 
@@ -5795,7 +5818,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -5803,7 +5826,7 @@ note = "
                                note = " is immune.";
 #endif
                                skipped = TRUE;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
 
@@ -5847,7 +5870,7 @@ note = "
        if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
 
        /* "Unique" and "quest" monsters can only be "killed" by the player. */
-       if (((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7) || (r_ptr->flags1 & RF1_QUESTOR)) && !p_ptr->inside_battle)
+       if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
        {
                if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
        }
@@ -5862,7 +5885,7 @@ note = "
        tmp = dam;
        dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
 #ifdef JP
-       if ((tmp > 0) && (dam == 0)) note = "¤Ï¥À¥á¡¼¥¸¤ò¼õ¤±¤Æ¤¤¤Ê¤¤";
+       if ((tmp > 0) && (dam == 0)) note = "¤Ï¥À¥á¡¼¥¸¤ò¼õ¤±¤Æ¤¤¤Ê¤¤¡£";
 #else
        if ((tmp > 0) && (dam == 0)) note = " is unharmed.";
 #endif
@@ -5884,7 +5907,7 @@ note = "
 
                        /* Monster polymorphs */
 #ifdef JP
-note = "¤¬ÊѿȤ·¤¿¡ª";
+                       note = "¤¬ÊѿȤ·¤¿¡ª";
 #else
                        note = " changes!";
 #endif
@@ -5919,7 +5942,7 @@ note = "
 
                /* Message */
 #ifdef JP
-note = "¤¬¾Ã¤¨µî¤Ã¤¿¡ª";
+               note = "¤¬¾Ã¤¨µî¤Ã¤¿¡ª";
 #else
                note = " disappears!";
 #endif
@@ -5937,20 +5960,19 @@ note = "
                c_ptr = &cave[y][x];
        }
 
-       /* Sound and Impact breathers never stun */
+       /* Sound and Impact resisters never stun */
        else if (do_stun &&
-           !(r_ptr->flags4 & (RF4_BR_SOUN)) &&
-           !(r_ptr->flags4 & (RF4_BR_WALL)) &&
-           !(r_ptr->flags3 & (RF3_NO_STUN)))
+           !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
+           !(r_ptr->flags3 & RF3_NO_STUN))
        {
                /* Obvious */
                if (seen) obvious = TRUE;
 
-               /* Get confused */
+               /* Get stunned */
                if (m_ptr->stunned)
                {
 #ifdef JP
-note = "¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£";
+                       note = "¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£";
 #else
                        note = " is more dazed.";
 #endif
@@ -5960,7 +5982,7 @@ note = "
                else
                {
 #ifdef JP
-note = "¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£";
+                       note = "¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£";
 #else
                        note = " is dazed.";
 #endif
@@ -5975,11 +5997,10 @@ note = "
                get_angry = TRUE;
        }
 
-       /* Confusion and Chaos breathers (and sleepers) never confuse */
+       /* Confusion and Chaos resisters (and sleepers) never confuse */
        else if (do_conf &&
-                !(r_ptr->flags3 & (RF3_NO_CONF)) &&
-                !(r_ptr->flags4 & (RF4_BR_CONF)) &&
-                !(r_ptr->flags4 & (RF4_BR_CHAO)))
+                !(r_ptr->flags3 & RF3_NO_CONF) &&
+                !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
        {
                /* Obvious */
                if (seen) obvious = TRUE;
@@ -5988,7 +6009,7 @@ note = "
                if (m_ptr->confused)
                {
 #ifdef JP
-note = "¤Ï¤µ¤é¤Ëº®Í𤷤¿¤è¤¦¤À¡£";
+                       note = "¤Ï¤µ¤é¤Ëº®Í𤷤¿¤è¤¦¤À¡£";
 #else
                        note = " looks more confused.";
 #endif
@@ -6000,7 +6021,7 @@ note = "
                else
                {
 #ifdef JP
-note = "¤Ïº®Í𤷤¿¤è¤¦¤À¡£";
+                       note = "¤Ïº®Í𤷤¿¤è¤¦¤À¡£";
 #else
                        note = " looks confused.";
 #endif
@@ -6014,22 +6035,23 @@ note = "
                /* Get angry */
                get_angry = TRUE;
        }
+
        else if (do_time)
        {
                /* Obvious */
                if (seen) obvious = TRUE;
 
-               if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp-1;
+               if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
 
                if (do_time)
                {
 #ifdef JP
-note = "¤Ï¼å¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£";
+                       note = "¤Ï¼å¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£";
 #else
                        note = " seems weakened.";
 #endif
                        m_ptr->maxhp -= do_time;
-                       if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp-m_ptr->maxhp;
+                       if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
                }
                get_angry = TRUE;
        }
@@ -6059,6 +6081,8 @@ note = "
                /* Wake the monster up */
                m_ptr->csleep = 0;
 
+               if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+
                /* Hurt the monster */
                m_ptr->hp -= dam;
 
@@ -6073,7 +6097,7 @@ note = "
                        /* Give detailed messages if destroyed */
                        if (known && note)
                        {
-                               monster_desc(m_name, m_ptr, 0x100);
+                               monster_desc(m_name, m_ptr, MD_TRUE_NAME);
                                if (see_s)
                                {
                                        msg_format("%^s%s", m_name, note);
@@ -6332,7 +6356,7 @@ msg_print("
                                set_target(m_ptr, monster_target_y, monster_target_x);
                        }
                }
-               else if (is_pet(&m_list[who]) && (m_ptr->target_y != py) && (m_ptr->target_x != px))
+               else if (is_pet(&m_list[who]) && !player_bold(m_ptr->target_y, m_ptr->target_x))
                {
                        set_target(m_ptr, m_list[who].fy, m_list[who].fx);
                }
@@ -6424,7 +6448,7 @@ static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int
 
 
        /* Player is not here */
-       if ((x != px) || (y != py)) return (FALSE);
+       if (!player_bold(y, x)) return (FALSE);
 
        if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
        {
@@ -7639,9 +7663,9 @@ msg_print("
                msg_format("¹¶·â¤¬%s¼«¿È¤ò½ý¤Ä¤±¤¿¡ª", m_name);
 #else
                char m_name_self[80];
-               
+
                /* hisself */
-               monster_desc(m_name_self, m_ptr, 0x23);
+               monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
 
                msg_format("The attack of %s has wounded %s!", m_name, m_name_self);
 #endif
@@ -8290,7 +8314,7 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
        {
                x1 = m_list[who].fx;
                y1 = m_list[who].fy;
-               monster_desc(who_name, &m_list[who], 0x288);
+               monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
        }
 
        /* Oops */
@@ -8707,11 +8731,6 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                                Term_xtra(TERM_XTRA_DELAY, msec);
                        }
                }
-               if ((typ == GF_ATTACK) && (dam == HISSATSU_NYUSIN) && ((i+1) == path_n))
-               {
-                       if (cave_empty_bold(y, x)) teleport_player_to(ny, nx, FALSE);
-               }
-
        }
 
        /* Save the "blast epicenter" */
@@ -9010,7 +9029,7 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                                                msg_print("The attack bounces!");
 #endif
 
-                                               ref_ptr->r_flags2 |= RF2_REFLECTING;
+                                               if (is_original_ap(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
                                        }
 
                                        /* Reflected bolts randomly target either one */
@@ -9036,10 +9055,10 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                        {
                                effective_dist = dist;
                        }
-                       
-                       
+
+
                        /* There is the riding player on this monster */
-                       if (p_ptr->riding && (y == py) && (x == px))
+                       if (p_ptr->riding && player_bold(y, x))
                        {
                                /* Aimed on the player */
                                if (flg & PROJECT_PLAYER)
@@ -9108,12 +9127,12 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                                        effective_dist++;
                                }
                        }
-                       
+
                        /* Affect the monster in the grid */
                        if (project_m(who, effective_dist, y, x, dam, typ,flg)) notice = TRUE;
                }
-               
-       
+
+
                /* Player affected one monster (without "jumping") */
                if (!who && (project_m_n == 1) && !jump)
                {
@@ -9155,7 +9174,7 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                        x = gx[i];
 
                        /* Affect the player? */
-                       if (y != py || x != px) continue;
+                       if (!player_bold(y, x)) continue;
 
                        /* Find the closest point in the blast */
                        if (breath)