OSDN Git Service

POWERFUL monsters can already invoke elemental balls as same damage as mana balls.
[hengband/hengband.git] / src / mspells2.c
index 71502be..130ebe4 100644 (file)
@@ -171,7 +171,7 @@ static bool breath_direct(int y1, int x1, int y2, int x2, int rad, int typ, bool
                else
                {
                        /* Hack -- Balls explode before reaching walls */
-                       if (!have_flag(f_flags_bold(ny, nx), FF_PROJECT)) break;
+                       if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
                }
 
                /* Save the "blast epicenter" */
@@ -179,23 +179,44 @@ static bool breath_direct(int y1, int x1, int y2, int x2, int rad, int typ, bool
                x = nx;
        }
 
-       breath_shape(grid_g, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, y, x, typ);
+       grid_n = i;
 
-       for (i = 0; i < grids; i++)
+       if (!grid_n)
        {
-               /* Extract the location */
-               y = gy[i];
-               x = gx[i];
+               if (flg & PROJECT_DISI)
+               {
+                       if (in_disintegration_range(y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
+                       if (in_disintegration_range(y1, x1, py, px) && (distance(y1, x1, py, px) <= rad)) hityou = TRUE;
+               }
+               else if (flg & PROJECT_LOS)
+               {
+                       if (los(y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
+                       if (los(y1, x1, py, px) && (distance(y1, x1, py, px) <= rad)) hityou = TRUE;
+               }
+               else
+               {
+                       if (projectable(y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
+                       if (projectable(y1, x1, py, px) && (distance(y1, x1, py, px) <= rad)) hityou = TRUE;
+               }
+       }
+       else
+       {
+               breath_shape(grid_g, grid_n, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, y, x, typ);
 
-               if (y == y2 && x == x2)
-                       hit2 = TRUE;
-               if (player_bold(y, x))
-                       hityou = TRUE;
+               for (i = 0; i < grids; i++)
+               {
+                       /* Extract the location */
+                       y = gy[i];
+                       x = gx[i];
+
+                       if ((y == y2) && (x == x2)) hit2 = TRUE;
+                       if (player_bold(y, x)) hityou = TRUE;
+               }
        }
-       if (!hit2)
-               return FALSE;
-       if (friend && hityou)
-               return FALSE;
+
+       if (!hit2) return FALSE;
+       if (friend && hityou) return FALSE;
+
        return TRUE;
 }
 
@@ -219,7 +240,7 @@ void get_project_point(int sy, int sx, int *ty, int *tx, int flg)
                sx = GRID_X(path_g[i]);
 
                /* Hack -- Balls explode before reaching walls */
-               if (!have_flag(f_flags_bold(sy, sx), FF_PROJECT)) break;
+               if (!cave_have_flag_bold(sy, sx, FF_PROJECT)) break;
 
                *ty = sy;
                *tx = sx;
@@ -227,6 +248,32 @@ void get_project_point(int sy, int sx, int *ty, int *tx, int flg)
 }
 
 /*
+ * Check should monster cast dispel spell at other monster.
+ */
+static bool dispel_check_monster(int m_idx, int t_idx)
+{
+       monster_type *t_ptr = &m_list[t_idx];
+
+       /* Invulnabilty */
+       if (MON_INVULNER(t_ptr)) return TRUE;
+
+       /* Speed */
+       if (t_ptr->mspeed < 135)
+       {
+               if (MON_FAST(t_ptr)) return TRUE;
+       }
+
+       /* Riding monster */
+       if (t_idx == p_ptr->riding)
+       {
+               if (dispel_check(m_idx)) return TRUE;
+       }
+
+       /* No need to cast dispel spell */
+       return FALSE;
+}
+
+/*
  * Monster tries to 'cast a spell' (or breath, etc)
  * at another monster.
  *
@@ -244,6 +291,7 @@ bool monst_spell_monst(int m_idx)
        u32b u_mode = 0L;
        int s_num_6 = (easy_band ? 2 : 6);
        int s_num_4 = (easy_band ? 1 : 4);
+       int rad = 0; //For elemental balls
 
        byte spell[96], num = 0;
 
@@ -267,9 +315,9 @@ bool monst_spell_monst(int m_idx)
 
        bool blind = (p_ptr->blind ? TRUE : FALSE);
 
-       bool see_m = m_ptr->ml;
+       bool see_m = is_seen(m_ptr);
        bool maneable = player_has_los_bold(m_ptr->fy, m_ptr->fx);
-       bool learnable = (see_m && maneable && !world_monster);
+       bool learnable = (m_ptr->ml && maneable && !world_monster);
        bool see_t;
        bool see_either;
        bool known;
@@ -279,13 +327,17 @@ bool monst_spell_monst(int m_idx)
        bool in_no_magic_dungeon = (d_info[dungeon_type].flags1 & DF1_NO_MAGIC) && dun_level
                && (!p_ptr->inside_quest || is_fixed_quest_idx(p_ptr->inside_quest));
 
+       bool can_use_lite_area = FALSE;
+
+       bool can_remember;
+
        bool resists_tele = FALSE;
 
        /* Prepare flags for summoning */
        if (!pet) u_mode |= PM_ALLOW_UNIQUE;
 
        /* Cannot cast spells when confused */
-       if (m_ptr->confused) return (FALSE);
+       if (MON_CONFUSED(m_ptr)) return (FALSE);
 
        /* Extract the racial spell flags */
        f4 = r_ptr->flags4;
@@ -299,7 +351,7 @@ bool monst_spell_monst(int m_idx)
                t_ptr = &m_list[t_idx];
 
                /* Cancel if not projectable (for now) */
-               if (!projectable(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx))
+               if ((m_idx == t_idx) || !projectable(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx))
                {
                        t_idx = 0;
                }
@@ -315,8 +367,8 @@ bool monst_spell_monst(int m_idx)
                        t_ptr = &m_list[t_idx];
 
                        /* Cancel if neither enemy nor a given target */
-                       if (t_idx != pet_t_m_idx &&
-                           !are_enemies(m_ptr, t_ptr))
+                       if ((m_idx == t_idx) ||
+                           ((t_idx != pet_t_m_idx) && !are_enemies(m_ptr, t_ptr)))
                        {
                                t_idx = 0;
                        }
@@ -356,7 +408,7 @@ bool monst_spell_monst(int m_idx)
                        if (!t_ptr->r_idx) continue;
 
                        /* Monster must be 'an enemy' */
-                       if (!are_enemies(m_ptr, t_ptr)) continue;
+                       if ((m_idx == t_idx) || !are_enemies(m_ptr, t_ptr)) continue;
 
                        /* Monster must be projectable */
                        if (!projectable(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx)) continue;
@@ -383,8 +435,13 @@ bool monst_spell_monst(int m_idx)
        rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
 
        /* Remove unimplemented spells */
-       f4 &= ~(RF4_DISPEL);
-       f6 &= ~(RF6_WORLD | RF6_FORGET);
+       f6 &= ~(RF6_WORLD | RF6_TRAPS | RF6_FORGET);
+
+       if (f4 & RF4_BR_LITE)
+       {
+               if (!los(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx))
+                       f4 &= ~(RF4_BR_LITE);
+       }
 
        /* Remove unimplemented special moves */
        if (f6 & RF6_SPECIAL)
@@ -393,6 +450,22 @@ bool monst_spell_monst(int m_idx)
                        f6 &= ~(RF6_SPECIAL);
        }
 
+       if (f6 & RF6_DARKNESS)
+       {
+               bool vs_ninja = (p_ptr->pclass == CLASS_NINJA) && !is_hostile(t_ptr);
+
+               if (vs_ninja &&
+                   !(r_ptr->flags3 & (RF3_UNDEAD | RF3_HURT_LITE)) &&
+                   !(r_ptr->flags7 & RF7_DARK_MASK))
+                       can_use_lite_area = TRUE;
+
+               if (!(r_ptr->flags2 & RF2_STUPID))
+               {
+                       if (d_info[dungeon_type].flags1 & DF1_DARKNESS) f6 &= ~(RF6_DARKNESS);
+                       else if (vs_ninja && !can_use_lite_area) f6 &= ~(RF6_DARKNESS);
+               }
+       }
+
        if (in_no_magic_dungeon && !(r_ptr->flags2 & RF2_STUPID))
        {
                f4 &= (RF4_NOMAGIC_MASK);
@@ -571,6 +644,13 @@ bool monst_spell_monst(int m_idx)
                        f6 &= ~(RF6_SUMMON_MASK);
                }
 
+               /* Dispel magic */
+               if ((f4 & RF4_DISPEL) && !dispel_check_monster(m_idx, t_idx))
+               {
+                       /* Remove dispel spell */
+                       f4 &= ~(RF4_DISPEL);
+               }
+
                /* Check for a possible raise dead */
                if ((f6 & RF6_RAISE_DEAD) && !raise_possible(m_ptr))
                {
@@ -651,7 +731,7 @@ bool monst_spell_monst(int m_idx)
        /* Choose a spell to cast */
        thrown_spell = spell[randint0(num)];
 
-       see_t = t_ptr->ml;
+       see_t = is_seen(t_ptr);
        see_either = (see_m || see_t);
 
        /* Can the player be aware of this attack? */
@@ -660,19 +740,32 @@ bool monst_spell_monst(int m_idx)
        if (p_ptr->riding && (m_idx == p_ptr->riding)) disturb(1, 0);
 
        /* Check for spell failure (inate attacks never fail) */
-       if (!spell_is_inate(thrown_spell) && (in_no_magic_dungeon || (m_ptr->stunned && one_in_(2))))
+       if (!spell_is_inate(thrown_spell) && (in_no_magic_dungeon || (MON_STUNNED(m_ptr) && one_in_(2))))
        {
                disturb(1, 0);
                /* Message */
 #ifdef JP
-               msg_format("%^s¤Ï¼öʸ¤ò¾§¤¨¤è¤¦¤È¤·¤¿¤¬¼ºÇÔ¤·¤¿¡£", m_name);
+               if (see_m) msg_format("%^s¤Ï¼öʸ¤ò¾§¤¨¤è¤¦¤È¤·¤¿¤¬¼ºÇÔ¤·¤¿¡£", m_name);
 #else
-               msg_format("%^s tries to cast a spell, but fails.", m_name);
+               if (see_m) msg_format("%^s tries to cast a spell, but fails.", m_name);
 #endif
 
                return (TRUE);
        }
 
+       /* Hex: Anti Magic Barrier */
+       if (!spell_is_inate(thrown_spell) && magic_barrier(m_idx))
+       {
+#ifdef JP
+               if (see_m) msg_format("È¿ËâË¡¥Ð¥ê¥¢¤¬%^s¤Î¼öʸ¤ò¤«¤­¾Ã¤·¤¿¡£", m_name);
+#else
+               if (see_m) msg_format("Anti magic barrier cancels the spell which %^s casts.");
+#endif
+               return (TRUE);
+       }
+
+       can_remember = is_original_ap_and_seen(m_ptr);
+
        switch (thrown_spell)
        {
        /* RF4_SHRIEK */
@@ -705,7 +798,26 @@ bool monst_spell_monst(int m_idx)
 
        /* RF4_DISPEL */
        case 96+2:
-               return FALSE;
+               if (known)
+               {
+                       if (see_m)
+                       {
+#ifdef JP
+                               msg_format("%^s¤¬%s¤ËÂФ·¤ÆËâÎϾõî¤Î¼öʸ¤òÇ°¤¸¤¿¡£", m_name, t_name);
+#else
+                               msg_format("%^s invokes a dispel magic at %s.", m_name, t_name);
+#endif
+                       }
+                       else
+                       {
+                               mon_fight = TRUE;
+                       }
+               }
+
+               if (t_idx == p_ptr->riding) dispel_player();
+               dispel_monster_status(t_idx);
+
+               break;
 
        /* RF4_ROCKET */
        case 96+3:
@@ -1820,9 +1932,17 @@ bool monst_spell_monst(int m_idx)
                        }
                }
 
-               dam = (randint1(rlev * 3) + 15) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
-               monst_breath_monst(m_idx, y, x, GF_ACID, dam, 2, FALSE, MS_BALL_ACID, learnable);
-
+               if (r_ptr->flags2 & RF2_POWERFUL)
+               {
+                       rad = 4;
+                       dam = (rlev * 4) + 50 + damroll(10, 10);
+               }
+               else
+               {
+                       rad = 2;
+                       dam = (randint1(rlev * 3) + 15);
+               }
+               monst_breath_monst(m_idx, y, x, GF_ACID, dam, rad, FALSE, MS_BALL_ACID, learnable);
                break;
 
        /* RF5_BA_ELEC */
@@ -1858,9 +1978,17 @@ bool monst_spell_monst(int m_idx)
                        }
                }
 
-               dam = (randint1(rlev * 3 / 2) + 8) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
-               monst_breath_monst(m_idx, y, x, GF_ELEC, dam, 2, FALSE, MS_BALL_ELEC, learnable);
-
+               if (r_ptr->flags2 & RF2_POWERFUL)
+               {
+                       rad = 4;
+                       dam = (rlev * 4) + 50 + damroll(10, 10);
+               }
+               else
+               {
+                       rad = 2;
+                       dam = (randint1(rlev * 3 / 2) + 8);
+               }
+               monst_breath_monst(m_idx, y, x, GF_ELEC, dam, rad, FALSE, MS_BALL_ELEC, learnable);
                break;
 
        /* RF5_BA_FIRE */
@@ -1913,9 +2041,17 @@ bool monst_spell_monst(int m_idx)
                        }
                }
 
