OSDN Git Service

[Refactor] #37353 蛸召喚を cast_summon_octopus() に分離。 / Separate cast_summon_octopus().
authordeskull <deskull@users.sourceforge.jp>
Sun, 24 Feb 2019 15:27:36 +0000 (00:27 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 24 Feb 2019 15:27:36 +0000 (00:27 +0900)
src/cmd-activate.c
src/spells-object.c
src/spells-summon.c
src/spells-summon.h

index a6c8d7f..707e12a 100644 (file)
@@ -1298,21 +1298,8 @@ bool activate_artifact(object_type *o_ptr)
        }
 
        case ACT_SUMMON_OCTOPUS:
-       {
-               BIT_FLAGS mode = PM_ALLOW_GROUP;
-               bool pet = !one_in_(5);
-               if (pet) mode |= PM_FORCE_PET;
-
-               if (summon_named_creature(0, p_ptr->y, p_ptr->x, MON_JIZOTAKO, mode))
-               {
-                       if (pet)
-                               msg_print(_("蛸があなたの下僕として出現した。", "A group of octopuses appear as your servant."));
-                       else
-                               msg_print(_("蛸はあなたを睨んでいる!", "A group of octopuses appear as your enemy!"));
-               }
-
+               if(!cast_summon_octopus(p_ptr)) return FALSE;
                break;
-       }
 
        /* Activate for healing */
 
index c1bdde9..aa86366 100644 (file)
@@ -804,33 +804,33 @@ bool perilous_secrets(player_type *creature_ptr)
        if (mp_ptr->spell_book)
        {
                /* Sufficient mana */
-               if (20 <= p_ptr->csp)
+               if (20 <= creature_ptr->csp)
                {
                        /* Use some mana */
-                       p_ptr->csp -= 20;
+                       creature_ptr->csp -= 20;
                }
 
                /* Over-exert the player */
                else
                {
-                       int oops = 20 - p_ptr->csp;
+                       int oops = 20 - creature_ptr->csp;
 
                        /* No mana left */
-                       p_ptr->csp = 0;
-                       p_ptr->csp_frac = 0;
+                       creature_ptr->csp = 0;
+                       creature_ptr->csp_frac = 0;
 
                        msg_print(_("石を制御できない!", "You are too weak to control the stone!"));
                        /* Hack -- Bypass free action */
-                       (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
+                       (void)set_paralyzed(creature_ptr->paralyzed + randint1(5 * oops + 1));
 
                        /* Confusing. */
-                       (void)set_confused(p_ptr->confused + randint1(5 * oops + 1));
+                       (void)set_confused(creature_ptr->confused + randint1(5 * oops + 1));
                }
-               p_ptr->redraw |= (PR_MANA);
+               creature_ptr->redraw |= (PR_MANA);
        }
        take_hit(DAMAGE_LOSELIFE, damroll(1, 12), _("危険な秘密", "perilous secrets"), -1);
        /* Confusing. */
-       if (one_in_(5)) (void)set_confused(p_ptr->confused + randint1(10));
+       if (one_in_(5)) (void)set_confused(creature_ptr->confused + randint1(10));
 
        /* Exercise a little care... */
        if (one_in_(20)) take_hit(DAMAGE_LOSELIFE, damroll(4, 10), _("危険な秘密", "perilous secrets"), -1);
index 391deac..50ce16b 100644 (file)
@@ -88,6 +88,22 @@ bool cast_summon_demon(int power)
        return TRUE;
 }
 
+bool cast_summon_octopus(player_type *creature_ptr)
+{
+       BIT_FLAGS mode = PM_ALLOW_GROUP;
+       bool pet = !one_in_(5);
+       if (pet) mode |= PM_FORCE_PET;
+
+       if (summon_named_creature(0, creature_ptr->y, creature_ptr->x, MON_JIZOTAKO, mode))
+       {
+               if (pet)
+                       msg_print(_("蛸があなたの下僕として出現した。", "A group of octopuses appear as your servant."));
+               else
+                       msg_print(_("蛸はあなたを睨んでいる!", "A group of octopuses appear as your enemy!"));
+       }
+
+       return TRUE;
+}
 
 /*!
 * @brief 悪魔領域のグレーターデーモン召喚に利用可能な死体かどうかを返す。 / An "item_tester_hook" for offer
index 20a1490..bfd829b 100644 (file)
@@ -6,6 +6,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_octopus(player_type *creature_ptr);
 extern bool item_tester_offer(object_type *o_ptr);
 extern bool cast_summon_greater_demon(void);
 extern bool summon_kin_player(DEPTH level, POSITION y, POSITION x, BIT_FLAGS mode);