OSDN Git Service

通常のセーブ/ロード時以外でc_ptr->mimicに0以外の値を代入する際に, 最
[hengbandforosx/hengbandosx.git] / src / spells1.c
index 84515ad..9d04757 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;
                        }
 
@@ -968,8 +968,8 @@ msg_print("
                                                obvious = TRUE;
                                        }
 
-                                       /* Place gold */
-                                       place_object(y, x, FALSE, FALSE);
+                                       /* Place object */
+                                       place_object(y, x, 0L);
                                }
                        }
 
@@ -1011,7 +1011,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 +1049,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);
@@ -1070,11 +1070,11 @@ msg_print("
 
                        /* Create a glyph */
                        cave[y][x].info |= CAVE_OBJECT;
-                       cave[y][x].mimic = FEAT_GLYPH;
+                       cave[y][x].mimic = f_info[FEAT_GLYPH].mimic;
 
                        /* Notice */
                        note_spot(y, x);
-       
+
                        /* Redraw */
                        lite_spot(y, x);
 
@@ -1087,7 +1087,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 +1756,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 +1781,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,15 +1791,12 @@ 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;
 
+       int caster_lev = (who > 0) ? (r_info[m_list[who].r_idx].level / 2) : p_ptr->lev;
 
        /* Nobody here */
        if (!c_ptr->m_idx) return (FALSE);
@@ -1818,35 +1817,11 @@ cptr note_dies = "
        /* 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);
 
@@ -1857,7 +1832,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -1865,7 +1841,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;
@@ -1875,7 +1851,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -1883,10 +1860,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 = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -1895,7 +1872,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;
                }
@@ -1904,7 +1881,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -1912,10 +1890,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 = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -1924,7 +1902,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;
                }
@@ -1933,7 +1911,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -1941,10 +1920,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 = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -1953,7 +1932,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))
                        {
@@ -1964,7 +1943,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;
                }
@@ -1973,7 +1952,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -1981,10 +1961,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 = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -1993,7 +1973,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))
                        {
@@ -2004,7 +1984,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;
                }
@@ -2013,7 +1993,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2021,10 +2002,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 = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2033,7 +2014,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;
                }
@@ -2043,7 +2024,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2051,10 +2032,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 = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
@@ -2063,7 +2044,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;
@@ -2073,7 +2054,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2081,7 +2063,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)
@@ -2093,7 +2075,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;
                }
@@ -2102,7 +2084,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2110,7 +2093,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)
@@ -2122,7 +2105,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)
                        {
@@ -2133,7 +2116,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
                        {
@@ -2152,7 +2135,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2160,7 +2144,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;
@@ -2170,7 +2154,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2178,10 +2163,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 = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
@@ -2190,8 +2175,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;
                }
@@ -2200,7 +2184,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2208,42 +2193,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;
                }
@@ -2252,7 +2239,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2260,29 +2248,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;
                }
@@ -2291,7 +2282,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2299,23 +2291,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;
                }
@@ -2324,7 +2328,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2332,18 +2337,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;
                }
@@ -2353,7 +2359,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2361,18 +2367,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;
                }
@@ -2382,7 +2389,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2390,20 +2398,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;
                }
 
@@ -2411,7 +2420,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2419,30 +2429,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;
                }
 
@@ -2450,7 +2451,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2458,19 +2460,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;
                }
@@ -2479,7 +2481,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2487,19 +2490,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;
                }
@@ -2508,7 +2511,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2516,20 +2520,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;
                }
 
@@ -2537,7 +2542,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2545,18 +2551,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
                        {
@@ -2572,7 +2579,7 @@ note = "
                                        if (!m_ptr->slow)
                                        {
 #ifdef JP
-note = "¤ÎÆ°¤­¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
+                                               note = "¤ÎÆ°¤­¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
 #else
                                                note = " starts moving slower.";
 #endif
@@ -2589,7 +2596,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2597,20 +2605,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;
                }
 
@@ -2621,7 +2630,7 @@ note = "
 
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2629,14 +2638,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
@@ -2647,7 +2656,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
@@ -2662,16 +2671,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
                        {
@@ -2699,7 +2709,7 @@ note = "
                                }
 
                                /* 2. stun */
-                               do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
+                               do_stun = damroll((caster_lev / 10) + 3 , (dam)) + 1;
 
                                /* Attempt a saving throw */
                                if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
@@ -2709,7 +2719,7 @@ note = "
                                        do_stun = 0;
                                        /* No obvious effect */
 #ifdef JP
-note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
+                                       note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
 #else
                                        note = " is unaffected!";
 #endif
@@ -2726,7 +2736,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2734,7 +2745,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;
@@ -2745,7 +2756,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2753,12 +2765,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 = "¤Ï¾øȯ¤·¤¿¡ª";
@@ -2779,16 +2791,16 @@ note_dies = "
                        /* PSI only works if the monster can see you! -- RG */
                        if (!(los(m_ptr->fy, m_ptr->fx, py, px)))
                        {
-                               dam = 0;
 #ifdef JP
-note = "¤Ï¤¢¤Ê¤¿¤¬¸«¤¨¤Ê¤¤¤Î¤Ç±Æ¶Á¤µ¤ì¤Ê¤¤¡ª";
+                               if (seen) msg_format("%s¤Ï¤¢¤Ê¤¿¤¬¸«¤¨¤Ê¤¤¤Î¤Ç±Æ¶Á¤µ¤ì¤Ê¤¤¡ª", m_name);
 #else
-                               note = " can't see you, and isn't affected!";
+                               if (seen) msg_format("%^s can't see you, and isn't affected!", m_name);
 #endif
-
+                               skipped = TRUE;
+                               break;
                        }
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2796,28 +2808,27 @@ 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->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
@@ -2827,15 +2838,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"));
@@ -2845,7 +2854,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
@@ -2854,7 +2863,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))
                                                {
@@ -2870,7 +2879,7 @@ msg_print("
                                                                {
                                                                        if (r_ptr->flags3 & RF3_NO_FEAR)
 #ifdef JP
-note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
+                                                                               note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
 #else
                                                                                note = " is unaffected.";
 #endif
@@ -2905,7 +2914,7 @@ note = "
                                                break;
                                        default:
 #ifdef JP
-note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
+                                               note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
 #else
                                                note = " falls asleep!";
 #endif
@@ -2916,7 +2925,7 @@ note = "
                        }
 
 #ifdef JP
-note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
+                       note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
 #else
                        note_dies = " collapses, a mindless husk.";
 #endif
@@ -2927,7 +2936,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2935,27 +2945,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
@@ -2965,15 +2974,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"));
@@ -2983,7 +2990,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
@@ -2992,9 +2999,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
@@ -3012,8 +3019,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"));
@@ -3026,7 +3032,7 @@ msg_format("
                        }
 
 #ifdef JP
-note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
+                       note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
 #else
                        note_dies = " collapses, a mindless husk.";
 #endif
@@ -3037,7 +3043,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -3045,7 +3052,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))
@@ -3055,7 +3062,7 @@ note_dies = "
                        }
 
                        /* 1. stun */
