OSDN Git Service

[Refactor] #37353 釣りの処理を fishing() に分離。 / Separate fishingpole of Taikobo to fishing().
authordeskull <deskull@users.sourceforge.jp>
Sat, 23 Feb 2019 11:29:03 +0000 (20:29 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sat, 23 Feb 2019 11:29:03 +0000 (20:29 +0900)
src/cmd-activate.c
src/spells-status.c
src/spells-status.h

index 938682f..4f724d1 100644 (file)
@@ -1897,36 +1897,12 @@ bool activate_artifact(object_type *o_ptr)
        }
 
        case ACT_FISHING:
-       {
-               POSITION x, y;
-
-               if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
-               y = p_ptr->y + ddy[dir];
-               x = p_ptr->x + ddx[dir];
-               p_ptr->fishing_dir = dir;
-               if (!cave_have_flag_bold(y, x, FF_WATER))
-               {
-                       msg_print(_("そこは水辺ではない。", "There is no fishing place."));
-                       return FALSE;
-               }
-               else if (grid_array[y][x].m_idx)
-               {
-                       GAME_TEXT m_name[MAX_NLEN];
-                       monster_desc(m_name, &m_list[grid_array[y][x].m_idx], 0);
-                       msg_format(_("%sが邪魔だ!", "%^s is stand in your way."), m_name);
-                       free_turn(p_ptr);
-                       return FALSE;
-               }
-               set_action(ACTION_FISH);
-               p_ptr->redraw |= (PR_STATE);
+               if(!fishing(p_ptr)) return FALSE;
                break;
-       }
 
        case ACT_INROU:
-       {
                mitokohmon();
                break;
-       }
 
        case ACT_MURAMASA:
        {
@@ -1957,13 +1933,10 @@ bool activate_artifact(object_type *o_ptr)
        }
 
        case ACT_CRIMSON:
-       {
-               /* Only for Crimson */
                if (o_ptr->name1 != ART_CRIMSON) return FALSE;
                msg_print(_("せっかくだから『クリムゾン』をぶっぱなすぜ!", "I'll fire CRIMSON! SEKKAKUDAKARA!"));
                if(!fire_crimson()) return FALSE;
                break;
-       }
 
        default:
        {
index 15294bf..9252f30 100644 (file)
@@ -1,5 +1,6 @@
 #include "angband.h"
 #include "avatar.h"
+#include "player-status.h"
 #include "spells-status.h"
 #include "projection.h"
 #include "spells.h"
@@ -389,3 +390,30 @@ bool restore_all_status(void)
        if (do_res_stat(A_CHR)) ident = TRUE;
        return ident;
 }
+
+bool fishing(player_type *creature_ptr)
+{
+       DIRECTION dir;
+       POSITION x, y;
+
+       if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
+       y = creature_ptr->y + ddy[dir];
+       x = creature_ptr->x + ddx[dir];
+       creature_ptr->fishing_dir = dir;
+       if (!cave_have_flag_bold(y, x, FF_WATER))
+       {
+               msg_print(_("そこは水辺ではない。", "There is no fishing place."));
+               return FALSE;
+       }
+       else if (grid_array[y][x].m_idx)
+       {
+               GAME_TEXT m_name[MAX_NLEN];
+               monster_desc(m_name, &m_list[grid_array[y][x].m_idx], 0);
+               msg_format(_("%sが邪魔だ!", "%^s is stand in your way."), m_name);
+               free_turn(creature_ptr);
+               return FALSE;
+       }
+       set_action(ACTION_FISH);
+       creature_ptr->redraw |= (PR_STATE);
+       return TRUE;
+}
index f576cdd..b97b80b 100644 (file)
@@ -23,3 +23,5 @@ extern bool_hack true_healing(HIT_POINT pow);
 extern bool_hack restore_mana(bool_hack magic_eater);
 extern bool restore_all_status(void);
 
+extern bool fishing(player_type *creature_ptr);
+