OSDN Git Service

モンスターボールのpvalが劣化して中身のモンスターが変わってしまうバグ修正。
[hengband/hengband.git] / src / mspells1.c
index 7ca8545..e8f9e25 100644 (file)
@@ -13,8 +13,6 @@
 #include "angband.h"
 
 
-#ifdef DRS_SMART_OPTIONS
-
 /*
  * And now for Intelligent monster attacks (including spells).
  *
@@ -88,7 +86,8 @@ static void remove_bad_spells(int m_idx, u32b *f4p, u32b *f5p, u32b *f6p)
        if (smart_learn)
        {
                /* Hack -- Occasionally forget player status */
-               if (m_ptr->smart && (randint0(100) < 1)) m_ptr->smart = 0L;
+               /* Only save SM_FRIENDLY, SM_PET or SM_CLONED */
+               if (m_ptr->smart && (randint0(100) < 1)) m_ptr->smart &= (SM_FRIENDLY | SM_PET | SM_CLONED);
 
                /* Use the memorized flags */
                smart = m_ptr->smart;
@@ -350,8 +349,6 @@ static void remove_bad_spells(int m_idx, u32b *f4p, u32b *f5p, u32b *f6p)
        (*f6p) = f6;
 }
 
-#endif /* DRS_SMART_OPTIONS */
-
 
 /*
  * Determine if there is a space near the player in which
@@ -373,11 +370,10 @@ bool summon_possible(int y1, int x1)
                        if (distance(y1, x1, y, x)>2) continue;
 
                        /* ...nor on the Pattern */
-                       if ((cave[y][x].feat >= FEAT_PATTERN_START)
-                               && (cave[y][x].feat <= FEAT_PATTERN_XTRA2)) continue;
+                       if (pattern_tile(y, x)) continue;
 
-                       /* Require empty floor grid in line of sight */
-                       if ((cave_empty_bold(y, x) || (cave[y][x].feat == FEAT_TREES)) && los(y1, x1, y, x) && los(y, x, y1, x1)) return (TRUE);
+                       /* Require empty floor grid in line of projection */
+                       if (cave_empty_bold(y, x) && projectable(y1, x1, y, x) && projectable(y, x, y1, x1)) return (TRUE);
                }
        }
 
@@ -385,9 +381,11 @@ bool summon_possible(int y1, int x1)
 }
 
 
-static bool raise_possible(int y, int x)
+bool raise_possible(monster_type *m_ptr)
 {
        int xx, yy;
+       int y = m_ptr->fy;
+       int x = m_ptr->fx;
        s16b this_o_idx, next_o_idx = 0;
        cave_type *c_ptr;
 
@@ -397,6 +395,7 @@ static bool raise_possible(int y, int x)
                {
                        if (distance(y, x, yy, xx) > 5) continue;
                        if (!los(y, x, yy, xx)) continue;
+                       if (!projectable(y, x, yy, xx)) continue;
 
                        c_ptr = &cave[yy][xx];
                        /* Scan the pile of objects */
@@ -410,7 +409,9 @@ static bool raise_possible(int y, int x)
 
                                /* Known to be worthless? */
                                if (o_ptr->tval == TV_CORPSE)
-                                       return TRUE;
+                               {
+                                       if (!monster_has_hostile_align(m_ptr, 0, 0, &r_info[o_ptr->pval])) return TRUE;
+                               }
                        }
                }
        }
@@ -467,7 +468,7 @@ bool clean_shot(int y1, int x1, int y2, int x2, bool friend)
                        }
                }
                /* Pets may not shoot through the character - TNB */
-               if ((y == py) && (x == px))
+               if (player_bold(y, x))
                {
                        if (friend) return (FALSE);
                }