-               dam = (randint1(rlev * 7 / 2) + 10) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
-               monst_breath_monst(m_idx, y, x, GF_FIRE, dam, 2, FALSE, MS_BALL_FIRE, learnable);
-
+               if (r_ptr->flags2 & RF2_POWERFUL)
+               {
+                       rad = 4;
+                       dam = (rlev * 4) + 50 + damroll(10, 10);
+               }
+               else
+               {
+                       rad = 2;
+                       dam = (randint1(rlev * 7 / 2) + 10);
+               }
+               monst_breath_monst(m_idx, y, x, GF_FIRE, dam, rad, FALSE, MS_BALL_FIRE, learnable);
                break;
 
        /* RF5_BA_COLD */
@@ -1951,9 +2087,17 @@ bool monst_spell_monst(int m_idx)
                        }
                }
 
-               dam = (randint1(rlev * 3 / 2) + 10) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
-               monst_breath_monst(m_idx, y, x, GF_COLD, dam, 2, FALSE, MS_BALL_COLD, learnable);
-
+               if (r_ptr->flags2 & RF2_POWERFUL)
+               {
+                       rad = 4;
+                       dam = (rlev * 4) + 50 + damroll(10, 10);
+               }
+               else
+               {
+                       rad = 2;
+                       dam = (randint1(rlev * 3 / 2) + 10);
+               }
+               monst_breath_monst(m_idx, y, x, GF_COLD, dam, rad, FALSE, MS_BALL_COLD, learnable);
                break;
 
        /* RF5_BA_POIS */
