OSDN Git Service

Changed to match the For2.2.2-Refactoring-Cocoa2 branch. Put se_maoudamashii_voice_m...
[hengbandforosx/hengbandosx.git] / src / spells-floor.c
1 #include "angband.h"
2 #include "spells-floor.h"
3
4 /*
5  * Light up the dungeon using "clairvoyance"
6  *
7  * This function "illuminates" every grid in the dungeon, memorizes all
8  * "objects", memorizes all grids as with magic mapping, and, under the
9  * standard option settings (view_perma_grids but not view_torch_grids)
10  * memorizes all floor grids too.
11  *
12  * Note that if "view_perma_grids" is not set, we do not memorize floor
13  * grids, since this would defeat the purpose of "view_perma_grids", not
14  * that anyone seems to play without this option.
15  *
16  * Note that if "view_torch_grids" is set, we do not memorize floor grids,
17  * since this would prevent the use of "view_torch_grids" as a method to
18  * keep track of what grids have been observed directly.
19  */
20 void wiz_lite(bool ninja)
21 {
22         OBJECT_IDX i;
23         POSITION y, x;
24         FEAT_IDX feat;
25         feature_type *f_ptr;
26
27         /* Memorize objects */
28         for (i = 1; i < o_max; i++)
29         {
30                 object_type *o_ptr = &current_floor_ptr->o_list[i];
31
32                 /* Skip dead objects */
33                 if (!o_ptr->k_idx) continue;
34
35                 /* Skip held objects */
36                 if (o_ptr->held_m_idx) continue;
37
38                 /* Memorize */
39                 o_ptr->marked |= OM_FOUND;
40         }
41
42         /* Scan all normal grids */
43         for (y = 1; y < current_floor_ptr->height - 1; y++)
44         {
45                 /* Scan all normal grids */
46                 for (x = 1; x < current_floor_ptr->width - 1; x++)
47                 {
48                         grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
49
50                         /* Memorize terrain of the grid */
51                         g_ptr->info |= (CAVE_KNOWN);
52
53                         /* Feature code (applying "mimic" field) */
54                         feat = get_feat_mimic(g_ptr);
55                         f_ptr = &f_info[feat];
56
57                         /* Process all non-walls */
58                         if (!have_flag(f_ptr->flags, FF_WALL))
59                         {
60                                 /* Scan all neighbors */
61                                 for (i = 0; i < 9; i++)
62                                 {
63                                         POSITION yy = y + ddy_ddd[i];
64                                         POSITION xx = x + ddx_ddd[i];
65                                         g_ptr = &current_floor_ptr->grid_array[yy][xx];
66
67                                         /* Feature code (applying "mimic" field) */
68                                         f_ptr = &f_info[get_feat_mimic(g_ptr)];
69
70                                         /* Perma-lite the grid */
71                                         if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) && !ninja)
72                                         {
73                                                 g_ptr->info |= (CAVE_GLOW);
74                                         }
75
76                                         /* Memorize normal features */
77                                         if (have_flag(f_ptr->flags, FF_REMEMBER))
78                                         {
79                                                 /* Memorize the grid */
80                                                 g_ptr->info |= (CAVE_MARK);
81                                         }
82
83                                         /* Perma-lit grids (newly and previously) */
84                                         else if (g_ptr->info & CAVE_GLOW)
85                                         {
86                                                 /* Normally, memorize floors (see above) */
87                                                 if (view_perma_grids && !view_torch_grids)
88                                                 {
89                                                         /* Memorize the grid */
90                                                         g_ptr->info |= (CAVE_MARK);
91                                                 }
92                                         }
93                                 }
94                         }
95                 }
96         }
97
98         p_ptr->update |= (PU_MONSTERS);
99         p_ptr->redraw |= (PR_MAP);
100         p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
101
102         if (p_ptr->special_defense & NINJA_S_STEALTH)
103         {
104                 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
105         }
106 }
107
108
109 /*
110  * Forget the dungeon map (ala "Thinking of Maud...").
111  */
112 void wiz_dark(void)
113 {
114         OBJECT_IDX i;
115         POSITION y, x;
116
117         /* Forget every grid */
118         for (y = 1; y < current_floor_ptr->height - 1; y++)
119         {
120                 for (x = 1; x < current_floor_ptr->width - 1; x++)
121                 {
122                         grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
123
124                         /* Process the grid */
125                         g_ptr->info &= ~(CAVE_MARK | CAVE_IN_DETECT | CAVE_KNOWN);
126                         g_ptr->info |= (CAVE_UNSAFE);
127                 }
128         }
129
130         /* Forget every grid on horizontal edge */
131         for (x = 0; x < current_floor_ptr->width; x++)
132         {
133                 current_floor_ptr->grid_array[0][x].info &= ~(CAVE_MARK);
134                 current_floor_ptr->grid_array[current_floor_ptr->height - 1][x].info &= ~(CAVE_MARK);
135         }
136
137         /* Forget every grid on vertical edge */
138         for (y = 1; y < (current_floor_ptr->height - 1); y++)
139         {
140                 current_floor_ptr->grid_array[y][0].info &= ~(CAVE_MARK);
141                 current_floor_ptr->grid_array[y][current_floor_ptr->width - 1].info &= ~(CAVE_MARK);
142         }
143
144         /* Forget all objects */
145         for (i = 1; i < o_max; i++)
146         {
147                 object_type *o_ptr = &current_floor_ptr->o_list[i];
148
149                 /* Skip dead objects */
150                 if (!o_ptr->k_idx) continue;
151
152                 /* Skip held objects */
153                 if (o_ptr->held_m_idx) continue;
154
155                 /* Forget the object */
156                 o_ptr->marked &= OM_TOUCHED;
157         }
158
159         /* Forget travel route when we have forgotten map */
160         forget_travel_flow();
161
162         p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
163         p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
164         p_ptr->update |= (PU_MONSTERS);
165         p_ptr->redraw |= (PR_MAP);
166         p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
167 }
168
169 /*!
170  * @brief 守りのルーン設置処理 /
171  * Leave a "glyph of warding" which prevents monster movement
172  * @return 実際に設置が行われた場合TRUEを返す
173  */
174 bool warding_glyph(void)
175 {
176         if (!cave_clean_bold(p_ptr->y, p_ptr->x))
177         {
178                 msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
179                 return FALSE;
180         }
181
182         /* Create a glyph */
183         current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT;
184         current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].mimic = feat_glyph;
185
186         note_spot(p_ptr->y, p_ptr->x);
187         lite_spot(p_ptr->y, p_ptr->x);
188
189         return TRUE;
190 }
191
192
193 /*!
194  * @brief 爆発のルーン設置処理 /
195  * Leave an "explosive rune" which prevents monster movement
196  * @return 実際に設置が行われた場合TRUEを返す
197  */
198 bool explosive_rune(void)
199 {
200         if (!cave_clean_bold(p_ptr->y, p_ptr->x))
201         {
202                 msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
203                 return FALSE;
204         }
205
206         /* Create a glyph */
207         current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT;
208         current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].mimic = feat_explosive_rune;
209
210         note_spot(p_ptr->y, p_ptr->x);
211         lite_spot(p_ptr->y, p_ptr->x);
212
213         return TRUE;
214 }
215
216
217 /*!
218  * @brief 鏡設置処理
219  * @return 実際に設置が行われた場合TRUEを返す
220  */
221 bool place_mirror(void)
222 {
223         if (!cave_clean_bold(p_ptr->y, p_ptr->x))
224         {
225                 msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
226                 return FALSE;
227         }
228
229         /* Create a mirror */
230         current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT;
231         current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].mimic = feat_mirror;
232
233         /* Turn on the light */
234         current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info |= CAVE_GLOW;
235
236         note_spot(p_ptr->y, p_ptr->x);
237         lite_spot(p_ptr->y, p_ptr->x);
238         update_local_illumination(p_ptr->y, p_ptr->x);
239
240         return TRUE;
241 }