From ef5fc5bd6d0b59af4087c2b1f741e8f24860604d Mon Sep 17 00:00:00 2001 From: Deskull Date: Wed, 12 Dec 2018 20:56:26 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#37353=E3=80=80monster1=EF=BD=9Emon?= =?utf8?q?ster-hook=E9=96=93=E6=95=B4=E7=90=86=E3=80=82=20/=20Refactor=20b?= =?utf8?q?etween=20monster1=20and=20monster-hook.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/birth.c | 10 ++-------- src/dungeon.c | 1 + src/externs.h | 2 -- src/hissatsu.c | 1 + src/melee1.c | 1 + src/monster-hook.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/monster-hook.h | 2 ++ src/monster-process.c | 1 + src/monster1.c | 45 --------------------------------------------- src/realm-hissatsu.c | 1 + src/spells1.c | 1 + src/spells2.c | 1 + src/xtra2.c | 1 + 13 files changed, 57 insertions(+), 55 deletions(-) diff --git a/src/birth.c b/src/birth.c index fbac11ea3..3b8137287 100644 --- a/src/birth.c +++ b/src/birth.c @@ -1891,17 +1891,11 @@ void determine_random_questor(quest_type *q_ptr) r_ptr = &r_info[r_idx]; if (!(r_ptr->flags1 & RF1_UNIQUE)) continue; - if (r_ptr->flags1 & RF1_QUESTOR) continue; - if (r_ptr->rarity > 100) continue; - if (r_ptr->flags7 & RF7_FRIENDLY) continue; - if (r_ptr->flags7 & RF7_AQUATIC) continue; - if (r_ptr->flags8 & RF8_WILD_ONLY) continue; - if (no_questor_or_bounty_uniques(r_idx)) continue; /* @@ -1911,7 +1905,7 @@ void determine_random_questor(quest_type *q_ptr) if (r_ptr->level > (q_ptr->level + (q_ptr->level / 20))) break; } - q_ptr->r_idx = (s16b)r_idx; + q_ptr->r_idx = r_idx; } /*! @@ -2579,7 +2573,7 @@ static bool get_player_race(void) } - sprintf(cur, "%c%c%s", '*', p2, _("ランダム", "Random"); + sprintf(cur, "%c%c%s", '*', p2, _("ランダム", "Random")); /* Choose */ k = -1; diff --git a/src/dungeon.c b/src/dungeon.c index eaf61357d..de15c59d1 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -24,6 +24,7 @@ #include "floor-events.h" #include "object-curse.h" #include "store.h" +#include "monster-hook.h" static bool load = TRUE; /*!<ロード処理中の分岐フラグ*/ static int wild_regen = 20; /*!<広域マップ移動時の自然回復処理カウンタ(広域マップ1マス毎に20回処理を基本とする)*/ diff --git a/src/externs.h b/src/externs.h index f6f7afd40..e7e2586de 100644 --- a/src/externs.h +++ b/src/externs.h @@ -737,8 +737,6 @@ extern bool monster_can_cross_terrain(FEAT_IDX feat, monster_race *r_ptr, u16b m extern bool monster_can_enter(POSITION y, POSITION x, monster_race *r_ptr, u16b mode); extern bool are_enemies(monster_type *m_ptr1, monster_type *m_ptr2); extern bool monster_has_hostile_align(monster_type *m_ptr, int pa_good, int pa_evil, monster_race *r_ptr); -extern bool monster_living(monster_race *r_ptr); -extern bool no_questor_or_bounty_uniques(MONRACE_IDX r_idx); extern void dice_to_string(int base_damage, int dice_num, int dice_side, int dice_mult, int dice_div, char* msg); diff --git a/src/hissatsu.c b/src/hissatsu.c index e5caa585c..5851735fd 100644 --- a/src/hissatsu.c +++ b/src/hissatsu.c @@ -11,6 +11,7 @@ */ #include "angband.h" +#include "monster-hook.h" #define TECHNIC_HISSATSU (REALM_HISSATSU - MIN_TECHNIC) diff --git a/src/melee1.c b/src/melee1.c index b612a677c..578fc4d1a 100644 --- a/src/melee1.c +++ b/src/melee1.c @@ -14,6 +14,7 @@ #include "angband.h" #include "cmd-pet.h" #include "player-damage.h" +#include "monster-hook.h" diff --git a/src/monster-hook.c b/src/monster-hook.c index e51a4de80..baebe620a 100644 --- a/src/monster-hook.c +++ b/src/monster-hook.c @@ -618,3 +618,48 @@ bool vault_aux_dark_elf(MONRACE_IDX r_idx) for (i = 0; dark_elf_list[i]; i++) if (r_idx == dark_elf_list[i]) return TRUE; return FALSE; } + + + +/*! + * @brief モンスターが生命体かどうかを返す + * Is the monster "alive"? + * @param r_ptr 判定するモンスターの種族情報構造体参照ポインタ + * @return 生命体ならばTRUEを返す + * @details + * Used to determine the message to print for a killed monster. + * ("dies", "destroyed") + */ +bool monster_living(monster_race *r_ptr) +{ + /* Non-living, undead, or demon */ + if (r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)) + return FALSE; + else + return TRUE; +} + +/*! + * @brief モンスターが特殊能力上、賞金首から排除する必要があるかどうかを返す。 + * Is the monster "alive"? / Is this monster declined to be questor or bounty? + * @param r_idx モンスターの種族ID + * @return 賞金首に加えられないならばTRUEを返す + * @details + * 実質バーノール=ルパート用。 + */ +bool no_questor_or_bounty_uniques(MONRACE_IDX r_idx) +{ + switch (r_idx) + { + /* + * Decline them to be questor or bounty because they use + * special motion "split and combine" + */ + case MON_BANORLUPART: + case MON_BANOR: + case MON_LUPART: + return TRUE; + default: + return FALSE; + } +} diff --git a/src/monster-hook.h b/src/monster-hook.h index 87285a9ce..bc87a6deb 100644 --- a/src/monster-hook.h +++ b/src/monster-hook.h @@ -58,3 +58,5 @@ extern bool vault_aux_demon(MONRACE_IDX r_idx); extern bool vault_aux_cthulhu(MONRACE_IDX r_idx); extern bool vault_aux_dark_elf(MONRACE_IDX r_idx); +extern bool monster_living(monster_race *r_ptr); +extern bool no_questor_or_bounty_uniques(MONRACE_IDX r_idx); diff --git a/src/monster-process.c b/src/monster-process.c index 4d04039e3..ab1f74c05 100644 --- a/src/monster-process.c +++ b/src/monster-process.c @@ -15,6 +15,7 @@ #include "angband.h" #include "cmd-pet.h" +#include "monster-hook.h" /*! diff --git a/src/monster1.c b/src/monster1.c index 2d0ac5e09..913332af1 100644 --- a/src/monster1.c +++ b/src/monster1.c @@ -2449,48 +2449,3 @@ bool monster_has_hostile_align(monster_type *m_ptr, int pa_good, int pa_evil, mo /* Non-hostile alignment */ return FALSE; } - - -/*! - * @brief モンスターが生命体かどうかを返す - * Is the monster "alive"? - * @param r_ptr 判定するモンスターの種族情報構造体参照ポインタ - * @return 生命体ならばTRUEを返す - * @details - * Used to determine the message to print for a killed monster. - * ("dies", "destroyed") - */ -bool monster_living(monster_race *r_ptr) -{ - /* Non-living, undead, or demon */ - if (r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)) - return FALSE; - else - return TRUE; -} - - -/*! - * @brief モンスターが特殊能力上、賞金首から排除する必要があるかどうかを返す。 - * Is the monster "alive"? / Is this monster declined to be questor or bounty? - * @param r_idx モンスターの種族ID - * @return 賞金首に加えられないならばTRUEを返す - * @details - * 実質バーノール=ルパート用。 - */ -bool no_questor_or_bounty_uniques(MONRACE_IDX r_idx) -{ - switch (r_idx) - { - /* - * Decline them to be questor or bounty because they use - * special motion "split and combine" - */ - case MON_BANORLUPART: - case MON_BANOR: - case MON_LUPART: - return TRUE; - default: - return FALSE; - } -} diff --git a/src/realm-hissatsu.c b/src/realm-hissatsu.c index f36d482f2..01ca7e195 100644 --- a/src/realm-hissatsu.c +++ b/src/realm-hissatsu.c @@ -1,5 +1,6 @@ #include "angband.h" #include "cmd-spell.h" +#include "monster-hook.h" /*! * @brief 剣術の各処理を行う diff --git a/src/spells1.c b/src/spells1.c index f01e32e33..a09fcdf3e 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -16,6 +16,7 @@ #include "trap.h" #include "object-curse.h" #include "player-damage.h" +#include "monster-hook.h" static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */ diff --git a/src/spells2.c b/src/spells2.c index ff294f58f..354d56ba8 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -14,6 +14,7 @@ #include "angband.h" #include "grid.h" #include "trap.h" +#include "monster-hook.h" /*! diff --git a/src/xtra2.c b/src/xtra2.c index be978c498..6e74963ba 100644 --- a/src/xtra2.c +++ b/src/xtra2.c @@ -14,6 +14,7 @@ #include "angband.h" #include "cmd-pet.h" #include "object-curse.h" +#include "monster-hook.h" #define REWARD_CHANCE 10 -- 2.11.0