OSDN Git Service

refactor a_m_aux2
[hengband/hengband.git] / src / mspells2.c
index a5d90b0..674a094 100644 (file)
@@ -59,8 +59,8 @@ static void monst_breath_monst(int m_idx, int y, int x, int typ, int dam_hp, int
  */
 static void monst_bolt_monst(int m_idx, int y, int x, int typ, int dam_hp, int monspell, bool learnable)
 {
-       int flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
-
+       int flg = PROJECT_STOP | PROJECT_KILL;
+       if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
        (void)project(m_idx, 0, y, x, dam_hp, typ, flg, (learnable ? monspell : -1));
 }
 
@@ -82,7 +82,7 @@ static bool direct_beam(int y1, int x1, int y2, int x2, monster_type *m_ptr)
        int grid_n = 0;
        u16b grid_g[512];
 
-       bool friend = is_pet(m_ptr);
+       bool is_friend = is_pet(m_ptr);
 
        /* Check the projection path */
        grid_n = project_path(grid_g, MAX_RANGE, y1, x1, y2, x2, PROJECT_THRU);
@@ -97,14 +97,14 @@ static bool direct_beam(int y1, int x1, int y2, int x2, monster_type *m_ptr)
 
                if (y == y2 && x == x2)
                        hit2 = TRUE;
-               else if (friend && cave[y][x].m_idx > 0 &&
+               else if (is_friend && cave[y][x].m_idx > 0 &&
                         !are_enemies(m_ptr, &m_list[cave[y][x].m_idx]))
                {
                        /* Friends don't shoot friends */
                        return FALSE;
                }
 
-               if (friend && player_bold(y, x))
+               if (is_friend && player_bold(y, x))
                        return FALSE;
        }
        if (!hit2)
@@ -112,7 +112,7 @@ static bool direct_beam(int y1, int x1, int y2, int x2, monster_type *m_ptr)
        return TRUE;
 }
 
-static bool breath_direct(int y1, int x1, int y2, int x2, int rad, int typ, bool friend)
+static bool breath_direct(int y1, int x1, int y2, int x2, int rad, int typ, bool is_friend)
 {
        /* Must be the same as projectable() */
 
@@ -215,7 +215,7 @@ static bool breath_direct(int y1, int x1, int y2, int x2, int rad, int typ, bool
        }
 
        if (!hit2) return FALSE;
-       if (friend && hityou) return FALSE;
+       if (is_friend && hityou) return FALSE;
 
        return TRUE;
 }
@@ -248,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.
  *
@@ -265,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;
 
@@ -324,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;
                }
@@ -340,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;
                        }
