OSDN Git Service

[Refactor] #37353 ハウンド召喚を cast_summon_hound() に分離。 / Separate cast_summon_hound().
authordeskull <deskull@users.sourceforge.jp>
Mon, 25 Feb 2019 04:24:55 +0000 (13:24 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Mon, 25 Feb 2019 04:24:55 +0000 (13:24 +0900)
src/cmd-activate.c
src/spells-summon.c
src/spells-summon.h

index 3abee28..a9e8afb 100644 (file)
@@ -1247,25 +1247,8 @@ bool activate_artifact(object_type *o_ptr)
                break;
 
        case ACT_SUMMON_HOUND:
-       {
-               BIT_FLAGS mode = PM_ALLOW_GROUP;
-               bool pet = !one_in_(5);
-               if (pet) mode |= PM_FORCE_PET;
-               else mode |= PM_NO_PET;
-
-               if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((p_ptr->lev * 3) / 2), SUMMON_HOUND, mode, '\0'))
-               {
-
-                       if (pet)
-                               msg_print(_("ハウンドがあなたの下僕として出現した。",
-                                       "A group of hounds appear as your servant."));
-                       else
-                               msg_print(_("ハウンドはあなたに牙を向けている!",
-                                       "A group of hounds appear as your enemy!"));
-               }
-
+               if (!cast_summon_hound(p_ptr, (plev * 3) / 2)) return FALSE;
                break;
-       }
 
        case ACT_SUMMON_DAWN:
        {
index d7217d3..716e615 100644 (file)
@@ -114,6 +114,25 @@ bool cast_summon_undead(player_type *creature_ptr, int power)
        return TRUE;
 }
 
+
+bool cast_summon_hound(player_type *creature_ptr, int power)
+{
+       BIT_FLAGS mode = PM_ALLOW_GROUP;
+       bool pet = !one_in_(5);
+       if (pet) mode |= PM_FORCE_PET;
+       else mode |= PM_NO_PET;
+
+       if (summon_specific((pet ? -1 : 0), creature_ptr->y, creature_ptr->x, power, SUMMON_HOUND, mode, '\0'))
+       {
+               if (pet)
+                       msg_print(_("ハウンドがあなたの下僕として出現した。", "A group of hounds appear as your servant."));
+               else
+                       msg_print(_("ハウンドはあなたに牙を向けている!", "A group of hounds appear as your enemy!"));
+       }
+       return TRUE;
+}
+
+
 bool cast_summon_octopus(player_type *creature_ptr)
 {
        BIT_FLAGS mode = PM_ALLOW_GROUP;
index 3566447..7adf302 100644 (file)
@@ -7,6 +7,7 @@ extern bool summon_named_creature(MONSTER_IDX who, POSITION oy, POSITION ox, MON
 extern bool trump_summoning(int num, bool pet, POSITION y, POSITION x, DEPTH lev, int type, BIT_FLAGS mode);
 extern bool cast_summon_demon(int power);
 extern bool cast_summon_undead(player_type *creature_ptr, int power);
+extern bool cast_summon_hound(player_type *creature_ptr, int power);
 extern bool cast_summon_octopus(player_type *creature_ptr);
 extern bool item_tester_offer(object_type *o_ptr);
 extern bool cast_summon_greater_demon(void);