OSDN Git Service

This commit was manufactured by cvs2svn to create tag
[hengband/hengband.git] / src / spells1.c
index 14e9e5c..b935af7 100644 (file)
@@ -391,7 +391,7 @@ sint project_path(u16b *gp, int range, int y1, int x1, int y2, int x2, int flg)
                        if (flg & (PROJECT_STOP))
                        {
                                if ((n > 0) &&
-                                   ((y == py && x == px) || cave[y][x].m_idx != 0))
+                                   (player_bold(y, x) || cave[y][x].m_idx != 0))
                                        break;
                        }
 
@@ -476,7 +476,7 @@ sint project_path(u16b *gp, int range, int y1, int x1, int y2, int x2, int flg)
                        if (flg & (PROJECT_STOP))
                        {
                                if ((n > 0) &&
-                                   ((y == py && x == px) || cave[y][x].m_idx != 0))
+                                   (player_bold(y, x) || cave[y][x].m_idx != 0))
                                        break;
                        }
 
@@ -543,7 +543,7 @@ sint project_path(u16b *gp, int range, int y1, int x1, int y2, int x2, int flg)
                        if (flg & (PROJECT_STOP))
                        {
                                if ((n > 0) &&
-                                   ((y == py && x == px) || cave[y][x].m_idx != 0))
+                                   (player_bold(y, x) || cave[y][x].m_idx != 0))
                                        break;
                        }
 
@@ -778,6 +778,17 @@ msg_print("
                                }
                        }
 
+                       /* Remove "unsafe" flag if player is not blind */
+                       if (!p_ptr->blind && player_has_los_bold(y, x))
+                       {
+                               c_ptr->info &= ~(CAVE_UNSAFE);
+
+                               /* Redraw */
+                               lite_spot(y, x);
+
+                               obvious = TRUE;
+                       }
+
                        break;
                }
 
@@ -802,14 +813,14 @@ msg_print("
 #endif
 
                                        obvious = TRUE;
+                               }
 
-                                       /* Visibility change */
-                                       if ((c_ptr->feat >= FEAT_DOOR_HEAD) &&
-                                                (c_ptr->feat <= FEAT_DOOR_TAIL))
-                                       {
-                                               /* Update some things */
-                                               p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
-                                       }
+                               /* Visibility change */
+                               if ((c_ptr->feat >= FEAT_DOOR_HEAD) &&
+                                        (c_ptr->feat <= FEAT_DOOR_TAIL))
+                               {
+                                       /* Update some things */
+                                       p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
                                }
 
                                /* Forget the door */
@@ -822,6 +833,17 @@ msg_print("
                        /* Notice */
                        note_spot(y, x);
 
+                       /* Remove "unsafe" flag if player is not blind */
+                       if (!p_ptr->blind && player_has_los_bold(y, x))
+                       {
+                               c_ptr->info &= ~(CAVE_UNSAFE);
+
+                               /* Redraw */
+                               lite_spot(y, x);
+
+                               obvious = TRUE;
+                       }
+
                        break;
                }
 
@@ -841,7 +863,7 @@ msg_print("
                                {
                                        /* Message */
 #ifdef JP
-msg_print("²¿¤«¤¬¤Ä¤Ã¤«¤¨¤Æ¥É¥¢¤¬³«¤«¤Ê¤¤¡£");
+                                       msg_print("¥É¥¢¤Ë²¿¤«¤¬¤Ä¤Ã¤«¤¨¤Æ³«¤«¤Ê¤¯¤Ê¤Ã¤¿¡£");
 #else
                                        msg_print("The door seems stuck.");
 #endif
@@ -968,8 +990,8 @@ msg_print("
                                                obvious = TRUE;
                                        }
 
-                                       /* Place gold */
-                                       place_object(y, x, FALSE, FALSE);
+                                       /* Place object */
+                                       place_object(y, x, 0L);
                                }
                        }
 
@@ -1011,7 +1033,7 @@ msg_print("
                        if (!cave_naked_bold(y, x)) break;
 
                        /* Not on the player */
-                       if ((y == py) && (x == px)) break;
+                       if (player_bold(y, x)) break;
 
                        /* Create a closed door */
                        cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x00);