@@ -2627,9 +2771,7 @@ bool monst_spell_monst(int m_idx)
                }
                else
                {
-                       if (!t_ptr->monfear) fear = TRUE;
-
-                       t_ptr->monfear += randint0(4) + 4;
+                       if (set_monster_monfear(t_idx, MON_MONFEAR(t_ptr) + randint0(4) + 4)) fear = TRUE;
                }
 
                wake_up = TRUE;
@@ -2678,13 +2820,12 @@ bool monst_spell_monst(int m_idx)
                else
                {
 #ifdef JP
-                       if (see_t)   msg_format("%^s¤ÏÌܤ¬¸«¤¨¤Ê¤¯¤Ê¤Ã¤¿¡ª ", t_name);
+                       if (see_t) msg_format("%^s¤ÏÌܤ¬¸«¤¨¤Ê¤¯¤Ê¤Ã¤¿¡ª ", t_name);
 #else
                        if (see_t) msg_format("%^s is blinded!", t_name);
 #endif
 
-
-                       t_ptr->confused += 12 + (byte)randint0(4);
+                       (void)set_monster_confused(t_idx, MON_CONFUSED(t_ptr) + 12 + randint0(4));
                }
 
                wake_up = TRUE;
@@ -2736,8 +2877,7 @@ bool monst_spell_monst(int m_idx)
                        if (see_t) msg_format("%^s seems confused.", t_name);
 #endif
 