@@ -381,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;
@@ -408,9 +435,14 @@ 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_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)
        {
@@ -612,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))
                {
@@ -698,12 +737,12 @@ bool monst_spell_monst(int m_idx)
        /* Can the player be aware of this attack? */
        known = (m_ptr->cdis <= MAX_SIGHT) || (t_ptr->cdis <= MAX_SIGHT);
 
-       if (p_ptr->riding && (m_idx == p_ptr->riding)) disturb(1, 0);
+       if (p_ptr->riding && (m_idx == p_ptr->riding)) disturb(1, 1);
 
        /* Check for spell failure (inate attacks never fail) */
        if (!spell_is_inate(thrown_spell) && (in_no_magic_dungeon || (MON_STUNNED(m_ptr) && one_in_(2))))
        {
-               disturb(1, 0);
+               disturb(1, 1);
                /* Message */
 #ifdef JP
                if (see_m) msg_format("%^s¤Ï¼öʸ¤ò¾§¤¨¤è¤¦¤È¤·¤¿¤¬¼ºÇÔ¤·¤¿¡£", m_name);
@@ -714,6 +753,17 @@ bool monst_spell_monst(int m_idx)
                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)
@@ -748,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:
@@ -756,7 +825,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -848,7 +917,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -889,7 +958,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -930,7 +999,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -971,7 +1040,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -1011,7 +1080,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -1052,7 +1121,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -1093,7 +1162,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -1134,7 +1203,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -1175,7 +1244,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -1216,7 +1285,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (m_ptr->r_idx == MON_JAIAN)
 #ifdef JP
@@ -1263,7 +1332,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -1304,7 +1373,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -1345,7 +1414,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -1386,7 +1455,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -1427,7 +1496,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -1468,7 +1537,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -1509,7 +1578,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (m_ptr->r_idx == MON_BOTEI)
 #ifdef JP
@@ -1556,7 +1625,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -1597,7 +1666,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -1637,7 +1706,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -1678,7 +1747,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -1717,7 +1786,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -1757,7 +1826,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -1796,7 +1865,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -1836,7 +1905,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -1863,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 */
@@ -1874,7 +1951,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -1901,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 */
@@ -1912,7 +1997,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (m_ptr->r_idx == MON_ROLENTO)
                                {
@@ -1956,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 */
@@ -1967,7 +2060,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -1994,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 */
@@ -2005,7 +2106,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -2043,7 +2144,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -2081,7 +2182,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -2125,7 +2226,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -2163,7 +2264,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -2449,7 +2550,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (blind)
                                {
@@ -3034,7 +3135,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_m)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 #ifdef JP
                                msg_format("%s¤Ï̵½ý¤Îµå¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
 #else
@@ -3052,32 +3153,56 @@ bool monst_spell_monst(int m_idx)
 
        /* 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
-
+                       }
+               }
+               else
+               {
+                       if (see_m)
+                       {
+#ifdef JP
+                               msg_format("%^s¤¬½Ö»þ¤Ë¾Ã¤¨¤¿¡£", m_name);
+#else
+                               msg_format("%^s blinks away.", m_name);
+#endif
+                       }
+                       teleport_away(m_idx, 10, 0L);
                }
-
-               teleport_away(m_idx, 10, FALSE, FALSE);
-
                break;
 
        /* RF6_TPORT */
        case 160+5:
-               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 teleports away.", m_name);
+                               msg_format("Magic barrier obstructs teleporting of %^s.", m_name);
 #endif
+                       }
+               }
+               else
+               {
+                       if (see_m)
+                       {
+#ifdef JP
+                               msg_format("%^s¤¬¥Æ¥ì¥Ý¡¼¥È¤·¤¿¡£", m_name);
+#else
+                               msg_format("%^s teleports away.", m_name);
+#endif
+                       }
+                       teleport_away_followable(m_idx);
                }
-
-               teleport_away_followable(m_idx);
                break;
 
        /* RF6_WORLD */
@@ -3104,7 +3229,7 @@ bool monst_spell_monst(int m_idx)
                        {
                                if (see_either)
                                {
-                                       disturb(1, 0);
+                                       disturb(1, 1);
 
 #ifdef JP
                                        msg_format("%^s¤Ï¼êÜØÃƤò¤Ð¤é¤Þ¤¤¤¿¡£", m_name);
@@ -3145,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, FALSE);
+                                       teleport_away(m_idx, 10, TELEPORT_NONMAGICAL);
                                        p_ptr->update |= (PU_MONSTERS);
                                }
                                else
@@ -3155,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
@@ -3169,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, TRUE);
-                                       else teleport_monster_to(t_idx, m_ptr->fy, m_ptr->fx, 100, TRUE);
+                                       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);
 
@@ -3282,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, TRUE);
-                       else teleport_monster_to(t_idx, m_ptr->fy, m_ptr->fx, 100, TRUE);
+                       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;
@@ -3342,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, TRUE);
-                       else teleport_away(t_idx, MAX_SIGHT * 2 + 5, FALSE, TRUE);
+                       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;
@@ -3499,7 +3624,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 #ifdef JP
                                if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
 #else
