OSDN Git Service

[Refactor] #37353 発動のエレメンタル召喚を cast_summon_elemental() に分離。 / Separate summon element...
authordeskull <deskull@users.sourceforge.jp>
Mon, 25 Feb 2019 04:34:00 +0000 (13:34 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Mon, 25 Feb 2019 04:34:00 +0000 (13:34 +0900)
src/cmd-activate.c
src/realm-arcane.c
src/spells-summon.c
src/spells-summon.h

index a9e8afb..4fc8028 100644 (file)
@@ -1216,25 +1216,8 @@ bool activate_artifact(object_type *o_ptr)
        }
 
        case ACT_SUMMON_ELEMENTAL:
-       {
-               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_ELEMENTAL, mode, '\0'))
-               {
-                       msg_print(_("エレメンタルが現れた...", "An elemental materializes..."));
-                       if (pet)
-                               msg_print(_("あなたに服従しているようだ。", "It seems obedient to you."));
-                       else
-                               msg_print(_("それをコントロールできなかった!", "You fail to control it!"));
-               }
-
+               if (!cast_summon_elemental(p_ptr, (plev * 3) / 2)) return FALSE;
                break;
-       }
 
        case ACT_SUMMON_DEMON:
        {
index 27538eb..b46eaac 100644 (file)
@@ -420,7 +420,6 @@ concptr do_arcane_spell(SPELL_IDX spell, BIT_FLAGS mode)
        case 25:
                if (name) return _("エレメンタル召喚", "Conjure Elemental");
                if (desc) return _("1体のエレメンタルを召喚する。", "Summons an elemental.");
-
                {
                        if (cast)
                        {
index 716e615..d3da340 100644 (file)
@@ -132,6 +132,27 @@ bool cast_summon_hound(player_type *creature_ptr, int power)
        return TRUE;
 }
 
+bool cast_summon_elemental(player_type *creature_ptr, int power)
+{
+       bool pet = one_in_(3);
+       BIT_FLAGS mode = 0L;
+
+       if (!(pet && (creature_ptr->lev < 50))) mode |= PM_ALLOW_GROUP;
+       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_ELEMENTAL, mode, '\0'))
+       {
+               msg_print(_("エレメンタルが現れた...", "An elemental materializes..."));
+               if (pet)
+                       msg_print(_("あなたに服従しているようだ。", "It seems obedient to you."));
+               else
+                       msg_print(_("それをコントロールできなかった!", "You fail to control it!"));
+       }
+
+       return TRUE;
+}
+
 
 bool cast_summon_octopus(player_type *creature_ptr)
 {
index 7adf302..4c142d0 100644 (file)
@@ -8,6 +8,7 @@ extern bool trump_summoning(int num, bool pet, POSITION y, POSITION x, DEPTH lev
 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_elemental(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);