OSDN Git Service

[Refactor] #37353 悪魔召喚の効果をcast_summon_demon()にまとめる。
authorDeskull <deskull@users.sourceforge.jp>
Thu, 8 Nov 2018 16:10:25 +0000 (01:10 +0900)
committerDeskull <deskull@users.sourceforge.jp>
Thu, 8 Nov 2018 16:10:25 +0000 (01:10 +0900)
Integrate some effects to cast_summon_demon().

src/cmd-activate.c
src/realm-chaos.c
src/realm-crusade.c
src/realm-daemon.c
src/spells-summon.c
src/spells-summon.h

index 64da2f7..ad00f25 100644 (file)
@@ -9,6 +9,7 @@
 #include "angband.h"
 #include "cmd-activate.h"
 #include "object-hook.h"
+#include "spells-summon.h"
 
 /*!
 * @brief ペット入りモンスターボールをソートするための比較関数
@@ -986,22 +987,7 @@ bool activate_artifact(object_type *o_ptr)
 
        case ACT_SUMMON_DEMON:
        {
-               bool pet = one_in_(3);
-               BIT_FLAGS mode = 0L;
-
-               if (!(pet && (plev < 50))) mode |= PM_ALLOW_GROUP;
-               if (pet) mode |= PM_FORCE_PET;
-               else mode |= PM_NO_PET;
-
-               if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((plev * 3) / 2), SUMMON_DEMON, mode))
-               {
-                       msg_print(_("硫黄の悪臭が充満した。", "The area fills with a stench of sulphur and brimstone."));
-                       if (pet)
-                               msg_print(_("「ご用でございますか、ご主人様」", "'What is thy bidding... Master?'"));
-                       else
-                               msg_print(_("「NON SERVIAM! Wretch! お前の魂を頂くぞ!」", "'NON SERVIAM! Wretch! I shall feast on thy mortal soul!'"));
-               }
-
+               cast_summon_demon((plev * 3) / 2);
                break;
        }
 
index 882bf7b..fe8972d 100644 (file)
@@ -1,5 +1,6 @@
 #include "angband.h"
 #include "cmd-spell.h"
+#include "spells-summon.h"
 
 /*!
 * @brief カオス領域魔法の各処理を行う
@@ -449,26 +450,7 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        if (cast)
                        {
-                               u32b flg = 0L;
-                               bool pet = !one_in_(3);
-
-                               if (pet) flg |= PM_FORCE_PET;
-                               else flg |= PM_NO_PET;
-                               if (!(pet && (plev < 50))) flg |= PM_ALLOW_GROUP;
-
-                               if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, (plev * 3) / 2, SUMMON_DEMON, flg))
-                               {
-                                       msg_print(_("硫黄の悪臭が充満した。", "The area fills with a stench of sulphur and brimstone."));
-                                       if (pet)
-                                       {
-                                               msg_print(_("「ご用でございますか、ご主人様」", "'What is thy bidding... Master?'"));
-                                       }
-                                       else
-                                       {
-                                               msg_print(_("「卑しき者よ、我は汝の下僕にあらず! お前の魂を頂くぞ!」",
-                                                       "'NON SERVIAM! Wretch! I shall feast on thy mortal soul!'"));
-                                       }
-                               }
+                               cast_summon_demon((plev * 3) / 2);
                        }
                }
                break;
index bfb5f26..5199ff3 100644 (file)
@@ -1,5 +1,6 @@
 #include "angband.h"
 #include "cmd-spell.h"
+#include "spells-summon.h"
 
 
 
index 1cb36e5..bc2c1c2 100644 (file)
@@ -297,32 +297,7 @@ cptr do_daemon_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        if (cast)
                        {
-                               bool pet = !one_in_(3);
-                               u32b flg = 0L;
-
-                               if (pet) flg |= PM_FORCE_PET;
-                               else flg |= PM_NO_PET;
-                               if (!(pet && (plev < 50))) flg |= PM_ALLOW_GROUP;
-
-                               if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, plev * 2 / 3 + randint1(plev / 2), SUMMON_DEMON, flg))
-                               {
-                                       msg_print(_("硫黄の悪臭が充満した。", "The area fills with a stench of sulphur and brimstone."));
-
-                                       if (pet)
-                                       {
-                                               msg_print(_("「ご用でございますか、ご主人様」", "'What is thy bidding... Master?'"));
-                                       }
-                                       else
-                                       {
-                                               msg_print(_("「卑しき者よ、我は汝の下僕にあらず! お前の魂を頂くぞ!」",
-                                                       "'NON SERVIAM! Wretch! I shall feast on thy mortal soul!'"));
-                                       }
-                               }
-                               else
-                               {
-                                       msg_print(_("悪魔は現れなかった。", "No demons arrive."));
-                               }
-                               break;
+                               cast_summon_demon(plev * 2 / 3 + randint1(plev / 2));
                        }
                }
                break;
index a4699fe..53cb422 100644 (file)
@@ -62,6 +62,31 @@ bool trump_summoning(int num, bool pet, POSITION y, POSITION x, DEPTH lev, int t
 }\r
 \r
 \r
+bool cast_summon_demon(int power)\r
+{\r
+       u32b flg = 0L;\r
+       bool pet = !one_in_(3);\r
+\r
+       if (pet) flg |= PM_FORCE_PET;\r
+       else flg |= PM_NO_PET;\r
+       if (!(pet && (p_ptr->lev < 50))) flg |= PM_ALLOW_GROUP;\r
+\r
+       if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, power, SUMMON_DEMON, flg))\r
+       {\r
+               msg_print(_("硫黄の悪臭が充満した。", "The area fills with a stench of sulphur and brimstone."));\r
+               if (pet)\r
+               {\r
+                       msg_print(_("「ご用でございますか、ご主人様」", "'What is thy bidding... Master?'"));\r
+               }\r
+               else\r
+               {\r
+                       msg_print(_("「卑しき者よ、我は汝の下僕にあらず! お前の魂を頂くぞ!」",\r
+                               "'NON SERVIAM! Wretch! I shall feast on thy mortal soul!'"));\r
+               }\r
+       }\r
+       return TRUE;\r
+}\r
+\r
 \r
 /*!\r
 * @brief 悪魔領域のグレーターデーモン召喚に利用可能な死体かどうかを返す。 / An "item_tester_hook" for offer\r
index e8def70..a22eb29 100644 (file)
@@ -1,3 +1,4 @@
 extern bool trump_summoning(int num, bool pet, POSITION y, POSITION x, DEPTH lev, int type, BIT_FLAGS mode);\r
+extern bool cast_summon_demon(int power);\r
 extern bool item_tester_offer(object_type *o_ptr);\r
 extern bool cast_summon_greater_demon(void);\r