OSDN Git Service

[Refactor] #37353 忍者の早駆けを hayagake() に分離。 / Separate Ninja's racial skill to hayagake().
authorDeskull <deskull@users.sourceforge.jp>
Wed, 23 Jan 2019 13:28:30 +0000 (22:28 +0900)
committerDeskull <deskull@users.sourceforge.jp>
Wed, 23 Jan 2019 13:28:30 +0000 (22:28 +0900)
src/externs.h
src/racial.c
src/spells2.c

index 4c9460e..67348b1 100644 (file)
@@ -992,6 +992,7 @@ extern bool psychometry(void);
 extern bool draconian_breath(player_type *creature_ptr);
 extern bool android_inside_weapon(player_type *creature_ptr);
 extern bool create_ration(player_type *crature_ptr);
+extern void hayagake(player_type *creature_ptr);
 
 /* spells3.c */
 extern bool teleport_away(MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode);
index 2158ae3..12e5f2e 100644 (file)
@@ -807,33 +807,9 @@ static bool cmd_racial_power_aux(s32b command)
                        break;
                }
                case CLASS_NINJA:
-               {
-                       if (p_ptr->action == ACTION_HAYAGAKE)
-                       {
-                               set_action(ACTION_NONE);
-                       }
-                       else
-                       {
-                               cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x];
-                               feature_type *f_ptr = &f_info[c_ptr->feat];
-
-                               if (!have_flag(f_ptr->flags, FF_PROJECT) ||
-                                   (!p_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP)))
-                               {
-                                       msg_print(_("ここでは素早く動けない。", "You cannot run in here."));
-                               }
-                               else
-                               {
-                                       set_action(ACTION_HAYAGAKE);
-                               }
-                       }
-
-
-                       p_ptr->energy_use = 0;
+                       hayagake(p_ptr);
                        break;
                }
-
-               }
        }
        else if (p_ptr->mimic_form)
        {
index 87b2bc0..af3c1ef 100644 (file)
@@ -5165,3 +5165,27 @@ bool create_ration(player_type *crature_ptr)
        msg_print(_("食事を料理して作った。", "You cook some food."));
        return TRUE;
 }
+
+void hayagake(player_type *creature_ptr)
+{
+       if (creature_ptr->action == ACTION_HAYAGAKE)
+       {
+               set_action(ACTION_NONE);
+       }
+       else
+       {
+               cave_type *c_ptr = &cave[creature_ptr->y][creature_ptr->x];
+               feature_type *f_ptr = &f_info[c_ptr->feat];
+
+               if (!have_flag(f_ptr->flags, FF_PROJECT) ||
+                       (!creature_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP)))
+               {
+                       msg_print(_("ここでは素早く動けない。", "You cannot run in here."));
+               }
+               else
+               {
+                       set_action(ACTION_HAYAGAKE);
+               }
+       }
+       creature_ptr->energy_use = 0;
+}