OSDN Git Service

v3.0.0 Alpha5 OSDN最終版
[hengband/hengband.git] / src / floor-events.c
1 #include "angband.h"
2
3 void day_break()
4 {
5         POSITION y, x;
6         msg_print(_("夜が明けた。", "The sun has risen."));
7
8         if (!p_ptr->wild_mode)
9         {
10                 /* Hack -- Scan the town */
11                 for (y = 0; y < cur_hgt; y++)
12                 {
13                         for (x = 0; x < cur_wid; x++)
14                         {
15                                 /* Get the cave grid */
16                                 cave_type *c_ptr = &cave[y][x];
17
18                                 /* Assume lit */
19                                 c_ptr->info |= (CAVE_GLOW);
20
21                                 /* Hack -- Memorize lit grids if allowed */
22                                 if (view_perma_grids) c_ptr->info |= (CAVE_MARK);
23
24                                 /* Hack -- Notice spot */
25                                 note_spot(y, x);
26                         }
27                 }
28         }
29
30         p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
31         p_ptr->redraw |= (PR_MAP);
32         p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
33
34         if (p_ptr->special_defense & NINJA_S_STEALTH)
35         {
36                 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
37         }
38
39 }
40
41 void night_falls(void)
42 {
43         POSITION y, x;
44         msg_print(_("日が沈んだ。", "The sun has fallen."));
45
46         if (!p_ptr->wild_mode)
47         {
48                 /* Hack -- Scan the town */
49                 for (y = 0; y < cur_hgt; y++)
50                 {
51                         for (x = 0; x < cur_wid; x++)
52                         {
53                                 /* Get the cave grid */
54                                 cave_type *c_ptr = &cave[y][x];
55
56                                 /* Feature code (applying "mimic" field) */
57                                 feature_type *f_ptr = &f_info[get_feat_mimic(c_ptr)];
58
59                                 if (!is_mirror_grid(c_ptr) && !have_flag(f_ptr->flags, FF_QUEST_ENTER) &&
60                                         !have_flag(f_ptr->flags, FF_ENTRANCE))
61                                 {
62                                         /* Assume dark */
63                                         c_ptr->info &= ~(CAVE_GLOW);
64
65                                         if (!have_flag(f_ptr->flags, FF_REMEMBER))
66                                         {
67                                                 /* Forget the normal floor grid */
68                                                 c_ptr->info &= ~(CAVE_MARK);
69
70                                                 /* Hack -- Notice spot */
71                                                 note_spot(y, x);
72                                         }
73                                 }
74                         }
75
76                         /* Glow deep lava and building entrances */
77                         glow_deep_lava_and_bldg();
78                 }
79         }
80
81         p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
82         p_ptr->redraw |= (PR_MAP);
83         p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
84
85         if (p_ptr->special_defense & NINJA_S_STEALTH)
86         {
87                 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
88         }
89
90 }
91
92 /*!
93  * @brief 現在フロアに残っている敵モンスターの数を返す /
94  * @return 現在の敵モンスターの数
95  */
96 MONSTER_NUMBER count_all_hostile_monsters(void)
97 {
98         POSITION x, y;
99         MONSTER_NUMBER number_mon = 0;
100
101         for (x = 0; x < cur_wid; ++x)
102         {
103                 for (y = 0; y < cur_hgt; ++y)
104                 {
105                         MONSTER_IDX m_idx = cave[y][x].m_idx;
106
107                         if (m_idx > 0 && is_hostile(&m_list[m_idx]))
108                         {
109                                 ++number_mon;
110                         }
111                 }
112         }
113
114         return number_mon;
115 }