@@ -1049,7 +1071,7 @@ msg_print("
                        if (!cave_naked_bold(y, x)) break;
 
                        /* Not on the player */
-                       if ((y == py) && (x == px)) break;
+                       if (player_bold(y, x)) break;
 
                        /* Create a closed door */
                        cave_set_feat(y, x, FEAT_TREES);
@@ -1087,7 +1109,7 @@ msg_print("
                        if (!cave_naked_bold(y, x)) break;
 
                        /* Not on the player */
-                       if ((y == py) && (x == px)) break;
+                       if (player_bold(y, x)) break;
 
                        /* Place a trap */
                        cave_set_feat(y, x, FEAT_WALL_EXTRA);
@@ -1156,20 +1178,28 @@ msg_print("
                case GF_LITE:
                {
                        /* Turn on the light */
-                       if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS)) c_ptr->info |= (CAVE_GLOW);
+                       if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
+                       {
+                               c_ptr->info |= (CAVE_GLOW);
 
-                       /* Notice */
-                       note_spot(y, x);
+                               /* Notice */
+                               note_spot(y, x);
 
-                       /* Redraw */
-                       lite_spot(y, x);
+                               /* Redraw */
+                               lite_spot(y, x);
 
-                       /* Observe */
-                       if (player_can_see_bold(y, x)) obvious = TRUE;
+                               /* Observe */
+                               if (player_can_see_bold(y, x)) obvious = TRUE;
 
-                       /* Mega-Hack -- Update the monster in the affected grid */
-                       /* This allows "spear of light" (etc) to work "correctly" */
-                       if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
+                               /* Mega-Hack -- Update the monster in the affected grid */
+                               /* This allows "spear of light" (etc) to work "correctly" */
+                               if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
+
+                               if (p_ptr->special_defense & NINJA_S_STEALTH)
+                               {
+                                       if (player_bold(y, x)) set_superstealth(FALSE);
+                               }
+                       }
 
                        break;
                }
@@ -1215,7 +1245,7 @@ msg_print("
 #ifdef JP
                                msg_print("¶À¤¬³ä¤ì¤¿¡ª");
 #else
-                               msg_print("The mirror was chashed!");
+                               msg_print("The mirror was crashed!");
 #endif                         
                                remove_mirror(y,x);
                            project(0,2,y,x, p_ptr->lev /2 +5 ,GF_SHARDS,(PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_HANGEKI),-1);
@@ -1229,9 +1259,9 @@ msg_print("
 #ifdef JP
                                msg_print("¶À¤¬³ä¤ì¤¿¡ª");
 #else
-                               msg_print("The mirror was chashed!");
+                               msg_print("The mirror was crashed!");
 #endif                         
-                               cave_set_feat(y,x, FEAT_FLOOR);
+                               remove_mirror(y, x);
                        }
                        break;
                }
@@ -1584,7 +1614,7 @@ note_kill = "
 #ifdef JP
 note_kill = "À¸¤­Ê֤ä¿¡£";
 #else
-                                       note_kill = "rivived.";
+                                       note_kill = " revived.";
 #endif
                                                }
                                                else if (!note_kill)
@@ -1756,7 +1786,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 +1811,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 +1821,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 +1847,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 +1862,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 +1871,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 +1881,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 +1890,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 +1902,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 +1911,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 +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_ELEC))
+                       if (r_ptr->flagsr & RFR_IM_ELEC)
                        {
 #ifdef JP
 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -1924,7 +1932,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 +1941,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 +1950,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 +1962,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 +1973,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 +1982,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 +1991,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 +2003,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 +2014,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 +2023,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 +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 = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2033,7 +2044,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 +2054,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 +2062,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 +2074,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 +2084,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 +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)
@@ -2093,7 +2105,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 +2114,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 +2123,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 +2135,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 +2146,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 +2165,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 +2174,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 +2184,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 +2193,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 +2205,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 +2214,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 +2223,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 +2269,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 +2278,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 +2312,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 +2321,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 +2358,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 +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.";
 #endif
 
                                dam *= 3; dam /= randint1(6) + 6;
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
                        }
                        break;
                }
@@ -2353,7 +2389,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 +2397,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 +2419,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 +2428,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 +2450,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 +2459,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 +2481,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 +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_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 +2511,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 +2520,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 +2541,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 +2550,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 +2572,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 +2581,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 +2609,7 @@ note = "
                                        if (!m_ptr->slow)
                                        {
 #ifdef JP
-note = "¤ÎÆ°¤­¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
+                                               note = "¤ÎÆ°¤­¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
 #else
                                                note = " starts moving slower.";
 #endif
@@ -2589,7 +2626,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 +2635,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 +2660,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 +2668,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 +2686,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 +2701,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 +2739,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 +2749,7 @@ note = "
                                        do_stun = 0;
                                        /* No obvious effect */
 #ifdef JP
-note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
+                                       note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
 #else
                                        note = " is unaffected!";
 #endif
@@ -2726,7 +2766,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 +2775,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 +2786,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 +2795,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 = "¤Ï¾øȯ¤·¤¿¡ª";
@@ -2788,7 +2830,7 @@ note_dies = "
                                break;
                        }
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -2796,28 +2838,27 @@ note_dies = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
                        if (r_ptr->flags2 & RF2_EMPTY_MIND)
                        {
                                dam = 0;
 #ifdef JP
-note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
+                               note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
 #else
                                note = " is immune!";
 #endif
-                               if (seen) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
 
                        }