-                       do_stun = damroll((p_ptr->lev / 10) + 3 , dam) + 1;
+                       do_stun = damroll((caster_lev / 10) + 3 , dam) + 1;
 
                        /* Attempt a saving throw */
                        if ((r_ptr->flags1 & RF1_UNIQUE) ||
@@ -3073,7 +3080,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -3081,7 +3089,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;
@@ -3091,7 +3099,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -3099,7 +3108,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;
@@ -3108,9 +3117,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 = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -3118,19 +3128,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 */
@@ -3140,15 +3149,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"));
@@ -3158,7 +3165,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
@@ -3179,7 +3186,7 @@ msg_print("
                                                        {
                                                                if (r_ptr->flags3 & RF3_NO_FEAR)
 #ifdef JP
-note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
+                                                                       note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
 #else
                                                                        note = " is unaffected.";
 #endif
@@ -3241,7 +3248,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -3249,31 +3257,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;
                }
@@ -3284,7 +3292,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -3292,19 +3300,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
@@ -3326,7 +3334,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -3334,15 +3342,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
@@ -3356,7 +3368,7 @@ note = "
                        }
                        else if (((r_ptr->flags1 & RF1_UNIQUE) &&
                                 (randint1(888) != 666)) ||
-                                (((r_ptr->level + randint1(20)) > randint1(p_ptr->lev + randint1(10))) &&
+                                (((r_ptr->level + randint1(20)) > randint1(caster_lev + randint1(10))) &&
                                 randint1(100) != 66))
                        {
 #ifdef JP
@@ -3377,7 +3389,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -3385,7 +3397,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) */
@@ -3458,6 +3470,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
@@ -3476,6 +3490,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
@@ -3587,7 +3603,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -3595,7 +3611,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 */
@@ -3639,7 +3655,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -3647,7 +3663,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 */
@@ -3658,7 +3674,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 */
@@ -3693,7 +3709,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -3701,7 +3717,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 */
@@ -3739,7 +3755,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -3747,7 +3763,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 */
@@ -3798,7 +3814,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 = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -3806,7 +3822,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;
                        }
 
@@ -3822,7 +3838,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 */
@@ -3885,7 +3901,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 = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -3893,7 +3909,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;
                        }
 
