From 5e25da216484e4aa040ea8645898750780c586a8 Mon Sep 17 00:00:00 2001 From: Deskull Date: Wed, 6 Feb 2019 23:43:10 +0900 Subject: [PATCH 1/1] =?utf8?q?[Refactor]=20#37353=20summon=5Fcyber()=20?= =?utf8?q?=E3=82=92=20spells-summon.c=20=E3=81=B8=E7=A7=BB=E5=8B=95?= =?utf8?q?=E3=80=82=20/=20Move=20summon=5Fcyber()=20to=20spells-summon.c.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/externs.h | 1 - src/spells-summon.c | 31 +++++++++++++++++++++++++++++++ src/spells-summon.h | 1 + src/spells2.c | 32 -------------------------------- 4 files changed, 32 insertions(+), 33 deletions(-) diff --git a/src/externs.h b/src/externs.h index 97ed70f75..77094d343 100644 --- a/src/externs.h +++ b/src/externs.h @@ -940,7 +940,6 @@ extern bool animate_dead(MONSTER_IDX who, POSITION y, POSITION x); extern bool sleep_monsters_touch(void); extern bool activate_ty_curse(bool stop_ty, int *count); extern int activate_hi_summon(POSITION y, POSITION x, bool can_pet); -extern int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x); extern void wall_breaker(void); extern bool confuse_monsters(HIT_POINT dam); extern bool charm_monsters(HIT_POINT dam); diff --git a/src/spells-summon.c b/src/spells-summon.c index 57a7e6599..64549e662 100644 --- a/src/spells-summon.c +++ b/src/spells-summon.c @@ -271,3 +271,34 @@ bool summon_kin_player(DEPTH level, POSITION y, POSITION x, BIT_FLAGS mode) } return summon_specific((pet ? -1 : 0), y, x, level, SUMMON_KIN, mode, symbol); } + +/*! + * @brief サイバーデーモンの召喚 + * @param who 召喚主のモンスターID(0ならばプレイヤー) + * @param y 召喚位置Y座標 + * @param x 召喚位置X座標 + * @return 作用が実際にあった場合TRUEを返す + */ +int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x) +{ + int i; + int max_cyber = (easy_band ? 1 : (dun_level / 50) + randint1(2)); + int count = 0; + BIT_FLAGS mode = PM_ALLOW_GROUP; + + /* Summoned by a monster */ + if (who > 0) + { + monster_type *m_ptr = &m_list[who]; + if (is_pet(m_ptr)) mode |= PM_FORCE_PET; + } + + if (max_cyber > 4) max_cyber = 4; + + for (i = 0; i < max_cyber; i++) + { + count += summon_specific(who, y, x, 100, SUMMON_CYBER, mode, '\0'); + } + + return count; +} \ No newline at end of file diff --git a/src/spells-summon.h b/src/spells-summon.h index 5c201d995..099162366 100644 --- a/src/spells-summon.h +++ b/src/spells-summon.h @@ -9,4 +9,5 @@ extern bool cast_summon_demon(int power); 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); +extern int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x); diff --git a/src/spells2.c b/src/spells2.c index 0a45ea543..167b730e9 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -3492,38 +3492,6 @@ int activate_hi_summon(POSITION y, POSITION x, bool can_pet) return count; } - -/*! - * @brief サイバーデーモンの召喚 - * @param who 召喚主のモンスターID(0ならばプレイヤー) - * @param y 召喚位置Y座標 - * @param x 召喚位置X座標 - * @return 作用が実際にあった場合TRUEを返す - */ -int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x) -{ - int i; - int max_cyber = (easy_band ? 1 : (dun_level / 50) + randint1(2)); - int count = 0; - BIT_FLAGS mode = PM_ALLOW_GROUP; - - /* Summoned by a monster */ - if (who > 0) - { - monster_type *m_ptr = &m_list[who]; - if (is_pet(m_ptr)) mode |= PM_FORCE_PET; - } - - if (max_cyber > 4) max_cyber = 4; - - for (i = 0; i < max_cyber; i++) - { - count += summon_specific(who, y, x, 100, SUMMON_CYBER, mode, '\0'); - } - - return count; -} - /*! * @brief 周辺破壊効果(プレイヤー中心) * @return 作用が実際にあった場合TRUEを返す -- 2.11.0