2 * @brief モンスターの思い出を記憶する処理
7 #include "lore/lore-store.h"
8 #include "core/window-redrawer.h"
9 #include "monster-race/race-flags1.h"
10 #include "monster-race/monster-race.h"
11 #include "monster/monster-info.h"
12 #include "system/floor-type-definition.h"
13 #include "system/monster-race-definition.h"
14 #include "system/monster-type-definition.h" //!< @todo 違和感、m_ptr は外から与えることとしたい.
15 #include "system/player-type-definition.h"
18 * @brief モンスターの調査による思い出補完処理 / Learn about a monster (by "probing" it)
19 * @param player_ptr プレイヤーへの参照ポインタ
20 * @param r_idx 補完されるモンスター種族ID
21 * @return 明らかになった情報の度数
23 * Return the number of new flags learnt. -Mogami-
25 int lore_do_probe(PlayerType *player_ptr, MONRACE_IDX r_idx)
28 monster_race *r_ptr = &r_info[r_idx];
29 if (r_ptr->r_wake != MAX_UCHAR)
31 if (r_ptr->r_ignore != MAX_UCHAR)
33 r_ptr->r_wake = r_ptr->r_ignore = MAX_UCHAR;
35 for (int i = 0; i < 4; i++) {
36 if (r_ptr->blow[i].effect != RaceBlowEffectType::NONE || r_ptr->blow[i].method != RaceBlowMethodType::NONE) {
37 if (r_ptr->r_blows[i] != MAX_UCHAR)
39 r_ptr->r_blows[i] = MAX_UCHAR;
43 byte tmp_byte = (((r_ptr->flags1 & RF1_DROP_4D2) ? 8 : 0) + ((r_ptr->flags1 & RF1_DROP_3D2) ? 6 : 0) + ((r_ptr->flags1 & RF1_DROP_2D2) ? 4 : 0)
44 + ((r_ptr->flags1 & RF1_DROP_1D2) ? 2 : 0) + ((r_ptr->flags1 & RF1_DROP_90) ? 1 : 0) + ((r_ptr->flags1 & RF1_DROP_60) ? 1 : 0));
46 if (!(r_ptr->flags1 & RF1_ONLY_GOLD)) {
47 if (r_ptr->r_drop_item != tmp_byte)
49 r_ptr->r_drop_item = tmp_byte;
51 if (!(r_ptr->flags1 & RF1_ONLY_ITEM)) {
52 if (r_ptr->r_drop_gold != tmp_byte)
54 r_ptr->r_drop_gold = tmp_byte;
57 if (r_ptr->r_cast_spell != MAX_UCHAR)
59 r_ptr->r_cast_spell = MAX_UCHAR;
61 for (int i = 0; i < 32; i++) {
62 if (!(r_ptr->r_flags1 & (1UL << i)) && (r_ptr->flags1 & (1UL << i)))
64 if (!(r_ptr->r_flags2 & (1UL << i)) && (r_ptr->flags2 & (1UL << i)))
66 if (!(r_ptr->r_flags3 & (1UL << i)) && (r_ptr->flags3 & (1UL << i)))
68 if (!(r_ptr->r_flagsr & (1UL << i)) && (r_ptr->flagsr & (1UL << i)))
72 auto ability_flags = r_ptr->ability_flags;
73 n += ability_flags.reset(r_ptr->r_ability_flags).count();
75 r_ptr->r_flags1 = r_ptr->flags1;
76 r_ptr->r_flags2 = r_ptr->flags2;
77 r_ptr->r_flags3 = r_ptr->flags3;
78 r_ptr->r_flagsr = r_ptr->flagsr;
79 r_ptr->r_ability_flags = r_ptr->ability_flags;
81 if (!r_ptr->r_can_evolve)
83 r_ptr->r_can_evolve = true;
85 if (player_ptr->monster_race_idx == r_idx) {
86 player_ptr->window_flags |= (PW_MONSTER);
93 * @brief モンスターの撃破に伴うドロップ情報の記憶処理 / Take note that the given monster just dropped some treasure
94 * @param player_ptr プレイヤーへの参照ポインタ
95 * @param m_idx モンスター情報のID
96 * @param num_item 手に入れたアイテム数
97 * @param num_gold 手に入れた財宝の単位数
99 void lore_treasure(PlayerType *player_ptr, MONSTER_IDX m_idx, ITEM_NUMBER num_item, ITEM_NUMBER num_gold)
101 monster_type *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
102 monster_race *r_ptr = &r_info[m_ptr->r_idx];
104 if (!is_original_ap(m_ptr))
107 if (num_item > r_ptr->r_drop_item)
108 r_ptr->r_drop_item = num_item;
109 if (num_gold > r_ptr->r_drop_gold)
110 r_ptr->r_drop_gold = num_gold;
112 if (r_ptr->flags1 & (RF1_DROP_GOOD))
113 r_ptr->r_flags1 |= (RF1_DROP_GOOD);
114 if (r_ptr->flags1 & (RF1_DROP_GREAT))
115 r_ptr->r_flags1 |= (RF1_DROP_GREAT);
116 if (player_ptr->monster_race_idx == m_ptr->r_idx)
117 player_ptr->window_flags |= (PW_MONSTER);