-                       else if ((r_ptr->flags2 & RF2_STUPID) ||
-                                               (r_ptr->flags2 & RF2_WEIRD_MIND) ||
-                                               (r_ptr->flags3 & RF3_ANIMAL) ||
-                                               (r_ptr->level > randint1(3 * dam)))
+                       else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
+                                (r_ptr->flags3 & RF3_ANIMAL) ||
+                                (r_ptr->level > randint1(3 * dam)))
                        {
                                dam /= 3;
 #ifdef JP
-note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
+                               note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
 #else
                                note = " resists.";
 #endif
@@ -2827,15 +2868,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 +2884,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 +2893,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 +2909,7 @@ msg_print("
                                                                {
                                                                        if (r_ptr->flags3 & RF3_NO_FEAR)
 #ifdef JP
-note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
+                                                                               note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
 #else
                                                                                note = " is unaffected.";
 #endif
@@ -2905,7 +2944,7 @@ note = "
                                                break;
                                        default:
 #ifdef JP
-note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
+                                               note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
 #else
                                                note = " falls asleep!";
 #endif
@@ -2916,7 +2955,7 @@ note = "
                        }
 
 #ifdef JP
-note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
+                       note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
 #else
                        note_dies = " collapses, a mindless husk.";
 #endif
@@ -2927,7 +2966,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 +2975,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 +3004,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 +3020,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 +3029,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 +3049,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 +3062,7 @@ msg_format("
                        }
 
 #ifdef JP
-note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
+                       note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
 #else
                        note_dies = " collapses, a mindless husk.";
 #endif
@@ -3037,7 +3073,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 +3082,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 +3092,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 +3110,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 +3119,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 +3129,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 +3138,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 +3147,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 +3158,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 +3179,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 +3195,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 +3216,7 @@ msg_print("
                                                        {
                                                                if (r_ptr->flags3 & RF3_NO_FEAR)
 #ifdef JP
-note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
+                                                                       note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
 #else
                                                                        note = " is unaffected.";
 #endif
@@ -3241,7 +3278,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 +3287,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 +3322,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 +3330,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 +3364,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 +3372,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 +3398,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 +3419,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 +3427,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) */
@@ -3418,7 +3460,7 @@ note = "
                {
                        if (seen) obvious = TRUE;
 
-                       if (is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_UNIQUE_7 | RF7_UNIQUE2)))
+                       if (is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
                        {
 #ifdef JP
 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
@@ -3458,6 +3500,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 +3520,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
@@ -3510,29 +3556,32 @@ msg_format("%^s
                        /* No overflow */
                        if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
 
-                       chg_virtue(V_VITALITY, 1);
-                       
-                       if (r_ptr->flags1 & RF1_UNIQUE)
-                               chg_virtue(V_INDIVIDUALISM, 1);
-       
-                       if (is_friendly(m_ptr))
-                               chg_virtue(V_HONOUR, 1);
-                       else if (!(r_ptr->flags3 & RF3_EVIL))
+                       if (!who)
                        {
-                               if (r_ptr->flags3 & RF3_GOOD)
-                                       chg_virtue(V_COMPASSION, 2);
-                               else
-                                       chg_virtue(V_COMPASSION, 1);
+                               chg_virtue(V_VITALITY, 1);
+
+                               if (r_ptr->flags1 & RF1_UNIQUE)
+                                       chg_virtue(V_INDIVIDUALISM, 1);
+
+                               if (is_friendly(m_ptr))
+                                       chg_virtue(V_HONOUR, 1);
+                               else if (!(r_ptr->flags3 & RF3_EVIL))
+                               {
+                                       if (r_ptr->flags3 & RF3_GOOD)
+                                               chg_virtue(V_COMPASSION, 2);
+                                       else
+                                               chg_virtue(V_COMPASSION, 1);
+                               }
+
+                               if (r_ptr->flags3 & RF3_ANIMAL)
+                                       chg_virtue(V_NATURE, 1);
                        }
 
                        if (m_ptr->r_idx == MON_LEPER)
                        {
                                heal_leper = TRUE;
-                               chg_virtue(V_COMPASSION, 5);
+                               if (!who) chg_virtue(V_COMPASSION, 5);
                        }
-       
-                       if (r_ptr->flags3 & RF3_ANIMAL)
-                               chg_virtue(V_NATURE, 1);
 
                        /* Redraw (later) if needed */
                        if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
@@ -3587,7 +3636,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 +3644,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 +3688,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 +3696,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 +3707,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 +3742,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 +3750,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 +3788,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 +3796,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 +3847,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,11 +3855,11 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
 
-                       if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
+                       if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
                                dam = dam * 2 / 3;
 
                        /* Attempt a saving throw */
@@ -3822,7 +3871,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 +3934,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,11 +3942,11 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
 
-                       if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
+                       if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
                                dam = dam * 2 / 3;
 
                        /* Attempt a saving throw */
@@ -3960,7 +4009,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,11 +4017,11 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
 
-                       if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
+                       if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
                                dam = dam * 2 / 3;
 
                        /* Attempt a saving throw */
@@ -4036,7 +4085,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,11 +4093,11 @@ note = "
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
 
-                       if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
+                       if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
                                dam = dam * 2 / 3;
 
                        /* Attempt a saving throw */
@@ -4061,7 +4110,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 +4181,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,17 +4189,17 @@ msg_format("%s
                                note = " is immune.";
 #endif
                                dam = 0;
-                               if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
+                               if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
                        }
 
-                       if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
+                       if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
                                dam = dam * 2 / 3;
 
                        /* Attempt a saving throw */
                        if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
                            (m_ptr->mflag2 & MFLAG2_NOPET) ||
-                                (r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)) ||
+                                !monster_living(r_ptr) ||
                                 ((r_ptr->level+10) > randint1(dam)))
                        {
                                /* Resist */
@@ -4198,7 +4247,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 +4255,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 +4269,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 +4294,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 +4302,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 +4340,7 @@ note = "
                                skipped = TRUE;
                                break;
                        }
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
                                dam = 0;
                                break;
@@ -4299,11 +4348,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 +4384,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 +4393,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 +4429,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 +4437,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 +4458,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 +4466,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 +4505,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 +4520,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 +4533,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 +4563,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 +4578,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 +4591,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 +4617,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 +4632,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 +4661,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 +4669,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 +4712,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 +4720,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 +4763,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 +4799,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 +4808,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 +4845,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 +4854,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 +4890,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 +4899,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 +4935,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 +4974,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 +4983,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 +5019,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 +5045,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,25 +5054,28 @@ 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;
                        }
 
                        if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->flags5 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->flags6 & ~(RF6_NOMAGIC_MASK)))
                        {
-                               /* Message */
+                               if (!who)
+                               {
+                                       /* Message */
 #ifdef JP
-msg_format("%s¤«¤éÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¤È¤Ã¤¿¡£",m_name);
+                                       msg_format("%s¤«¤éÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¤È¤Ã¤¿¡£", m_name);
 #else
-                               msg_format("You draw psychic energy from %s.", m_name);
+                                       msg_format("You draw psychic energy from %s.", m_name);
 #endif
 
-                               (void)hp_player(dam);
+                                       (void)hp_player(dam);
+                               }
                        }
                        else
                        {
 #ifdef JP
-msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£",m_name);
+                               msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
 #else
                                msg_format("%s is unaffected.", m_name);
 #endif
@@ -5007,12 +5090,12 @@ msg_format("%s
                        if (seen) obvious = TRUE;
                        /* Message */
 #ifdef JP
-msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£",m_name);
+                       if (!who) msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£", m_name);
 #else
-                       msg_format("You gaze intently at %s.", m_name);
+                       if (!who) 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,22 +5103,22 @@ 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 = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
+                               note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
 #else
                                note = "is unaffected!";
 #endif
@@ -5044,8 +5127,8 @@ note = "
                        else
                        {
 #ifdef JP
-msg_format("%s¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£",m_name);
-note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
+                               msg_format("%s¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£", m_name);
+                               note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
 #else
                                msg_format("%^s is blasted by psionic energy.", m_name);
                                note_dies = " collapses, a mindless husk.";
@@ -5062,12 +5145,12 @@ note_dies = "
                        if (seen) obvious = TRUE;
                        /* Message */
 #ifdef JP
-msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£",m_name);
+                       if (!who) msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£", m_name);
 #else
-                       msg_format("You gaze intently at %s.", m_name);
+                       if (!who) 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,22 +5158,22 @@ 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 = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
+                               note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
 #else
                                note = "is unaffected!";
 #endif
@@ -5099,8 +5182,8 @@ note = "
                        else
                        {
 #ifdef JP
-msg_format("%s¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£",m_name);
-note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
+                               msg_format("%s¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£", m_name);
+                               note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
 #else
                                msg_format("%^s is blasted by psionic energy.", m_name);
                                note_dies = " collapses, a mindless husk.";
@@ -5121,12 +5204,12 @@ note_dies = "
                        if (seen) obvious = TRUE;
                        /* Message */
 #ifdef JP
-msg_format("%s¤ò»Øº¹¤·¤Æ¼ö¤¤¤ò¤«¤±¤¿¡£",m_name);
+                       if (!who) msg_format("%s¤ò»Øº¹¤·¤Æ¼ö¤¤¤ò¤«¤±¤¿¡£", m_name);
 #else
-                       msg_format("You point at %s and curses.", m_name);
+                       if (!who) msg_format("You point at %s and curse.", m_name);
 #endif
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -5134,16 +5217,15 @@ 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
-note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
+                               note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
 #else
                                note = "is unaffected!";
 #endif
@@ -5158,12 +5240,12 @@ note = "
                        if (seen) obvious = TRUE;
                        /* Message */
 #ifdef JP
-msg_format("%s¤ò»Øº¹¤·¤Æ¶²¤í¤·¤²¤Ë¼ö¤¤¤ò¤«¤±¤¿¡£",m_name);
+                       if (!who) msg_format("%s¤ò»Øº¹¤·¤Æ¶²¤í¤·¤²¤Ë¼ö¤¤¤ò¤«¤±¤¿¡£", m_name);
 #else
-                       msg_format("You point at %s and curses horribly.", m_name);
+                       if (!who) msg_format("You point at %s and curse horribly.", m_name);
 #endif
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -5171,16 +5253,15 @@ 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
-note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
+                               note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
 #else
                                note = "is unaffected!";
 #endif
@@ -5195,12 +5276,12 @@ note = "
                        if (seen) obvious = TRUE;
                        /* Message */
 #ifdef JP
-msg_format("%s¤ò»Øº¹¤·¡¢¶²¤·¤²¤Ë¼öʸ¤ò¾§¤¨¤¿¡ª",m_name);
+                       if (!who) msg_format("%s¤ò»Øº¹¤·¡¢¶²¤í¤·¤²¤Ë¼öʸ¤ò¾§¤¨¤¿¡ª", m_name);
 #else
-                       msg_format("You point at %s, incanting terribly!", m_name);
+                       if (!who) 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,16 +5289,15 @@ 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
-note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
+                               note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
 #else
                                note = "is unaffected!";
 #endif
@@ -5232,12 +5312,12 @@ note = "
                        if (seen) obvious = TRUE;
                        /* Message */
 #ifdef JP
-msg_format("%s¤ÎÈ빦¤òÆͤ¤¤Æ¡¢¡Ö¤ªÁ°¤Ï´û¤Ë»à¤ó¤Ç¤¤¤ë¡×¤È¶«¤ó¤À¡£",m_name);
+                       if (!who) msg_format("%s¤ÎÈ빦¤òÆͤ¤¤Æ¡¢¡Ö¤ªÁ°¤Ï´û¤Ë»à¤ó¤Ç¤¤¤ë¡×¤È¶«¤ó¤À¡£", m_name);
 #else
-                       msg_format("You point at %s, screaming th word, 'DIE!'.", m_name);
+                       if (!who) msg_format("You point at %s, screaming the word, 'DIE!'.", m_name);
 #endif
 
-                       if (r_ptr->flags3 & (RF3_RES_ALL))
+                       if (r_ptr->flagsr & RFR_RES_ALL)
                        {
 #ifdef JP
                                note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
@@ -5245,16 +5325,15 @@ 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)) && ((who <= 0) || (m_list[who].r_idx != MON_KENSHIROU)))
                        {
-
 #ifdef JP
-note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
+                               note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
 #else
                                note = "is unaffected!";
 #endif
@@ -5268,7 +5347,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 +5355,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 +5370,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;
@@ -5316,7 +5395,7 @@ note = "
                {
                        int nokori_hp;
                        if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
-                           (r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags7 & (RF7_UNIQUE_7)) || (r_ptr->flags7 & (RF7_UNIQUE2)) || (r_ptr->flags1 & RF1_QUESTOR))
+                           (r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags7 & (RF7_NAZGUL)) || (r_ptr->flags7 & (RF7_UNIQUE2)) || (r_ptr->flags1 & RF1_QUESTOR))
                        {
 #ifdef JP
 msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£",m_name);
@@ -5328,11 +5407,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 +5465,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 +5480,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 +5488,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 +5500,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 +5585,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 +5630,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 +5638,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;
                        }
 
@@ -5668,23 +5698,26 @@ note = "
                case GF_PHOTO:
                {
 #ifdef JP
-                       msg_format("%s¤ò¼Ì¿¿¤Ë»£¤Ã¤¿¡£",m_name);
+                       if (!who) msg_format("%s¤ò¼Ì¿¿¤Ë»£¤Ã¤¿¡£", m_name);
 #else
-                       msg_format("You take a photograph of %s.",m_name);
+                       if (!who) msg_format("You take a photograph of %s.", m_name);
 #endif
                        /* 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
-note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
-note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
+                               note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
+                               note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
 #else
                                note = " cringes from the light!";
                                note_dies = " shrivels away in the light!";
@@ -5709,7 +5742,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 +5751,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 +5802,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 +5815,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 +5828,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 +5836,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;
                        }
 
@@ -5846,7 +5880,7 @@ note = "
        if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
 
        /* "Unique" and "quest" monsters can only be "killed" by the player. */
-       if (((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7) || (r_ptr->flags1 & RF1_QUESTOR)) && !p_ptr->inside_battle)
+       if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
        {
                if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
        }
@@ -5861,7 +5895,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
@@ -5872,182 +5906,179 @@ note = "
                /* Extract method of death */
                note = note_dies;
        }
-
-       /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
-       else if (do_poly && (randint1(90) > r_ptr->level))
+       else
        {
-               if (polymorph_monster(y, x))
+               /* Sound and Impact breathers never stun */
+               if (do_stun &&
+                   !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
+                   !(r_ptr->flags3 & RF3_NO_STUN))
                {
                        /* Obvious */
                        if (seen) obvious = TRUE;
 
-                       /* Monster polymorphs */
+                       /* Get confused */
+                       if (m_ptr->stunned)
+                       {
 #ifdef JP
-note = "¤¬ÊѿȤ·¤¿¡ª";
+                               note = "¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£";
 #else
-                       note = " changes!";
+                               note = " is more dazed.";
 #endif
 
+                               tmp = m_ptr->stunned + (do_stun / 2);
+                       }
+                       else
+                       {
+#ifdef JP
+                               note = "¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£";
+#else
+                               note = " is dazed.";
+#endif
 
-                       /* Turn off the damage */
-                       dam = 0;
+                               tmp = do_stun;
+                       }
 
-                       /* Hack -- Get new monster */
-                       m_ptr = &m_list[c_ptr->m_idx];
+                       /* Apply stun */
+                       m_ptr->stunned = (tmp < 200) ? tmp : 200;
 
-                       /* Hack -- Get new race */
-                       r_ptr = &r_info[m_ptr->r_idx];
+                       /* Get angry */
+                       get_angry = TRUE;
                }
-               else
+
+               /* Confusion and Chaos breathers (and sleepers) never confuse */
+               if (do_conf &&
+                        !(r_ptr->flags3 & RF3_NO_CONF) &&
+                        !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
                {
-                       /* No polymorph */
+                       /* Obvious */
+                       if (seen) obvious = TRUE;
+
+                       /* Already partially confused */
+                       if (m_ptr->confused)
+                       {
 #ifdef JP
-note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
+                               note = "¤Ï¤µ¤é¤Ëº®Í𤷤¿¤è¤¦¤À¡£";
 #else
-                       note = " is unaffected!";
+                               note = " looks more confused.";
 #endif
 
-               }
-       }
-
-       /* Handle "teleport" */
-       else if (do_dist)
-       {
-               /* Obvious */
-               if (seen) obvious = TRUE;
+                               tmp = m_ptr->confused + (do_conf / 2);
+                       }
 
-               /* Message */
+                       /* Was not confused */
+                       else
+                       {
 #ifdef JP
-note = "¤¬¾Ã¤¨µî¤Ã¤¿¡ª";
+                               note = "¤Ïº®Í𤷤¿¤è¤¦¤À¡£";
 #else
-               note = " disappears!";
+                               note = " looks confused.";
 #endif
 
-               chg_virtue(V_VALOUR, -1);
+                               tmp = do_conf;
+                       }
 
-               /* Teleport */
-               teleport_away(c_ptr->m_idx, do_dist, (bool)(!who));
+                       /* Apply confusion */
+                       m_ptr->confused = (tmp < 200) ? tmp : 200;
 
-               /* Hack -- get new location */
-               y = m_ptr->fy;
-               x = m_ptr->fx;
+                       /* Get angry */
+                       get_angry = TRUE;
+               }
 
-               /* Hack -- get new grid */
-               c_ptr = &cave[y][x];
-       }
+               if (do_time)
+               {
+                       /* Obvious */
+                       if (seen) obvious = TRUE;
 
-       /* Sound and Impact breathers never stun */
-       else if (do_stun &&
-           !(r_ptr->flags4 & (RF4_BR_SOUN)) &&
-           !(r_ptr->flags4 & (RF4_BR_WALL)) &&
-           !(r_ptr->flags3 & (RF3_NO_STUN)))
-       {
-               /* Obvious */
-               if (seen) obvious = TRUE;
+                       if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
 
-               /* Get confused */
-               if (m_ptr->stunned)
-               {
+                       if (do_time)
+                       {
 #ifdef JP
-note = "¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£";
+                               note = "¤Ï¼å¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£";
 #else
-                       note = " is more dazed.";
+                               note = " seems weakened.";
 #endif
-
-                       tmp = m_ptr->stunned + (do_stun / 2);
+                               m_ptr->maxhp -= do_time;
+                               if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
+                       }
+                       get_angry = TRUE;
                }
-               else
+
+               /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
+               if (do_poly && (randint1(90) > r_ptr->level))
                {
+                       if (polymorph_monster(y, x))
+                       {
+                               /* Obvious */
+                               if (seen) obvious = TRUE;
+
+                               /* Monster polymorphs */
 #ifdef JP
-note = "¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£";
+                               note = "¤¬ÊѿȤ·¤¿¡ª";
 #else
-                       note = " is dazed.";
+                               note = " changes!";
 #endif
 
-                       tmp = do_stun;
-               }
-
-               /* Apply stun */
-               m_ptr->stunned = (tmp < 200) ? tmp : 200;
-
-               /* Get angry */
-               get_angry = TRUE;
-       }
-
-       /* Confusion and Chaos breathers (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)))
-       {
-               /* Obvious */
-               if (seen) obvious = TRUE;
-
-               /* Already partially confused */
-               if (m_ptr->confused)
-               {
+                               /* Turn off the damage */
+                               dam = 0;
+                       }
+                       else
+                       {
+                               /* No polymorph */
 #ifdef JP
-note = "¤Ï¤µ¤é¤Ëº®Í𤷤¿¤è¤¦¤À¡£";
+                               note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
 #else
-                       note = " looks more confused.";
+                               note = " is unaffected!";
 #endif
+                       }
+
+                       /* Hack -- Get new monster */
+                       m_ptr = &m_list[c_ptr->m_idx];
 
-                       tmp = m_ptr->confused + (do_conf / 2);
+                       /* Hack -- Get new race */
+                       r_ptr = &r_info[m_ptr->r_idx];
                }
 
-               /* Was not confused */
-               else
+               /* Handle "teleport" */
+               if (do_dist)
                {
+                       /* Obvious */
+                       if (seen) obvious = TRUE;
+
+                       /* Message */
 #ifdef JP
-note = "¤Ïº®Í𤷤¿¤è¤¦¤À¡£";
+                       note = "¤¬¾Ã¤¨µî¤Ã¤¿¡ª";
 #else
-                       note = " looks confused.";
+                       note = " disappears!";
 #endif
 
-                       tmp = do_conf;
-               }
-
-               /* Apply confusion */
-               m_ptr->confused = (tmp < 200) ? tmp : 200;
+                       if (!who) chg_virtue(V_VALOUR, -1);
 
-               /* Get angry */
-               get_angry = TRUE;
-       }
-       else if (do_time)
-       {
-               /* Obvious */
-               if (seen) obvious = TRUE;
+                       /* Teleport */
+                       teleport_away(c_ptr->m_idx, do_dist, (bool)(!who));
 
-               if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp-1;
+                       /* Hack -- get new location */
+                       y = m_ptr->fy;
+                       x = m_ptr->fx;
 
-               if (do_time)
-               {
-#ifdef JP
-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;
+                       /* Hack -- get new grid */
+                       c_ptr = &cave[y][x];
                }
-               get_angry = TRUE;
-       }
 
+               /* Fear */
+               if (do_fear)
+               {
+                       /* Increase fear */
+                       tmp = m_ptr->monfear + do_fear;
 
-       /* Fear */
-       if (do_fear)
-       {
-               /* Increase fear */
-               tmp = m_ptr->monfear + do_fear;
-
-               /* Set fear */
-               m_ptr->monfear = (tmp < 200) ? tmp : 200;
+                       /* Set fear */
+                       m_ptr->monfear = (tmp < 200) ? tmp : 200;
 
-               /* Get angry */
-               get_angry = TRUE;
+                       /* Get angry */
+                       get_angry = TRUE;
+               }
        }
 
-
        /* If another monster did the damage, hurt the monster by hand */
        if (who)
        {
@@ -6058,6 +6089,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 +6105,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 +6364,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 +6456,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))
        {
@@ -6451,19 +6484,27 @@ static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int
 
 
                /* Choose 'new' target */
-               do
+               if (who > 0)
                {
-                       t_y = m_list[who].fy - 1 + randint1(3);
-                       t_x = m_list[who].fx - 1 + randint1(3);
-                       max_attempts--;
-               }
-               while (max_attempts && in_bounds2u(t_y, t_x) &&
-                    !(player_has_los_bold(t_y, t_x)));
+                       do
+                       {
+                               t_y = m_list[who].fy - 1 + randint1(3);
+                               t_x = m_list[who].fx - 1 + randint1(3);
+                               max_attempts--;
+                       }
+                       while (max_attempts && in_bounds2u(t_y, t_x) &&
+                            !(player_has_los_bold(t_y, t_x)));
 
-               if (max_attempts < 1)
+                       if (max_attempts < 1)
+                       {
+                               t_y = m_list[who].fy;
+                               t_x = m_list[who].fx;
+                       }
+               }
+               else
                {
-                       t_y = m_list[who].fy;
-                       t_x = m_list[who].fx;
+                       t_y = py - 1 + randint1(3);
+                       t_x = px - 1 + randint1(3);
                }
 
                project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
@@ -6497,13 +6538,29 @@ static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int
                /* Get the monster's real name (gotten before polymorph!) */
                strcpy(killer, who_name);
        }
