From 1a7698657e76fe5db37c164637bd5e61461ca1dd Mon Sep 17 00:00:00 2001 From: nothere Date: Fri, 4 Jul 2003 07:32:58 +0000 Subject: [PATCH] =?utf8?q?=E3=83=A2=E3=83=B3=E3=82=B9=E3=82=BF=E3=83=BC?= =?utf8?q?=E5=90=8C=E5=A3=AB=E3=81=A7=E3=81=AE=E3=83=86=E3=83=AC=E3=83=9D?= =?utf8?q?=E3=83=BC=E3=83=88=E3=83=90=E3=83=83=E3=82=AF=E3=81=A8=E6=8A=95?= =?utf8?q?=E3=81=92=E8=90=BD=E3=81=A8=E3=81=97=E3=82=92=E5=AE=9F=E8=A3=85.?= =?utf8?q?=20=E3=81=93=E3=81=AE=E9=81=8E=E7=A8=8B=E3=81=A7,=20=E3=83=A2?= =?utf8?q?=E3=83=B3=E3=82=B9=E3=82=BF=E3=83=BC=E3=81=AE=E3=83=86=E3=83=AC?= =?utf8?q?=E3=83=9D=E3=83=BC=E3=83=88=E3=83=90=E3=83=83=E3=82=AF=E3=81=AB?= =?utf8?q?=E4=BD=BF=E3=81=86=E9=96=A2=E6=95=B0=E5=90=8D=E3=82=92teleport?= =?utf8?q?=5Fto=5Fplayer()=E3=81=8B=E3=82=89=20teleport=5Fmonster=5Fto()?= =?utf8?q?=E3=81=AB=E5=A4=89=E6=9B=B4=E3=81=97,=20=E3=83=97=E3=83=AC?= =?utf8?q?=E3=82=A4=E3=83=A4=E3=83=BC=E3=81=AE=E5=A0=B4=E6=89=80=E3=81=AB?= =?utf8?q?=E9=99=90=E5=AE=9A=E3=81=9B=E3=81=9A=E3=81=AB=E4=BD=BF=E3=81=88?= =?utf8?q?=E3=82=8B=E3=82=88=E3=81=86=20=E3=81=AB=E3=81=AA=E3=81=A3?= =?utf8?q?=E3=81=9F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/cmd6.c | 2 +- src/externs.h | 2 +- src/mane.c | 2 +- src/mspells2.c | 156 +++++++++++++++++++++++++++++++++++++++++++++------------ src/mspells3.c | 2 +- src/spells3.c | 27 +++++----- 6 files changed, 144 insertions(+), 47 deletions(-) diff --git a/src/cmd6.c b/src/cmd6.c index 9aa2e482d..cf82f4e15 100644 --- a/src/cmd6.c +++ b/src/cmd6.c @@ -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 */ diff --git a/src/externs.h b/src/externs.h index 36e041e3b..c78b03134 100644 --- a/src/externs.h +++ b/src/externs.h @@ -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); diff --git a/src/mane.c b/src/mane.c index 0998f8f68..d0c159e4f 100644 --- a/src/mane.c +++ b/src/mane.c @@ -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: diff --git a/src/mspells2.c b/src/mspells2.c index 97c11d666..1014a1b66 100644 --- a/src/mspells2.c +++ b/src/mspells2.c @@ -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 */ diff --git a/src/mspells3.c b/src/mspells3.c index feaf7d788..406d33b85 100644 --- a/src/mspells3.c +++ b/src/mspells3.c @@ -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: diff --git a/src/spells3.c b/src/spells3.c index ad150eb93..f4e8bf957 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -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); } } } -- 2.11.0