@@ -3960,7 +3976,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 = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -3968,7 +3984,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;
                        }
 
@@ -4036,7 +4052,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 = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -4044,7 +4060,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;
                        }
 
@@ -4061,7 +4077,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 */
@@ -4132,7 +4148,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 = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -4140,7 +4156,7 @@ 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;
                        }
 
@@ -4150,7 +4166,7 @@ msg_format("%s
                        /* 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 */
@@ -4198,7 +4214,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -4206,7 +4222,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 */
@@ -4220,7 +4236,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 */
@@ -4245,7 +4261,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -4253,10 +4269,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;
                        }
-                       do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
+                       do_stun = damroll((caster_lev / 10) + 3 , (dam)) + 1;
 
                        /* Attempt a saving throw */
                        if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
@@ -4291,7 +4307,7 @@ note = "
                                skipped = TRUE;
                                break;
                        }
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
                                dam = 0;
                                break;
@@ -4299,11 +4315,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
@@ -4332,7 +4351,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -4340,25 +4360,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!";
@@ -4375,7 +4396,7 @@ note_dies = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -4383,21 +4404,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;
                }
@@ -4406,7 +4425,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;
@@ -4414,11 +4433,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
@@ -4450,11 +4472,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
@@ -4465,7 +4487,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
@@ -4478,8 +4500,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;
                                }
                        }
@@ -4505,11 +4530,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
@@ -4520,7 +4545,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
@@ -4533,8 +4558,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;
                                }
                        }
@@ -4556,11 +4584,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
@@ -4571,7 +4599,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
@@ -4600,7 +4628,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;
@@ -4608,11 +4636,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;
@@ -4648,7 +4679,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;
@@ -4656,11 +4687,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;
@@ -4696,7 +4730,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;
@@ -4732,7 +4766,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;
@@ -4741,11 +4775,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
@@ -4775,7 +4812,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;
@@ -4784,11 +4821,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
@@ -4817,7 +4857,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;
@@ -4826,11 +4866,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
@@ -4859,7 +4902,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;
@@ -4898,7 +4941,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;
@@ -4907,11 +4950,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
@@ -4940,7 +4986,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;
@@ -4966,7 +5012,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -4974,7 +5021,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;
                        }
 
