OSDN Git Service

モンスター同士でのテレポートバックと投げ落としを実装. この過程で,
authornothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Fri, 4 Jul 2003 07:32:58 +0000 (07:32 +0000)
committernothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Fri, 4 Jul 2003 07:32:58 +0000 (07:32 +0000)
モンスターのテレポートバックに使う関数名をteleport_to_player()から
teleport_monster_to()に変更し, プレイヤーの場所に限定せずに使えるよう
になった.

src/cmd6.c
src/externs.h
src/mane.c
src/mspells2.c
src/mspells3.c
src/spells3.c

index 9aa2e48..cf82f4e 100644 (file)
@@ -6323,7 +6323,7 @@ msg_print("
                        for (i = 0; i < max_pet; i++)
                        {
                                pet_ctr = who[i];
-                               teleport_to_player(pet_ctr, 100);
+                               teleport_monster_to(pet_ctr, py, px, 100);
                        }
 
                        /* Free the "who" array */
index 36e041e..c78b031 100644 (file)
@@ -1090,7 +1090,7 @@ extern bool rush_attack(bool *mdeath);
 
 /* spells3.c */
 extern bool teleport_away(int m_idx, int dis, bool dec_valour);
-extern void teleport_to_player(int m_idx, int power);
+extern void teleport_monster_to(int m_idx, int ty, int tx, int power);
 extern void teleport_player(int dis);
 extern void teleport_player_to(int ny, int nx, bool no_tele);
 extern void teleport_level(int m_idx);
index 0998f8f..d0c159e 100644 (file)
@@ -997,7 +997,7 @@ msg_format("%s
                msg_format("You command %s to return.", m_name);
 #endif
 
-               teleport_to_player(cave[target_row][target_col].m_idx, 100);
+               teleport_monster_to(cave[target_row][target_col].m_idx, py, px, 100);
                break;
        }
        case MS_TELE_AWAY:
index 97c11d6..1014a1b 100644 (file)
@@ -213,6 +213,8 @@ 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 resists_tele = FALSE;
+
        /* Prepare flags for summoning */
        if (pet) p_mode |= PM_FORCE_PET;
        if (!pet) u_mode |= PM_ALLOW_UNIQUE;
@@ -3254,8 +3256,47 @@ bool monst_spell_monst(int m_idx)
                                }
                                else
                                {
-                                       /* Not implemented */
-                                       return FALSE;
+                                       if (known)
+                                       {
+                                               if (see_either)
+                                               {
+#ifdef JP
+                                                       msg_format("%^s¤¬%s¤òÄϤó¤Ç¶õÃ椫¤éÅꤲÍ¤¿¡£", m_name, t_name);
+#else
+                                                       msg_format("%^s holds %s, and drops from the sky.", m_name, t_name);
+#endif
+
+                                               }
+                                               else
+                                               {
+                                                       mon_fight = TRUE;
+                                               }
+                                       }
+
+                                       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 (tr_ptr->flags7 & RF7_CAN_FLY)
+                                       {
+#ifdef JP
+                                               if (see_t) msg_format("%^s¤ÏÀŤ«¤ËÃåÃϤ·¤¿¡£", t_name);
+#else
+                                               if (see_t) msg_format("%^s floats gently down to the ground.", t_name);
+#endif
+                                       }
+                                       else
+                                       {
+#ifdef JP
+                                               if (see_t) msg_format("%^s¤ÏÃÏÌ̤Ë᤭¤Ä¤±¤é¤ì¤¿¡£", t_name);
+#else
+                                               if (see_t) msg_format("%^s crashed into the ground.", t_name);
+#endif
+                                               dam += damroll(6, 8);
+                                       }
+
+                                       mon_take_hit_mon(t_idx, dam, &fear, NULL, m_idx);
                                }
                                break;
                        }
@@ -3269,8 +3310,65 @@ bool monst_spell_monst(int m_idx)
 
        /* RF6_TELE_TO */
        case 160+8:
-               /* Not implemented */
-               return FALSE;
+               if (known)
+               {
+                       if (see_either)
+                       {
+#ifdef JP
+                               msg_format("%^s¤¬%s¤ò°ú¤­Ìᤷ¤¿¡£", m_name, t_name);
+#else
+                               msg_format("%^s commands %s to return.", m_name, t_name);
+#endif
+
+                       }
+                       else
+                       {
+                               mon_fight = TRUE;
+                       }
+               }
+
+               if (tr_ptr->flagsr & RFR_RES_TELE)
+               {
+                       if ((tr_ptr->flags1 & RF1_UNIQUE) || (tr_ptr->flagsr & RFR_RES_ALL))
+                       {
+                               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 (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;
+                       }
+               }
+
+               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);
+               }
+
+               wake_up = TRUE;
+               break;
 
        /* RF6_TELE_AWAY */
        case 160+9:
@@ -3291,51 +3389,47 @@ bool monst_spell_monst(int m_idx)
                        }
                }
 
