From: nothere Date: Sat, 28 Jun 2003 05:54:35 +0000 (+0000) Subject: 剣術 / 忍術 "入身" でプレイヤーが超えられない地形を超えられてしまうの X-Git-Tag: v2.1.2~1331 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=14fc9f68cadd37f36555c4aa59b5e1183df5191f;p=hengbandforosx%2Fhengbandosx.git 剣術 / 忍術 "入身" でプレイヤーが超えられない地形を超えられてしまうの を修正. 入身のためにproject()にこれ以上のhackを加えるのは得策ではない と判断し, 入身を別関数として再構成した. この過程で以下の変更や修正を 含む. * 入身の移動地点にプレイヤーから5マス未満の位置を指定しても必ず5マス 走っていたのを修正. 指定した位置に止まれるようになった. * 指定通りのターゲットを攻撃できた時は英語版に合わせて日本語版でも ターゲットのモンスター名を書くように変更. * project()からは入身のhackを削除. --- diff --git a/src/externs.h b/src/externs.h index 715072260..e2907832b 100644 --- a/src/externs.h +++ b/src/externs.h @@ -1086,6 +1086,7 @@ extern bool project_hack(int typ, int dam); extern bool eat_magic(int power); extern void discharge_minion(void); extern void kawarimi(bool success); +extern bool rush_attack(bool *mdeath); /* spells3.c */ extern bool teleport_away(int m_idx, int dis, bool dec_valour); diff --git a/src/hissatsu.c b/src/hissatsu.c index 76ddb6d5d..ce814a163 100644 --- a/src/hissatsu.c +++ b/src/hissatsu.c @@ -777,11 +777,7 @@ static bool cast_hissatsu_spell(int spell) break; } case 18: - project_length = 5; - if (!get_aim_dir(&dir)) return FALSE; - project_hook(GF_ATTACK, dir, HISSATSU_NYUSIN, PROJECT_STOP | PROJECT_KILL); - - break; + return rush_attack(NULL); case 19: /* Whirlwind Attack */ { int y = 0, x = 0; @@ -1026,30 +1022,35 @@ static bool cast_hissatsu_spell(int spell) } case 26: { +#define NEED_MANA_PER_MONSTER 8 bool new = TRUE; - int count = 0; + bool mdeath; + /* int count = 0; currently unused */ do { - project_length = 5; - if (!get_aim_dir(&dir)) break; + if (!rush_attack(&mdeath)) break; if (new) + { /* Reserve needed mana point */ p_ptr->csp -= technic_info[TECHNIC_HISSATSU][26].smana; + new = FALSE; + } else - p_ptr->csp -= 8; - new = FALSE; - if (!project_hook(GF_ATTACK, dir, HISSATSU_NYUSIN, PROJECT_STOP | PROJECT_KILL)) break; - count++; + p_ptr->csp -= NEED_MANA_PER_MONSTER; + if (!mdeath) break; + /* count++; currently unused */ command_dir = 0; p_ptr->redraw |= PR_MANA; handle_stuff(); - } while (p_ptr->csp > 8); + } + while (p_ptr->csp > NEED_MANA_PER_MONSTER); if (new) return FALSE; /* Restore reserved mana */ p_ptr->csp += technic_info[TECHNIC_HISSATSU][26].smana; - break; + +#undef NEED_MANA_PER_MONSTER } case 27: { diff --git a/src/mind.c b/src/mind.c index 72ab0bc3b..8db69c416 100644 --- a/src/mind.c +++ b/src/mind.c @@ -1684,11 +1684,7 @@ msg_print(" set_oppose_fire(plev, FALSE); break; case 10: - project_length = 5; - if (!get_aim_dir(&dir)) return FALSE; - project_hook(GF_ATTACK, dir, HISSATSU_NYUSIN, PROJECT_STOP | PROJECT_KILL); - - break; + return rush_attack(NULL); case 11: { int i; diff --git a/src/spells1.c b/src/spells1.c index 7e489c71a..236ffacb8 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -5459,62 +5459,11 @@ msg_format(" break; } + /* Attack (Use "dam" as attack type) */ case GF_ATTACK: { - if (seen) obvious = TRUE; - skipped = TRUE; - if (dam == HISSATSU_NYUSIN) - { - int i, yy, xx; - int ny = y, nx = x; - bool success = FALSE; - for (i = 0; i < 8; i++) - { - yy = y + ddy[i]; - xx = x + ddx[i]; - if (cave_empty_bold(yy, xx) || player_bold(yy, xx)) - { - success = TRUE; - if (distance(py, px, ny, nx) > distance(py, px, yy, xx)) - { - ny = yy; - nx = xx; - } - } - } - if (success) - { - if (!player_bold(ny, nx)) - { - teleport_player_to(ny, nx, FALSE); -#ifdef JP - msg_print("ÁÇÁ᤯Áê¼ê¤Î²û¤ËÆþ¤ê¹þ¤ó¤À¡ª"); -#else - msg_format("You quickly jump in and attack %s!", m_name); -#endif - } - } - else - { -#ifdef JP - msg_print("¼ºÇÔ¡ª"); -#else - msg_print("Failed!"); -#endif - dam = 0; - break; - } - } - if (c_ptr->m_idx) - return (py_attack(y, x, dam)); - else -#ifdef JP - msg_print("¹¶·â¤Ï¶õ¤òÀڤä¿¡£"); -#else - msg_print("You attack the empty air."); -#endif - dam = 0; - break; + /* Return this monster's death */ + return py_attack(y, x, dam); } /* Sleep (Use "dam" as "power") */ @@ -8784,11 +8733,6 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons Term_xtra(TERM_XTRA_DELAY, msec); } } - if ((typ == GF_ATTACK) && (dam == HISSATSU_NYUSIN) && ((i+1) == path_n)) - { - if (cave_empty_bold(y, x)) teleport_player_to(ny, nx, FALSE); - } - } /* Save the "blast epicenter" */ diff --git a/src/spells2.c b/src/spells2.c index e637acfa3..b008378c7 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -7637,3 +7637,120 @@ void kawarimi(bool success) p_ptr->special_defense &= ~(NINJA_KAWARIMI); p_ptr->redraw |= (PR_STATUS); } + + +/* + * "Rush Attack" routine for Samurai or Ninja + * Return value is for checking "done" + */ +bool rush_attack(bool *mdeath) +{ + int dir; + int tx, ty, nx, ny; + int tm_idx = 0; + u16b path_g[32]; + int path_n, i; + bool tmp_mdeath = FALSE; + + if (mdeath) *mdeath = FALSE; + + project_length = 5; + if (!get_aim_dir(&dir)) return FALSE; + + /* Use the given direction */ + tx = px + project_length * ddx[dir]; + ty = py + project_length * ddy[dir]; + + /* Hack -- Use an actual "target" */ + if ((dir == 5) && target_okay()) + { + tx = target_col; + ty = target_row; + } + + if (in_bounds(ty, tx)) tm_idx = cave[ty][tx].m_idx; + + path_n = project_path(path_g, project_length, py, px, ty, tx, PROJECT_STOP | PROJECT_KILL); + project_length = 0; + + /* No need to move */ + if (!path_n) return TRUE; + + /* Use ty and tx as to-move point */ + ty = py; + tx = px; + + /* Project along the path */ + for (i = 0; i < path_n; i++) + { + ny = GRID_Y(path_g[i]); + nx = GRID_X(path_g[i]); + + if (!cave_empty_bold(ny, nx) || !player_can_enter(cave[ny][nx].feat)) + { + if (cave[ny][nx].m_idx) + { + monster_type *m_ptr = &m_list[cave[ny][nx].m_idx]; + + if (tm_idx != cave[ny][nx].m_idx) + { +#ifdef JP + msg_format("%s%s¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª", tm_idx ? "Ê̤Î" : "", + m_ptr->ml ? "¥â¥ó¥¹¥¿¡¼" : "²¿¤«"); +#else + msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : + "someone"); +#endif + } + else + { + if (!player_bold(ty, tx)) + { + /* Hold the monster name */ + char m_name[80]; + + /* Get the monster name (BEFORE polymorphing) */ + monster_desc(m_name, m_ptr, 0); +#ifdef JP + msg_format("ÁÇÁ᤯%s¤Î²û¤ËÆþ¤ê¹þ¤ó¤À¡ª", m_name); +#else + msg_format("You quickly jump in and attack %s!", m_name); +#endif + } + } + + tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN); + } + else + { + if (tm_idx) + { +#ifdef JP + msg_print("¼ºÇÔ¡ª"); +#else + msg_print("Failed!"); +#endif + } + else + { +#ifdef JP + msg_print("¤³¤³¤Ë¤ÏÆþ¿È¤Ç¤ÏÆþ¤ì¤Ê¤¤¡£"); +#else + msg_print("You can't move to that place."); +#endif + } + } + break; + } + else + { + ty = ny; + tx = nx; + } + } + + if (!player_bold(ty, tx)) teleport_player_to(ty, tx, FALSE); + + if (mdeath) *mdeath = tmp_mdeath; + return TRUE; +}