@@ -5012,7 +5059,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -5020,19 +5067,19 @@ 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;
                        }
 
                        /* Attempt a saving throw */
                        if ((r_ptr->flags1 & RF1_UNIQUE) ||
                                 (r_ptr->flags3 & RF3_NO_CONF) ||
-                                (r_ptr->level > randint1((p_ptr->lev*2 - 10) < 1 ? 1 : (p_ptr->lev*2 - 10)) + 10))
+                                (r_ptr->level > randint1((caster_lev*2 - 10) < 1 ? 1 : (caster_lev*2 - 10)) + 10))
                        {
                                /* 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 = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
@@ -5045,7 +5092,7 @@ note = "
                        {
 #ifdef JP
 msg_format("%s¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£",m_name);
-note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±¶õ¤È¤Ê¤Ã¤¿¡£";
+note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
 #else
                                msg_format("%^s is blasted by psionic energy.", m_name);
                                note_dies = " collapses, a mindless husk.";
@@ -5067,7 +5114,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -5075,19 +5122,19 @@ 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;
                        }
 
                        /* Attempt a saving throw */
                        if ((r_ptr->flags1 & RF1_UNIQUE) ||
                                 (r_ptr->flags3 & RF3_NO_CONF) ||
-                                (r_ptr->level > randint1((p_ptr->lev*2 - 10) < 1 ? 1 : (p_ptr->lev*2 - 10)) + 10))
+                                (r_ptr->level > randint1((caster_lev*2 - 10) < 1 ? 1 : (caster_lev*2 - 10)) + 10))
                        {
                                /* 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 = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
@@ -5100,7 +5147,7 @@ note = "
                        {
 #ifdef JP
 msg_format("%s¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£",m_name);
-note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±¶õ¤È¤Ê¤Ã¤¿¡£";
+note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
 #else
                                msg_format("%^s is blasted by psionic energy.", m_name);
                                note_dies = " collapses, a mindless husk.";
@@ -5126,7 +5173,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -5134,12 +5181,12 @@ 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;
                        }
 
                        /* Attempt a saving throw */
-                       if (randint0(100 + p_ptr->lev) < (r_ptr->level + 35))
+                       if (randint0(100 + caster_lev) < (r_ptr->level + 35))
                        {
 
 #ifdef JP
@@ -5163,7 +5210,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -5171,12 +5218,12 @@ 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;
                        }
 
                        /* Attempt a saving throw */
-                       if (randint0(100 + p_ptr->lev) < (r_ptr->level + 35))
+                       if (randint0(100 + caster_lev) < (r_ptr->level + 35))
                        {
 
 #ifdef JP
@@ -5200,7 +5247,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -5208,12 +5255,12 @@ 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;
                        }
 
                        /* Attempt a saving throw */
-                       if (randint0(100 + p_ptr->lev) < (r_ptr->level + 35))
+                       if (randint0(100 + caster_lev) < (r_ptr->level + 35))
                        {
 
 #ifdef JP
@@ -5237,7 +5284,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -5245,12 +5292,12 @@ 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;
                        }
 
                        /* Attempt a saving throw */
-                       if (randint0(100 + p_ptr->lev) < (r_ptr->level + 35))
+                       if (randint0(100 + caster_lev) < (r_ptr->level + 35))
                        {
 
 #ifdef JP
@@ -5268,7 +5315,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -5276,7 +5323,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;
                        }
 
@@ -5291,7 +5338,7 @@ note = "
                        }
                        else
                        {
-                               if ((p_ptr->lev + randint1(dam)) >
+                               if ((caster_lev + randint1(dam)) >
                                        (r_ptr->level + randint1(200)))
                                        {
                                                dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
@@ -5328,11 +5375,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
@@ -5386,60 +5433,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") */
@@ -5450,7 +5448,7 @@ msg_format("
 
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -5458,7 +5456,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)
@@ -5470,7 +5468,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)
@@ -5555,7 +5553,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 */
@@ -5600,7 +5598,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 = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
@@ -5608,7 +5606,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;
                        }
 
@@ -5675,11 +5673,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
@@ -5709,7 +5710,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 = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -5717,7 +5719,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;
@@ -5768,7 +5770,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;
                                }
                        }
@@ -5781,7 +5783,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);
                                }
                        }
 
@@ -5794,7 +5796,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -5802,7 +5804,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;
                        }
 
@@ -5861,7 +5863,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
@@ -5883,7 +5885,7 @@ note = "
 
                        /* Monster polymorphs */
 #ifdef JP
-note = "¤¬ÊѿȤ·¤¿¡ª";
+                       note = "¤¬ÊѿȤ·¤¿¡ª";
 #else
                        note = " changes!";
 #endif
@@ -5918,7 +5920,7 @@ note = "
 
                /* Message */
 #ifdef JP
-note = "¤¬¾Ã¤¨µî¤Ã¤¿¡ª";
+               note = "¤¬¾Ã¤¨µî¤Ã¤¿¡ª";
 #else
                note = " disappears!";
 #endif