+               if (tr_ptr->flagsr & RFR_RES_TELE)
                {
-                       bool resists_tele = FALSE;
-
-                       if (tr_ptr->flagsr & RFR_RES_TELE)
+                       if ((tr_ptr->flags1 & RF1_UNIQUE) || (tr_ptr->flagsr & RFR_RES_ALL))
                        {
-                               if ((tr_ptr->flags1 & RF1_UNIQUE) || (tr_ptr->flagsr & RFR_RES_ALL))
+                               if (see_t)
                                {
-                                       if (see_t)
-                                       {
-                                               if (is_original_ap(t_ptr)) tr_ptr->r_flagsr |= RFR_RES_TELE;
+                                       if (is_original_ap(t_ptr)) tr_ptr->r_flagsr |= RFR_RES_TELE;
 #ifdef JP
-                                               msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", t_name);
+                                       msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", t_name);
 #else
-                                               msg_format("%^s is unaffected!", t_name);
+                                       msg_format("%^s is unaffected!", t_name);
 #endif
 
-                                       }
-
-                                       resists_tele = TRUE;
                                }
-                               else if (tr_ptr->level > randint1(100))
+
+                               resists_tele = TRUE;
+                       }
+                       else if (tr_ptr->level > randint1(100))
+                       {
+                               if (see_t)
                                {
-                                       if (see_t)
-                                       {
-                                               if (is_original_ap(t_ptr)) tr_ptr->r_flagsr |= RFR_RES_TELE;
+                                       if (is_original_ap(t_ptr)) tr_ptr->r_flagsr |= RFR_RES_TELE;
 #ifdef JP
-                                               msg_format("%^s¤ÏÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡ª", t_name);
+                                       msg_format("%^s¤ÏÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡ª", t_name);
 #else
-                                               msg_format("%^s resists!", t_name);
+                                       msg_format("%^s resists!", t_name);
 #endif
 
-                                       }
-
-                                       resists_tele = TRUE;
                                }
-                       }
 
-                       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);
+                               resists_tele = TRUE;
                        }
+               }
 
-                       wake_up = TRUE;
+               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);
                }
+
+               wake_up = TRUE;
                break;
 
        /* RF6_TELE_LEVEL */
index feaf7d7..406d33b 100644 (file)
@@ -1431,7 +1431,7 @@ msg_format("%s
                msg_format("You command %s to return.", m_name);
 #endif
 
-               teleport_to_player(cave[target_row][target_col].m_idx, 100);
+               teleport_monster_to(cave[target_row][target_col].m_idx, py, px, 100);
                break;
        }
        case MS_TELE_AWAY:
index ad150eb..f4e8bf9 100644 (file)
@@ -140,14 +140,15 @@ bool teleport_away(int m_idx, int dis, bool dec_valour)
 
 
 /*
- * Teleport monster next to the player
+ * Teleport monster next to a grid near the given location
  */
-void teleport_to_player(int m_idx, int power)
+void teleport_monster_to(int m_idx, int ty, int tx, int power)
 {
        int ny, nx, oy, ox, d, i, min;
        int attempts = 500;
        int dis = 2;
        bool look = TRUE;
+       cave_type    *c_ptr;
        monster_type *m_ptr = &m_list[m_idx];
 
 
@@ -180,9 +181,9 @@ void teleport_to_player(int m_idx, int power)
                        /* Pick a (possibly illegal) location */
                        while (1)
                        {
-                               ny = rand_spread(py, dis);
-                               nx = rand_spread(px, dis);
-                               d = distance(py, px, ny, nx);
+                               ny = rand_spread(ty, dis);
+                               nx = rand_spread(tx, dis);
+                               d = distance(ty, tx, ny, nx);
                                if ((d >= min) && (d <= dis)) break;
                        }
 
@@ -192,16 +193,18 @@ void teleport_to_player(int m_idx, int power)
                        /* Require "empty" floor space */
                        if (!cave_empty_bold(ny, nx)) continue;
 
+                       c_ptr = &cave[ny][nx];
+
                        /* Hack -- no teleport onto glyph of warding */
-                       if (is_glyph_grid(&cave[ny][nx])) continue;
-                       if (is_explosive_rune_grid(&cave[ny][nx])) continue;
+                       if (is_glyph_grid(c_ptr)) continue;
+                       if (is_explosive_rune_grid(c_ptr)) continue;
 
                        /* ...nor onto the Pattern */
-                       if ((cave[ny][nx].feat >= FEAT_PATTERN_START) &&
-                           (cave[ny][nx].feat <= FEAT_PATTERN_XTRA2)) continue;
+                       if ((c_ptr->feat >= FEAT_PATTERN_START) &&
+                           (c_ptr->feat <= FEAT_PATTERN_XTRA2)) continue;
 
                        /* No teleporting into vaults and such */
-                       /* if (cave[ny][nx].info & (CAVE_ICKY)) continue; */
+                       /* if (c_ptr->info & (CAVE_ICKY)) continue; */
 
                        /* This grid looks good */
                        look = FALSE;
@@ -223,7 +226,7 @@ void teleport_to_player(int m_idx, int power)
        sound(SOUND_TPOTHER);
 
        /* Update the new location */
-       cave[ny][nx].m_idx = m_idx;
+       c_ptr->m_idx = m_idx;
 
        /* Update the old location */
        cave[oy][ox].m_idx = 0;
@@ -386,7 +389,7 @@ msg_print("
                                if ((r_ptr->flags6 & RF6_TPORT) &&
                                    !(r_ptr->flagsr & RFR_RES_TELE))
                                {
-                                       if (!m_ptr->csleep) teleport_to_player(tmp_m_idx, r_ptr->level);
+                                       if (!m_ptr->csleep) teleport_monster_to(tmp_m_idx, py, px, r_ptr->level);
                                }
                        }
                }