@@ -3526,7 +3651,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                if (m_ptr->r_idx == MON_SERPENT || m_ptr->r_idx == MON_ZOMBI_SERPENT)
                                {
@@ -3645,7 +3770,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
 #ifdef JP
                                msg_format("%^s¤¬¥µ¥¤¥Ð¡¼¥Ç¡¼¥â¥ó¤ò¾¤´­¤·¤¿¡ª", m_name);
@@ -3682,7 +3807,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
 #ifdef JP
                                msg_format("%^s¤¬ËâË¡¤ÇÃç´Ö¤ò¾¤´­¤·¤¿¡ª", m_name);
@@ -3712,7 +3837,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
 #ifdef JP
                                msg_format("%^s¤¬ËâË¡¤Ç¥â¥ó¥¹¥¿¡¼¤ò¾¤´­¤·¤¿¡ª", m_name);
@@ -3745,7 +3870,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
 #ifdef JP
                                msg_format("%^s¤¬ËâË¡¤Ç¥¢¥ê¤ò¾¤´­¤·¤¿¡£", m_name);
@@ -3778,7 +3903,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
 #ifdef JP
                                msg_format("%^s¤¬ËâË¡¤Ç¥¯¥â¤ò¾¤´­¤·¤¿¡£", m_name);
@@ -3811,7 +3936,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
 #ifdef JP
                                msg_format("%^s¤¬ËâË¡¤Ç¥Ï¥¦¥ó¥É¤ò¾¤´­¤·¤¿¡£", m_name);
@@ -3844,7 +3969,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
 #ifdef JP
                                msg_format("%^s¤¬ËâË¡¤Ç¥Ò¥É¥é¤ò¾¤´­¤·¤¿¡£", m_name);
@@ -3877,7 +4002,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
 #ifdef JP
                                msg_format("%^s¤¬ËâË¡¤ÇÅ·»È¤ò¾¤´­¤·¤¿¡ª", m_name);
@@ -3919,7 +4044,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
 #ifdef JP
                                msg_format("%^s¤¬ËâË¡¤Çº®Æ٤εÜÄ¤é¥Ç¡¼¥â¥ó¤ò¾¤´­¤·¤¿¡ª", m_name);
@@ -3952,7 +4077,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
 #ifdef JP
                                msg_format("%s¤¬ËâË¡¤Ç¥¢¥ó¥Ç¥Ã¥É¤ò¾¤´­¤·¤¿¡£", m_name);
@@ -3985,7 +4110,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
 #ifdef JP
                                msg_format("%^s¤¬ËâË¡¤Ç¥É¥é¥´¥ó¤ò¾¤´­¤·¤¿¡ª", m_name);
@@ -4018,7 +4143,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
 #ifdef JP
                                msg_format("%s¤¬ËâË¡¤Ç¥¢¥ó¥Ç¥Ã¥É¤ò¾¤´­¤·¤¿¡£", m_name);
@@ -4051,7 +4176,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
 #ifdef JP
                                msg_format("%^s¤¬ËâË¡¤Ç¸ÅÂå¥É¥é¥´¥ó¤ò¾¤´­¤·¤¿¡ª", m_name);
@@ -4084,7 +4209,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
 #ifdef JP
                                msg_format("%^s¤¬¥¢¥ó¥Ð¡¼¤Î²¦Â²¤ò¾¤´­¤·¤¿¡ª", m_name);
@@ -4117,7 +4242,7 @@ bool monst_spell_monst(int m_idx)
                {
                        if (see_either)
                        {
-                               disturb(1, 0);
+                               disturb(1, 1);
 
 #ifdef JP
                                msg_format("%^s¤¬ËâË¡¤ÇÆÃÊ̤ʶ¯Å¨¤ò¾¤´­¤·¤¿¡ª", m_name);
@@ -4137,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;
@@ -4174,7 +4313,7 @@ bool monst_spell_monst(int m_idx)
                        p_ptr->mane_num++;
                        new_mane = TRUE;
 
-                       p_ptr->redraw |= (PR_MANE);
+                       p_ptr->redraw |= (PR_IMITATION);
                }
        }