OSDN Git Service

[Refactor] #37353 型の置換。 / Type replacement.
[hengband/hengband.git] / src / realm-hissatsu.c
index 18df0f9..3111b76 100644 (file)
@@ -1,5 +1,10 @@
 #include "angband.h"
 #include "cmd-spell.h"
+#include "melee.h"
+#include "monsterrace-hook.h"
+#include "projection.h"
+#include "artifact.h"
+#include "player-status.h"
 
 /*!
 * @brief 剣術の各処理を行う
 * @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;
        bool cast = (mode == SPELL_CAST) ? TRUE : FALSE;
 
-       int dir;
-       int plev = p_ptr->lev;
+       DIRECTION dir;
+       PLAYER_LEVEL plev = p_ptr->lev;
 
        switch (spell)
        {
@@ -37,10 +42,10 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                if (cast)
                {
-                       int cdir;
-                       int y, x;
+                       DIRECTION cdir;
+                       POSITION y, x;
 
-                       if (!get_rep_dir2(&dir)) return NULL;
+                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        for (cdir = 0; cdir < 8; cdir++)
@@ -90,9 +95,9 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                if (cast)
                {
-                       int y, x;
+                       POSITION y, x;
 
-                       if (!get_rep_dir2(&dir)) return NULL;
+                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = p_ptr->y + ddy[dir];
@@ -124,9 +129,9 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                if (cast)
                {
-                       int y, x;
+                       POSITION y, x;
 
-                       if (!get_rep_dir2(&dir)) return NULL;
+                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = p_ptr->y + ddy[dir];
@@ -174,7 +179,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                return NULL;
                        }
 
-                       if (!get_rep_dir2(&dir)) return NULL;
+                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
 
                        if (dir == 5) return NULL;
                        y = p_ptr->y + ddy[dir];
@@ -197,8 +202,6 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        if (player_can_enter(cave[y][x].feat, 0) && !is_trap(cave[y][x].feat) && !cave[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);
                        }
                }
@@ -210,9 +213,9 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                if (cast)
                {
-                       int y, x;
+                       POSITION y, x;
 
-                       if (!get_rep_dir2(&dir)) return NULL;
+                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = p_ptr->y + ddy[dir];
@@ -235,9 +238,9 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                if (cast)
                {
-                       int y, x;
+                       POSITION y, x;
 
-                       if (!get_rep_dir2(&dir)) return NULL;
+                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = p_ptr->y + ddy[dir];
@@ -259,9 +262,9 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                if (cast)
                {
-                       int y, x;
+                       POSITION y, x;
 
-                       if (!get_rep_dir2(&dir)) return NULL;
+                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = p_ptr->y + ddy[dir];
@@ -274,7 +277,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                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 "";
                        }
@@ -285,7 +288,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                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];
+                               GAME_TEXT m_name[MAX_NLEN];
 
                                monster_desc(m_name, m_ptr, 0);
 
@@ -308,7 +311,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                        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);
 
@@ -343,9 +346,9 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                if (cast)
                {
-                       int y, x;
+                       POSITION y, x;
 
-                       if (!get_rep_dir2(&dir)) return NULL;
+                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = p_ptr->y + ddy[dir];
@@ -371,9 +374,9 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                if (cast)
                {
-                       int y, x;
+                       POSITION y, x;
 
-                       if (!get_rep_dir2(&dir)) return NULL;
+                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = p_ptr->y + ddy[dir];
@@ -396,9 +399,9 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                if (cast)
                {
-                       int y, x;
+                       POSITION y, x;
 
-                       if (!get_rep_dir2(&dir)) return NULL;
+                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = p_ptr->y + ddy[dir];
@@ -421,9 +424,9 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                if (cast)
                {
-                       int y, x;
+                       POSITION y, x;
 
-                       if (!get_rep_dir2(&dir)) return NULL;
+                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = p_ptr->y + ddy[dir];
@@ -446,9 +449,9 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                if (cast)
                {
-                       int y, x;
+                       POSITION y, x;
 
-                       if (!get_rep_dir2(&dir)) return NULL;
+                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = p_ptr->y + ddy[dir];
@@ -472,9 +475,9 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                if (cast)
                {
-                       int y, x;
+                       POSITION y, x;
 
-                       if (!get_rep_dir2(&dir)) return NULL;
+                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = p_ptr->y + ddy[dir];
@@ -507,7 +510,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                if (cast)
                {
-                       int y = 0, x = 0;
+                       POSITION y = 0, x = 0;
 
                        cave_type       *c_ptr;
                        monster_type    *m_ptr;
@@ -522,16 +525,14 @@ 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];
 
                                /* Hack -- attack monsters */
                                if (c_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);
@@ -548,9 +549,9 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                if (cast)
                {
-                       int y, x;
+                       POSITION y, x;
 
-                       if (!get_rep_dir2(&dir)) return NULL;
+                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = p_ptr->y + ddy[dir];
@@ -570,7 +571,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (cast)
                {
                        int total_damage = 0, basedam, i;
-                       u32b flgs[TR_FLAG_SIZE];
+                       BIT_FLAGS flgs[TR_FLAG_SIZE];
                        object_type *o_ptr;
                        if (!get_aim_dir(&dir)) return NULL;
                        msg_print(_("武器を大きく振り下ろした。", "You swing your weapon downward."));
@@ -578,7 +579,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 +613,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;
@@ -625,7 +626,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        int i;
 
-                       if (!get_rep_dir2(&dir)) return NULL;
+                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        for (i = 0; i < 3; i++)
@@ -648,7 +649,7 @@ 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 "";
                                }
@@ -674,7 +675,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                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);
@@ -685,7 +686,6 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                /* Player can move forward? */
                                if (player_can_enter(c_ptr->feat, 0))
                                {
-                                       /* Move the player */
                                        if (!move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP)) break;
                                }
                                else
@@ -706,9 +706,9 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                if (cast)
                {
-                       int y, x;
+                       POSITION y, x;
 
-                       if (!get_rep_dir2(&dir)) return NULL;
+                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = p_ptr->y + ddy[dir];
@@ -731,9 +731,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;
 
@@ -808,7 +808,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                if (cast)
                {
-                       int x, y;
+                       POSITION x, y;
 
                        if (!get_rep_dir(&dir, FALSE)) return NULL;
 
@@ -839,17 +839,17 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (cast)
                {
                        int total_damage = 0, basedam, i;
-                       int y, x;
-                       u32b flgs[TR_FLAG_SIZE];
+                       POSITION y, x;
+                       BIT_FLAGS flgs[TR_FLAG_SIZE];
                        object_type *o_ptr;
 
-                       if (!get_rep_dir2(&dir)) return NULL;
+                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        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 +858,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;
@@ -891,9 +891,9 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                if (cast)
                {
-                       int y, x;
+                       POSITION y, x;
 
-                       if (!get_rep_dir2(&dir)) return NULL;
+                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        y = p_ptr->y + ddy[dir];