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