-
-                       t_ptr->confused += 12 + (byte)randint0(4);
+                       (void)set_monster_confused(t_idx, MON_CONFUSED(t_ptr) + 12 + randint0(4));
                }
 
                wake_up = TRUE;
@@ -2784,7 +2924,7 @@ bool monst_spell_monst(int m_idx)
                }
                else
                {
-                       if (!t_ptr->slow)
+                       if (set_monster_slow(t_idx, MON_SLOW(t_ptr) + 50))
                        {
 #ifdef JP
                                if (see_t) msg_format("%s¤ÎÆ°¤­¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£", t_name);
@@ -2792,8 +2932,6 @@ bool monst_spell_monst(int m_idx)
                                if (see_t) msg_format("%^s starts moving slower.", t_name);
 #endif
                        }
-
-                       t_ptr->slow = MIN(200, t_ptr->slow + 50);
                }
 
                wake_up = TRUE;
@@ -2846,8 +2984,7 @@ bool monst_spell_monst(int m_idx)
                        if (see_t) msg_format("%^s is paralyzed!", t_name);
 #endif
 
-
-                       t_ptr->stunned += randint1(4) + 4;
+                       (void)set_monster_stunned(t_idx, MON_STUNNED(t_ptr) + randint1(4) + 4);
                }
 
                wake_up = TRUE;
