OSDN Git Service

[Refactor] #38997 identify_fully() にplayer_type * 引数を追加 / Added player_type * argumen...
[hengband/hengband.git] / src / realm-hissatsu.c
index 1cc45da..69ee1ad 100644 (file)
 #include "targeting.h"
 #include "view-mainwindow.h"
 #include "spells-floor.h"
+#include "world.h"
 
 /*!
 * @brief 剣術の各処理を行う
+* @param caster_ptr プレーヤーへの参照ポインタ
 * @param spell 剣術ID
 * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_CAST)
 * @return SPELL_NAME / SPELL_DESC 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
@@ -60,7 +62,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                        DIRECTION cdir;
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        for (cdir = 0; cdir < 8; cdir++)
@@ -112,7 +114,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -134,7 +136,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
 
                if (cast)
                {
-                       detect_monsters_mind(DETECT_RAD_DEFAULT);
+                       detect_monsters_mind(caster_ptr, DETECT_RAD_DEFAULT);
                }
                break;
 
@@ -146,7 +148,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -194,7 +196,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                                return NULL;
                        }
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
 
                        if (dir == 5) return NULL;
                        y = caster_ptr->y + ddy[dir];
@@ -208,13 +210,13 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
 
                        py_attack(caster_ptr, y, x, 0);
 
-                       if (!player_can_enter(caster_ptr->current_floor_ptr->grid_array[y][x].feat, 0) || is_trap(caster_ptr->current_floor_ptr->grid_array[y][x].feat))
+                       if (!player_can_enter(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].feat, 0) || is_trap(caster_ptr->current_floor_ptr->grid_array[y][x].feat))
                                break;
 
                        y += ddy[dir];
                        x += ddx[dir];
 
-                       if (player_can_enter(caster_ptr->current_floor_ptr->grid_array[y][x].feat, 0) && !is_trap(caster_ptr->current_floor_ptr->grid_array[y][x].feat) && !caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
+                       if (player_can_enter(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].feat, 0) && !is_trap(caster_ptr->current_floor_ptr->grid_array[y][x].feat) && !caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
                        {
                                msg_print(NULL);
                                (void)move_player_effect(caster_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
@@ -230,7 +232,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -255,7 +257,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -279,7 +281,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -346,7 +348,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        if (plev > 44)
                        {
-                               if (!identify_fully(TRUE)) return NULL;
+                               if (!identify_fully(caster_ptr, TRUE)) return NULL;
                        }
                        else
                        {
@@ -363,7 +365,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -372,7 +374,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                        if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
                                py_attack(caster_ptr, y, x, HISSATSU_HAGAN);
 
-                       if (!cave_have_flag_bold(y, x, FF_HURT_ROCK)) break;
+                       if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_HURT_ROCK)) break;
 
                        /* Destroy the feature */
                        cave_alter_feat(y, x, FF_HURT_ROCK);
@@ -389,7 +391,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -414,7 +416,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -439,7 +441,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -464,7 +466,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -490,7 +492,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -541,7 +543,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                                m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
 
                                /* Hack -- attack monsters */
-                               if (g_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(caster_ptr->current_floor_ptr, y, x, FF_PROJECT)))
                                {
                                        if (!monster_living(m_ptr->r_idx))
                                        {
@@ -564,7 +566,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -614,7 +616,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                                total_damage += damage / 200;
                                if (i) total_damage = total_damage * 7 / 10;
                        }
-                       fire_beam(GF_FORCE, dir, total_damage);
+                       fire_beam(caster_ptr, GF_FORCE, dir, total_damage);
                }
                break;
 
@@ -626,8 +628,8 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                if (cast)
                {
                        msg_print(_("雄叫びをあげた!", "You roar out!"));
-                       project_all_los(GF_SOUND, randint1(plev * 3));
-                       aggravate_monsters(0);
+                       project_all_los(caster_ptr, GF_SOUND, randint1(plev * 3));
+                       aggravate_monsters(caster_ptr, 0);
                }
                break;
 
@@ -639,7 +641,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        int i;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        for (i = 0; i < 3; i++)
@@ -697,7 +699,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                                lite_spot(ny, nx);
 
                                /* Player can move forward? */
-                               if (player_can_enter(g_ptr->feat, 0))
+                               if (player_can_enter(caster_ptr, g_ptr->feat, 0))
                                {
                                        if (!move_player_effect(caster_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP)) break;
                                }
@@ -721,7 +723,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -744,9 +746,9 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                if (cast)
                {
                        msg_print(_("武器を不規則に揺らした...", "You irregularly wave your weapon..."));
-                       project_all_los(GF_ENGETSU, plev * 4);
-                       project_all_los(GF_ENGETSU, plev * 4);
-                       project_all_los(GF_ENGETSU, plev * 4);
+                       project_all_los(caster_ptr, GF_ENGETSU, plev * 4);
+                       project_all_los(caster_ptr, GF_ENGETSU, plev * 4);
+                       project_all_los(caster_ptr, GF_ENGETSU, plev * 4);
                }
                break;
 
@@ -796,7 +798,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!tgt_pt(&x, &y)) return NULL;
+                       if (!tgt_pt(caster_ptr, &x, &y)) return NULL;
 
                        if (!cave_player_teleportable_bold(y, x, 0L) ||
                                (distance(y, x, caster_ptr->y, caster_ptr->x) > MAX_SIGHT / 2) ||
@@ -810,7 +812,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                                msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
                                break;
                        }
-                       project(0, 0, y, x, HISSATSU_ISSEN, GF_ATTACK, PROJECT_BEAM | PROJECT_KILL, -1);
+                       project(caster_ptr, 0, 0, y, x, HISSATSU_ISSEN, GF_ATTACK, PROJECT_BEAM | PROJECT_KILL, -1);
                        teleport_player_to(caster_ptr, y, x, 0L);
                }
                break;
@@ -856,7 +858,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                        BIT_FLAGS flgs[TR_FLAG_SIZE];
                        object_type *o_ptr;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -893,7 +895,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                                damage *= caster_ptr->num_blow[i];
                                total_damage += (damage / 100);
                        }
-                       project(0, (cave_have_flag_bold(y, x, FF_PROJECT) ? 5 : 0), y, x, total_damage * 3 / 2, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
+                       project(caster_ptr, 0, (cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT) ? 5 : 0), y, x, total_damage * 3 / 2, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
                }
                break;
 
@@ -906,7 +908,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = caster_ptr->y + ddy[dir];
@@ -938,10 +940,10 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                        i = inkey();
                        prt("", 0, 0);
                        if (i != '@') return NULL;
-                       if (caster_ptr->total_winner)
+                       if (current_world_ptr->total_winner)
                        {
                                take_hit(caster_ptr, DAMAGE_FORCE, 9999, "Seppuku", -1);
-                               caster_ptr->total_winner = TRUE;
+                               current_world_ptr->total_winner = TRUE;
                        }
                        else
                        {