2 #include "spells-floor.h"
5 * Light up the dungeon using "clairvoyance"
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.
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.
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.
20 void wiz_lite(bool ninja)
27 /* Memorize objects */
28 for (i = 1; i < o_max; i++)
30 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
32 /* Skip dead objects */
33 if (!o_ptr->k_idx) continue;
35 /* Skip held objects */
36 if (o_ptr->held_m_idx) continue;
39 o_ptr->marked |= OM_FOUND;
42 /* Scan all normal grids */
43 for (y = 1; y < current_floor_ptr->height - 1; y++)
45 /* Scan all normal grids */
46 for (x = 1; x < current_floor_ptr->width - 1; x++)
48 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
50 /* Memorize terrain of the grid */
51 g_ptr->info |= (CAVE_KNOWN);
53 /* Feature code (applying "mimic" field) */
54 feat = get_feat_mimic(g_ptr);
55 f_ptr = &f_info[feat];
57 /* Process all non-walls */
58 if (!have_flag(f_ptr->flags, FF_WALL))
60 /* Scan all neighbors */
61 for (i = 0; i < 9; i++)
63 POSITION yy = y + ddy_ddd[i];
64 POSITION xx = x + ddx_ddd[i];
65 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
67 /* Feature code (applying "mimic" field) */
68 f_ptr = &f_info[get_feat_mimic(g_ptr)];
70 /* Perma-lite the grid */
71 if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) && !ninja)
73 g_ptr->info |= (CAVE_GLOW);
76 /* Memorize normal features */
77 if (have_flag(f_ptr->flags, FF_REMEMBER))
79 /* Memorize the grid */
80 g_ptr->info |= (CAVE_MARK);
83 /* Perma-lit grids (newly and previously) */
84 else if (g_ptr->info & CAVE_GLOW)
86 /* Normally, memorize floors (see above) */
87 if (view_perma_grids && !view_torch_grids)
89 /* Memorize the grid */
90 g_ptr->info |= (CAVE_MARK);
98 p_ptr->update |= (PU_MONSTERS);
99 p_ptr->redraw |= (PR_MAP);
100 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
102 if (p_ptr->special_defense & NINJA_S_STEALTH)
104 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
110 * Forget the dungeon map (ala "Thinking of Maud...").
117 /* Forget every grid */
118 for (y = 1; y < current_floor_ptr->height - 1; y++)
120 for (x = 1; x < current_floor_ptr->width - 1; x++)
122 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
124 /* Process the grid */
125 g_ptr->info &= ~(CAVE_MARK | CAVE_IN_DETECT | CAVE_KNOWN);
126 g_ptr->info |= (CAVE_UNSAFE);
130 /* Forget every grid on horizontal edge */
131 for (x = 0; x < current_floor_ptr->width; x++)
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);
137 /* Forget every grid on vertical edge */
138 for (y = 1; y < (current_floor_ptr->height - 1); y++)
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);
144 /* Forget all objects */
145 for (i = 1; i < o_max; i++)
147 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
149 /* Skip dead objects */
150 if (!o_ptr->k_idx) continue;
152 /* Skip held objects */
153 if (o_ptr->held_m_idx) continue;
155 /* Forget the object */
156 o_ptr->marked &= OM_TOUCHED;
159 /* Forget travel route when we have forgotten map */
160 forget_travel_flow();
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);
170 * @brief 守りのルーン設置処理 /
171 * Leave a "glyph of warding" which prevents monster movement
172 * @return 実際に設置が行われた場合TRUEを返す
174 bool warding_glyph(void)
176 if (!cave_clean_bold(p_ptr->y, p_ptr->x))
178 msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
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;
186 note_spot(p_ptr->y, p_ptr->x);
187 lite_spot(p_ptr->y, p_ptr->x);
194 * @brief 爆発のルーン設置処理 /
195 * Leave an "explosive rune" which prevents monster movement
196 * @return 実際に設置が行われた場合TRUEを返す
198 bool explosive_rune(void)
200 if (!cave_clean_bold(p_ptr->y, p_ptr->x))
202 msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
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;
210 note_spot(p_ptr->y, p_ptr->x);
211 lite_spot(p_ptr->y, p_ptr->x);
219 * @return 実際に設置が行われた場合TRUEを返す
221 bool place_mirror(void)
223 if (!cave_clean_bold(p_ptr->y, p_ptr->x))
225 msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
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;
233 /* Turn on the light */
234 current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info |= CAVE_GLOW;
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);