@@ -2875,17 +3012,14 @@ bool monst_spell_monst(int m_idx)
                }
 
                /* Allow quick speed increases to base+10 */
-               if (!m_ptr->fast)
+               if (set_monster_fast(m_idx, MON_FAST(m_ptr) + 100))
                {
 #ifdef JP
                        if (see_m) msg_format("%^s¤ÎÆ°¤­¤¬Â®¤¯¤Ê¤Ã¤¿¡£", m_name);
 #else
                        if (see_m) msg_format("%^s starts moving faster.", m_name);
 #endif
-
                }
-               m_ptr->fast = MIN(200, m_ptr->fast + 100);
-               if (p_ptr->riding == m_idx) p_ptr->update |= PU_BONUS;
                break;
 
        /* RF6_HAND_DOOM */
@@ -2968,7 +3102,6 @@ bool monst_spell_monst(int m_idx)
 #else
                                msg_format("%^s looks healthier.", m_name);
 #endif
-
                        }
                        else
                        {
@@ -2981,10 +3114,10 @@ bool monst_spell_monst(int m_idx)
                if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
 
                /* Cancel fear */
-               if (m_ptr->monfear)
+               if (MON_MONFEAR(m_ptr))
                {
                        /* Cancel fear */
-                       m_ptr->monfear = 0;
+                       (void)set_monster_monfear(m_idx, 0);
 
                        /* Message */
 #ifdef JP
@@ -2992,7 +3125,6 @@ bool monst_spell_monst(int m_idx)
 #else
                        if (see_m) msg_format("%^s recovers %s courage.", m_name, m_poss);
 #endif
-
                }
 
                break;
@@ -3009,7 +3141,6 @@ bool monst_spell_monst(int m_idx)
 #else
                                msg_format("%^s casts a Globe of Invulnerability.", m_name);
 #endif
-
                        }
                        else
                        {
@@ -3017,77 +3148,60 @@ bool monst_spell_monst(int m_idx)
                        }
                }
 
-               if (!m_ptr->invulner) m_ptr->invulner = randint1(4) + 4;
-
-               if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
-               if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
+               if (!MON_INVULNER(m_ptr)) (void)set_monster_invulner(m_idx, randint1(4) + 4, FALSE);
                break;
 
        /* RF6_BLINK */
        case 160+4:
-               if (see_m)
+               if (teleport_barrier(m_idx))
                {
+                       if (see_m)
+                       {
 #ifdef JP
-                       msg_format("%^s¤¬½Ö»þ¤Ë¾Ã¤¨¤¿¡£", m_name);
+                               msg_format("ËâË¡¤Î¥Ð¥ê¥¢¤¬%^s¤Î¥Æ¥ì¥Ý¡¼¥È¤ò¼ÙË⤷¤¿¡£", m_name);
 #else
-                       msg_format("%^s blinks away.", m_name);
+                               msg_format("Magic barrier obstructs teleporting of %^s.", m_name);
 #endif
-
+                       }
                }
-
-               teleport_away(m_idx, 10, FALSE);
-
-               break;
-
-       /* RF6_TPORT */
-       case 160+5:
-               if (see_m)
+               else
                {
+                       if (see_m)
+                       {
 #ifdef JP
-                       msg_format("%^s¤¬¥Æ¥ì¥Ý¡¼¥È¤·¤¿¡£", m_name);
+                               msg_format("%^s¤¬½Ö»þ¤Ë¾Ã¤¨¤¿¡£", m_name);
 #else
-                       msg_format("%^s teleports away.", m_name);
+                               msg_format("%^s blinks away.", m_name);
 #endif
+                       }
+                       teleport_away(m_idx, 10, 0L);
                }
+               break;
 
