OSDN Git Service

[Refactor] #37353 クリムゾンの処理を fire_crimson() に分離。 / Separate activation of Crimson...
authordeskull <deskull@users.sourceforge.jp>
Sat, 23 Feb 2019 11:10:54 +0000 (20:10 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sat, 23 Feb 2019 11:10:54 +0000 (20:10 +0900)
src/cmd-activate.c
src/externs.h
src/spells3.c

index f4d2eee..938682f 100644 (file)
@@ -1958,43 +1958,10 @@ bool activate_artifact(object_type *o_ptr)
 
        case ACT_CRIMSON:
        {
-               int num = 1;
-               int i;
-               BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
-               int tx, ty;
-
                /* Only for Crimson */
                if (o_ptr->name1 != ART_CRIMSON) return FALSE;
-
                msg_print(_("せっかくだから『クリムゾン』をぶっぱなすぜ!", "I'll fire CRIMSON! SEKKAKUDAKARA!"));
-
-               if (!get_aim_dir(&dir)) return FALSE;
-
-               /* Use the given direction */
-               tx = p_ptr->x + 99 * ddx[dir];
-               ty = p_ptr->y + 99 * ddy[dir];
-
-               /* Hack -- Use an actual "target" */
-               if ((dir == 5) && target_okay())
-               {
-                       tx = target_col;
-                       ty = target_row;
-               }
-
-               if (p_ptr->pclass == CLASS_ARCHER)
-               {
-                       /* Extra shot at level 10 */
-                       if (p_ptr->lev >= 10) num++;
-
-                       /* Extra shot at level 30 */
-                       if (p_ptr->lev >= 30) num++;
-
-                       /* Extra shot at level 45 */
-                       if (p_ptr->lev >= 45) num++;
-               }
-
-               for (i = 0; i < num; i++)
-                       project(0, p_ptr->lev / 20 + 1, ty, tx, p_ptr->lev*p_ptr->lev * 6 / 50, GF_ROCKET, flg, -1);
+               if(!fire_crimson()) return FALSE;
                break;
        }
 
index e41e31d..0a06fe2 100644 (file)
@@ -1036,6 +1036,7 @@ extern bool shock_power(void);
 extern bool booze(player_type *creature_ptr);
 extern bool detonation(player_type *creature_ptr);
 extern void blood_curse_to_enemy(MONSTER_IDX m_idx);
+extern bool fire_crimson(void);
 
 
 /* bldg.c */
index 6a6c777..6ff4f4f 100644 (file)
@@ -4623,4 +4623,45 @@ void blood_curse_to_enemy(MONSTER_IDX m_idx)
                }
                }
        } while (one_in_(5));
-}
\ No newline at end of file
+}
+
+
+bool fire_crimson(void)
+{
+       int num = 1;
+       int i;
+       BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
+       POSITION tx, ty;
+       DIRECTION dir;
+
+       if (!get_aim_dir(&dir)) return FALSE;
+
+       /* Use the given direction */
+       tx = p_ptr->x + 99 * ddx[dir];
+       ty = p_ptr->y + 99 * ddy[dir];
+
+       /* Hack -- Use an actual "target" */
+       if ((dir == 5) && target_okay())
+       {
+               tx = target_col;
+               ty = target_row;
+       }
+
+       if (p_ptr->pclass == CLASS_ARCHER)
+       {
+               /* Extra shot at level 10 */
+               if (p_ptr->lev >= 10) num++;
+
+               /* Extra shot at level 30 */
+               if (p_ptr->lev >= 30) num++;
+
+               /* Extra shot at level 45 */
+               if (p_ptr->lev >= 45) num++;
+       }
+
+       for (i = 0; i < num; i++)
+               project(0, p_ptr->lev / 20 + 1, ty, tx, p_ptr->lev*p_ptr->lev * 6 / 50, GF_ROCKET, flg, -1);
+
+       return TRUE;
+}
+