@@ -5936,20 +5938,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
@@ -5959,7 +5960,7 @@ note = "
                else
                {
 #ifdef JP
-note = "¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£";
+                       note = "¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£";
 #else
                        note = " is dazed.";
 #endif
@@ -5974,11 +5975,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;
@@ -5987,7 +5987,7 @@ note = "
                if (m_ptr->confused)
                {
 #ifdef JP
-note = "¤Ï¤µ¤é¤Ëº®Í𤷤¿¤è¤¦¤À¡£";
+                       note = "¤Ï¤µ¤é¤Ëº®Í𤷤¿¤è¤¦¤À¡£";
 #else
                        note = " looks more confused.";
 #endif
@@ -5999,7 +5999,7 @@ note = "
                else
                {
 #ifdef JP
-note = "¤Ïº®Í𤷤¿¤è¤¦¤À¡£";
+                       note = "¤Ïº®Í𤷤¿¤è¤¦¤À¡£";
 #else
                        note = " looks confused.";
 #endif
@@ -6013,22 +6013,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;
        }
@@ -6058,6 +6059,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;
 
@@ -6072,7 +6075,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);
@@ -6331,7 +6334,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);
                }
@@ -6423,7 +6426,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))
        {
@@ -6435,15 +6438,15 @@ static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int
        if (!who) return (FALSE);
        if (who == p_ptr->riding) return (FALSE);
 
-       if ((p_ptr->reflect || p_ptr->tim_reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
+       if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
        {
                byte t_y, t_x;
                int max_attempts = 10;
 
 #ifdef JP
-if (blind) msg_print("²¿¤«¤¬Ä·¤ÍÊ֤ä¿¡ª");
-else if (p_ptr->special_defense & KATA_FUUJIN) msg_print("É÷¤ÎÇ¡¤¯Éð´ï¤ò¿¶¤ë¤Ã¤ÆÃƤ­ÊÖ¤·¤¿¡ª");
-else msg_print("¹¶·â¤¬Ä·¤ÍÊ֤ä¿¡ª");
+               if (blind) msg_print("²¿¤«¤¬Ä·¤ÍÊ֤ä¿¡ª");
+               else if (p_ptr->special_defense & KATA_FUUJIN) msg_print("É÷¤ÎÇ¡¤¯Éð´ï¤ò¿¶¤ë¤Ã¤ÆÃƤ­ÊÖ¤·¤¿¡ª");
+               else msg_print("¹¶·â¤¬Ä·¤ÍÊ֤ä¿¡ª");
 #else
                if (blind) msg_print("Something bounces!");
                else msg_print("The attack bounces!");
@@ -6564,7 +6567,7 @@ if (fuzzy) msg_print("
                /* Standard damage -- also poisons player */
                case GF_POIS:
                {
-                       bool double_resist = (p_ptr->oppose_pois  || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
+                       bool double_resist = IS_OPPOSE_POIS();
 #ifdef JP
 if (fuzzy) msg_print("ÆǤǹ¶·â¤µ¤ì¤¿¡ª");
 #else
@@ -6592,7 +6595,7 @@ if (fuzzy) msg_print("
                /* Standard damage -- also poisons / mutates player */
                case GF_NUKE:
                {
-                       bool double_resist = (p_ptr->oppose_pois  || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
+                       bool double_resist = IS_OPPOSE_POIS();
 #ifdef JP
 if (fuzzy) msg_print("Êü¼Íǽ¤Ç¹¶·â¤µ¤ì¤¿¡ª");
 #else
@@ -6712,8 +6715,7 @@ if (fuzzy) msg_print("
                        }
 
                        if (!(p_ptr->resist_fire ||
-                             p_ptr->oppose_fire ||
-                             music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU) ||
+                             IS_OPPOSE_FIRE() ||
                              p_ptr->immune_fire))
                        {
                                inven_damage(set_acid_destroy, 3);
@@ -7370,7 +7372,7 @@ if (fuzzy) msg_print("
                                (void)set_stun(p_ptr->stun + randint1(15));
                        }
 
-                       if ((!(p_ptr->resist_cold || p_ptr->oppose_cold || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU))) || one_in_(12))
+                       if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
                        {
                                if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
                        }
@@ -7639,9 +7641,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
@@ -8205,6 +8207,7 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
 
        int y1, x1;
        int y2, x2;
+       int by, bx;
 
        int dist_hack = 0;
 
@@ -8289,7 +8292,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 */
@@ -8706,18 +8709,13 @@ 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" */
-       y2 = y;
-       x2 = x;
+       by = y;
+       bx = x;
 
-       if (breath && (y1 == y2) && (x1 == x2))
+       if (breath && (y1 == by) && (x1 == bx))
        {
                breath = FALSE;
                gm_rad = 1;
@@ -8758,7 +8756,7 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                {
                        flg &= ~(PROJECT_HIDE);
 
-                       breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, y2, x2, (bool)(typ == GF_DISINTEGRATE), TRUE);
+                       breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, (bool)(typ == GF_DISINTEGRATE), TRUE);
                }
                else
                {
@@ -8766,25 +8764,25 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                        for (dist = 0; dist <= rad; dist++)
                        {
                                /* Scan the maximal blast area of radius "dist" */
-                               for (y = y2 - dist; y <= y2 + dist; y++)
+                               for (y = by - dist; y <= by + dist; y++)
                                {
-                                       for (x = x2 - dist; x <= x2 + dist; x++)
+                                       for (x = bx - dist; x <= bx + dist; x++)
                                        {
                                                /* Ignore "illegal" locations */
                                                if (!in_bounds2(y, x)) continue;
 
                                                /* Enforce a "circular" explosion */
-                                               if (distance(y2, x2, y, x) != dist) continue;
+                                               if (distance(by, bx, y, x) != dist) continue;
 
                                                if (typ == GF_DISINTEGRATE)
                                                {
                                                        /* Disintegration are stopped only by perma-walls */
-                                                       if (!do_disintegration(y2, x2, y, x)) continue;
+                                                       if (!do_disintegration(by, bx, y, x)) continue;
                                                }
                                                else
                                                {
                                                        /* Ball explosions are stopped by walls */
-                                                       if (!los(y2, x2, y, x)) continue;
+                                                       if (!los(by, bx, y, x)) continue;
                                                }
 
                                                /* Save this grid */
@@ -8840,7 +8838,7 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                        }
 
                        /* Hack -- center the cursor */
-                       move_cursor_relative(y2, x2);
+                       move_cursor_relative(by, bx);
 
                        /* Flush each "radius" seperately */
                        /*if (fresh_before)*/ Term_fresh();
@@ -8870,7 +8868,7 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                        }
 
                        /* Hack -- center the cursor */
-                       move_cursor_relative(y2, x2);
+                       move_cursor_relative(by, bx);
 
                        /* Flush the explosion */
                        /*if (fresh_before)*/ Term_fresh();
@@ -8901,7 +8899,7 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                        /* Find the closest point in the blast */
                        if (breath)
                        {
-                               int d = dist_to_line(y, x, y1, x1, y2, x2);
+                               int d = dist_to_line(y, x, y1, x1, by, bx);
 
                                /* Affect the grid */
                                if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
@@ -8934,7 +8932,7 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                        /* Find the closest point in the blast */
                        if (breath)
                        {
-                               int d = dist_to_line(y, x, y1, x1, y2, x2);
+                               int d = dist_to_line(y, x, y1, x1, by, bx);
 
                                /* Affect the object in the grid */
                                if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
@@ -8962,6 +8960,8 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                /* Scan for monsters */
                for (i = 0; i < grids; i++)
                {
+                       int effective_dist;
+
                        /* Hack -- Notice new "dist" values */
                        if (gm[dist + 1] == i) dist++;
 
@@ -8969,38 +8969,13 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                        y = gy[i];
                        x = gx[i];
 
-                       if (grids > 1)
-                       {
-                               /* Find the closest point in the blast */
-                               if (breath)
-                               {
-                                       int d = dist_to_line(y, x, y1, x1, y2, x2);
-
-                                       /* Affect the monster in the grid */
-                                       if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_PLAYER))
-                                       {
-                                               if (project_m(who, d+1, y, x, dam, typ,flg)) notice = TRUE;
-                                       }
-                                       else if (project_m(who, d, y, x, dam, typ,flg)) notice = TRUE;
-                               }
-                               else
-                               {
-                                       /* Affect the monster in the grid */
-                                       if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_PLAYER))
-                                       {
-                                               if (!(flg & PROJECT_BEAM))
-                                               {
-                                                       if (project_m(who, dist+1, y, x, dam, typ,flg)) notice = TRUE;
-                                               }
-                                       }
-                                       else if (project_m(who, dist, y, x, dam, typ,flg)) notice = TRUE;
-                               }
-                       }
-                       else
+                       /* A single bolt may be reflected */
+                       if (grids <= 1)
                        {
-                               monster_race *ref_ptr = &r_info[m_list[cave[y][x].m_idx].r_idx];
+                               monster_type *m_ptr = &m_list[cave[y][x].m_idx];
+                               monster_race *ref_ptr = &r_info[m_ptr->r_idx];
 
-                               if ((ref_ptr->flags2 & RF2_REFLECTING) && (!one_in_(10) && (flg & PROJECT_REFLECTABLE) && (!who || dist_hack > 1)))
+                               if ((ref_ptr->flags2 & RF2_REFLECTING) && (flg & PROJECT_REFLECTABLE) && (!who || dist_hack > 1) && !one_in_(10))
                                {
                                        byte t_y, t_x;
                                        int max_attempts = 10;
@@ -9012,7 +8987,6 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                                                t_x = x_saver - 1 + randint1(3);
                                                max_attempts--;
                                        }
-
                                        while (max_attempts && in_bounds2u(t_y, t_x) &&
                                            !(los(y, x, t_y, t_x)));
 
@@ -9022,36 +8996,121 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                                                t_x = x_saver;
                                        }
 
-                                       if (m_list[cave[y][x].m_idx].ml)
+                                       if (m_ptr->ml)
                                        {
 #ifdef JP
-if ((m_list[cave[y][x].m_idx].r_idx == MON_KENSHIROU)
-       || (m_list[cave[y][x].m_idx].r_idx == MON_RAOU))
-       msg_print("¡ÖËÌÅÍ¿À·ý±üµÁ¡¦Æó»Ø¿¿¶õÇÄ¡ª¡×");
-if (m_list[cave[y][x].m_idx].r_idx == MON_DIO) msg_print("¥Ç¥£¥ª¡¦¥Ö¥é¥ó¥É¡¼¤Ï»Ø°ìËܤǹ¶·â¤òÃƤ­ÊÖ¤·¤¿¡ª");
-else msg_print("¹¶·â¤ÏÄ·¤ÍÊ֤ä¿¡ª");
+                                               if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
+                                                       msg_print("¡ÖËÌÅÍ¿À·ý±üµÁ¡¦Æó»Ø¿¿¶õÇÄ¡ª¡×");
+                                               else if (m_ptr->r_idx == MON_DIO) msg_print("¥Ç¥£¥ª¡¦¥Ö¥é¥ó¥É¡¼¤Ï»Ø°ìËܤǹ¶·â¤òÃƤ­ÊÖ¤·¤¿¡ª");
+                                               else msg_print("¹¶·â¤ÏÄ·¤ÍÊ֤ä¿¡ª");
 #else
                                                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 */
                                        flg &= ~(PROJECT_MONSTER | PROJECT_PLAYER);
                                        if (one_in_(2)) flg |= PROJECT_MONSTER;
                                        else flg |= PROJECT_PLAYER;
 
-                                       project(cave[y][x].m_idx, 0, t_y, t_x,  dam, typ, flg, monspell);
+                                       /* The bolt is reflected */
+                                       project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
+
+                                       /* Don't affect the monster any longer */
+                                       continue;
                                }
-                               else
+                       }
+
+
+                       /* Find the closest point in the blast */
+                       if (breath)
+                       {
+                               effective_dist = dist_to_line(y, x, y1, x1, by, bx);
+                       }
+                       else
+                       {
+                               effective_dist = dist;
+                       }
+
+
+                       /* There is the riding player on this monster */
+                       if (p_ptr->riding && player_bold(y, x))
+                       {
+                               /* Aimed on the player */
+                               if (flg & PROJECT_PLAYER)
                                {
-                                       if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_PLAYER))
+                                       if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
                                        {
+                                               /*
+                                                * A beam or bolt is well aimed
+                                                * at the PLAYER!
+                                                * So don't affects the mount.
+                                                */
+                                               continue;
+                                       }
+                                       else
+                                       {
+                                               /*
+                                                * The spell is not well aimed, 
+                                                * So partly affect the mount too.
+                                                */
+                                               effective_dist++;
                                        }
-                                       else if (project_m(who, dist, y, x, dam, typ,flg)) notice = TRUE;
+                               }
+
+                               /*
+                                * This grid is the original target.
+                                */
+                               else if ((y == y2) || (x == x2))
+                               {
+                                       /* Hit the mount with full damage */
+                               }
+
+                               /*
+                                * Otherwise this grid is not the
+                                * original target, it means that line
+                                * of fire is obstructed by this
+                                * monster.
+                                */
+                               /*
+                                * A beam or bolt will hit either
+                                * player or mount.  Choose randomly.
+                                */
+                               else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
+                               {
+                                       if (one_in_(2))
+                                       {
+                                               /* Hit the mount with full damage */
+                                       }
+                                       else
+                                       {
+                                               /* Hit the player later */
+                                               flg &= ~(PROJECT_MONSTER);
+                                               flg |= PROJECT_PLAYER;
+                                                       
+                                               /* Don't affect the mount */
+                                               continue;
+                                       }
+                               }
+
+                               /*
+                                * The spell is not well aimed, so
+                                * partly affect both player and
+                                * mount.
+                                */
+                               else
+                               {
+                                       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)
                {
@@ -9083,6 +9142,8 @@ else msg_print("
                /* Scan for player */
                for (i = 0; i < grids; i++)
                {
+                       int effective_dist;
+
                        /* Hack -- Notice new "dist" values */
                        if (gm[dist+1] == i) dist++;
 
@@ -9090,30 +9151,58 @@ else msg_print("
                        y = gy[i];
                        x = gx[i];
 
+                       /* Affect the player? */
+                       if (!player_bold(y, x)) continue;
+
                        /* Find the closest point in the blast */
                        if (breath)
                        {
-                               int d = dist_to_line(y, x, y1, x1, y2, x2);
-
-                               /* Affect the player */
-                               if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_MONSTER))
-                               {
-                                       if (project_p(who, who_name, d+1, y, x, dam, typ, flg, monspell)) notice = TRUE;
-                               }
-                               else if (project_p(who, who_name, d, y, x, dam, typ, flg, monspell)) notice = TRUE;
+                               effective_dist = dist_to_line(y, x, y1, x1, by, bx);
                        }
                        else
                        {
-                               /* Affect the player */
-                               if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_MONSTER))
+                               effective_dist = dist;
+                       }
+
+                       /* Target may be your horse */
+                       if (p_ptr->riding)
+                       {
+                               /* Aimed on the player */
+                               if (flg & PROJECT_PLAYER)
                                {
-                                       if (!((flg & PROJECT_BEAM) || (flg & PROJECT_STOP)))
-                                       {
-                                               if (project_p(who, who_name, dist+1, y, x, dam, typ, flg, monspell)) notice = TRUE;
-                                       }
+                                       /* Hit the player with full damage */
+                               }
+
+                               /*
+                                * Hack -- When this grid was not the
+                                * original target, a beam or bolt
+                                * would hit either player or mount,
+                                * and should be choosen randomly.
+                                *
+                                * But already choosen to hit the
+                                * mount at this point.
+                                */
+                               else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
+                               {
+                                       /*
+                                        * A beam or bolt is well aimed
+                                        * at the mount!
+                                        * So don't affects the player.
+                                        */
+                                       continue;
+                               }
+                               else
+                               {
+                                       /*
+                                        * The spell is not well aimed, 
+                                        * So partly affect the player too.
+                                        */
+                                       effective_dist++;
                                }
-                               else if (project_p(who, who_name, dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
                        }
+
+                       /* Affect the player */
+                       if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
                }
        }