-               teleport_away(m_idx, MAX_SIGHT * 2 + 5, FALSE);
-
-               if (los(py, px, m_ptr->fy, m_ptr->fx) && !world_monster && see_m)
+       /* RF6_TPORT */
+       case 160+5:
+               if (teleport_barrier(m_idx))
                {
-                       for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
+                       if (see_m)
                        {
-                               u32b flgs[TR_FLAG_SIZE];
-                               object_type *o_ptr = &inventory[i];
-
-                               if (cursed_p(o_ptr)) continue;
-
-                               object_flags(o_ptr, flgs);
-
-                               if((have_flag(flgs, TR_TELEPORT)) || (p_ptr->muta1 & MUT1_VTELEPORT) || (p_ptr->pclass == CLASS_IMITATOR))
-                               {
 #ifdef JP
-                                       cptr msg = "¤Ä¤¤¤Æ¤¤¤­¤Þ¤¹¤«¡©";
+                               msg_format("ËâË¡¤Î¥Ð¥ê¥¢¤¬%^s¤Î¥Æ¥ì¥Ý¡¼¥È¤ò¼ÙË⤷¤¿¡£", m_name);
 #else
-                                       cptr msg = "Do you follow it? ";
+                               msg_format("Magic barrier obstructs teleporting of %^s.", m_name);
 #endif
-
-                                       if(get_check_strict(msg, CHECK_OKAY_CANCEL))
-                                       {
-                                               if (one_in_(3))
-                                               {
-                                                       teleport_player(200);
+                       }
+               }
+               else
+               {
+                       if (see_m)
+                       {
 #ifdef JP
-                                                       msg_print("¼ºÇÔ¡ª");
+                               msg_format("%^s¤¬¥Æ¥ì¥Ý¡¼¥È¤·¤¿¡£", m_name);
 #else
-                                                       msg_print("Failed!");
+                               msg_format("%^s teleports away.", m_name);
 #endif
-                                               }
-                                               else teleport_player_to(m_ptr->fy, m_ptr->fx, TRUE);
-                                               p_ptr->energy_need = ENERGY_NEED();
-                                       }
-                                       break;
-                               }
                        }
+                       teleport_away_followable(m_idx);
                }
                break;
 
@@ -3098,7 +3212,7 @@ bool monst_spell_monst(int m_idx)
                if(m_ptr->r_idx = MON_DIO) who == 1;
                else if(m_ptr->r_idx = MON_WONG) who == 3;
                dam = who;
-               if(!process_the_world(randint1(2)+2, who, los(py, px, m_ptr->fy, m_ptr->fx))) return (FALSE);
+               if(!process_the_world(randint1(2)+2, who, player_has_los_bold(m_ptr->fy, m_ptr->fx))) return (FALSE);
 #endif
                return FALSE;
 
@@ -3156,7 +3270,7 @@ bool monst_spell_monst(int m_idx)
                                                msg_format("%^s suddenly go out of your sight!", m_name);
 #endif
                                        }
-                                       teleport_away(m_idx, 10, FALSE);
+                                       teleport_away(m_idx, 10, TELEPORT_NONMAGICAL);
                                        p_ptr->update |= (PU_MONSTERS);
                                }
                                else
