OSDN Git Service

Merge remote-tracking branch 'remotes/hengbandosx/english-mind-edits' into feature...
[hengband/hengband.git] / src / object-hook / hook-quest.c
1 #include "object-hook/hook-quest.h"
2 #include "cmd-building/cmd-building.h"
3 #include "dungeon/quest.h"
4 #include "game-option/birth-options.h"
5 #include "monster-race/monster-race.h"
6 #include "monster-race/race-indice-types.h"
7 #include "system/artifact-type-definition.h"
8 #include "object-enchant/trg-types.h"
9 #include "system/floor-type-definition.h"
10 #include "system/object-type-definition.h"
11 #include "world/world.h"
12
13 /*!
14  * @brief オブジェクトが賞金首の報酬対象になるかを返す
15  * @param o_ptr 対象のオブジェクト構造体ポインタ
16  * @return オブジェクトが報酬対象になるならTRUEを返す
17  */
18 bool object_is_bounty(player_type *player_ptr, object_type *o_ptr)
19 {
20     int i;
21
22     if (o_ptr->tval != TV_CORPSE)
23         return FALSE;
24
25     if (vanilla_town)
26         return FALSE;
27
28     if (player_ptr->today_mon > 0 && (streq(r_name + r_info[o_ptr->pval].name, r_name + r_info[today_mon].name)))
29         return TRUE;
30
31     if (o_ptr->pval == MON_TSUCHINOKO)
32         return TRUE;
33
34     for (i = 0; i < MAX_BOUNTY; i++)
35         if (o_ptr->pval == current_world_ptr->bounty_r_idx[i])
36             break;
37     if (i < MAX_BOUNTY)
38         return TRUE;
39
40     return FALSE;
41 }
42
43 /*!
44  * @brief オブジェクトがクエストの達成目的か否かを返す。
45  * @param o_ptr 特性短縮表記を得たいオブジェクト構造体の参照ポインタ
46  * @return 現在クエスト達成目的のアイテムならばTRUEを返す。
47  */
48 bool object_is_quest_target(player_type *player_ptr, object_type *o_ptr)
49 {
50     if (player_ptr->current_floor_ptr->inside_quest == 0)
51         return FALSE;
52
53     ARTIFACT_IDX a_idx = quest[player_ptr->current_floor_ptr->inside_quest].k_idx;
54     if (a_idx == 0)
55         return FALSE;
56
57     artifact_type *a_ptr = &a_info[a_idx];
58     if ((a_ptr->gen_flags & TRG_INSTA_ART) != 0)
59         return FALSE;
60
61     return (o_ptr->tval == a_ptr->tval) && (o_ptr->sval == a_ptr->sval);
62 }