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;
}
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;
}
/* 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:
}
}
+ 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 */
/*
- * 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];
/* 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;
}
/* 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;
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;
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);
}
}
}