From 124bd8e69189adc63ed5dd704c04db8b93f27142 Mon Sep 17 00:00:00 2001 From: deskull Date: Mon, 25 Feb 2019 13:34:00 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#37353=20=E7=99=BA=E5=8B=95?= =?utf8?q?=E3=81=AE=E3=82=A8=E3=83=AC=E3=83=A1=E3=83=B3=E3=82=BF=E3=83=AB?= =?utf8?q?=E5=8F=AC=E5=96=9A=E3=82=92=20cast=5Fsummon=5Felemental()=20?= =?utf8?q?=E3=81=AB=E5=88=86=E9=9B=A2=E3=80=82=20/=20Separate=20summon=20e?= =?utf8?q?lemental=20by=20activation=20to=20cast=5Fsummon=5Felemental().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/cmd-activate.c | 19 +------------------ src/realm-arcane.c | 1 - src/spells-summon.c | 21 +++++++++++++++++++++ src/spells-summon.h | 1 + 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/cmd-activate.c b/src/cmd-activate.c index a9e8afb59..4fc8028c3 100644 --- a/src/cmd-activate.c +++ b/src/cmd-activate.c @@ -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: { diff --git a/src/realm-arcane.c b/src/realm-arcane.c index 27538eb61..b46eaacb4 100644 --- a/src/realm-arcane.c +++ b/src/realm-arcane.c @@ -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) { diff --git a/src/spells-summon.c b/src/spells-summon.c index 716e615bf..d3da3406d 100644 --- a/src/spells-summon.c +++ b/src/spells-summon.c @@ -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) { diff --git a/src/spells-summon.h b/src/spells-summon.h index 7adf3028d..4c142d0f8 100644 --- a/src/spells-summon.h +++ b/src/spells-summon.h @@ -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); -- 2.11.0