-       else if (who < 0)
+       else
        {
+               switch (who)
+               {
+               case PROJECT_WHO_UNCTRL_POWER:
+#ifdef JP
+                       strcpy(killer, "À©¸æ¤Ç¤­¤Ê¤¤ÎϤÎÈÅή");
+#else
+                       strcpy(killer, "uncontrollable power storm");
+#endif
+                       break;
+
+               default:
 #ifdef JP
-               strcpy(killer, "æ«");
+                       strcpy(killer, "æ«");
 #else
-               strcpy(killer, "a trap");
+                       strcpy(killer, "a trap");
 #endif
+                       break;
+               }
+
+               /* Paranoia */
+               strcpy(m_name, killer);
        }
 
        /* Analyze the damage */
@@ -6698,7 +6755,7 @@ if (fuzzy) msg_print("
                case GF_PLASMA:
                {
 #ifdef JP
-if (fuzzy) msg_print("²¿¤«¤È¤Æ¤âÇ®¤¤¤â¤Î¤Ç¤Ç¹¶·â¤µ¤ì¤¿¡ª");
+                       if (fuzzy) msg_print("²¿¤«¤È¤Æ¤âÇ®¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
 #else
                        if (fuzzy) msg_print("You are hit by something *HOT*!");
 #endif
@@ -6908,7 +6965,7 @@ if (fuzzy) msg_print("
                case GF_DISENCHANT:
                {
 #ifdef JP
-if (fuzzy) msg_print("²¿¤«¤µ¤¨¤Ê¤¤¤â¤Î¤Ç¤Ç¹¶·â¤µ¤ì¤¿¡ª");
+                       if (fuzzy) msg_print("²¿¤«¤µ¤¨¤Ê¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
 #else
                        if (fuzzy) msg_print("You are hit by something static!");
 #endif
@@ -7189,8 +7246,8 @@ msg_print("
                case GF_GRAVITY:
                {
 #ifdef JP
-if (fuzzy) msg_print("²¿¤«½Å¤¤¤â¤Î¤Ç¤Ç¹¶·â¤µ¤ì¤¿¡ª");
-msg_print("¼þÊդνÅÎϤ¬¤æ¤¬¤ó¤À¡£");
+                       if (fuzzy) msg_print("²¿¤«½Å¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
+                       msg_print("¼þÊդνÅÎϤ¬¤æ¤¬¤ó¤À¡£");
 #else
                        if (fuzzy) msg_print("You are hit by something heavy!");
                        msg_print("Gravity warps around you.");
@@ -7611,7 +7668,7 @@ msg_format("
 #ifdef JP
 msg_print("¤¢¤Ê¤¿¤ÏÌ¿¤¬Çö¤Þ¤Ã¤Æ¤¤¤¯¤è¤¦¤Ë´¶¤¸¤¿¡ª");
 #else
-                               msg_print("Your feel your life fade away!");
+                               msg_print("You feel your life fade away!");
 #endif
 
                                get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, MS_HAND_DOOM);
@@ -7632,15 +7689,15 @@ msg_print("
                }
        }
 
-       if (p_ptr->tim_eyeeye && get_damage > 0 && !p_ptr->is_dead)
+       if (p_ptr->tim_eyeeye && get_damage > 0 && !p_ptr->is_dead && (who > 0))
        {
 #ifdef JP
                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
@@ -7935,13 +7992,13 @@ static bool do_disintegration(int by, int bx, int y, int x)
 
        /* Disintegration balls explosions are stopped by perma-walls */
        if (!in_disintegration_range(by, bx, y, x)) return FALSE;
-                                               
-       /* Permanent walls and artifacts don't get effect */
-       /* But not protect monsters and other objects */
-       if (!cave_valid_bold(y, x)) return TRUE;
 
        /* Destroy mirror/glyph */
-       remove_mirror(y,x);
+       remove_mirror(y, x);
+
+       /* Permanent walls and artifacts don't get effect */
+       /* But not protect monsters and other objects */
+       if (cave_perma_bold(y, x)) return TRUE;
 
        feat = cave[y][x].feat;
 
@@ -7973,8 +8030,7 @@ void breath_shape(u16b *path_g, int dist, int *pgrids, byte *gx, byte *gy, byte
        int bdis = 0;
        int cdis;
        int path_n = 0;
-       int tdis = distance(y1, x1, y2, x2);
-       int mdis = tdis + rad;
+       int mdis = distance(y1, x1, y2, x2) + rad;
 
        while (bdis <= mdis)
        {
@@ -8289,7 +8345,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 */
@@ -8656,7 +8712,7 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                }
 
                /* Only do visuals if requested */
-               if (!blind && !(flg & (PROJECT_HIDE)) && !(flg & PROJECT_FAST))
+               if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
                {
                        /* Only do visuals if the player can "see" the bolt */
                        if (panel_contains(y, x) && player_has_los_bold(y, x))
@@ -8706,21 +8762,18 @@ 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);
-               }
-
        }
 
+       path_n = i;
+
        /* Save the "blast epicenter" */
        by = y;
        bx = x;
 
-       if (breath && (y1 == by) && (x1 == bx))
+       if (breath && !path_n)
        {
                breath = FALSE;
-               gm_rad = 1;
+               gm_rad = rad;
                if (!old_hide)
                {
                        flg &= ~(PROJECT_HIDE);
@@ -9009,13 +9062,12 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                                                msg_print("The attack bounces!");
 #endif
 
-                                               ref_ptr->r_flags2 |= RF2_REFLECTING;
+                                               if (is_original_ap(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
                                        }
 
                                        /* Reflected bolts randomly target either one */
-                                       flg &= ~(PROJECT_MONSTER | PROJECT_PLAYER);
-                                       if (one_in_(2)) flg |= PROJECT_MONSTER;
-                                       else flg |= PROJECT_PLAYER;
+                                       if (one_in_(2)) flg |= PROJECT_PLAYER;
+                                       else flg &= ~(PROJECT_PLAYER);
 
                                        /* The bolt is reflected */
                                        project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
@@ -9035,15 +9087,15 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                        {
                                effective_dist = dist;
                        }
-                       
-                       
+
+
                        /* There is the riding player on this monster */
-                       if (p_ptr->riding && (y == py) && (x == px))
+                       if (p_ptr->riding && player_bold(y, x))
                        {
                                /* Aimed on the player */
                                if (flg & PROJECT_PLAYER)
                                {
-                                       if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
+                                       if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
                                        {
                                                /*
                                                 * A beam or bolt is well aimed
@@ -9064,8 +9116,9 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
 
                                /*
                                 * This grid is the original target.
+                                * Or aimed on your horse.
                                 */
-                               else if ((y == y2) || (x == x2))
+                               else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
                                {
                                        /* Hit the mount with full damage */
                                }
@@ -9089,9 +9142,8 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                                        else
                                        {
                                                /* Hit the player later */
-                                               flg &= ~(PROJECT_MONSTER);
                                                flg |= PROJECT_PLAYER;
-                                                       
+
                                                /* Don't affect the mount */
                                                continue;
                                        }
@@ -9107,12 +9159,12 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                                        effective_dist++;
                                }
                        }
-                       
+
                        /* Affect the monster in the grid */
                        if (project_m(who, effective_dist, y, x, dam, typ,flg)) notice = TRUE;
                }
-               
-       
+
+
                /* Player affected one monster (without "jumping") */
                if (!who && (project_m_n == 1) && !jump)
                {
@@ -9154,7 +9206,7 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                        x = gx[i];
 
                        /* Affect the player? */
-                       if (y != py || x != px) continue;
+                       if (!player_bold(y, x)) continue;
 
                        /* Find the closest point in the blast */
                        if (breath)
@@ -9183,8 +9235,10 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                                 *
                                 * But already choosen to hit the
                                 * mount at this point.
+                                *
+                                * Or aimed on your horse.
                                 */
-                               else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
+                               else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
                                {
                                        /*
                                         * A beam or bolt is well aimed