@@ -516,10 +517,22 @@ static void breath(int y, int x, int m_idx, int typ, int dam_hp, int rad, bool b
        /* Handle breath attacks */
        if (breath) rad = 0 - rad;
 
-       if (typ == GF_ROCKET) flg |= PROJECT_STOP;
-       if (typ == GF_MIND_BLAST || typ == GF_BRAIN_SMASH ||
-           typ == GF_CAUSE_1 || typ == GF_CAUSE_2 || typ == GF_CAUSE_3 ||
-           typ == GF_CAUSE_4 || typ == GF_HAND_DOOM) flg |= PROJECT_HIDE;
+       switch (typ)
+       {
+       case GF_ROCKET:
+               flg |= PROJECT_STOP;
+               break;
+       case GF_DRAIN_MANA:
+       case GF_MIND_BLAST:
+       case GF_BRAIN_SMASH:
+       case GF_CAUSE_1:
+       case GF_CAUSE_2:
+       case GF_CAUSE_3:
+       case GF_CAUSE_4:
+       case GF_HAND_DOOM:
+               flg |= (PROJECT_HIDE | PROJECT_AIMED);
+               break;
+       }
 
        /* Target the player with a ball attack */
        (void)project(m_idx, rad, y, x, dam_hp, typ, flg, (learnable ? monspell : -1));
@@ -545,8 +558,8 @@ u32b get_curse(int power, object_type *o_ptr)
                {
                        if (new_curse & TRC_HEAVY_MASK) continue;
                }
-               if (((o_ptr->tval < TV_BOW) || (o_ptr->tval > TV_SWORD)) && (new_curse == TRC_LOW_MELEE)) continue;
-               if (((o_ptr->tval < TV_BOOTS) || (o_ptr->tval > TV_DRAG_ARMOR)) && (new_curse == TRC_LOW_AC)) continue;
+               if (((o_ptr->tval < TV_WEAPON_BEGIN) || (o_ptr->tval > TV_WEAPON_END)) && (new_curse == TRC_LOW_MELEE)) continue;
+               if (((o_ptr->tval < TV_ARMOR_BEGIN) || (o_ptr->tval > TV_ARMOR_END)) && (new_curse == TRC_LOW_AC)) continue;
                break;
        }
        return new_curse;
@@ -567,7 +580,7 @@ void curse_equipment(int chance, int heavy_chance)
 
        object_flags(o_ptr, oflgs);
 
-       object_desc(o_name, o_ptr, FALSE, 0);
+       object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
 
        /* Extra, biased saving throw for blessed items */
        if (have_flag(oflgs, TR_BLESSED) && (randint1(888) > chance))
