X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Frealm-hissatsu.c;h=e4534ea9c745c6548b1907400222ebab23844f2b;hb=3b87c7250e7a560a11398daa278da2018efaeff8;hp=01350b5279f05fd95a73372523ec86e3f0853bfb;hpb=3e91c391b54b8028671d5e13f77a8961f6fa06dd;p=hengband%2Fhengband.git diff --git a/src/realm-hissatsu.c b/src/realm-hissatsu.c index 01350b527..e4534ea9c 100644 --- a/src/realm-hissatsu.c +++ b/src/realm-hissatsu.c @@ -1,5 +1,11 @@ #include "angband.h" #include "cmd-spell.h" +#include "melee.h" +#include "monsterrace-hook.h" +#include "projection.h" +#include "artifact.h" +#include "player-status.h" +#include "feature.h" /*! * @brief 剣術の各処理を行う @@ -7,7 +13,7 @@ * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_CAST) * @return SPELL_NAME / SPELL_DESC 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。 */ -cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) +concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) { bool name = (mode == SPELL_NAME) ? TRUE : FALSE; bool desc = (mode == SPELL_DESC) ? TRUE : FALSE; @@ -52,21 +58,21 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy_cdd[cdir]; x = p_ptr->x + ddx_cdd[cdir]; - if (cave[y][x].m_idx) + if (current_floor_ptr->grid_array[y][x].m_idx) py_attack(y, x, 0); else msg_print(_("攻撃は空を切った。", "You attack the empty air.")); y = p_ptr->y + ddy_cdd[(cdir + 7) % 8]; x = p_ptr->x + ddx_cdd[(cdir + 7) % 8]; - if (cave[y][x].m_idx) + if (current_floor_ptr->grid_array[y][x].m_idx) py_attack(y, x, 0); else msg_print(_("攻撃は空を切った。", "You attack the empty air.")); y = p_ptr->y + ddy_cdd[(cdir + 1) % 8]; x = p_ptr->x + ddx_cdd[(cdir + 1) % 8]; - if (cave[y][x].m_idx) + if (current_floor_ptr->grid_array[y][x].m_idx) py_attack(y, x, 0); else msg_print(_("攻撃は空を切った。", "You attack the empty air.")); @@ -98,7 +104,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (cave[y][x].m_idx) + if (current_floor_ptr->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_FIRE); else { @@ -132,7 +138,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (cave[y][x].m_idx) + if (current_floor_ptr->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_MINEUCHI); else { @@ -180,7 +186,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (!cave[y][x].m_idx) + if (!current_floor_ptr->grid_array[y][x].m_idx) { msg_print(_("その方向にはモンスターはいません。", "There is no monster.")); return NULL; @@ -188,17 +194,15 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) py_attack(y, x, 0); - if (!player_can_enter(cave[y][x].feat, 0) || is_trap(cave[y][x].feat)) + if (!player_can_enter(current_floor_ptr->grid_array[y][x].feat, 0) || is_trap(current_floor_ptr->grid_array[y][x].feat)) break; y += ddy[dir]; x += ddx[dir]; - if (player_can_enter(cave[y][x].feat, 0) && !is_trap(cave[y][x].feat) && !cave[y][x].m_idx) + if (player_can_enter(current_floor_ptr->grid_array[y][x].feat, 0) && !is_trap(current_floor_ptr->grid_array[y][x].feat) && !current_floor_ptr->grid_array[y][x].m_idx) { msg_print(NULL); - - /* Move the player */ (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP); } } @@ -218,7 +222,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (cave[y][x].m_idx) + if (current_floor_ptr->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_POISON); else { @@ -243,7 +247,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (cave[y][x].m_idx) + if (current_floor_ptr->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_ZANMA); else { @@ -267,25 +271,25 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (cave[y][x].m_idx) + if (current_floor_ptr->grid_array[y][x].m_idx) py_attack(y, x, 0); else { msg_print(_("その方向にはモンスターはいません。", "There is no monster.")); return NULL; } - if (d_info[dungeon_type].flags1 & DF1_NO_MELEE) + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE) { return ""; } - if (cave[y][x].m_idx) + if (current_floor_ptr->grid_array[y][x].m_idx) { int i; POSITION ty = y, tx = x; POSITION oy = y, ox = x; - MONSTER_IDX m_idx = cave[y][x].m_idx; - monster_type *m_ptr = &m_list[m_idx]; - char m_name[80]; + MONSTER_IDX m_idx = current_floor_ptr->grid_array[y][x].m_idx; + monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; + GAME_TEXT m_name[MAX_NLEN]; monster_desc(m_name, m_ptr, 0); @@ -303,12 +307,12 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) if ((ty != oy) || (tx != ox)) { msg_format(_("%sを吹き飛ばした!", "You blow %s away!"), m_name); - cave[oy][ox].m_idx = 0; - cave[ty][tx].m_idx = m_idx; + current_floor_ptr->grid_array[oy][ox].m_idx = 0; + current_floor_ptr->grid_array[ty][tx].m_idx = m_idx; m_ptr->fy = ty; m_ptr->fx = tx; - update_mon(m_idx, TRUE); + update_monster(m_idx, TRUE); lite_spot(oy, ox); lite_spot(ty, tx); @@ -351,7 +355,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (cave[y][x].m_idx) + if (current_floor_ptr->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_HAGAN); if (!cave_have_flag_bold(y, x, FF_HURT_ROCK)) break; @@ -379,7 +383,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (cave[y][x].m_idx) + if (current_floor_ptr->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_COLD); else { @@ -404,7 +408,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (cave[y][x].m_idx) + if (current_floor_ptr->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_KYUSHO); else { @@ -429,7 +433,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (cave[y][x].m_idx) + if (current_floor_ptr->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_MAJIN); else { @@ -454,7 +458,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (cave[y][x].m_idx) + if (current_floor_ptr->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_SUTEMI); else { @@ -480,7 +484,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (cave[y][x].m_idx) + if (current_floor_ptr->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_ELEC); else { @@ -509,7 +513,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) { POSITION y = 0, x = 0; - cave_type *c_ptr; + grid_type *g_ptr; monster_type *m_ptr; if (p_ptr->cut < 300) @@ -521,17 +525,15 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) { y = p_ptr->y + ddy_ddd[dir]; x = p_ptr->x + ddx_ddd[dir]; - c_ptr = &cave[y][x]; - - /* Get the monster */ - m_ptr = &m_list[c_ptr->m_idx]; + g_ptr = ¤t_floor_ptr->grid_array[y][x]; + m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx]; /* Hack -- attack monsters */ - if (c_ptr->m_idx && (m_ptr->ml || cave_have_flag_bold(y, x, FF_PROJECT))) + if (g_ptr->m_idx && (m_ptr->ml || cave_have_flag_bold(y, x, FF_PROJECT))) { - if (!monster_living(&r_info[m_ptr->r_idx])) + if (!monster_living(m_ptr->r_idx)) { - char m_name[80]; + GAME_TEXT m_name[MAX_NLEN]; monster_desc(m_name, m_ptr, 0); msg_format(_("%sには効果がない!", "%s is unharmed!"), m_name); @@ -556,7 +558,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (cave[y][x].m_idx) + if (current_floor_ptr->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_QUAKE); else earthquake(p_ptr->y, p_ptr->x, 10); @@ -578,7 +580,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) { int damage; - if (!buki_motteruka(INVEN_RARM + i)) break; + if (!has_melee_weapon(INVEN_RARM + i)) break; o_ptr = &inventory[INVEN_RARM + i]; basedam = (o_ptr->dd * (o_ptr->ds + 1)) * 50; damage = o_ptr->to_d * 100; @@ -612,7 +614,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) if (cast) { msg_print(_("雄叫びをあげた!", "You roar out!")); - project_hack(GF_SOUND, randint1(plev * 3)); + project_all_los(GF_SOUND, randint1(plev * 3)); aggravate_monsters(0); } break; @@ -633,14 +635,14 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) POSITION y, x; POSITION ny, nx; MONSTER_IDX m_idx; - cave_type *c_ptr; + grid_type *g_ptr; monster_type *m_ptr; y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - c_ptr = &cave[y][x]; + g_ptr = ¤t_floor_ptr->grid_array[y][x]; - if (c_ptr->m_idx) + if (g_ptr->m_idx) py_attack(y, x, HISSATSU_3DAN); else { @@ -648,18 +650,18 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) return NULL; } - if (d_info[dungeon_type].flags1 & DF1_NO_MELEE) + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE) { return ""; } /* Monster is dead? */ - if (!c_ptr->m_idx) break; + if (!g_ptr->m_idx) break; ny = y + ddy[dir]; nx = x + ddx[dir]; - m_idx = c_ptr->m_idx; - m_ptr = &m_list[m_idx]; + m_idx = g_ptr->m_idx; + m_ptr = ¤t_floor_ptr->m_list[m_idx]; /* Monster cannot move back? */ if (!monster_can_enter(ny, nx, &r_info[m_ptr->r_idx], 0)) @@ -669,12 +671,12 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) continue; } - c_ptr->m_idx = 0; - cave[ny][nx].m_idx = m_idx; + g_ptr->m_idx = 0; + current_floor_ptr->grid_array[ny][nx].m_idx = m_idx; m_ptr->fy = ny; m_ptr->fx = nx; - update_mon(m_idx, TRUE); + update_monster(m_idx, TRUE); /* Redraw the old spot */ lite_spot(y, x); @@ -683,9 +685,8 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) lite_spot(ny, nx); /* Player can move forward? */ - if (player_can_enter(c_ptr->feat, 0)) + if (player_can_enter(g_ptr->feat, 0)) { - /* Move the player */ if (!move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP)) break; } else @@ -714,7 +715,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (cave[y][x].m_idx) + if (current_floor_ptr->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_DRAIN); else { @@ -731,9 +732,9 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) if (cast) { msg_print(_("武器を不規則に揺らした...", "You irregularly wave your weapon...")); - project_hack(GF_ENGETSU, plev * 4); - project_hack(GF_ENGETSU, plev * 4); - project_hack(GF_ENGETSU, plev * 4); + project_all_los(GF_ENGETSU, plev * 4); + project_all_los(GF_ENGETSU, plev * 4); + project_all_los(GF_ENGETSU, plev * 4); } break; @@ -815,10 +816,10 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (cave[y][x].m_idx) + if (current_floor_ptr->grid_array[y][x].m_idx) { py_attack(y, x, 0); - if (cave[y][x].m_idx) + if (current_floor_ptr->grid_array[y][x].m_idx) { handle_stuff(); py_attack(y, x, 0); @@ -849,7 +850,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (d_info[dungeon_type].flags1 & DF1_NO_MELEE) + if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE) { msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking.")); return ""; @@ -858,7 +859,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) for (i = 0; i < 2; i++) { int damage; - if (!buki_motteruka(INVEN_RARM + i)) break; + if (!has_melee_weapon(INVEN_RARM + i)) break; o_ptr = &inventory[INVEN_RARM + i]; basedam = (o_ptr->dd * (o_ptr->ds + 1)) * 50; damage = o_ptr->to_d * 100; @@ -899,7 +900,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) y = p_ptr->y + ddy[dir]; x = p_ptr->x + ddx[dir]; - if (cave[y][x].m_idx) + if (current_floor_ptr->grid_array[y][x].m_idx) py_attack(y, x, HISSATSU_UNDEAD); else {