@@ -3166,7 +3280,7 @@ bool monst_spell_monst(int m_idx)
                                                if (see_either)
                                                {
 #ifdef JP
-                                                       msg_format("%^s¤¬%s¤òÄϤó¤Ç¶õÃ椫¤éÅꤲÍ¤¿¡£", m_name, t_name);
+                                                       msg_format("%^s¤¬%s¤òÄϤó¤Ç¶õÃ椫¤éÅꤲÍî¤Ȥ·¤¿¡£", m_name, t_name);
 #else
                                                        msg_format("%^s holds %s, and drops from the sky.", m_name, t_name);
 #endif
@@ -3180,8 +3294,8 @@ bool monst_spell_monst(int m_idx)
 
                                        dam = damroll(4, 8);
 
-                                       if (t_idx == p_ptr->riding) teleport_player_to(m_ptr->fy, m_ptr->fx, FALSE);
-                                       else teleport_monster_to(t_idx, m_ptr->fy, m_ptr->fx, 100);
+                                       if (t_idx == p_ptr->riding) teleport_player_to(m_ptr->fy, m_ptr->fx, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
+                                       else teleport_monster_to(t_idx, m_ptr->fy, m_ptr->fx, 100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
 
                                        sound(SOUND_FALL);
 
@@ -3203,7 +3317,7 @@ bool monst_spell_monst(int m_idx)
                                                dam += damroll(6, 8);
                                        }
 
-                                       if (p_ptr->riding)
+                                       if (p_ptr->riding == t_idx)
                                        {
                                                int get_damage = 0;
 
@@ -3263,30 +3377,28 @@ bool monst_spell_monst(int m_idx)
                {
                        if ((tr_ptr->flags1 & RF1_UNIQUE) || (tr_ptr->flagsr & RFR_RES_ALL))
                        {
+                               if (is_original_ap_and_seen(t_ptr)) tr_ptr->r_flagsr |= RFR_RES_TELE;
                                if (see_t)
                                {
-                                       if (is_original_ap(t_ptr)) tr_ptr->r_flagsr |= RFR_RES_TELE;
 #ifdef JP
                                        msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", t_name);
 #else
                                        msg_format("%^s is unaffected!", t_name);
 #endif
-
                                }
 
                                resists_tele = TRUE;
                        }
                        else if (tr_ptr->level > randint1(100))
                        {
+                               if (is_original_ap_and_seen(t_ptr)) tr_ptr->r_flagsr |= RFR_RES_TELE;
                                if (see_t)
                                {
-                                       if (is_original_ap(t_ptr)) tr_ptr->r_flagsr |= RFR_RES_TELE;
 #ifdef JP
                                        msg_format("%^s¤ÏÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡ª", t_name);
 #else
                                        msg_format("%^s resists!", t_name);
 #endif
-
                                }
 
                                resists_tele = TRUE;
@@ -3295,8 +3407,8 @@ bool monst_spell_monst(int m_idx)
 
                if (!resists_tele)
                {
-                       if (t_idx == p_ptr->riding) teleport_player_to(m_ptr->fy, m_ptr->fx, TRUE);
-                       else teleport_monster_to(t_idx, m_ptr->fy, m_ptr->fx, 100);
+                       if (t_idx == p_ptr->riding) teleport_player_to(m_ptr->fy, m_ptr->fx, TELEPORT_PASSIVE);
+                       else teleport_monster_to(t_idx, m_ptr->fy, m_ptr->fx, 100, TELEPORT_PASSIVE);
                }
 
                wake_up = TRUE;
@@ -3325,30 +3437,28 @@ bool monst_spell_monst(int m_idx)
                {
                        if ((tr_ptr->flags1 & RF1_UNIQUE) || (tr_ptr->flagsr & RFR_RES_ALL))
                        {
+                               if (is_original_ap_and_seen(t_ptr)) tr_ptr->r_flagsr |= RFR_RES_TELE;
                                if (see_t)
                                {
-                                       if (is_original_ap(t_ptr)) tr_ptr->r_flagsr |= RFR_RES_TELE;
 #ifdef JP
                                        msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", t_name);
 #else
                                        msg_format("%^s is unaffected!", t_name);
 #endif
-
                                }
 
                                resists_tele = TRUE;
                        }
                        else if (tr_ptr->level > randint1(100))
                        {
+                               if (is_original_ap_and_seen(t_ptr)) tr_ptr->r_flagsr |= RFR_RES_TELE;
                                if (see_t)
                                {
-                                       if (is_original_ap(t_ptr)) tr_ptr->r_flagsr |= RFR_RES_TELE;
 #ifdef JP
                                        msg_format("%^s¤ÏÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡ª", t_name);
 #else
                                        msg_format("%^s resists!", t_name);
 #endif
-
                                }
 
                                resists_tele = TRUE;
@@ -3357,8 +3467,8 @@ bool monst_spell_monst(int m_idx)
 
                if (!resists_tele)
                {
-                       if (t_idx == p_ptr->riding) teleport_player(MAX_SIGHT * 2 + 5);
-                       else teleport_away(t_idx, MAX_SIGHT * 2 + 5, FALSE);
+                       if (t_idx == p_ptr->riding) teleport_player_away(m_idx, MAX_SIGHT * 2 + 5);
+                       else teleport_away(t_idx, MAX_SIGHT * 2 + 5, TELEPORT_PASSIVE);
                }
 
                wake_up = TRUE;
@@ -3435,20 +3545,22 @@ bool monst_spell_monst(int m_idx)
                        if (see_m)
                        {
 #ifdef JP
-                               msg_format("%^s¤¬°Å°Ç¤ÎÃæ¤Ç¼ê¤ò¿¶¤Ã¤¿¡£", m_name);
+                               if (can_use_lite_area) msg_format("%^s¤¬ÊÕ¤ê¤òÌÀ¤ë¤¯¾È¤é¤·¤¿¡£", m_name);
+                               else msg_format("%^s¤¬°Å°Ç¤ÎÃæ¤Ç¼ê¤ò¿¶¤Ã¤¿¡£", m_name);
 #else
-                               msg_format("%^s gestures in shadow.", m_name);
+                               if (can_use_lite_area) msg_format("%^s cast a spell to light up.", m_name);
+                               else msg_format("%^s gestures in shadow.", m_name);
 #endif
 
-
                                if (see_t)
                                {
 #ifdef JP
-                                       msg_format("%^s¤Ï°Å°Ç¤ËÊñ¤Þ¤ì¤¿¡£", t_name);
+                                       if (can_use_lite_area) msg_format("%^s¤ÏÇò¤¤¸÷¤ËÊñ¤Þ¤ì¤¿¡£", t_name);
+                                       else msg_format("%^s¤Ï°Å°Ç¤ËÊñ¤Þ¤ì¤¿¡£", t_name);
 #else
-                                       msg_format("%^s is surrounded by darkness.", t_name);
+                                       if (can_use_lite_area) msg_format("%^s is surrounded by a white light.", t_name);
+                                       else msg_format("%^s is surrounded by darkness.", t_name);
 #endif
-
                                }
                        }
                        else
@@ -3457,9 +3569,16 @@ bool monst_spell_monst(int m_idx)
                        }
                }
 
-               (void)project(m_idx, 3, y, x, 0, GF_DARK_WEAK, PROJECT_GRID | PROJECT_KILL, MS_DARKNESS);
-
-               unlite_room(y, x);
+               if (can_use_lite_area)
+               {
+                       (void)project(m_idx, 3, y, x, 0, GF_LITE_WEAK, PROJECT_GRID | PROJECT_KILL, -1);
+                       lite_room(y, x);
+               }
+               else
+               {
+                       (void)project(m_idx, 3, y, x, 0, GF_DARK_WEAK, PROJECT_GRID | PROJECT_KILL, MS_DARKNESS);
+                       unlite_room(y, x);
+               }
 
                break;
 
@@ -3487,8 +3606,12 @@ bool monst_spell_monst(int m_idx)
                }
 
                trap_creation(y, x);
-#endif
+
                break;
+#else
+               /* Not implemented */
+               return FALSE;
+#endif
 
        /* RF6_FORGET */
        case 160+14:
@@ -4139,6 +4262,20 @@ bool monst_spell_monst(int m_idx)
                        count += summon_specific(m_idx, y, x, rlev, SUMMON_UNIQUE, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
                }
 
+               {
+                       int non_unique_type = SUMMON_HI_UNDEAD;
+
+                       if ((m_ptr->sub_align & (SUB_ALIGN_GOOD | SUB_ALIGN_EVIL)) == (SUB_ALIGN_GOOD | SUB_ALIGN_EVIL))
+                               non_unique_type = 0;
+                       else if (m_ptr->sub_align & SUB_ALIGN_GOOD)
+                               non_unique_type = SUMMON_ANGEL;
+
+                       for (k = count; k < s_num_4; k++)
+                       {
+                               count += summon_specific(m_idx, y, x, rlev, non_unique_type, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
+                       }
+               }
+
                if (known && !see_t && count)
                {
                        mon_fight = TRUE;
@@ -4147,11 +4284,7 @@ bool monst_spell_monst(int m_idx)
                break;
        }
 
-       if (wake_up)
-       {
-               t_ptr->csleep = 0;
-               if (tr_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
-       }
+       if (wake_up) (void)set_monster_csleep(t_idx, 0);
 
        if (fear && see_t)
        {
@@ -4160,10 +4293,9 @@ bool monst_spell_monst(int m_idx)
 #else
                msg_format("%^s flees in terror!", t_name);
 #endif
-
        }
 
-       if (see_m && maneable && !world_monster && !p_ptr->blind && (p_ptr->pclass == CLASS_IMITATOR))
+       if (m_ptr->ml && maneable && !world_monster && !p_ptr->blind && (p_ptr->pclass == CLASS_IMITATOR))
        {
                if (thrown_spell != 167) /* Not RF6_SPECIAL */
                {
@@ -4181,12 +4313,12 @@ bool monst_spell_monst(int m_idx)
                        p_ptr->mane_num++;
                        new_mane = TRUE;
 
-                       p_ptr->redraw |= (PR_MANE);
+                       p_ptr->redraw |= (PR_IMITATION);
                }
        }
 
        /* Remember what the monster did, if we saw it */
-       if (see_m && is_original_ap(m_ptr))
+       if (can_remember)
        {
                /* Inate spell */
                if (thrown_spell < 32*4)