@@ -859,7 +872,7 @@ static bool dispel_check(int m_idx)
 
        if (r_ptr->flags4 & RF4_BR_FIRE)
        {
-               if (!(prace_is_(RACE_DEMON) && p_ptr->lev > 44))
+               if (!((p_ptr->prace == RACE_DEMON) && p_ptr->lev > 44))
                {
                        if (!p_ptr->immune_fire && (p_ptr->oppose_fire || music_singing(MUSIC_RESIST))) return (TRUE);
                        if (p_ptr->special_defense & DEFENSE_FIRE) return (TRUE);
@@ -894,11 +907,11 @@ static bool dispel_check(int m_idx)
        if (p_ptr->tsuyoshi) return (TRUE);
 
        /* Elemental Brands */
-       if ((p_ptr->special_attack & ATTACK_ACID) && !(r_ptr->flags3 & RF3_IM_ACID)) return (TRUE);
-       if ((p_ptr->special_attack & ATTACK_FIRE) && !(r_ptr->flags3 & RF3_IM_FIRE)) return (TRUE);
-       if ((p_ptr->special_attack & ATTACK_ELEC) && !(r_ptr->flags3 & RF3_IM_ELEC)) return (TRUE);
-       if ((p_ptr->special_attack & ATTACK_COLD) && !(r_ptr->flags3 & RF3_IM_COLD)) return (TRUE);
-       if ((p_ptr->special_attack & ATTACK_POIS) && !(r_ptr->flags3 & RF3_IM_POIS)) return (TRUE);
+       if ((p_ptr->special_attack & ATTACK_ACID) && !(r_ptr->flagsr & RFR_EFF_IM_ACID_MASK)) return (TRUE);
+       if ((p_ptr->special_attack & ATTACK_FIRE) && !(r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK)) return (TRUE);
+       if ((p_ptr->special_attack & ATTACK_ELEC) && !(r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK)) return (TRUE);
+       if ((p_ptr->special_attack & ATTACK_COLD) && !(r_ptr->flagsr & RFR_EFF_IM_COLD_MASK)) return (TRUE);
+       if ((p_ptr->special_attack & ATTACK_POIS) && !(r_ptr->flagsr & RFR_EFF_IM_POIS_MASK)) return (TRUE);
 
        /* Speed */
        if (p_ptr->pspeed < 145)
@@ -1046,16 +1059,17 @@ static int choose_attack_spell(int m_idx, byte spells[], byte num)
        if (special_num)
        {
                bool success = FALSE;
-               switch(m_ptr->r_idx)
+               switch (m_ptr->r_idx)
                {
                        case MON_OHMU:
-                               if (randint0(100) < 50) success = TRUE;
+                       case MON_BANOR:
+                       case MON_LUPART:
                                break;
                        case MON_BANORLUPART:
                                if (randint0(100) < 70) success = TRUE;
                                break;
-                       case MON_BANOR:
-                       case MON_LUPART:
+                       case MON_ROLENTO:
+                               if (randint0(100) < 40) success = TRUE;
                                break;
                        default:
                                if (randint0(100) < 50) success = TRUE;
@@ -1089,7 +1103,7 @@ static int choose_attack_spell(int m_idx, byte spells[], byte num)
        }
 
        /* Raise-dead if possible (sometimes) */
-       if (raise_num && (randint0(100) < 40) && raise_possible(m_ptr->fy, m_ptr->fx))
+       if (raise_num && (randint0(100) < 40))
        {
                /* Choose raise-dead spell */
                return (raise[randint0(raise_num)]);
@@ -1304,7 +1318,7 @@ bool make_attack_spell(int m_idx)
        if (projectable(m_ptr->fy, m_ptr->fx, y, x))
        {
                /* Breath disintegration to the glyph if possible */
-               if ((!cave_floor_bold(y,x)) && (r_ptr->flags4 & RF4_BR_DISI) && one_in_(2)) do_disi = TRUE;
+               if (!have_flag(f_flags_bold(y, x), FF_PROJECT) && (f4 & RF4_BR_DISI) && one_in_(2)) do_disi = TRUE;
        }
 
        /* Check path to next grid */
@@ -1312,7 +1326,7 @@ bool make_attack_spell(int m_idx)
        {
                bool success = FALSE;
 
-               if ((r_ptr->flags4 & RF4_BR_DISI) &&
+               if ((f4 & RF4_BR_DISI) &&
                    (m_ptr->cdis < MAX_RANGE/2) &&
                    in_disintegration_range(m_ptr->fy, m_ptr->fx, y, x) &&
                    (one_in_(10) || (projectable(y, x, m_ptr->fy, m_ptr->fx) && one_in_(2))))
@@ -1347,14 +1361,8 @@ bool make_attack_spell(int m_idx)
                                /* Access the next grid */
                                c_ptr = &cave[next_y][next_x];
 
-                               /* Skip door, rubble, wall */
-                               if ((c_ptr->feat >= FEAT_DOOR_HEAD) && (c_ptr->feat <= FEAT_PERM_SOLID)) continue;
-
-                               /* Skip tree */
-                               if (c_ptr->feat == FEAT_TREES) continue;
-
-                               /* Skip mountain */
-                               if (c_ptr->feat == FEAT_MOUNTAIN) continue;
+                               /* Skip door, rubble, wall, tree, mountain, etc. */
+                               if (!have_flag(f_flags_grid(c_ptr), FF_PROJECT)) continue;
 
                                if (projectable(m_ptr->fy, m_ptr->fx, next_y, next_x))
                                {
@@ -1400,7 +1408,10 @@ bool make_attack_spell(int m_idx)
        {
                f5 &= ~(RF5_DRAIN_MANA);
        }
-       if ((p_ptr->pclass == CLASS_NINJA) && (r_ptr->flags3 & (RF3_UNDEAD | RF3_HURT_LITE)))
+
+       if ((p_ptr->pclass == CLASS_NINJA) &&
+           ((r_ptr->flags3 & (RF3_UNDEAD | RF3_HURT_LITE)) ||
+            (r_ptr->flags7 & RF7_DARK_MASK)))
        {
                f6 &= ~(RF6_DARKNESS);
        }
@@ -1412,61 +1423,88 @@ bool make_attack_spell(int m_idx)
                f6 &= (RF6_NOMAGIC_MASK);
        }
 
-       /* Hack -- allow "desperate" spells */
-       if ((r_ptr->flags2 & (RF2_SMART)) &&
-               (m_ptr->hp < m_ptr->maxhp / 10) &&
-               (randint0(100) < 50))
+       if (r_ptr->flags2 & RF2_SMART)
        {
-               /* Require intelligent spells */
-               f4 &= (RF4_INT_MASK);
-               f5 &= (RF5_INT_MASK);
-               f6 &= (RF6_INT_MASK);
+               /* Hack -- allow "desperate" spells */
+               if ((m_ptr->hp < m_ptr->maxhp / 10) &&
+                       (randint0(100) < 50))
+               {
+                       /* Require intelligent spells */
+                       f4 &= (RF4_INT_MASK);
+                       f5 &= (RF5_INT_MASK);
+                       f6 &= (RF6_INT_MASK);
+               }
 
-               /* No spells left */
-               if (!f4 && !f5 && !f6) return (FALSE);
+               /* Hack -- decline "teleport level" in some case */
+               if ((f6 & RF6_TELE_LEVEL) && TELE_LEVEL_IS_INEFF(0))
+               {
+                       f6 &= ~(RF6_TELE_LEVEL);
+               }
        }
 
+       /* No spells left */
+       if (!f4 && !f5 && !f6) return (FALSE);
+
        /* Remove the "ineffective" spells */
        remove_bad_spells(m_idx, &f4, &f5, &f6);
 
-       if (p_ptr->inside_arena)
+       if (p_ptr->inside_arena || p_ptr->inside_battle)
        {
                f4 &= ~(RF4_SUMMON_MASK);
                f5 &= ~(RF5_SUMMON_MASK);
-               f6 &= ~(RF6_SUMMON_MASK);
+               f6 &= ~(RF6_SUMMON_MASK | RF6_TELE_LEVEL);
+
+               if (m_ptr->r_idx == MON_ROLENTO) f6 &= ~(RF6_SPECIAL);
        }
 
        /* No spells left */
        if (!f4 && !f5 && !f6) return (FALSE);
 
-       /* Check for a clean bolt shot */
-       if (((f4 & RF4_BOLT_MASK) ||
-            (f5 & RF5_BOLT_MASK) ||
-            (f6 & RF6_BOLT_MASK)) &&
-           !(r_ptr->flags2 & RF2_STUPID) &&
-           !clean_shot(m_ptr->fy, m_ptr->fx, py, px, FALSE))
+       if (!(r_ptr->flags2 & RF2_STUPID))
        {
-               /* Remove spells that will only hurt friends */
-               f4 &= ~(RF4_BOLT_MASK);
-               f5 &= ~(RF5_BOLT_MASK);
-               f6 &= ~(RF6_BOLT_MASK);
-       }
+               /* Check for a clean bolt shot */
+               if (((f4 & RF4_BOLT_MASK) ||
+                    (f5 & RF5_BOLT_MASK) ||
+                    (f6 & RF6_BOLT_MASK)) &&
+                   !clean_shot(m_ptr->fy, m_ptr->fx, py, px, FALSE))
+               {
+                       /* Remove spells that will only hurt friends */
+                       f4 &= ~(RF4_BOLT_MASK);
+                       f5 &= ~(RF5_BOLT_MASK);
+                       f6 &= ~(RF6_BOLT_MASK);
+               }
 
-       /* Check for a possible summon */
-       if (((f4 & RF4_SUMMON_MASK) ||
-            (f5 & RF5_SUMMON_MASK) ||
-            (f6 & RF6_SUMMON_MASK)) &&
-           !(r_ptr->flags2 & RF2_STUPID) &&
-           !(summon_possible(y, x)))
-       {
-               /* Remove summoning spells */
-               f4 &= ~(RF4_SUMMON_MASK);
-               f5 &= ~(RF5_SUMMON_MASK);
-               f6 &= ~(RF6_SUMMON_MASK);
-       }
+               /* Check for a possible summon */
+               if (((f4 & RF4_SUMMON_MASK) ||
+                    (f5 & RF5_SUMMON_MASK) ||
+                    (f6 & RF6_SUMMON_MASK)) &&
+                   !(summon_possible(y, x)))
+               {
+                       /* Remove summoning spells */
+                       f4 &= ~(RF4_SUMMON_MASK);
+                       f5 &= ~(RF5_SUMMON_MASK);
+                       f6 &= ~(RF6_SUMMON_MASK);
+               }
 
-       /* No spells left */
-       if (!f4 && !f5 && !f6) return (FALSE);
+               /* Check for a possible raise dead */
+               if ((f6 & RF6_RAISE_DEAD) && !raise_possible(m_ptr))
+               {
+                       /* Remove raise dead spell */
+                       f6 &= ~(RF6_RAISE_DEAD);
+               }
+
+               /* Special moves restriction */
+               if (f6 & RF6_SPECIAL)
+               {
+                       if ((m_ptr->r_idx == MON_ROLENTO) && !summon_possible(y, x))
+                       {
+                               f6 &= ~(RF6_SPECIAL);
+                       }
+               }
+
+               /* No spells left */
+               if (!f4 && !f5 && !f6) return (FALSE);
+       }
 
        /* Extract the "inate" spells */
        for (k = 0; k < 32; k++)
@@ -1540,7 +1578,7 @@ bool make_attack_spell(int m_idx)
        }
 
        /* Projectable? */
-       direct = ((x == px) && (y == py));
+       direct = player_bold(y, x);
 
        /* Cast the spell. */
        switch (thrown_spell)
@@ -1677,7 +1715,7 @@ msg_format("%^s
                        break;
                }
 
-               /* RF4_XXX4X4 */
+               /* RF4_ROCKET */
                case 96+3:
                {
                        disturb(1, 0);
@@ -2504,67 +2542,9 @@ else msg_format("%^s
                {
                        if (!direct) return (FALSE);
                        disturb(1, 0);
-                       if (p_ptr->csp)
-                       {
-                               int r1;
-
-                               /* Basic message */
-#ifdef JP
-msg_format("%^s¤ËÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¼è¤é¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
-#else
-                               msg_format("%^s draws psychic energy from you!", m_name);
-#endif
-
-
-                               /* Attack power */
-                               r1 = (randint1(rlev) / 2) + 1;
-
-                               /* Full drain */
-                               if (r1 >= p_ptr->csp)
-                               {
-                                       r1 = p_ptr->csp;
-                                       p_ptr->csp = 0;
-                                       p_ptr->csp_frac = 0;
-                               }
-
-                               /* Partial drain */
-                               else
-                               {
-                                       p_ptr->csp -= r1;
-                               }
 
-                               learn_spell(MS_DRAIN_MANA);
-
-                               /* Redraw mana */
-                               p_ptr->redraw |= (PR_MANA);
-
-                               /* Window stuff */
-                               p_ptr->window |= (PW_PLAYER);
-                               p_ptr->window |= (PW_SPELL);
-
-                               /* Heal the monster */
-                               if (m_ptr->hp < m_ptr->maxhp)
-                               {
-                                       /* Heal */
-                                       m_ptr->hp += (6 * r1);
-                                       if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
-
-                                       /* Redraw (later) if needed */
-                                       if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
-                                       if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
-
-                                       /* Special message */
-                                       if (seen)
-                                       {
-#ifdef JP
-msg_format("%^s¤Ïµ¤Ê¬¤¬Îɤµ¤½¤¦¤À¡£", m_name);
-#else
-                                               msg_format("%^s appears healthier.", m_name);
-#endif
-
-                                       }
-                               }
-                       }
+                       dam = (randint1(rlev) / 2) + 1;
+                       breath(y, x, m_idx, GF_DRAIN_MANA, dam, 0, FALSE, MS_DRAIN_MANA, learnable);
                        update_smart_learn(m_idx, DRS_MANA);
                        break;
                }
@@ -3230,7 +3210,7 @@ msg_format("%^s
                        if (!direct) return (FALSE);
                        disturb(1, 0);
 #ifdef JP
-msg_format("%^s¤¬ÇËÌǤμê¤òÊü¤Ã¤¿¡ª", m_name);
+msg_format("%^s¤¬<ÇËÌǤμê>¤òÊü¤Ã¤¿¡ª", m_name);
 #else
                        msg_format("%^s invokes the Hand of Doom!", m_name);
 #endif
@@ -3383,7 +3363,7 @@ msg_format("%^s
 #endif
 
                        teleport_away(m_idx, 10, FALSE);
-                       p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
+                       p_ptr->update |= (PU_MONSTERS);
                        break;
                }
 
@@ -3461,7 +3441,7 @@ msg_format("%^s
                        int k;
 
                        disturb(1, 0);
-                       switch(m_ptr->r_idx)
+                       switch (m_ptr->r_idx)
                        {
                        case MON_OHMU:
                                /* Moved to process_monster(), like multiplication */
@@ -3491,8 +3471,9 @@ msg_format("%^s
 
                                        break;
                                }
-                               case MON_BANOR:
-                               case MON_LUPART:
+
+                       case MON_BANOR:
+                       case MON_LUPART:
                                {
                                        int dummy_hp = 0;
                                        int dummy_maxhp = 0;
@@ -3527,6 +3508,30 @@ msg_format("%^s
                                        break;
                                }
 
+                       case MON_ROLENTO:
+#ifdef JP
+                               if (blind) msg_format("%^s¤¬²¿¤«ÂçÎ̤ËÅꤲ¤¿¡£", m_name);
+                               else msg_format("%^s¤Ï¼êÜØÃƤò¤Ð¤é¤Þ¤¤¤¿¡£", m_name);
+#else
+                               if (blind) msg_format("%^s spreads something.", m_name);
+                               else msg_format("%^s throws some hand grenades.", m_name);
+#endif
+
+                               {
+                                       int num = 1 + randint1(3);
+
+                                       for (k = 0; k < num; k++)
+                                       {
+                                               count += summon_named_creature(m_idx, y, x, MON_SHURYUUDAN, mode);
+                                       }
+                               }
+#ifdef JP
+                               if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¤Ð¤é¤Þ¤«¤ì¤ë²»¤¬¤¹¤ë¡£");
+#else
+                               if (blind && count) msg_print("You hear many things are scattered nearby.");
+#endif
+                               break;
+
                        default:
                                if (r_ptr->d_char == 'B')
                                {
@@ -3539,17 +3544,19 @@ msg_format("%^s
                                                msg_format("%^s suddenly go out of your sight!", m_name);
 #endif
                                                teleport_away(m_idx, 10, FALSE);
-                                               p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
+                                               p_ptr->update |= (PU_MONSTERS);
                                        }
                                        else
                                        {
-                                               int dam = damroll(4, 8);
                                                int get_damage = 0;
+                                               bool fear; /* dummy */
+
 #ifdef JP
                                                msg_format("%^s¤¬¤¢¤Ê¤¿¤òÄϤó¤Ç¶õÃ椫¤éÅꤲÍ¤¿¡£", m_name);
 #else
                                                msg_format("%^s holds you, and drops from the sky.", m_name);
 #endif
+                                               dam = damroll(4, 8);
                                                teleport_player_to(m_ptr->fy, m_ptr->fx, FALSE);
 
                                                sound(SOUND_FALL);
@@ -3591,6 +3598,8 @@ msg_format("%^s
                                                        project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
                                                        set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
                                                }
+
+                                               if (p_ptr->riding) mon_take_hit_mon(p_ptr->riding, dam, &fear, extract_note_dies(real_r_ptr(&m_list[p_ptr->riding])), m_idx);
                                        }
                                        break;
                                }
@@ -3672,7 +3681,7 @@ msg_print("
                        }
                        else
                        {
-                               teleport_player_level();
+                               teleport_level(0);
                        }
                        learn_spell(MS_TELE_LEVEL);
                        update_smart_learn(m_idx, DRS_NEXUS);
@@ -3803,25 +3812,11 @@ else msg_format("%^s
                        break;
                }
 
-               /* RF6_SUMMON_KIN */
+               /* RF6_S_KIN */
                case 160+16:
                {
                        disturb(1, 0);
-                       if (m_ptr->r_idx == MON_ROLENTO)
-                       {
-#ifdef JP
-                               if (blind)
-                                       msg_format("%^s¤¬²¿¤«ÂçÎ̤ËÅꤲ¤¿¡£", m_name);
-                               else 
-                                       msg_format("%^s¤Ï¼êÜØÃƤò¤Ð¤é¤Þ¤¤¤¿¡£", m_name);
-#else
-                               if (blind)
-                                       msg_format("%^s spreads something.", m_name);
-                               else
-                                       msg_format("%^s throws some hand grenades.", m_name);
-#endif
-                       }
-                       else if (m_ptr->r_idx == MON_SERPENT || m_ptr->r_idx == MON_ZOMBI_SERPENT)
+                       if (m_ptr->r_idx == MON_SERPENT || m_ptr->r_idx == MON_ZOMBI_SERPENT)
                        {
 #ifdef JP
                                if (blind)
@@ -3856,85 +3851,87 @@ else msg_format("%^s
 #endif
                        }
 
-                       if(m_ptr->r_idx == MON_ROLENTO)
-                       {
-                               int num = 1 + randint1(3);
-
-                               for (k = 0; k < num; k++)
-                               {
-                                       count += summon_named_creature(m_idx, y, x, MON_SHURYUUDAN, mode);
-                               }
-                       }
-                       else if(m_ptr->r_idx == MON_THORONDOR ||
-                               m_ptr->r_idx == MON_GWAIHIR ||
-                               m_ptr->r_idx == MON_MENELDOR)
-                       {
-                               int num = 4 + randint1(3);
-                               for (k = 0; k < num; k++)
-                               {
-                                       count += summon_specific(m_idx, y, x, rlev, SUMMON_EAGLES, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
-                               }
-                       }
-                       else if(m_ptr->r_idx == MON_LOUSY)
+                       switch (m_ptr->r_idx)
                        {
-                               int num = 2 + randint1(3);
-                               for (k = 0; k < num; k++)
+                       case MON_MENELDOR:
+                       case MON_GWAIHIR:
+                       case MON_THORONDOR:
                                {
-                                       count += summon_specific(m_idx, y, x, rlev, SUMMON_LOUSE, PM_ALLOW_GROUP);
-                               }
-                       }
-                       else if(m_ptr->r_idx == MON_BULLGATES)
-                       {
-                               int num = 2 + randint1(3);
-                               for (k = 0; k < num; k++)
-                               {
-                                       count += summon_named_creature(m_idx, y, x, 921, mode);
+                                       int num = 4 + randint1(3);
+                                       for (k = 0; k < num; k++)
+                                       {
+                                               count += summon_specific(m_idx, y, x, rlev, SUMMON_EAGLES, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
+                                       }
                                }
-                       }
-                       else if (m_ptr->r_idx == MON_CALDARM)
-                       {
-                               int num = randint1(3);
-                               for (k = 0; k < num; k++)
+                               break;
+
+                       case MON_BULLGATES:
                                {
-                                       count += summon_named_creature(m_idx, y, x, 930, mode);
+                                       int num = 2 + randint1(3);
+                                       for (k = 0; k < num; k++)
+                                       {
+                                               count += summon_named_creature(m_idx, y, x, MON_IE, mode);
+                                       }
                                }
-                       }
-                       else if (m_ptr->r_idx == MON_SERPENT || m_ptr->r_idx == MON_ZOMBI_SERPENT)
-                       {
-                               int num = 2 + randint1(3);
+                               break;
 
-                               if (r_info[MON_JORMUNGAND].cur_num < r_info[MON_JORMUNGAND].max_num && one_in_(6))
+                       case MON_SERPENT:
+                       case MON_ZOMBI_SERPENT:
                                {
+                                       int num = 2 + randint1(3);
+
+                                       if (r_info[MON_JORMUNGAND].cur_num < r_info[MON_JORMUNGAND].max_num && one_in_(6))
+                                       {
 #ifdef JP
-                                       msg_print("ÃÏÌ̤«¤é¿å¤¬¿á¤­½Ð¤·¤¿¡ª");
+                                               msg_print("ÃÏÌ̤«¤é¿å¤¬¿á¤­½Ð¤·¤¿¡ª");
 #else
-                                       msg_print("Water blew off from the ground!");
+                                               msg_print("Water blew off from the ground!");
 #endif
-                                       fire_ball_hide(GF_WATER_FLOW, 0, 3, 8);
+                                               fire_ball_hide(GF_WATER_FLOW, 0, 3, 8);
+                                       }
+
+                                       for (k = 0; k < num; k++)
+                                       {
+                                               count += summon_specific(m_idx, y, x, rlev, SUMMON_GUARDIANS, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
+                                       }
                                }
+                               break;
 
-                               for (k = 0; k < num; k++)
+                       case MON_CALDARM:
                                {
-                                       count += summon_specific(m_idx, y, x, rlev, SUMMON_GUARDIANS, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
+                                       int num = randint1(3);
+                                       for (k = 0; k < num; k++)
+                                       {
+                                               count += summon_named_creature(m_idx, y, x, MON_LOCKE_CLONE, mode);
+                                       }
                                }
-                       }
-                       else
-                       {
+                               break;
 
+                       case MON_LOUSY:
+                               {
+                                       int num = 2 + randint1(3);
+                                       for (k = 0; k < num; k++)
+                                       {
+                                               count += summon_specific(m_idx, y, x, rlev, SUMMON_LOUSE, PM_ALLOW_GROUP);
+                                       }
+                               }
+                               break;
+
+                       default:
                                summon_kin_type = r_ptr->d_char; /* Big hack */
 
                                for (k = 0; k < 4; k++)
                                {
                                        count += summon_specific(m_idx, y, x, rlev, SUMMON_KIN, PM_ALLOW_GROUP);
                                }
+                               break;
                        }
 #ifdef JP
-if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
+                       if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
 #else
                        if (blind && count) msg_print("You hear many things appear nearby.");
 #endif
 
-
                        break;
                }
 
@@ -4298,17 +4295,17 @@ else msg_format("%^s
 
                                for (k = 0; k < 30; k++)
                                {
-                                       if (!summon_possible(cy, cx) || !cave_floor_bold(cy, cx))
+                                       if (!summon_possible(cy, cx) || !cave_empty_bold(cy, cx))
                                        {
                                                int j;
                                                for (j = 100; j > 0; j--)
                                                {
                                                        scatter(&cy, &cx, y, x, 2, 0);
-                                                       if (cave_floor_bold(cy, cx)) break;
+                                                       if (cave_empty_bold(cy, cx)) break;
                                                }
                                                if (!j) break;
                                        }
-                                       if (!cave_floor_bold(cy, cx)) continue;
+                                       if (!cave_empty_bold(cy, cx)) continue;
 
                                        if (summon_named_creature(m_idx, cy, cx, MON_NAZGUL, mode))
                                        {
@@ -4510,7 +4507,7 @@ msg_print("¿
        }
 
        /* Remember what the monster did to us */
-       if (seen)
+       if (seen && is_original_ap(m_ptr))
        {
                /* Inate spell */
                if (thrown_spell < 32 * 4)
@@ -4538,7 +4535,7 @@ msg_print("¿
        /* Always take note of monsters that kill you */
        if (p_ptr->is_dead && (r_ptr->r_deaths < MAX_SHORT) && !p_ptr->inside_arena)
        {
-               r_ptr->r_deaths++;
+               r_ptr->r_deaths++; /* Ignore appearance difference */
        }
 
        /* A spell was cast */