OSDN Git Service

[Refactor] #37353 死者召喚を cast_summon_undead() に分離。 / Separate cast_summon_undead().
authordeskull <deskull@users.sourceforge.jp>
Mon, 25 Feb 2019 04:19:26 +0000 (13:19 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Mon, 25 Feb 2019 04:19:26 +0000 (13:19 +0900)
src/cmd-activate.c
src/realm-death.c
src/spells-summon.c
src/spells-summon.h

index 707e12a..3abee28 100644 (file)
@@ -1243,31 +1243,8 @@ bool activate_artifact(object_type *o_ptr)
        }
 
        case ACT_SUMMON_UNDEAD:
-       {
-               bool pet = one_in_(3);
-               int type;
-               BIT_FLAGS mode = 0L;
-
-               type = (plev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD);
-
-               if (!pet || ((plev > 24) && one_in_(3))) mode |= PM_ALLOW_GROUP;
-               if (pet) mode |= PM_FORCE_PET;
-               else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
-
-               if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((plev * 3) / 2), type, mode, '\0'))
-               {
-                       msg_print(_("冷たい風があなたの周りに吹き始めた。それは腐敗臭を運んでいる...",
-                               "Cold winds begin to blow around you, carrying with them the stench of decay..."));
-                       if (pet)
-                               msg_print(_("古えの死せる者共があなたに仕えるため土から甦った!",
-                                       "Ancient, long-dead forms arise from the ground to serve you!"));
-                       else
-                               msg_print(_("死者が甦った。眠りを妨げるあなたを罰するために!",
-                                       "'The dead arise... to punish you for disturbing them!'"));
-               }
-
+               if (!cast_summon_undead(p_ptr, (plev * 3) / 2)) return FALSE;
                break;
-       }
 
        case ACT_SUMMON_HOUND:
        {
index 136e198..901c92b 100644 (file)
@@ -522,43 +522,7 @@ concptr do_death_spell(SPELL_IDX spell, BIT_FLAGS mode)
        case 25:
                if (name) return _("死者召喚", "Raise the Dead");
                if (desc) return _("1体のアンデッドを召喚する。", "Summons an undead monster.");
-
-               {
-                       if (cast)
-                       {
-                               int type;
-                               bool pet = one_in_(3);
-                               u32b flg = 0L;
-
-                               type = (plev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD);
-
-                               if (!pet || (pet && (plev > 24) && one_in_(3)))
-                                       flg |= PM_ALLOW_GROUP;
-
-                               if (pet) flg |= PM_FORCE_PET;
-                               else flg |= (PM_ALLOW_UNIQUE | PM_NO_PET);
-
-                               if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, (plev * 3) / 2, type, flg, '\0'))
-                               {
-                                       msg_print(_("冷たい風があなたの周りに吹き始めた。それは腐敗臭を運んでいる...",
-                                               "Cold winds begin to blow around you, carrying with them the stench of decay..."));
-
-
-                                       if (pet)
-                                       {
-                                               msg_print(_("古えの死せる者共があなたに仕えるため土から甦った!",
-                                                       "Ancient, long-dead forms arise from the ground to serve you!"));
-                                       }
-                                       else
-                                       {
-                                               msg_print(_("死者が甦った。眠りを妨げるあなたを罰するために!",
-                                                       "'The dead arise... to punish you for disturbing them!'"));
-                                       }
-
-                                       chg_virtue(V_UNLIFE, 1);
-                               }
-                       }
-               }
+               if (cast) cast_summon_undead(p_ptr, (plev * 3) / 2);
                break;
 
        case 26:
index 50ce16b..d7217d3 100644 (file)
@@ -88,6 +88,32 @@ bool cast_summon_demon(int power)
        return TRUE;
 }
 
+bool cast_summon_undead(player_type *creature_ptr, int power)
+{
+       bool pet = one_in_(3);
+       int type;
+       BIT_FLAGS mode = 0L;
+
+       type = (creature_ptr->lev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD);
+
+       if (!pet || ((creature_ptr->lev > 24) && one_in_(3))) mode |= PM_ALLOW_GROUP;
+       if (pet) mode |= PM_FORCE_PET;
+       else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
+
+       if (summon_specific((pet ? -1 : 0), creature_ptr->y, creature_ptr->x, power, type, mode, '\0'))
+       {
+               msg_print(_("冷たい風があなたの周りに吹き始めた。それは腐敗臭を運んでいる...",
+                       "Cold winds begin to blow around you, carrying with them the stench of decay..."));
+               if (pet)
+                       msg_print(_("古えの死せる者共があなたに仕えるため土から甦った!",
+                               "Ancient, long-dead forms arise from the ground to serve you!"));
+               else
+                       msg_print(_("死者が甦った。眠りを妨げるあなたを罰するために!",
+                               "'The dead arise... to punish you for disturbing them!'"));
+       }
+       return TRUE;
+}
+
 bool cast_summon_octopus(player_type *creature_ptr)
 {
        BIT_FLAGS mode = PM_ALLOW_GROUP;
index bfd829b..3566447 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_undead(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);