OSDN Git Service

For the Styx ogre, replaced "a" with "an" in the English description since it comes...
[hengband/hengband.git] / src / spells2.c
1 /*!
2  * @file spells2.c
3  * @brief 魔法効果の実装/ Spell code (part 2)
4  * @date 2014/07/15
5  * @author
6  * <pre>
7  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8  * This software may be copied and distributed for educational, research,
9  * and not for profit purposes provided that this copyright and statement
10  * are included in all such copies.  Other copyrights may also apply.
11  * </pre>
12  */
13
14 #include "angband.h"
15 #include "core.h"
16 #include "util.h"
17
18 #include "creature.h"
19
20 #include "artifact.h"
21 #include "io/write-diary.h"
22 #include "cmd/cmd-pet.h"
23 #include "cmd/cmd-dump.h"
24 #include "floor.h"
25 #include "grid.h"
26 #include "trap.h"
27 #include "monsterrace-hook.h"
28 #include "melee.h"
29 #include "world.h"
30 #include "spells.h"
31 #include "spells-summon.h"
32 #include "mutation.h"
33 #include "quest.h"
34 #include "avatar.h"
35
36 #include "spells-status.h"
37 #include "spells-floor.h"
38 #include "spells-diceroll.h"
39 #include "realm-hex.h"
40 #include "autopick.h"
41 #include "object-flavor.h"
42 #include "object-hook.h"
43 #include "monster-status.h"
44 #include "player-move.h"
45 #include "player-status.h"
46 #include "player-effects.h"
47 #include "player-skill.h"
48 #include "player-class.h"
49 #include "player-damage.h"
50 #include "player-inventory.h"
51
52 #include "dungeon.h"
53 #include "floor-events.h"
54 #include "feature.h"
55 #include "view-mainwindow.h"
56 #include "objectkind.h"
57 #include "monsterrace.h"
58 #include "targeting.h"
59 #include "realm-song.h"
60 #include "english.h"
61
62  /*!
63   * @brief プレイヤー周辺の地形を感知する
64   * @param caster_ptr プレーヤーへの参照ポインタ
65   * @param range 効果範囲
66   * @param flag 特定地形ID
67   * @param known 地形から危険フラグを外すならTRUE
68   * @return 効力があった場合TRUEを返す
69   */
70 static bool detect_feat_flag(player_type *caster_ptr, POSITION range, int flag, bool known)
71 {
72         if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
73
74         grid_type *g_ptr;
75         bool detect = FALSE;
76         for (POSITION y = 1; y < caster_ptr->current_floor_ptr->height - 1; y++)
77         {
78                 for (POSITION x = 1; x <= caster_ptr->current_floor_ptr->width - 1; x++)
79                 {
80                         int dist = distance(caster_ptr->y, caster_ptr->x, y, x);
81                         if (dist > range) continue;
82                         g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
83                         if (flag == FF_TRAP)
84                         {
85                                 /* Mark as detected */
86                                 if (dist <= range && known)
87                                 {
88                                         if (dist <= range - 1) g_ptr->info |= (CAVE_IN_DETECT);
89
90                                         g_ptr->info &= ~(CAVE_UNSAFE);
91
92                                         lite_spot(caster_ptr, y, x);
93                                 }
94                         }
95
96                         if (cave_have_flag_grid(g_ptr, flag))
97                         {
98                                 disclose_grid(caster_ptr, y, x);
99                                 g_ptr->info |= (CAVE_MARK);
100                                 lite_spot(caster_ptr, y, x);
101                                 detect = TRUE;
102                         }
103                 }
104         }
105
106         return detect;
107 }
108
109
110 /*!
111  * @brief プレイヤー周辺のトラップを感知する / Detect all traps on current panel
112  * @param caster_ptr プレーヤーへの参照ポインタ
113  * @param range 効果範囲
114  * @param known 感知外範囲を超える警告フラグを立てる場合TRUEを返す
115  * @return 効力があった場合TRUEを返す
116  */
117 bool detect_traps(player_type *caster_ptr, POSITION range, bool known)
118 {
119         bool detect = detect_feat_flag(caster_ptr, range, FF_TRAP, known);
120
121         if (known) caster_ptr->dtrap = TRUE;
122
123         if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 0) detect = FALSE;
124         if (detect)
125         {
126                 msg_print(_("トラップの存在を感じとった!", "You sense the presence of traps!"));
127         }
128
129         return detect;
130 }
131
132
133 /*!
134  * @brief プレイヤー周辺のドアを感知する / Detect all doors on current panel
135  * @param caster_ptr プレーヤーへの参照ポインタ
136  * @param range 効果範囲
137  * @return 効力があった場合TRUEを返す
138  */
139 bool detect_doors(player_type *caster_ptr, POSITION range)
140 {
141         bool detect = detect_feat_flag(caster_ptr, range, FF_DOOR, TRUE);
142
143         if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 0) detect = FALSE;
144         if (detect)
145         {
146                 msg_print(_("ドアの存在を感じとった!", "You sense the presence of doors!"));
147         }
148
149         return detect;
150 }
151
152
153 /*!
154  * @brief プレイヤー周辺の階段を感知する / Detect all stairs on current panel
155  * @param caster_ptr プレーヤーへの参照ポインタ
156  * @param range 効果範囲
157  * @return 効力があった場合TRUEを返す
158  */
159 bool detect_stairs(player_type *caster_ptr, POSITION range)
160 {
161         bool detect = detect_feat_flag(caster_ptr, range, FF_STAIRS, TRUE);
162
163         if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 0) detect = FALSE;
164         if (detect)
165         {
166                 msg_print(_("階段の存在を感じとった!", "You sense the presence of stairs!"));
167         }
168
169         return detect;
170 }
171
172
173 /*!
174  * @brief プレイヤー周辺の地形財宝を感知する / Detect any treasure on the current panel
175  * @param caster_ptr プレーヤーへの参照ポインタ
176  * @param range 効果範囲
177  * @return 効力があった場合TRUEを返す
178  */
179 bool detect_treasure(player_type *caster_ptr, POSITION range)
180 {
181         bool detect = detect_feat_flag(caster_ptr, range, FF_HAS_GOLD, TRUE);
182
183         if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 6) detect = FALSE;
184         if (detect)
185         {
186                 msg_print(_("埋蔵された財宝の存在を感じとった!", "You sense the presence of buried treasure!"));
187         }
188
189         return detect;
190 }
191
192
193 /*!
194  * @brief プレイヤー周辺のアイテム財宝を感知する / Detect all "gold" objects on the current panel
195  * @param caster_ptr プレーヤーへの参照ポインタ
196  * @param range 効果範囲
197  * @return 効力があった場合TRUEを返す
198  */
199 bool detect_objects_gold(player_type *caster_ptr, POSITION range)
200 {
201         POSITION range2 = range;
202         if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
203
204         /* Scan objects */
205         bool detect = FALSE;
206         POSITION y, x;
207         for (OBJECT_IDX i = 1; i < caster_ptr->current_floor_ptr->o_max; i++)
208         {
209                 object_type *o_ptr = &caster_ptr->current_floor_ptr->o_list[i];
210
211                 if (!OBJECT_IS_VALID(o_ptr)) continue;
212                 if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
213
214                 y = o_ptr->iy;
215                 x = o_ptr->ix;
216                 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range2) continue;
217
218                 if (o_ptr->tval == TV_GOLD)
219                 {
220                         o_ptr->marked |= OM_FOUND;
221                         lite_spot(caster_ptr, y, x);
222                         detect = TRUE;
223                 }
224         }
225
226         if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 6) detect = FALSE;
227         if (detect)
228         {
229                 msg_print(_("財宝の存在を感じとった!", "You sense the presence of treasure!"));
230         }
231
232         if (detect_monsters_string(caster_ptr, range, "$"))
233         {
234                 detect = TRUE;
235         }
236
237         return detect;
238 }
239
240
241 /*!
242  * @brief 通常のアイテムオブジェクトを感知する / Detect all "normal" objects on the current panel
243  * @param caster_ptr プレーヤーへの参照ポインタ
244  * @param range 効果範囲
245  * @return 効力があった場合TRUEを返す
246  */
247 bool detect_objects_normal(player_type *caster_ptr, POSITION range)
248 {
249         POSITION range2 = range;
250         if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
251
252         bool detect = FALSE;
253         for (OBJECT_IDX i = 1; i < caster_ptr->current_floor_ptr->o_max; i++)
254         {
255                 object_type *o_ptr = &caster_ptr->current_floor_ptr->o_list[i];
256
257                 if (!OBJECT_IS_VALID(o_ptr)) continue;
258                 if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
259
260                 POSITION y = o_ptr->iy;
261                 POSITION x = o_ptr->ix;
262
263                 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range2) continue;
264
265                 if (o_ptr->tval != TV_GOLD)
266                 {
267                         o_ptr->marked |= OM_FOUND;
268                         lite_spot(caster_ptr, y, x);
269                         detect = TRUE;
270                 }
271         }
272
273         if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 6) detect = FALSE;
274         if (detect)
275         {
276                 msg_print(_("アイテムの存在を感じとった!", "You sense the presence of objects!"));
277         }
278
279         if (detect_monsters_string(caster_ptr, range, "!=?|/`"))
280         {
281                 detect = TRUE;
282         }
283
284         return detect;
285 }
286
287
288 /*!
289  * @brief 魔法効果のあるのアイテムオブジェクトを感知する / Detect all "magic" objects on the current panel.
290  * @param caster_ptr プレーヤーへの参照ポインタ
291  * @param range 効果範囲
292  * @return 効力があった場合TRUEを返す
293  * @details
294  * <pre>
295  * This will light up all spaces with "magic" items, including artifacts,
296  * ego-items, potions, scrolls, books, rods, wands, staffs, amulets, rings,
297  * and "enchanted" items of the "good" variety.
298  *
299  * It can probably be argued that this function is now too powerful.
300  * </pre>
301  */
302 bool detect_objects_magic(player_type *caster_ptr, POSITION range)
303 {
304         if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
305
306         OBJECT_TYPE_VALUE tv;
307         bool detect = FALSE;
308         for (OBJECT_IDX i = 1; i < caster_ptr->current_floor_ptr->o_max; i++)
309         {
310                 object_type *o_ptr = &caster_ptr->current_floor_ptr->o_list[i];
311
312                 if (!OBJECT_IS_VALID(o_ptr)) continue;
313                 if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
314
315                 POSITION y = o_ptr->iy;
316                 POSITION x = o_ptr->ix;
317
318                 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
319
320                 tv = o_ptr->tval;
321                 if (object_is_artifact(o_ptr) ||
322                         object_is_ego(o_ptr) ||
323                         (tv == TV_WHISTLE) ||
324                         (tv == TV_AMULET) ||
325                         (tv == TV_RING) ||
326                         (tv == TV_STAFF) ||
327                         (tv == TV_WAND) ||
328                         (tv == TV_ROD) ||
329                         (tv == TV_SCROLL) ||
330                         (tv == TV_POTION) ||
331                         (tv == TV_LIFE_BOOK) ||
332                         (tv == TV_SORCERY_BOOK) ||
333                         (tv == TV_NATURE_BOOK) ||
334                         (tv == TV_CHAOS_BOOK) ||
335                         (tv == TV_DEATH_BOOK) ||
336                         (tv == TV_TRUMP_BOOK) ||
337                         (tv == TV_ARCANE_BOOK) ||
338                         (tv == TV_CRAFT_BOOK) ||
339                         (tv == TV_DAEMON_BOOK) ||
340                         (tv == TV_CRUSADE_BOOK) ||
341                         (tv == TV_MUSIC_BOOK) ||
342                         (tv == TV_HISSATSU_BOOK) ||
343                         (tv == TV_HEX_BOOK) ||
344                         ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
345                 {
346                         o_ptr->marked |= OM_FOUND;
347                         lite_spot(caster_ptr, y, x);
348                         detect = TRUE;
349                 }
350         }
351
352         if (detect)
353         {
354                 msg_print(_("魔法のアイテムの存在を感じとった!", "You sense the presence of magic objects!"));
355         }
356
357         return detect;
358 }
359
360
361 /*!
362  * @brief 一般のモンスターを感知する / Detect all "normal" monsters on the current panel
363  * @param caster_ptr プレーヤーへの参照ポインタ
364  * @param range 効果範囲
365  * @return 効力があった場合TRUEを返す
366  */
367 bool detect_monsters_normal(player_type *caster_ptr, POSITION range)
368 {
369         if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
370
371         bool flag = FALSE;
372         for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
373         {
374                 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
375                 monster_race *r_ptr = &r_info[m_ptr->r_idx];
376                 if (!monster_is_valid(m_ptr)) continue;
377
378                 POSITION y = m_ptr->fy;
379                 POSITION x = m_ptr->fx;
380                 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
381
382                 if (!(r_ptr->flags2 & RF2_INVISIBLE) || caster_ptr->see_inv)
383                 {
384                         repair_monsters = TRUE;
385                         m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
386                         update_monster(caster_ptr, i, FALSE);
387                         flag = TRUE;
388                 }
389         }
390
391         if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 3) flag = FALSE;
392         if (flag)
393         {
394                 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
395         }
396
397         return flag;
398 }
399
400
401 /*!
402  * @brief 不可視のモンスターを感知する / Detect all "invisible" monsters around the player
403  * @param caster_ptr プレーヤーへの参照ポインタ
404  * @param range 効果範囲
405  * @return 効力があった場合TRUEを返す
406  */
407 bool detect_monsters_invis(player_type *caster_ptr, POSITION range)
408 {
409         if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
410
411         bool flag = FALSE;
412         for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
413         {
414                 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
415                 monster_race *r_ptr = &r_info[m_ptr->r_idx];
416
417                 if (!monster_is_valid(m_ptr)) continue;
418
419                 POSITION y = m_ptr->fy;
420                 POSITION x = m_ptr->fx;
421
422                 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
423
424                 if (r_ptr->flags2 & RF2_INVISIBLE)
425                 {
426                         if (caster_ptr->monster_race_idx == m_ptr->r_idx)
427                         {
428                                 caster_ptr->window |= (PW_MONSTER);
429                         }
430
431                         repair_monsters = TRUE;
432                         m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
433                         update_monster(caster_ptr, i, FALSE);
434                         flag = TRUE;
435                 }
436         }
437
438         if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 3) flag = FALSE;
439         if (flag)
440         {
441                 msg_print(_("透明な生物の存在を感じとった!", "You sense the presence of invisible creatures!"));
442         }
443
444         return flag;
445 }
446
447
448 /*!
449  * @brief 邪悪なモンスターを感知する / Detect all "evil" monsters on current panel
450  * @param caster_ptr プレーヤーへの参照ポインタ
451  * @param range 効果範囲
452  * @return 効力があった場合TRUEを返す
453  */
454 bool detect_monsters_evil(player_type *caster_ptr, POSITION range)
455 {
456         if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
457
458         bool flag = FALSE;
459         for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
460         {
461                 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
462                 monster_race *r_ptr = &r_info[m_ptr->r_idx];
463                 if (!monster_is_valid(m_ptr)) continue;
464
465                 POSITION y = m_ptr->fy;
466                 POSITION x = m_ptr->fx;
467
468                 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
469
470                 if (r_ptr->flags3 & RF3_EVIL)
471                 {
472                         if (is_original_ap(m_ptr))
473                         {
474                                 r_ptr->r_flags3 |= (RF3_EVIL);
475                                 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
476                                 {
477                                         caster_ptr->window |= (PW_MONSTER);
478                                 }
479                         }
480
481                         repair_monsters = TRUE;
482                         m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
483                         update_monster(caster_ptr, i, FALSE);
484                         flag = TRUE;
485                 }
486         }
487
488         if (flag)
489         {
490                 msg_print(_("邪悪なる生物の存在を感じとった!", "You sense the presence of evil creatures!"));
491         }
492
493         return flag;
494 }
495
496
497 /*!
498  * @brief 無生命のモンスターを感知する(アンデッド、悪魔系を含む) / Detect all "nonliving", "undead" or "demonic" monsters on current panel
499  * @param caster_ptr プレーヤーへの参照ポインタ
500  * @param range 効果範囲
501  * @return 効力があった場合TRUEを返す
502  */
503 bool detect_monsters_nonliving(player_type *caster_ptr, POSITION range)
504 {
505         if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
506
507         bool flag = FALSE;
508         for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
509         {
510                 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
511                 if (!monster_is_valid(m_ptr)) continue;
512
513                 POSITION y = m_ptr->fy;
514                 POSITION x = m_ptr->fx;
515                 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
516
517                 if (!monster_living(m_ptr->r_idx))
518                 {
519                         if (caster_ptr->monster_race_idx == m_ptr->r_idx)
520                         {
521                                 caster_ptr->window |= (PW_MONSTER);
522                         }
523
524                         repair_monsters = TRUE;
525                         m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
526                         update_monster(caster_ptr, i, FALSE);
527                         flag = TRUE;
528                 }
529         }
530
531         if (flag)
532         {
533                 msg_print(_("自然でないモンスターの存在を感じた!", "You sense the presence of unnatural beings!"));
534         }
535
536         return flag;
537 }
538
539
540 /*!
541  * @brief 精神のあるモンスターを感知する / Detect all monsters it has mind on current panel
542  * @param caster_ptr プレーヤーへの参照ポインタ
543  * @param range 効果範囲
544  * @return 効力があった場合TRUEを返す
545  */
546 bool detect_monsters_mind(player_type *caster_ptr, POSITION range)
547 {
548         if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
549
550         bool flag = FALSE;
551         for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
552         {
553                 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
554                 monster_race *r_ptr = &r_info[m_ptr->r_idx];
555                 if (!monster_is_valid(m_ptr)) continue;
556
557                 POSITION y = m_ptr->fy;
558                 POSITION x = m_ptr->fx;
559
560                 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
561
562                 if (!(r_ptr->flags2 & RF2_EMPTY_MIND))
563                 {
564                         if (caster_ptr->monster_race_idx == m_ptr->r_idx)
565                         {
566                                 caster_ptr->window |= (PW_MONSTER);
567                         }
568
569                         repair_monsters = TRUE;
570                         m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
571                         update_monster(caster_ptr, i, FALSE);
572                         flag = TRUE;
573                 }
574         }
575
576         if (flag)
577         {
578                 msg_print(_("殺気を感じとった!", "You sense the presence of someone's mind!"));
579         }
580
581         return flag;
582 }
583
584
585 /*!
586  * @brief 該当シンボルのモンスターを感知する / Detect all (string) monsters on current panel
587  * @param caster_ptr プレーヤーへの参照ポインタ
588  * @param range 効果範囲
589  * @param Match 対応シンボルの混じったモンスター文字列(複数指定化)
590  * @return 効力があった場合TRUEを返す
591  */
592 bool detect_monsters_string(player_type *caster_ptr, POSITION range, concptr Match)
593 {
594         if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
595
596         bool flag = FALSE;
597         for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
598         {
599                 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
600                 monster_race *r_ptr = &r_info[m_ptr->r_idx];
601                 if (!monster_is_valid(m_ptr)) continue;
602
603                 POSITION y = m_ptr->fy;
604                 POSITION x = m_ptr->fx;
605
606                 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
607
608                 if (my_strchr(Match, r_ptr->d_char))
609                 {
610                         if (caster_ptr->monster_race_idx == m_ptr->r_idx)
611                         {
612                                 caster_ptr->window |= (PW_MONSTER);
613                         }
614
615                         repair_monsters = TRUE;
616                         m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
617                         update_monster(caster_ptr, i, FALSE);
618                         flag = TRUE;
619                 }
620         }
621
622         if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 3) flag = FALSE;
623         if (flag)
624         {
625                 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
626         }
627
628         return flag;
629 }
630
631
632 /*!
633  * @brief flags3に対応するモンスターを感知する / A "generic" detect monsters routine, tagged to flags3
634  * @param caster_ptr プレーヤーへの参照ポインタ
635  * @param range 効果範囲
636  * @param match_flag 感知フラグ
637  * @return 効力があった場合TRUEを返す
638  */
639 bool detect_monsters_xxx(player_type *caster_ptr, POSITION range, u32b match_flag)
640 {
641         if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
642
643         bool flag = FALSE;
644         for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
645         {
646                 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
647                 monster_race *r_ptr = &r_info[m_ptr->r_idx];
648                 if (!monster_is_valid(m_ptr)) continue;
649
650                 POSITION y = m_ptr->fy;
651                 POSITION x = m_ptr->fx;
652
653                 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
654
655                 if (r_ptr->flags3 & (match_flag))
656                 {
657                         if (is_original_ap(m_ptr))
658                         {
659                                 r_ptr->r_flags3 |= (match_flag);
660                                 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
661                                 {
662                                         caster_ptr->window |= (PW_MONSTER);
663                                 }
664                         }
665
666                         repair_monsters = TRUE;
667                         m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
668                         update_monster(caster_ptr, i, FALSE);
669                         flag = TRUE;
670                 }
671         }
672
673         concptr desc_monsters = _("変なモンスター", "weird monsters");
674         if (flag)
675         {
676                 switch (match_flag)
677                 {
678                 case RF3_DEMON:
679                         desc_monsters = _("デーモン", "demons");
680                         break;
681                 case RF3_UNDEAD:
682                         desc_monsters = _("アンデッド", "the undead");
683                         break;
684                 }
685
686                 msg_format(_("%sの存在を感じとった!", "You sense the presence of %s!"), desc_monsters);
687                 msg_print(NULL);
688         }
689
690         return flag;
691 }
692
693
694 /*!
695  * @brief 全感知処理 / Detect everything
696  * @param caster_ptr プレーヤーへの参照ポインタ
697  * @param range 効果範囲
698  * @return 効力があった場合TRUEを返す
699  */
700 bool detect_all(player_type *caster_ptr, POSITION range)
701 {
702         bool detect = FALSE;
703         if (detect_traps(caster_ptr, range, TRUE)) detect = TRUE;
704         if (detect_doors(caster_ptr, range)) detect = TRUE;
705         if (detect_stairs(caster_ptr, range)) detect = TRUE;
706         if (detect_objects_gold(caster_ptr, range)) detect = TRUE;
707         if (detect_objects_normal(caster_ptr, range)) detect = TRUE;
708         if (detect_monsters_invis(caster_ptr, range)) detect = TRUE;
709         if (detect_monsters_normal(caster_ptr, range)) detect = TRUE;
710         return (detect);
711 }
712
713
714 /*!
715  * @brief 視界内モンスターに魔法効果を与える / Apply a "project()" directly to all viewable monsters
716  * @param typ 属性効果
717  * @param dam 効果量
718  * @return 効力があった場合TRUEを返す
719  * @details
720  * <pre>
721  * Note that affected monsters are NOT auto-tracked by this usage.
722  *
723  * To avoid misbehavior when monster deaths have side-effects,
724  * this is done in two passes. -- JDL
725  * </pre>
726  */
727 bool project_all_los(player_type *caster_ptr, EFFECT_ID typ, HIT_POINT dam)
728 {
729         for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
730         {
731                 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
732                 if (!monster_is_valid(m_ptr)) continue;
733
734                 POSITION y = m_ptr->fy;
735                 POSITION x = m_ptr->fx;
736                 if (!player_has_los_bold(caster_ptr, y, x) || !projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)) continue;
737
738                 m_ptr->mflag |= (MFLAG_LOS);
739         }
740
741         BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
742         bool obvious = FALSE;
743         for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
744         {
745                 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
746                 if (!(m_ptr->mflag & (MFLAG_LOS))) continue;
747
748                 m_ptr->mflag &= ~(MFLAG_LOS);
749                 POSITION y = m_ptr->fy;
750                 POSITION x = m_ptr->fx;
751
752                 if (project(caster_ptr, 0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
753         }
754
755         return obvious;
756 }
757
758
759 /*!
760  * @brief 視界内モンスターを加速する処理 / Speed monsters
761  * @param caster_ptr プレーヤーへの参照ポインタ
762  * @return 効力があった場合TRUEを返す
763  */
764 bool speed_monsters(player_type *caster_ptr)
765 {
766         return (project_all_los(caster_ptr, GF_OLD_SPEED, caster_ptr->lev));
767 }
768
769
770 /*!
771  * @brief 視界内モンスターを加速する処理 / Slow monsters
772  * @param caster_ptr プレーヤーへの参照ポインタ
773  * @return 効力があった場合TRUEを返す
774  */
775 bool slow_monsters(player_type *caster_ptr, int power)
776 {
777         return (project_all_los(caster_ptr, GF_OLD_SLOW, power));
778 }
779
780
781 /*!
782  * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
783  * @param caster_ptr プレーヤーへの参照ポインタ
784  * @return 効力があった場合TRUEを返す
785  */
786 bool sleep_monsters(player_type *caster_ptr, int power)
787 {
788         return (project_all_los(caster_ptr, GF_OLD_SLEEP, power));
789 }
790
791
792 /*!
793  * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
794  * @param caster_ptr プレーヤーへの参照ポインタ
795  * @return 効力があった場合TRUEを返す
796  */
797 bool banish_evil(player_type *caster_ptr, int dist)
798 {
799         return (project_all_los(caster_ptr, GF_AWAY_EVIL, dist));
800 }
801
802
803 /*!
804  * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
805  * @return 効力があった場合TRUEを返す
806  */
807 bool turn_undead(player_type *caster_ptr)
808 {
809         bool tester = (project_all_los(caster_ptr, GF_TURN_UNDEAD, caster_ptr->lev));
810         if (tester)
811                 chg_virtue(caster_ptr, V_UNLIFE, -1);
812         return tester;
813 }
814
815
816 /*!
817  * @brief 視界内のアンデッド・モンスターにダメージを与える処理 / Dispel undead monsters
818  * @param caster_ptr プレーヤーへの参照ポインタ
819  * @return 効力があった場合TRUEを返す
820  */
821 bool dispel_undead(player_type *caster_ptr, HIT_POINT dam)
822 {
823         bool tester = (project_all_los(caster_ptr, GF_DISP_UNDEAD, dam));
824         if (tester)
825                 chg_virtue(caster_ptr, V_UNLIFE, -2);
826         return tester;
827 }
828
829
830 /*!
831  * @brief 視界内の邪悪なモンスターにダメージを与える処理 / Dispel evil monsters
832  * @param caster_ptr プレーヤーへの参照ポインタ
833  * @return 効力があった場合TRUEを返す
834  */
835 bool dispel_evil(player_type *caster_ptr, HIT_POINT dam)
836 {
837         return (project_all_los(caster_ptr, GF_DISP_EVIL, dam));
838 }
839
840
841 /*!
842  * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
843  * @param caster_ptr プレーヤーへの参照ポインタ
844  * @return 効力があった場合TRUEを返す
845  */
846 bool dispel_good(player_type *caster_ptr, HIT_POINT dam)
847 {
848         return (project_all_los(caster_ptr, GF_DISP_GOOD, dam));
849 }
850
851
852 /*!
853  * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
854  * @param caster_ptr プレーヤーへの参照ポインタ
855  * @return 効力があった場合TRUEを返す
856  */
857 bool dispel_monsters(player_type *caster_ptr, HIT_POINT dam)
858 {
859         return (project_all_los(caster_ptr, GF_DISP_ALL, dam));
860 }
861
862
863 /*!
864  * todo ここにこれがあるのは少し違和感、spells-staffonlyとかに分離したい
865  * @brief 聖浄の杖の効果
866  * @param creature_ptr プレーヤーへの参照ポインタ
867  * @magic 魔法の効果である場合TRUE (杖と同じ効果の呪文はあったか? 要調査)
868  * @powerful 効果が増強される時TRUE (TRUEになるタイミングはあるか? 要調査)
869  */
870 bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful)
871 {
872         bool ident = FALSE;
873         if (dispel_evil(creature_ptr, powerful ? 225 : 150)) ident = TRUE;
874         int k = 3 * creature_ptr->lev;
875         if (set_protevil(creature_ptr, (magic ? 0 : creature_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
876         if (set_poisoned(creature_ptr, 0)) ident = TRUE;
877         if (set_afraid(creature_ptr, 0)) ident = TRUE;
878         if (hp_player(creature_ptr, 50)) ident = TRUE;
879         if (set_stun(creature_ptr, 0)) ident = TRUE;
880         if (set_cut(creature_ptr, 0)) ident = TRUE;
881         return ident;
882 }
883
884
885 /*!
886  * todo ここにこれがあるのは少し違和感、spells-staffonlyとかに分離したい
887  * @brief 魔力の嵐の杖の効果
888  * @param creature_ptr プレーヤーへの参照ポインタ
889  * @powerful 効果が増強される時TRUE (TRUEになるタイミングはあるか? 要調査)
890  */
891 bool unleash_mana_storm(player_type *creature_ptr, bool powerful)
892 {
893         msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!"));
894         project(creature_ptr, 0, (powerful ? 7 : 5), creature_ptr->y, creature_ptr->x,
895                 (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
896
897         bool is_special_class = creature_ptr->pclass != CLASS_MAGE;
898         is_special_class &= creature_ptr->pclass != CLASS_HIGH_MAGE;
899         is_special_class &= creature_ptr->pclass != CLASS_SORCERER;
900         is_special_class &= creature_ptr->pclass != CLASS_MAGIC_EATER;
901         is_special_class &= creature_ptr->pclass != CLASS_BLUE_MAGE;
902         if (is_special_class)
903         {
904                 (void)take_hit(creature_ptr, DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
905         }
906
907         return TRUE;
908 }
909
910
911 /*!
912  * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
913  * @param caster_ptr プレーヤーへの参照ポインタ
914  * @return 効力があった場合TRUEを返す
915  */
916 bool dispel_living(player_type *caster_ptr, HIT_POINT dam)
917 {
918         return (project_all_los(caster_ptr, GF_DISP_LIVING, dam));
919 }
920
921
922 /*!
923  * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
924  * @param caster_ptr プレーヤーへの参照ポインタ
925  * @return 効力があった場合TRUEを返す
926  */
927 bool dispel_demons(player_type *caster_ptr, HIT_POINT dam)
928 {
929         return (project_all_los(caster_ptr, GF_DISP_DEMON, dam));
930 }
931
932
933 /*!
934  * @brief 視界内のモンスターに「聖戦」効果を与える処理
935  * @param caster_ptr プレーヤーへの参照ポインタ
936  * @return 効力があった場合TRUEを返す
937  */
938 bool crusade(player_type *caster_ptr)
939 {
940         return (project_all_los(caster_ptr, GF_CRUSADE, caster_ptr->lev * 4));
941 }
942
943
944 /*!
945  * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
946  * @param caster_ptr プレーヤーへの参照ポインタ
947  * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
948  * @return なし
949  */
950 void aggravate_monsters(player_type *caster_ptr, MONSTER_IDX who)
951 {
952         bool sleep = FALSE;
953         bool speed = FALSE;
954         for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
955         {
956                 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
957                 if (!monster_is_valid(m_ptr)) continue;
958                 if (i == who) continue;
959
960                 if (m_ptr->cdis < MAX_SIGHT * 2)
961                 {
962                         if (MON_CSLEEP(m_ptr))
963                         {
964                                 (void)set_monster_csleep(caster_ptr, i, 0);
965                                 sleep = TRUE;
966                         }
967
968                         if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
969                 }
970
971                 if (player_has_los_bold(caster_ptr, m_ptr->fy, m_ptr->fx))
972                 {
973                         if (!is_pet(m_ptr))
974                         {
975                                 (void)set_monster_fast(caster_ptr, i, MON_FAST(m_ptr) + 100);
976                                 speed = TRUE;
977                         }
978                 }
979         }
980
981         if (speed) msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
982         else if (sleep) msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
983         if (caster_ptr->riding) caster_ptr->update |= PU_BONUS;
984 }
985
986
987 /*!
988  * @brief モンスターへの単体抹殺処理サブルーチン / Delete a non-unique/non-quest monster
989  * @param m_idx 抹殺するモンスターID
990  * @param power 抹殺の威力
991  * @param player_cast プレイヤーの魔法によるものならば TRUE
992  * @param dam_side プレイヤーへの負担ダメージ量(1d(dam_side))
993  * @param spell_name 抹殺効果を起こした魔法の名前
994  * @return 効力があった場合TRUEを返す
995  */
996 bool genocide_aux(player_type *caster_ptr, MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, concptr spell_name)
997 {
998         monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx];
999         monster_race *r_ptr = &r_info[m_ptr->r_idx];
1000         if (is_pet(m_ptr) && !player_cast) return FALSE;
1001
1002         bool resist = FALSE;
1003         if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
1004         else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
1005         else if (m_idx == caster_ptr->riding) resist = TRUE;
1006         else if ((caster_ptr->current_floor_ptr->inside_quest && !random_quest_number(caster_ptr, caster_ptr->current_floor_ptr->dun_level)) || caster_ptr->current_floor_ptr->inside_arena || caster_ptr->phase_out) resist = TRUE;
1007         else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
1008         else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
1009         else
1010         {
1011                 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1012                 {
1013                         GAME_TEXT m_name[MAX_NLEN];
1014                         monster_desc(caster_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
1015                         exe_write_diary(caster_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
1016                 }
1017
1018                 delete_monster_idx(caster_ptr, m_idx);
1019         }
1020
1021         if (resist && player_cast)
1022         {
1023                 bool see_m = is_seen(m_ptr);
1024                 GAME_TEXT m_name[MAX_NLEN];
1025                 monster_desc(caster_ptr, m_name, m_ptr, 0);
1026                 if (see_m)
1027                 {
1028                         msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1029                 }
1030
1031                 if (MON_CSLEEP(m_ptr))
1032                 {
1033                         (void)set_monster_csleep(caster_ptr, m_idx, 0);
1034                         if (m_ptr->ml)
1035                         {
1036                                 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1037                         }
1038                 }
1039
1040                 if (is_friendly(m_ptr) && !is_pet(m_ptr))
1041                 {
1042                         if (see_m)
1043                         {
1044                                 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
1045                         }
1046
1047                         set_hostile(caster_ptr, m_ptr);
1048                 }
1049
1050                 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
1051         }
1052
1053         if (player_cast)
1054         {
1055                 take_hit(caster_ptr, DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
1056         }
1057
1058         move_cursor_relative(caster_ptr->y, caster_ptr->x);
1059         caster_ptr->redraw |= (PR_HP);
1060         caster_ptr->window |= (PW_PLAYER);
1061         handle_stuff(caster_ptr);
1062         Term_fresh();
1063
1064         int msec = delay_factor * delay_factor * delay_factor;
1065         Term_xtra(TERM_XTRA_DELAY, msec);
1066
1067         return !resist;
1068 }
1069
1070
1071 /*!
1072  * @brief モンスターへのシンボル抹殺処理ルーチン / Delete all non-unique/non-quest monsters of a given "type" from the level
1073  * @param power 抹殺の威力
1074  * @param player_cast プレイヤーの魔法によるものならば TRUE
1075  * @return 効力があった場合TRUEを返す
1076  */
1077 bool symbol_genocide(player_type *caster_ptr, int power, bool player_cast)
1078 {
1079         floor_type *floor_ptr = caster_ptr->current_floor_ptr;
1080         bool is_special_floor = floor_ptr->inside_quest && !random_quest_number(caster_ptr, floor_ptr->dun_level);
1081         is_special_floor |= caster_ptr->current_floor_ptr->inside_arena;
1082         is_special_floor |= caster_ptr->phase_out;
1083         if (is_special_floor)
1084         {
1085                 msg_print(_("何も起きないようだ……", "It seems nothing happen here..."));
1086                 return FALSE;
1087         }
1088
1089         char typ;
1090         while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE));
1091         bool result = FALSE;
1092         for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1093         {
1094                 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1095                 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1096                 if (!monster_is_valid(m_ptr)) continue;
1097                 if (r_ptr->d_char != typ) continue;
1098
1099                 result |= genocide_aux(caster_ptr, i, power, player_cast, 4, _("抹殺", "Genocide"));
1100         }
1101
1102         if (result)
1103         {
1104                 chg_virtue(caster_ptr, V_VITALITY, -2);
1105                 chg_virtue(caster_ptr, V_CHANCE, -1);
1106         }
1107
1108         return result;
1109 }
1110
1111
1112 /*!
1113  * @brief モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) monsters
1114  * @param power 抹殺の威力
1115  * @param player_cast プレイヤーの魔法によるものならば TRUE
1116  * @return 効力があった場合TRUEを返す
1117  */
1118 bool mass_genocide(player_type *caster_ptr, int power, bool player_cast)
1119 {
1120         floor_type *floor_ptr = caster_ptr->current_floor_ptr;
1121         bool is_special_floor = floor_ptr->inside_quest && !random_quest_number(caster_ptr, floor_ptr->dun_level);
1122         is_special_floor |= caster_ptr->current_floor_ptr->inside_arena;
1123         is_special_floor |= caster_ptr->phase_out;
1124         if (is_special_floor)
1125         {
1126                 return FALSE;
1127         }
1128
1129         bool result = FALSE;
1130         for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1131         {
1132                 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1133                 if (!monster_is_valid(m_ptr)) continue;
1134                 if (m_ptr->cdis > MAX_SIGHT) continue;
1135
1136                 result |= genocide_aux(caster_ptr, i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
1137         }
1138
1139         if (result)
1140         {
1141                 chg_virtue(caster_ptr, V_VITALITY, -2);
1142                 chg_virtue(caster_ptr, V_CHANCE, -1);
1143         }
1144
1145         return result;
1146 }
1147
1148
1149 /*!
1150  * @brief アンデッド・モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) undead
1151  * @param power 抹殺の威力
1152  * @param player_cast プレイヤーの魔法によるものならば TRUE
1153  * @return 効力があった場合TRUEを返す
1154  */
1155 bool mass_genocide_undead(player_type *caster_ptr, int power, bool player_cast)
1156 {
1157         floor_type *floor_ptr = caster_ptr->current_floor_ptr;
1158         bool is_special_floor = floor_ptr->inside_quest && !random_quest_number(caster_ptr, floor_ptr->dun_level);
1159         is_special_floor |= caster_ptr->current_floor_ptr->inside_arena;
1160         is_special_floor |= caster_ptr->phase_out;
1161         if (is_special_floor)
1162         {
1163                 return FALSE;
1164         }
1165
1166         bool result = FALSE;
1167         for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1168         {
1169                 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1170                 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1171                 if (!monster_is_valid(m_ptr)) continue;
1172                 if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
1173                 if (m_ptr->cdis > MAX_SIGHT) continue;
1174
1175                 result |= genocide_aux(caster_ptr, i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
1176         }
1177
1178         if (result)
1179         {
1180                 chg_virtue(caster_ptr, V_UNLIFE, -2);
1181                 chg_virtue(caster_ptr, V_CHANCE, -1);
1182         }
1183
1184         return result;
1185 }
1186
1187
1188 /*!
1189  * @brief 周辺モンスターを調査する / Probe nearby monsters
1190  * @return 効力があった場合TRUEを返す
1191  */
1192 bool probing(player_type *caster_ptr)
1193 {
1194         bool_hack cu = Term->scr->cu;
1195         bool_hack cv = Term->scr->cv;
1196         Term->scr->cu = 0;
1197         Term->scr->cv = 1;
1198
1199         bool probe = FALSE;
1200         int speed;
1201         char buf[256];
1202         concptr align;
1203         for (int i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1204         {
1205                 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1206                 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1207                 if (!monster_is_valid(m_ptr)) continue;
1208                 if (!player_has_los_bold(caster_ptr, m_ptr->fy, m_ptr->fx)) continue;
1209                 if (!m_ptr->ml) continue;
1210
1211                 GAME_TEXT m_name[MAX_NLEN];
1212                 if (!probe) msg_print(_("調査中...", "Probing..."));
1213                 msg_print(NULL);
1214
1215                 if (!is_original_ap(m_ptr))
1216                 {
1217                         if (m_ptr->mflag2 & MFLAG2_KAGE)
1218                                 m_ptr->mflag2 &= ~(MFLAG2_KAGE);
1219
1220                         m_ptr->ap_r_idx = m_ptr->r_idx;
1221                         lite_spot(caster_ptr, m_ptr->fy, m_ptr->fx);
1222                 }
1223
1224                 monster_desc(caster_ptr, m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
1225                 speed = m_ptr->mspeed - 110;
1226                 if (MON_FAST(m_ptr)) speed += 10;
1227                 if (MON_SLOW(m_ptr)) speed -= 10;
1228                 if (ironman_nightmare) speed += 5;
1229
1230                 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
1231                 else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
1232                 else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
1233                 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) align = _("中立(善悪)", "neutral(good&evil)");
1234                 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
1235                 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
1236                 else align = _("中立", "neutral");
1237
1238                 sprintf(buf, _("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
1239                         m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
1240
1241                 if (r_ptr->next_r_idx)
1242                 {
1243                         strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
1244                 }
1245                 else
1246                 {
1247                         strcat(buf, "xxx ");
1248                 }
1249
1250                 if (MON_CSLEEP(m_ptr)) strcat(buf, _("睡眠 ", "sleeping "));
1251                 if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
1252                 if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
1253                 if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
1254                 if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
1255                 buf[strlen(buf) - 1] = '\0';
1256                 prt(buf, 0, 0);
1257
1258                 message_add(buf);
1259                 caster_ptr->window |= (PW_MESSAGE);
1260                 handle_stuff(caster_ptr);
1261                 move_cursor_relative(m_ptr->fy, m_ptr->fx);
1262                 inkey();
1263                 Term_erase(0, 0, 255);
1264                 if (lore_do_probe(caster_ptr, m_ptr->r_idx))
1265                 {
1266                         strcpy(buf, (r_name + r_ptr->name));
1267 #ifdef JP
1268                         msg_format("%sについてさらに詳しくなった気がする。", buf);
1269 #else
1270                         plural_aux(buf);
1271                         msg_format("You now know more about %s.", buf);
1272 #endif
1273                         msg_print(NULL);
1274                 }
1275
1276                 probe = TRUE;
1277         }
1278
1279         Term->scr->cu = cu;
1280         Term->scr->cv = cv;
1281         Term_fresh();
1282
1283         if (probe)
1284         {
1285                 chg_virtue(caster_ptr, V_KNOWLEDGE, 1);
1286                 msg_print(_("これで全部です。", "That's all."));
1287         }
1288
1289         return (probe);
1290 }
1291
1292
1293 /*!
1294  * @brief ペット爆破処理 /
1295  * @return なし
1296  */
1297 void discharge_minion(player_type *caster_ptr)
1298 {
1299         bool okay = TRUE;
1300         for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1301         {
1302                 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1303                 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
1304                 if (m_ptr->nickname) okay = FALSE;
1305         }
1306
1307         if (!okay || caster_ptr->riding)
1308         {
1309                 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
1310                         return;
1311         }
1312
1313         for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1314         {
1315                 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1316                 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
1317
1318                 monster_race *r_ptr;
1319                 r_ptr = &r_info[m_ptr->r_idx];
1320                 if (r_ptr->flags1 & RF1_UNIQUE)
1321                 {
1322                         GAME_TEXT m_name[MAX_NLEN];
1323                         monster_desc(caster_ptr, m_name, m_ptr, 0x00);
1324                         msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists being blasted and runs away."), m_name);
1325                         delete_monster_idx(caster_ptr, i);
1326                         continue;
1327                 }
1328
1329                 HIT_POINT dam = m_ptr->maxhp / 2;
1330                 if (dam > 100) dam = (dam - 100) / 2 + 100;
1331                 if (dam > 400) dam = (dam - 400) / 2 + 400;
1332                 if (dam > 800) dam = 800;
1333                 project(caster_ptr, i, 2 + (r_ptr->level / 20), m_ptr->fy, m_ptr->fx, dam, GF_PLASMA,
1334                         PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
1335
1336                 if (record_named_pet && m_ptr->nickname)
1337                 {
1338                         GAME_TEXT m_name[MAX_NLEN];
1339
1340                         monster_desc(caster_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
1341                         exe_write_diary(caster_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
1342                 }
1343
1344                 delete_monster_idx(caster_ptr, i);
1345         }
1346 }
1347
1348
1349 /*!
1350  * todo この辺、xとyが引数になっているが、caster_ptr->xとcaster_ptr->yで全て置き換えが効くはず……
1351  * @brief 部屋全体を照らすサブルーチン
1352  * @param caster_ptr プレーヤーへの参照ポインタ
1353  * @return なし
1354  * @details
1355  * <pre>
1356  * This routine clears the entire "temp" set.
1357  * This routine will Perma-Lite all "temp" grids.
1358  * This routine is used (only) by "lite_room()"
1359  * Dark grids are illuminated.
1360  * Also, process all affected monsters.
1361  *
1362  * SMART monsters always wake up when illuminated
1363  * NORMAL monsters wake up 1/4 the time when illuminated
1364  * STUPID monsters wake up 1/10 the time when illuminated
1365  * </pre>
1366  */
1367 static void cave_temp_room_lite(player_type *caster_ptr)
1368 {
1369         for (int i = 0; i < tmp_pos.n; i++)
1370         {
1371                 POSITION y = tmp_pos.y[i];
1372                 POSITION x = tmp_pos.x[i];
1373                 grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
1374                 g_ptr->info &= ~(CAVE_TEMP);
1375                 g_ptr->info |= (CAVE_GLOW);
1376                 if (g_ptr->m_idx)
1377                 {
1378                         PERCENTAGE chance = 25;
1379                         monster_type    *m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
1380                         monster_race    *r_ptr = &r_info[m_ptr->r_idx];
1381                         update_monster(caster_ptr, g_ptr->m_idx, FALSE);
1382                         if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
1383                         if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
1384
1385                         if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
1386                         {
1387                                 (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
1388                                 if (m_ptr->ml)
1389                                 {
1390                                         GAME_TEXT m_name[MAX_NLEN];
1391                                         monster_desc(caster_ptr, m_name, m_ptr, 0);
1392                                         msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1393                                 }
1394                         }
1395                 }
1396
1397                 note_spot(caster_ptr, y, x);
1398                 lite_spot(caster_ptr, y, x);
1399                 update_local_illumination(caster_ptr, y, x);
1400         }
1401
1402         tmp_pos.n = 0;
1403 }
1404
1405
1406 /*!
1407  * todo この辺、xとyが引数になっているが、caster_ptr->xとcaster_ptr->yで全て置き換えが効くはず……
1408  * @brief 部屋全体を暗くするサブルーチン
1409  * @param caster_ptr プレーヤーへの参照ポインタ
1410  * @return なし
1411  * @details
1412  * <pre>
1413  * This routine clears the entire "temp" set.
1414  * This routine will "darken" all "temp" grids.
1415  * In addition, some of these grids will be "unmarked".
1416  * This routine is used (only) by "unlite_room()"
1417  * Also, process all affected monsters
1418  * </pre>
1419  */
1420 static void cave_temp_room_unlite(player_type *caster_ptr)
1421 {
1422         for (int i = 0; i < tmp_pos.n; i++)
1423         {
1424                 POSITION y = tmp_pos.y[i];
1425                 POSITION x = tmp_pos.x[i];
1426                 grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
1427                 bool do_dark = !is_mirror_grid(g_ptr);
1428                 g_ptr->info &= ~(CAVE_TEMP);
1429                 if (!do_dark) continue;
1430
1431                 if (caster_ptr->current_floor_ptr->dun_level || !is_daytime())
1432                 {
1433                         for (int j = 0; j < 9; j++)
1434                         {
1435                                 POSITION by = y + ddy_ddd[j];
1436                                 POSITION bx = x + ddx_ddd[j];
1437
1438                                 if (in_bounds2(caster_ptr->current_floor_ptr, by, bx))
1439                                 {
1440                                         grid_type *cc_ptr = &caster_ptr->current_floor_ptr->grid_array[by][bx];
1441
1442                                         if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1443                                         {
1444                                                 do_dark = FALSE;
1445                                                 break;
1446                                         }
1447                                 }
1448                         }
1449
1450                         if (!do_dark) continue;
1451                 }
1452
1453                 g_ptr->info &= ~(CAVE_GLOW);
1454                 if (!have_flag(f_info[get_feat_mimic(g_ptr)].flags, FF_REMEMBER))
1455                 {
1456                         if (!view_torch_grids) g_ptr->info &= ~(CAVE_MARK);
1457                         note_spot(caster_ptr, y, x);
1458                 }
1459
1460                 if (g_ptr->m_idx)
1461                 {
1462                         update_monster(caster_ptr, g_ptr->m_idx, FALSE);
1463                 }
1464
1465                 lite_spot(caster_ptr, y, x);
1466                 update_local_illumination(caster_ptr, y, x);
1467         }
1468
1469         tmp_pos.n = 0;
1470 }
1471
1472
1473 /*!
1474  * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
1475  * @param floor_ptr 配置するフロアの参照ポインタ
1476  * @param cy Y座標
1477  * @param cx X座標
1478  * @param pass_bold 地形条件を返す関数ポインタ
1479  * @return 該当地形の数
1480  */
1481 static int next_to_open(floor_type *floor_ptr, POSITION cy, POSITION cx, bool(*pass_bold)(floor_type*, POSITION, POSITION))
1482 {
1483         int len = 0;
1484         int blen = 0;
1485         for (int i = 0; i < 16; i++)
1486         {
1487                 POSITION y = cy + ddy_cdd[i % 8];
1488                 POSITION x = cx + ddx_cdd[i % 8];
1489                 if (!pass_bold(floor_ptr, y, x))
1490                 {
1491                         if (len > blen)
1492                         {
1493                                 blen = len;
1494                         }
1495
1496                         len = 0;
1497                 }
1498                 else
1499                 {
1500                         len++;
1501                 }
1502         }
1503
1504         return MAX(len, blen);
1505 }
1506
1507
1508 /*!
1509  * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
1510  * @param floor_ptr 配置するフロアの参照ポインタ
1511  * @param cy Y座標
1512  * @param cx X座標
1513  * @param pass_bold 地形条件を返す関数ポインタ
1514  * @return 該当地形の数
1515  */
1516 static int next_to_walls_adj(floor_type *floor_ptr, POSITION cy, POSITION cx, bool(*pass_bold)(floor_type*, POSITION, POSITION))
1517 {
1518         POSITION y, x;
1519         int c = 0;
1520         for (DIRECTION i = 0; i < 8; i++)
1521         {
1522                 y = cy + ddy_ddd[i];
1523                 x = cx + ddx_ddd[i];
1524
1525                 if (!pass_bold(floor_ptr, y, x)) c++;
1526         }
1527
1528         return c;
1529 }
1530
1531
1532 /*!
1533  * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数tmp_pos.nに返す / Aux function -- see below
1534  * @param caster_ptr プレーヤーへの参照ポインタ
1535  * @param y 部屋内のy座標1点
1536  * @param x 部屋内のx座標1点
1537  * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
1538  * @param pass_bold 地形条件を返す関数ポインタ
1539  * @return 該当地形の数
1540  */
1541 static void cave_temp_room_aux(player_type *caster_ptr, POSITION y, POSITION x, bool only_room, bool(*pass_bold)(floor_type*, POSITION, POSITION))
1542 {
1543         grid_type *g_ptr;
1544         floor_type *floor_ptr = caster_ptr->current_floor_ptr;
1545         g_ptr = &floor_ptr->grid_array[y][x];
1546         if (g_ptr->info & (CAVE_TEMP)) return;
1547
1548         if (!(g_ptr->info & (CAVE_ROOM)))
1549         {
1550                 if (only_room) return;
1551                 if (!in_bounds2(floor_ptr, y, x)) return;
1552                 if (distance(caster_ptr->y, caster_ptr->x, y, x) > MAX_RANGE) return;
1553
1554                 /* Verify this grid */
1555                 /*
1556                  * The reason why it is ==6 instead of >5 is that 8 is impossible
1557                  * due to the check for cave_bold above.
1558                  * 7 lights dead-end corridors (you need to do this for the
1559                  * checkboard interesting rooms, so that the boundary is lit
1560                  * properly.
1561                  * This leaves only a check for 6 bounding walls!
1562                  */
1563                 if (in_bounds(floor_ptr, y, x) && pass_bold(floor_ptr, y, x) &&
1564                         (next_to_walls_adj(floor_ptr, y, x, pass_bold) == 6) && (next_to_open(floor_ptr, y, x, pass_bold) <= 1)) return;
1565         }
1566
1567         if (tmp_pos.n == TEMP_MAX) return;
1568
1569         g_ptr->info |= (CAVE_TEMP);
1570         tmp_pos.y[tmp_pos.n] = y;
1571         tmp_pos.x[tmp_pos.n] = x;
1572         tmp_pos.n++;
1573 }
1574
1575
1576 /*!
1577  * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
1578 * @param caster_ptr プレーヤーへの参照ポインタ
1579   * @param y 指定Y座標
1580  * @param x 指定X座標
1581  * @return なし
1582  */
1583 static void cave_temp_lite_room_aux(player_type *caster_ptr, POSITION y, POSITION x)
1584 {
1585         cave_temp_room_aux(caster_ptr, y, x, FALSE, cave_los_bold);
1586 }
1587
1588
1589 /*!
1590  * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
1591  * @param floor_ptr 配置するフロアの参照ポインタ
1592  * @param y 指定Y座標
1593  * @param x 指定X座標
1594  * @return 射線を通すならばtrueを返す。
1595  */
1596 static bool cave_pass_dark_bold(floor_type *floor_ptr, POSITION y, POSITION x)
1597 {
1598         return cave_have_flag_bold(floor_ptr, y, x, FF_PROJECT);
1599 }
1600
1601
1602 /*!
1603  * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
1604  * @param caster_ptr プレーヤーへの参照ポインタ
1605  * @param y 指定Y座標
1606  * @param x 指定X座標
1607  * @return なし
1608  */
1609 static void cave_temp_unlite_room_aux(player_type *caster_ptr, POSITION y, POSITION x)
1610 {
1611         cave_temp_room_aux(caster_ptr, y, x, TRUE, cave_pass_dark_bold);
1612 }
1613
1614
1615 /*!
1616  * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
1617  * @param caster_ptr プレーヤーへの参照ポインタ
1618  * @param y1 指定Y座標
1619  * @param x1 指定X座標
1620  * @return なし
1621  */
1622 void lite_room(player_type *caster_ptr, POSITION y1, POSITION x1)
1623 {
1624         cave_temp_lite_room_aux(caster_ptr, y1, x1);
1625         floor_type *floor_ptr = caster_ptr->current_floor_ptr;
1626         for (int i = 0; i < tmp_pos.n; i++)
1627         {
1628                 POSITION x = tmp_pos.x[i];
1629                 POSITION y = tmp_pos.y[i];
1630
1631                 if (!cave_los_bold(floor_ptr, y, x)) continue;
1632
1633                 cave_temp_lite_room_aux(caster_ptr, y + 1, x);
1634                 cave_temp_lite_room_aux(caster_ptr, y - 1, x);
1635                 cave_temp_lite_room_aux(caster_ptr, y, x + 1);
1636                 cave_temp_lite_room_aux(caster_ptr, y, x - 1);
1637
1638                 cave_temp_lite_room_aux(caster_ptr, y + 1, x + 1);
1639                 cave_temp_lite_room_aux(caster_ptr, y - 1, x - 1);
1640                 cave_temp_lite_room_aux(caster_ptr, y - 1, x + 1);
1641                 cave_temp_lite_room_aux(caster_ptr, y + 1, x - 1);
1642         }
1643
1644         cave_temp_room_lite(caster_ptr);
1645         if (caster_ptr->special_defense & NINJA_S_STEALTH)
1646         {
1647                 if (floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].info & CAVE_GLOW)
1648                         set_superstealth(caster_ptr, FALSE);
1649         }
1650 }
1651
1652
1653 /*!
1654  * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
1655  * @param caster_ptr プレーヤーへの参照ポインタ
1656  * @param y1 指定Y座標
1657  * @param x1 指定X座標
1658  * @return なし
1659  */
1660 void unlite_room(player_type *caster_ptr, POSITION y1, POSITION x1)
1661 {
1662         cave_temp_unlite_room_aux(caster_ptr, y1, x1);
1663         for (int i = 0; i < tmp_pos.n; i++)
1664         {
1665                 POSITION x = tmp_pos.x[i];
1666                 POSITION y = tmp_pos.y[i];
1667                 if (!cave_pass_dark_bold(caster_ptr->current_floor_ptr, y, x)) continue;
1668
1669                 cave_temp_unlite_room_aux(caster_ptr, y + 1, x);
1670                 cave_temp_unlite_room_aux(caster_ptr, y - 1, x);
1671                 cave_temp_unlite_room_aux(caster_ptr, y, x + 1);
1672                 cave_temp_unlite_room_aux(caster_ptr, y, x - 1);
1673
1674                 cave_temp_unlite_room_aux(caster_ptr, y + 1, x + 1);
1675                 cave_temp_unlite_room_aux(caster_ptr, y - 1, x - 1);
1676                 cave_temp_unlite_room_aux(caster_ptr, y - 1, x + 1);
1677                 cave_temp_unlite_room_aux(caster_ptr, y + 1, x - 1);
1678         }
1679
1680         cave_temp_room_unlite(caster_ptr);
1681 }
1682
1683
1684 /*!
1685  * @brief スターライトの効果を発生させる
1686  * @param caster_ptr プレーヤーへの参照ポインタ
1687  * @param magic 魔法による効果であればTRUE、スターライトの杖による効果であればFALSE
1688  * @return 常にTRUE
1689  */
1690 bool starlight(player_type *caster_ptr, bool magic)
1691 {
1692         if (!caster_ptr->blind && !magic)
1693         {
1694                 msg_print(_("杖の先が明るく輝いた...", "The end of the staff glows brightly..."));
1695         }
1696
1697         HIT_POINT num = damroll(5, 3);
1698         int attempts;
1699         POSITION y = 0, x = 0;
1700         for (int k = 0; k < num; k++)
1701         {
1702                 attempts = 1000;
1703
1704                 while (attempts--)
1705                 {
1706                         scatter(caster_ptr, &y, &x, caster_ptr->y, caster_ptr->x, 4, PROJECT_LOS);
1707                         if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT)) continue;
1708                         if (!player_bold(caster_ptr, y, x)) break;
1709                 }
1710
1711                 project(caster_ptr, 0, 0, y, x, damroll(6 + caster_ptr->lev / 8, 10), GF_LITE_WEAK,
1712                         (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL | PROJECT_LOS), -1);
1713         }
1714
1715         return TRUE;
1716 }
1717
1718
1719 /*!
1720  * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
1721  * @param caster_ptr プレーヤーへの参照ポインタ
1722  * @param dam 威力
1723  * @param rad 効果半径
1724  * @return 作用が実際にあった場合TRUEを返す
1725  */
1726 bool lite_area(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
1727 {
1728         if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS)
1729         {
1730                 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorbs your light."));
1731                 return FALSE;
1732         }
1733
1734         if (!caster_ptr->blind)
1735         {
1736                 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
1737         }
1738
1739         BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
1740         (void)project(caster_ptr, 0, rad, caster_ptr->y, caster_ptr->x, dam, GF_LITE_WEAK, flg, -1);
1741
1742         lite_room(caster_ptr, caster_ptr->y, caster_ptr->x);
1743
1744         return TRUE;
1745 }
1746
1747
1748 /*!
1749  * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
1750  * @param caster_ptr プレーヤーへの参照ポインタ
1751  * @param dam 威力
1752  * @param rad 効果半径
1753  * @return 作用が実際にあった場合TRUEを返す
1754  */
1755 bool unlite_area(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
1756 {
1757         if (!caster_ptr->blind)
1758         {
1759                 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
1760         }
1761
1762         BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
1763         (void)project(caster_ptr, 0, rad, caster_ptr->y, caster_ptr->x, dam, GF_DARK_WEAK, flg, -1);
1764
1765         unlite_room(caster_ptr, caster_ptr->y, caster_ptr->x);
1766
1767         return TRUE;
1768 }
1769
1770
1771 /*!
1772  * @brief ボール系スペルの発動 / Cast a ball spell
1773  * @param caster_ptr プレーヤーへの参照ポインタ
1774  * @param typ 効果属性
1775  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1776  * @param dam 威力
1777  * @param rad 半径
1778  * @return 作用が実際にあった場合TRUEを返す
1779  * @details
1780  * <pre>
1781  * Stop if we hit a monster, act as a "ball"
1782  * Allow "target" mode to pass over monsters
1783  * Affect grids, objects, and monsters
1784  * </pre>
1785  */
1786 bool fire_ball(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
1787 {
1788         BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1789         if (typ == GF_CHARM_LIVING) flg |= PROJECT_HIDE;
1790
1791         POSITION tx = caster_ptr->x + 99 * ddx[dir];
1792         POSITION ty = caster_ptr->y + 99 * ddy[dir];
1793
1794         if ((dir == 5) && target_okay(caster_ptr))
1795         {
1796                 flg &= ~(PROJECT_STOP);
1797                 tx = target_col;
1798                 ty = target_row;
1799         }
1800
1801         return project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1);
1802 }
1803
1804
1805 /*!
1806 * @brief ブレス系スペルの発動 / Cast a breath spell
1807 * @param caster_ptr プレーヤーへの参照ポインタ
1808 * @param typ 効果属性
1809 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1810 * @param dam 威力
1811 * @param rad 半径
1812 * @return 作用が実際にあった場合TRUEを返す
1813 * @details
1814 * <pre>
1815 * Stop if we hit a monster, act as a "ball"
1816 * Allow "target" mode to pass over monsters
1817 * Affect grids, objects, and monsters
1818 * </pre>
1819 */
1820 bool fire_breath(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
1821 {
1822         return fire_ball(caster_ptr, typ, dir, dam, -rad);
1823 }
1824
1825
1826 /*!
1827  * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
1828  * @param caster_ptr プレーヤーへの参照ポインタ
1829  * @param typ 効果属性
1830  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1831  * @param dam 威力
1832  * @param rad 半径
1833  * @return 作用が実際にあった場合TRUEを返す
1834  * @details
1835  * <pre>
1836  * Stop if we hit a monster, act as a "ball"
1837  * Allow "target" mode to pass over monsters
1838  * Affect grids, objects, and monsters
1839  * </pre>
1840  */
1841 bool fire_rocket(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
1842 {
1843         POSITION tx = caster_ptr->x + 99 * ddx[dir];
1844         POSITION ty = caster_ptr->y + 99 * ddy[dir];
1845         if ((dir == 5) && target_okay(caster_ptr))
1846         {
1847                 tx = target_col;
1848                 ty = target_row;
1849         }
1850
1851         BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1852         return (project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1));
1853 }
1854
1855
1856 /*!
1857  * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
1858  * @param caster_ptr プレーヤーへの参照ポインタ
1859  * @param typ 効果属性
1860  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1861  * @param dam 威力
1862  * @param rad 半径
1863  * @return 作用が実際にあった場合TRUEを返す
1864  * @details
1865  * <pre>
1866  * Stop if we hit a monster, act as a "ball"
1867  * Allow "target" mode to pass over monsters
1868  * Affect grids, objects, and monsters
1869  * </pre>
1870  */
1871 bool fire_ball_hide(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
1872 {
1873         POSITION tx = caster_ptr->x + 99 * ddx[dir];
1874         POSITION ty = caster_ptr->y + 99 * ddy[dir];
1875         BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
1876         if ((dir == 5) && target_okay(caster_ptr))
1877         {
1878                 flg &= ~(PROJECT_STOP);
1879                 tx = target_col;
1880                 ty = target_row;
1881         }
1882
1883         return (project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1));
1884 }
1885
1886
1887 /*!
1888  * @brief メテオ系スペルの発動 / Cast a meteor spell
1889  * @param caster_ptr プレーヤーへの参照ポインタ
1890  * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
1891  * @param typ 効果属性
1892  * @param dam 威力
1893  * @param rad 半径
1894  * @param y 中心点Y座標
1895  * @param x 中心点X座標
1896  * @return 作用が実際にあった場合TRUEを返す
1897  * @details
1898  * <pre>
1899  * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
1900  * player, or outside source, that starts out at an arbitrary location, and
1901  * leaving no trail from the "caster" to the target.  This function is
1902  * especially useful for bombardments and similar. -LM-
1903  * Option to hurt the player.
1904  * </pre>
1905  */
1906 bool fire_meteor(player_type *caster_ptr, MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
1907 {
1908         BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1909         return (project(caster_ptr, who, rad, y, x, dam, typ, flg, -1));
1910 }
1911
1912
1913 /*!
1914  * @brief ブラスト系スペルの発動 / Cast a blast spell
1915  * @param caster_ptr プレーヤーへの参照ポインタ
1916  * @param typ 効果属性
1917  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1918  * @param dd 威力ダイス数
1919  * @param ds 威力ダイス目
1920  * @param num 基本回数
1921  * @param dev 回数分散
1922  * @return 作用が実際にあった場合TRUEを返す
1923  */
1924 bool fire_blast(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, DICE_NUMBER dd, DICE_SID ds, int num, int dev)
1925 {
1926         POSITION ty, tx, y, x;
1927         POSITION ly, lx;
1928         if (dir == 5)
1929         {
1930                 tx = target_col;
1931                 ty = target_row;
1932
1933                 lx = 20 * (tx - caster_ptr->x) + caster_ptr->x;
1934                 ly = 20 * (ty - caster_ptr->y) + caster_ptr->y;
1935         }
1936         else
1937         {
1938                 ly = ty = caster_ptr->y + 20 * ddy[dir];
1939                 lx = tx = caster_ptr->x + 20 * ddx[dir];
1940         }
1941
1942         int ld = distance(caster_ptr->y, caster_ptr->x, ly, lx);
1943         BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
1944         bool result = TRUE;
1945         for (int i = 0; i < num; i++)
1946         {
1947                 while (TRUE)
1948                 {
1949                         /* Get targets for some bolts */
1950                         y = rand_spread(ly, ld * dev / 20);
1951                         x = rand_spread(lx, ld * dev / 20);
1952
1953                         if (distance(ly, lx, y, x) <= ld * dev / 20) break;
1954                 }
1955
1956                 /* Analyze the "dir" and the "target". */
1957                 if (!project(caster_ptr, 0, 0, y, x, damroll(dd, ds), typ, flg, -1))
1958                 {
1959                         result = FALSE;
1960                 }
1961         }
1962
1963         return result;
1964 }
1965
1966
1967 /*!
1968  * @brief モンスターとの位置交換処理 / Switch position with a monster.
1969  * @param caster_ptr プレーヤーへの参照ポインタ
1970  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1971  * @return 作用が実際にあった場合TRUEを返す
1972  */
1973 bool teleport_swap(player_type *caster_ptr, DIRECTION dir)
1974 {
1975         POSITION tx, ty;
1976         if ((dir == 5) && target_okay(caster_ptr))
1977         {
1978                 tx = target_col;
1979                 ty = target_row;
1980         }
1981         else
1982         {
1983                 tx = caster_ptr->x + ddx[dir];
1984                 ty = caster_ptr->y + ddy[dir];
1985         }
1986
1987         if (caster_ptr->anti_tele)
1988         {
1989                 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
1990                 return FALSE;
1991         }
1992
1993         grid_type* g_ptr;
1994         g_ptr = &caster_ptr->current_floor_ptr->grid_array[ty][tx];
1995         if (!g_ptr->m_idx || (g_ptr->m_idx == caster_ptr->riding))
1996         {
1997                 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
1998                 return FALSE;
1999         }
2000
2001         if ((g_ptr->info & CAVE_ICKY) || (distance(ty, tx, caster_ptr->y, caster_ptr->x) > caster_ptr->lev * 3 / 2 + 10))
2002         {
2003                 msg_print(_("失敗した。", "Failed to swap."));
2004                 return FALSE;
2005         }
2006
2007         monster_type* m_ptr;
2008         monster_race* r_ptr;
2009         m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
2010         r_ptr = &r_info[m_ptr->r_idx];
2011
2012         (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
2013
2014         if (r_ptr->flagsr & RFR_RES_TELE)
2015         {
2016                 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
2017                 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2018                 return FALSE;
2019         }
2020
2021         sound(SOUND_TELEPORT);
2022         (void)move_player_effect(caster_ptr, ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
2023         return TRUE;
2024 }
2025
2026
2027 /*!
2028  * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "project()" in a direction (or at the target)
2029  * @param caster_ptr プレーヤーへの参照ポインタ
2030  * @param typ 効果属性
2031  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2032  * @param dam 威力
2033  * @param flg フラグ
2034  * @return 作用が実際にあった場合TRUEを返す
2035  */
2036 bool project_hook(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
2037 {
2038         flg |= (PROJECT_THRU);
2039         POSITION tx = caster_ptr->x + ddx[dir];
2040         POSITION ty = caster_ptr->y + ddy[dir];
2041         if ((dir == 5) && target_okay(caster_ptr))
2042         {
2043                 tx = target_col;
2044                 ty = target_row;
2045         }
2046
2047         return (project(caster_ptr, 0, 0, ty, tx, dam, typ, flg, -1));
2048 }
2049
2050
2051 /*!
2052  * @brief ボルト系スペルの発動 / Cast a bolt spell.
2053  * @param caster_ptr プレーヤーへの参照ポインタ
2054  * @param typ 効果属性
2055  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2056  * @param dam 威力
2057  * @return 作用が実際にあった場合TRUEを返す
2058  * @details
2059  * <pre>
2060  * Stop if we hit a monster, as a "bolt".
2061  * Affect monsters and grids (not objects).
2062  * </pre>
2063  */
2064 bool fire_bolt(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2065 {
2066         BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
2067         if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
2068         return (project_hook(caster_ptr, typ, dir, dam, flg));
2069 }
2070
2071
2072 /*!
2073  * @brief ビーム系スペルの発動 / Cast a beam spell.
2074  * @param caster_ptr プレーヤーへの参照ポインタ
2075  * @param typ 効果属性
2076  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2077  * @param dam 威力
2078  * @return 作用が実際にあった場合TRUEを返す
2079  * @details
2080  * <pre>
2081  * Pass through monsters, as a "beam".
2082  * Affect monsters, grids and objects.
2083  * </pre>
2084  */
2085 bool fire_beam(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2086 {
2087         BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
2088         return (project_hook(caster_ptr, typ, dir, dam, flg));
2089 }
2090
2091
2092 /*!
2093  * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
2094  * @param caster_ptr プレーヤーへの参照ポインタ
2095  * @param prob ビーム化する確率(%)
2096  * @param typ 効果属性
2097  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2098  * @param dam 威力
2099  * @return 作用が実際にあった場合TRUEを返す
2100  * @details
2101  * <pre>
2102  * Pass through monsters, as a "beam".
2103  * Affect monsters, grids and objects.
2104  * </pre>
2105  */
2106 bool fire_bolt_or_beam(player_type *caster_ptr, PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2107 {
2108         if (randint0(100) < prob)
2109         {
2110                 return (fire_beam(caster_ptr, typ, dir, dam));
2111         }
2112
2113         return (fire_bolt(caster_ptr, typ, dir, dam));
2114 }
2115
2116
2117 /*!
2118  * @brief LITE_WEAK属性による光源ビーム処理
2119  * @param caster_ptr プレーヤーへの参照ポインタ
2120  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2121  * @param dam 威力
2122  * @return 作用が実際にあった場合TRUEを返す
2123  */
2124 bool lite_line(player_type *caster_ptr, DIRECTION dir, HIT_POINT dam)
2125 {
2126         BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
2127         return (project_hook(caster_ptr, GF_LITE_WEAK, dir, dam, flg));
2128 }
2129
2130
2131 /*!
2132  * @brief 衰弱ボルト処理
2133  * @param caster_ptr プレーヤーへの参照ポインタ
2134  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2135  * @param dam 威力
2136  * @return 作用が実際にあった場合TRUEを返す
2137  */
2138 bool hypodynamic_bolt(player_type *caster_ptr, DIRECTION dir, HIT_POINT dam)
2139 {
2140         BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
2141         return (project_hook(caster_ptr, GF_HYPODYNAMIA, dir, dam, flg));
2142 }
2143
2144
2145 /*!
2146  * @brief 岩石溶解処理
2147  * @param caster_ptr プレーヤーへの参照ポインタ
2148  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2149  * @param dam 威力
2150  * @return 作用が実際にあった場合TRUEを返す
2151  */
2152 bool wall_to_mud(player_type *caster_ptr, DIRECTION dir, HIT_POINT dam)
2153 {
2154         BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2155         return (project_hook(caster_ptr, GF_KILL_WALL, dir, dam, flg));
2156 }
2157
2158
2159 /*!
2160  * @brief 魔法の施錠処理
2161  * @param caster_ptr プレーヤーへの参照ポインタ
2162  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2163  * @return 作用が実際にあった場合TRUEを返す
2164  */
2165 bool wizard_lock(player_type *caster_ptr, DIRECTION dir)
2166 {
2167         BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2168         return (project_hook(caster_ptr, GF_JAM_DOOR, dir, 20 + randint1(30), flg));
2169 }
2170
2171
2172 /*!
2173  * @brief ドア破壊処理
2174  * @param caster_ptr プレーヤーへの参照ポインタ
2175  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2176  * @return 作用が実際にあった場合TRUEを返す
2177  */
2178 bool destroy_door(player_type *caster_ptr, DIRECTION dir)
2179 {
2180         BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
2181         return (project_hook(caster_ptr, GF_KILL_DOOR, dir, 0, flg));
2182 }
2183
2184
2185 /*!
2186  * @brief トラップ解除処理
2187  * @param caster_ptr プレーヤーへの参照ポインタ
2188  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2189  * @return 作用が実際にあった場合TRUEを返す
2190  */
2191 bool disarm_trap(player_type *caster_ptr, DIRECTION dir)
2192 {
2193         BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
2194         return (project_hook(caster_ptr, GF_KILL_TRAP, dir, 0, flg));
2195 }
2196
2197
2198 /*!
2199  * @brief 死の光線処理
2200  * @param caster_ptr プレーヤーへの参照ポインタ
2201  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2202  * @param plev プレイヤーレベル(効力はplev*200)
2203  * @return 作用が実際にあった場合TRUEを返す
2204  */
2205 bool death_ray(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
2206 {
2207         BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
2208         return (project_hook(caster_ptr, GF_DEATH_RAY, dir, plev * 200, flg));
2209 }
2210
2211
2212 /*!
2213  * @brief モンスター用テレポート処理
2214  * @param caster_ptr プレーヤーへの参照ポインタ
2215  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2216  * @param distance 移動距離
2217  * @return 作用が実際にあった場合TRUEを返す
2218  */
2219 bool teleport_monster(player_type *caster_ptr, DIRECTION dir, int distance)
2220 {
2221         BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
2222         return (project_hook(caster_ptr, GF_AWAY_ALL, dir, distance, flg));
2223 }
2224
2225
2226 /*!
2227  * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
2228  * @param caster_ptr プレーヤーへの参照ポインタ
2229  * @return 作用が実際にあった場合TRUEを返す
2230  */
2231 bool door_creation(player_type *caster_ptr, POSITION y, POSITION x)
2232 {
2233         BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2234         return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_DOOR, flg, -1));
2235 }
2236
2237
2238 /*!
2239  * @brief トラップ生成処理(起点から周囲1マス)
2240  * @param caster_ptr プレーヤーへの参照ポインタ
2241  * @param y 起点Y座標
2242  * @param x 起点X座標
2243  * @return 作用が実際にあった場合TRUEを返す
2244  */
2245 bool trap_creation(player_type *caster_ptr, POSITION y, POSITION x)
2246 {
2247         BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2248         return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
2249 }
2250
2251
2252 /*!
2253  * @brief 森林生成処理(プレイヤー中心に周囲1マス)
2254  * @param caster_ptr プレーヤーへの参照ポインタ
2255  * @return 作用が実際にあった場合TRUEを返す
2256  */
2257 bool tree_creation(player_type *caster_ptr, POSITION y, POSITION x)
2258 {
2259         BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2260         return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_TREE, flg, -1));
2261 }
2262
2263
2264 /*!
2265  * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
2266  * @param caster_ptr プレーヤーへの参照ポインタ
2267  * @return 作用が実際にあった場合TRUEを返す
2268  */
2269 bool glyph_creation(player_type *caster_ptr, POSITION y, POSITION x)
2270 {
2271         BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
2272         return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_GLYPH, flg, -1));
2273 }
2274
2275
2276 /*!
2277  * @brief 壁生成処理(プレイヤー中心に周囲1マス)
2278  * @param caster_ptr プレーヤーへの参照ポインタ
2279  * @return 作用が実際にあった場合TRUEを返す
2280  */
2281 bool wall_stone(player_type *caster_ptr)
2282 {
2283         BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2284         bool dummy = (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, 0, GF_STONE_WALL, flg, -1));
2285         caster_ptr->update |= (PU_FLOW);
2286         caster_ptr->redraw |= (PR_MAP);
2287         return dummy;
2288 }
2289
2290
2291 /*!
2292  * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
2293  * @param caster_ptr プレーヤーへの参照ポインタ
2294  * @return 作用が実際にあった場合TRUEを返す
2295  */
2296 bool destroy_doors_touch(player_type *caster_ptr)
2297 {
2298         BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2299         return (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, 0, GF_KILL_DOOR, flg, -1));
2300 }
2301
2302
2303 /*!
2304  * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
2305  * @param caster_ptr プレーヤーへの参照ポインタ
2306  * @return 作用が実際にあった場合TRUEを返す
2307  */
2308 bool disarm_traps_touch(player_type *caster_ptr)
2309 {
2310         BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2311         return (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, 0, GF_KILL_TRAP, flg, -1));
2312 }
2313
2314
2315 /*!
2316  * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
2317  * @param caster_ptr プレーヤーへの参照ポインタ
2318  * @return 作用が実際にあった場合TRUEを返す
2319  */
2320 bool sleep_monsters_touch(player_type *caster_ptr)
2321 {
2322         BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
2323         return (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, caster_ptr->lev, GF_OLD_SLEEP, flg, -1));
2324 }
2325
2326
2327 /*!
2328  * @brief 死者復活処理(起点より周囲5マス)
2329  * @param caster_ptr プレーヤーへの参照ポインタ
2330  * @param who 術者モンスターID(0ならばプレイヤー)
2331  * @param y 起点Y座標
2332  * @param x 起点X座標
2333  * @return 作用が実際にあった場合TRUEを返す
2334  */
2335 bool animate_dead(player_type *caster_ptr, MONSTER_IDX who, POSITION y, POSITION x)
2336 {
2337         BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
2338         return (project(caster_ptr, who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
2339 }
2340
2341
2342 /*!
2343  * @brief 混沌招来処理
2344  * @return 作用が実際にあった場合TRUEを返す
2345  */
2346 void call_chaos(player_type *caster_ptr)
2347 {
2348         int hurt_types[31] =
2349         {
2350                 GF_ELEC,      GF_POIS,    GF_ACID,    GF_COLD,
2351                 GF_FIRE,      GF_MISSILE, GF_ARROW,   GF_PLASMA,
2352                 GF_HOLY_FIRE, GF_WATER,   GF_LITE,    GF_DARK,
2353                 GF_FORCE,     GF_INERTIAL, GF_MANA,    GF_METEOR,
2354                 GF_ICE,       GF_CHAOS,   GF_NETHER,  GF_DISENCHANT,
2355                 GF_SHARDS,    GF_SOUND,   GF_NEXUS,   GF_CONFUSION,
2356                 GF_TIME,      GF_GRAVITY, GF_ROCKET,  GF_NUKE,
2357                 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
2358         };
2359
2360         int chaos_type = hurt_types[randint0(31)];
2361         bool line_chaos = FALSE;
2362         if (one_in_(4)) line_chaos = TRUE;
2363
2364         int dir;
2365         if (one_in_(6))
2366         {
2367                 for (int dummy = 1; dummy < 10; dummy++)
2368                 {
2369                         if (dummy - 5)
2370                         {
2371                                 if (line_chaos)
2372                                         fire_beam(caster_ptr, chaos_type, dummy, 150);
2373                                 else
2374                                         fire_ball(caster_ptr, chaos_type, dummy, 150, 2);
2375                         }
2376                 }
2377
2378                 return;
2379         }
2380
2381         if (one_in_(3))
2382         {
2383                 fire_ball(caster_ptr, chaos_type, 0, 500, 8);
2384                 return;
2385         }
2386
2387         if (!get_aim_dir(caster_ptr, &dir)) return;
2388         if (line_chaos)
2389                 fire_beam(caster_ptr, chaos_type, dir, 250);
2390         else
2391                 fire_ball(caster_ptr, chaos_type, dir, 250, 3 + (caster_ptr->lev / 35));
2392 }
2393
2394
2395 /*!
2396  * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
2397  * @param target_ptr プレーヤーへの参照ポインタ
2398  * @param stop_ty 再帰処理停止フラグ
2399  * @param count 発動回数
2400  * @return 作用が実際にあった場合TRUEを返す
2401  * @details
2402  * <pre>
2403  * rr9: Stop the nasty things when a Cyberdemon is summoned
2404  * or the player gets paralyzed.
2405  * </pre>
2406  */
2407 bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count)
2408 {
2409         BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
2410         bool is_first_curse = TRUE;
2411         floor_type *floor_ptr = target_ptr->current_floor_ptr;
2412         while (is_first_curse || (one_in_(3) && !stop_ty))
2413         {
2414                 is_first_curse = FALSE;
2415                 switch (randint1(34))
2416                 {
2417                 case 28: case 29:
2418                         if (!(*count))
2419                         {
2420                                 msg_print(_("地面が揺れた...", "The ground trembles..."));
2421                                 earthquake(target_ptr, target_ptr->y, target_ptr->x, 5 + randint0(10), 0);
2422                                 if (!one_in_(6)) break;
2423                         }
2424                 case 30: case 31:
2425                         if (!(*count))
2426                         {
2427                                 HIT_POINT dam = damroll(10, 10);
2428                                 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
2429                                 project(target_ptr, 0, 8, target_ptr->y, target_ptr->x, dam, GF_MANA, flg, -1);
2430                                 take_hit(target_ptr, DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
2431                                 if (!one_in_(6)) break;
2432                         }
2433                 case 32: case 33:
2434                         if (!(*count))
2435                         {
2436                                 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
2437                                 teleport_player(target_ptr, damroll(10, 10), TELEPORT_PASSIVE);
2438                                 if (randint0(13)) (*count) += activate_hi_summon(target_ptr, target_ptr->y, target_ptr->x, FALSE);
2439                                 if (!one_in_(6)) break;
2440                         }
2441                 case 34:
2442                         msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
2443                         wall_breaker(target_ptr);
2444                         if (!randint0(7))
2445                         {
2446                                 project(target_ptr, 0, 7, target_ptr->y, target_ptr->x, 50, GF_KILL_WALL, flg, -1);
2447                                 take_hit(target_ptr, DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
2448                         }
2449
2450                         if (!one_in_(6)) break;
2451                 case 1: case 2: case 3: case 16: case 17:
2452                         aggravate_monsters(target_ptr, 0);
2453                         if (!one_in_(6)) break;
2454                 case 4: case 5: case 6:
2455                         (*count) += activate_hi_summon(target_ptr, target_ptr->y, target_ptr->x, FALSE);
2456                         if (!one_in_(6)) break;
2457                 case 7: case 8: case 9: case 18:
2458                         (*count) += summon_specific(target_ptr, 0, target_ptr->y, target_ptr->x, floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
2459                         if (!one_in_(6)) break;
2460                 case 10: case 11: case 12:
2461                         msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
2462                         lose_exp(target_ptr, target_ptr->exp / 16);
2463                         if (!one_in_(6)) break;
2464                 case 13: case 14: case 15: case 19: case 20:
2465                 {
2466                         bool is_statue = stop_ty;
2467                         is_statue |= target_ptr->free_act && (randint1(125) < target_ptr->skill_sav);
2468                         is_statue |= target_ptr->pclass == CLASS_BERSERKER;
2469                         if (!is_statue)
2470                         {
2471                                 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
2472                                 if (target_ptr->free_act)
2473                                         set_paralyzed(target_ptr, target_ptr->paralyzed + randint1(3));
2474                                 else
2475                                         set_paralyzed(target_ptr, target_ptr->paralyzed + randint1(13));
2476                                 stop_ty = TRUE;
2477                         }
2478
2479                         if (!one_in_(6)) break;
2480                 }
2481                 case 21: case 22: case 23:
2482                         (void)do_dec_stat(target_ptr, randint0(6));
2483                         if (!one_in_(6)) break;
2484                 case 24:
2485                         msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
2486                         lose_all_info(target_ptr);
2487                         if (!one_in_(6)) break;
2488                 case 25:
2489                         if ((floor_ptr->dun_level > 65) && !stop_ty)
2490                         {
2491                                 (*count) += summon_cyber(target_ptr, -1, target_ptr->y, target_ptr->x);
2492                                 stop_ty = TRUE;
2493                                 break;
2494                         }
2495
2496                         if (!one_in_(6)) break;
2497                 default:
2498                         for (int i = 0; i < A_MAX; i++)
2499                         {
2500                                 bool is_first_dec_stat = TRUE;
2501                                 while (is_first_dec_stat || one_in_(2))
2502                                 {
2503                                         is_first_dec_stat = FALSE;
2504                                         (void)do_dec_stat(target_ptr, i);
2505                                 }
2506                         }
2507                 }
2508         }
2509
2510         return stop_ty;
2511 }
2512
2513
2514 /*!
2515  * todo 引数にPOSITION x/yは必要か? 要調査
2516  * @brief HI_SUMMON(上級召喚)処理発動
2517  * @param caster_ptr プレーヤーへの参照ポインタ
2518  * @param y 召喚位置Y座標
2519  * @param x 召喚位置X座標
2520  * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
2521  * @return 作用が実際にあった場合TRUEを返す
2522  */
2523 int activate_hi_summon(player_type *caster_ptr, POSITION y, POSITION x, bool can_pet)
2524 {
2525         BIT_FLAGS mode = PM_ALLOW_GROUP;
2526         bool pet = FALSE;
2527         if (can_pet)
2528         {
2529                 if (one_in_(4))
2530                 {
2531                         mode |= PM_FORCE_FRIENDLY;
2532                 }
2533                 else
2534                 {
2535                         mode |= PM_FORCE_PET;
2536                         pet = TRUE;
2537                 }
2538         }
2539
2540         if (!pet) mode |= PM_NO_PET;
2541
2542         DEPTH dungeon_level = caster_ptr->current_floor_ptr->dun_level;
2543         DEPTH summon_lev = (pet ? caster_ptr->lev * 2 / 3 + randint1(caster_ptr->lev / 2) : dungeon_level);
2544         int count = 0;
2545         for (int i = 0; i < (randint1(7) + (dungeon_level / 40)); i++)
2546         {
2547                 switch (randint1(25) + (dungeon_level / 20))
2548                 {
2549                 case 1: case 2:
2550                         count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
2551                         break;
2552                 case 3: case 4:
2553                         count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
2554                         break;
2555                 case 5: case 6:
2556                         count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
2557                         break;
2558                 case 7: case 8:
2559                         count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
2560                         break;
2561                 case 9: case 10:
2562                         count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
2563                         break;
2564                 case 11: case 12:
2565                         count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
2566                         break;
2567                 case 13: case 14:
2568                         count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
2569                         break;
2570                 case 15: case 16:
2571                         count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
2572                         break;
2573                 case 17:
2574                         if (can_pet) break;
2575                         count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
2576                         break;
2577                 case 18: case 19:
2578                         if (can_pet) break;
2579                         count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
2580                         break;
2581                 case 20: case 21:
2582                         if (!can_pet) mode |= PM_ALLOW_UNIQUE;
2583                         count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
2584                         break;
2585                 case 22: case 23:
2586                         if (!can_pet) mode |= PM_ALLOW_UNIQUE;
2587                         count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
2588                         break;
2589                 case 24:
2590                         count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
2591                         break;
2592                 default:
2593                         if (!can_pet) mode |= PM_ALLOW_UNIQUE;
2594                         count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
2595                 }
2596         }
2597
2598         return count;
2599 }
2600
2601
2602 /*!
2603  * @brief 周辺破壊効果(プレイヤー中心)
2604  * @param caster_ptr プレーヤーへの参照ポインタ
2605  * @return 作用が実際にあった場合TRUEを返す
2606  */
2607 void wall_breaker(player_type *caster_ptr)
2608 {
2609         POSITION y = 0, x = 0;
2610         int attempts = 1000;
2611         if (randint1(80 + caster_ptr->lev) < 70)
2612         {
2613                 while (attempts--)
2614                 {
2615                         scatter(caster_ptr, &y, &x, caster_ptr->y, caster_ptr->x, 4, 0);
2616
2617                         if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT)) continue;
2618
2619                         if (!player_bold(caster_ptr, y, x)) break;
2620                 }
2621
2622                 project(caster_ptr, 0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
2623                         (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
2624                 return;
2625         }
2626
2627         if (randint1(100) > 30)
2628         {
2629                 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 1, 0);
2630                 return;
2631         }
2632
2633         int num = damroll(5, 3);
2634         for (int i = 0; i < num; i++)
2635         {
2636                 while (TRUE)
2637                 {
2638                         scatter(caster_ptr, &y, &x, caster_ptr->y, caster_ptr->x, 10, 0);
2639
2640                         if (!player_bold(caster_ptr, y, x)) break;
2641                 }
2642
2643                 project(caster_ptr, 0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
2644                         (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
2645         }
2646 }
2647
2648
2649 /*!
2650  * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
2651  * @param caster_ptr プレーヤーへの参照ポインタ
2652  * @param dam 効力
2653  * @return 作用が実際にあった場合TRUEを返す
2654  */
2655 bool confuse_monsters(player_type *caster_ptr, HIT_POINT dam)
2656 {
2657         return (project_all_los(caster_ptr, GF_OLD_CONF, dam));
2658 }
2659
2660
2661 /*!
2662  * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
2663  * @param caster_ptr プレーヤーへの参照ポインタ
2664  * @param dam 効力
2665  * @return 作用が実際にあった場合TRUEを返す
2666  */
2667 bool charm_monsters(player_type *caster_ptr, HIT_POINT dam)
2668 {
2669         return (project_all_los(caster_ptr, GF_CHARM, dam));
2670 }
2671
2672
2673 /*!
2674  * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
2675  * @param caster_ptr プレーヤーへの参照ポインタ
2676  * @param dam 効力
2677  * @return 作用が実際にあった場合TRUEを返す
2678  */
2679 bool charm_animals(player_type *caster_ptr, HIT_POINT dam)
2680 {
2681         return (project_all_los(caster_ptr, GF_CONTROL_ANIMAL, dam));
2682 }
2683
2684
2685 /*!
2686  * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
2687  * @param caster_ptr プレーヤーへの参照ポインタ
2688  * @param dam 効力
2689  * @return 作用が実際にあった場合TRUEを返す
2690  */
2691 bool stun_monsters(player_type *caster_ptr, HIT_POINT dam)
2692 {
2693         return (project_all_los(caster_ptr, GF_STUN, dam));
2694 }
2695
2696
2697 /*!
2698  * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
2699  * @param caster_ptr プレーヤーへの参照ポインタ
2700  * @param dam 効力
2701  * @return 作用が実際にあった場合TRUEを返す
2702  */
2703 bool stasis_monsters(player_type *caster_ptr, HIT_POINT dam)
2704 {
2705         return (project_all_los(caster_ptr, GF_STASIS, dam));
2706 }
2707
2708
2709 /*!
2710  * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
2711  * @param caster_ptr プレーヤーへの参照ポインタ
2712  * @param dam 効力
2713  * @return 作用が実際にあった場合TRUEを返す
2714  */
2715 bool mindblast_monsters(player_type *caster_ptr, HIT_POINT dam)
2716 {
2717         return (project_all_los(caster_ptr, GF_PSI, dam));
2718 }
2719
2720
2721 /*!
2722  * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
2723  * @param caster_ptr プレーヤーへの参照ポインタ
2724  * @param dist 効力(距離)
2725  * @return 作用が実際にあった場合TRUEを返す
2726  */
2727 bool banish_monsters(player_type *caster_ptr, int dist)
2728 {
2729         return (project_all_los(caster_ptr, GF_AWAY_ALL, dist));
2730 }
2731
2732
2733 /*!
2734  * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
2735  * @param caster_ptr プレーヤーへの参照ポインタ
2736  * @param dam 効力
2737  * @return 作用が実際にあった場合TRUEを返す
2738  */
2739 bool turn_evil(player_type *caster_ptr, HIT_POINT dam)
2740 {
2741         return (project_all_los(caster_ptr, GF_TURN_EVIL, dam));
2742 }
2743
2744
2745 /*!
2746  * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
2747  * @param caster_ptr プレーヤーへの参照ポインタ
2748  * @param dam 効力
2749  * @return 作用が実際にあった場合TRUEを返す
2750  */
2751 bool turn_monsters(player_type *caster_ptr, HIT_POINT dam)
2752 {
2753         return (project_all_los(caster_ptr, GF_TURN_ALL, dam));
2754 }
2755
2756
2757 /*!
2758  * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
2759  * @param caster_ptr プレーヤーへの参照ポインタ
2760  * @return 作用が実際にあった場合TRUEを返す
2761  */
2762 bool deathray_monsters(player_type *caster_ptr)
2763 {
2764         return (project_all_los(caster_ptr, GF_DEATH_RAY, caster_ptr->lev * 200));
2765 }
2766
2767
2768 /*!
2769  * @brief チャーム・モンスター(1体)
2770  * @param caster_ptr プレーヤーへの参照ポインタ
2771  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2772  * @param plev パワー
2773  * @return 作用が実際にあった場合TRUEを返す
2774  */
2775 bool charm_monster(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
2776 {
2777         BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
2778         return (project_hook(caster_ptr, GF_CHARM, dir, plev, flg));
2779 }
2780
2781
2782 /*!
2783  * @brief アンデッド支配(1体)
2784  * @param caster_ptr プレーヤーへの参照ポインタ
2785  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2786  * @param plev パワー
2787  * @return 作用が実際にあった場合TRUEを返す
2788  */
2789 bool control_one_undead(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
2790 {
2791         BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
2792         return (project_hook(caster_ptr, GF_CONTROL_UNDEAD, dir, plev, flg));
2793 }
2794
2795
2796 /*!
2797  * @brief 悪魔支配(1体)
2798  * @param caster_ptr プレーヤーへの参照ポインタ
2799  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2800  * @param plev パワー
2801  * @return 作用が実際にあった場合TRUEを返す
2802  */
2803 bool control_one_demon(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
2804 {
2805         BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
2806         return (project_hook(caster_ptr, GF_CONTROL_DEMON, dir, plev, flg));
2807 }
2808
2809
2810 /*!
2811  * @brief 動物支配(1体)
2812  * @param caster_ptr プレーヤーへの参照ポインタ
2813  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2814  * @param plev パワー
2815  * @return 作用が実際にあった場合TRUEを返す
2816  */
2817 bool charm_animal(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
2818 {
2819         BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
2820         return (project_hook(caster_ptr, GF_CONTROL_ANIMAL, dir, plev, flg));
2821 }
2822
2823
2824 /*!
2825  * @brief 変わり身処理
2826  * @param caster_ptr プレーヤーへの参照ポインタ
2827  * @param success 判定成功上の処理ならばTRUE
2828  * @return 作用が実際にあった場合TRUEを返す
2829  */
2830 bool kawarimi(player_type *caster_ptr, bool success)
2831 {
2832         object_type forge;
2833         object_type *q_ptr = &forge;
2834
2835         if (caster_ptr->is_dead) return FALSE;
2836         if (caster_ptr->confused || caster_ptr->blind || caster_ptr->paralyzed || caster_ptr->image) return FALSE;
2837         if (randint0(200) < caster_ptr->stun) return FALSE;
2838
2839         if (!success && one_in_(3))
2840         {
2841                 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
2842                 caster_ptr->special_defense &= ~(NINJA_KAWARIMI);
2843                 caster_ptr->redraw |= (PR_STATUS);
2844                 return FALSE;
2845         }
2846
2847         POSITION y = caster_ptr->y;
2848         POSITION x = caster_ptr->x;
2849
2850         teleport_player(caster_ptr, 10 + randint1(90), 0L);
2851         object_wipe(q_ptr);
2852         object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
2853
2854         q_ptr->pval = MON_NINJA;
2855         (void)drop_near(caster_ptr, q_ptr, -1, y, x);
2856
2857         if (success) msg_print(_("攻撃を受ける前に素早く身をひるがえした。", "You have turned around just before the attack hit you."));
2858         else msg_print(_("失敗!攻撃を受けてしまった。", "Failed! You are hit by the attack."));
2859
2860         caster_ptr->special_defense &= ~(NINJA_KAWARIMI);
2861         caster_ptr->redraw |= (PR_STATUS);
2862         return TRUE;
2863 }
2864
2865
2866 /*!
2867  * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
2868  * @param caster_ptr プレーヤーへの参照ポインタ
2869  * @param mdeath 目標モンスターが死亡したかを返す
2870  * @return 作用が実際にあった場合TRUEを返す /  Return value is for checking "done"
2871  */
2872 bool rush_attack(player_type *attacker_ptr, bool *mdeath)
2873 {
2874         if (mdeath) *mdeath = FALSE;
2875
2876         project_length = 5;
2877         DIRECTION dir;
2878         if (!get_aim_dir(attacker_ptr, &dir)) return FALSE;
2879
2880         int tx = attacker_ptr->x + project_length * ddx[dir];
2881         int ty = attacker_ptr->y + project_length * ddy[dir];
2882
2883         if ((dir == 5) && target_okay(attacker_ptr))
2884         {
2885                 tx = target_col;
2886                 ty = target_row;
2887         }
2888
2889         int tm_idx = 0;
2890         floor_type *floor_ptr = attacker_ptr->current_floor_ptr;
2891         if (in_bounds(floor_ptr, ty, tx)) tm_idx = floor_ptr->grid_array[ty][tx].m_idx;
2892
2893         u16b path_g[32];
2894         int path_n = project_path(attacker_ptr, path_g, project_length, attacker_ptr->y, attacker_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
2895         project_length = 0;
2896         if (!path_n) return TRUE;
2897
2898         ty = attacker_ptr->y;
2899         tx = attacker_ptr->x;
2900         bool tmp_mdeath = FALSE;
2901         bool moved = FALSE;
2902         for (int i = 0; i < path_n; i++)
2903         {
2904                 monster_type *m_ptr;
2905
2906                 int ny = GRID_Y(path_g[i]);
2907                 int nx = GRID_X(path_g[i]);
2908
2909                 if (is_cave_empty_bold(attacker_ptr, ny, nx) && player_can_enter(attacker_ptr, floor_ptr->grid_array[ny][nx].feat, 0))
2910                 {
2911                         ty = ny;
2912                         tx = nx;
2913                         continue;
2914                 }
2915
2916                 if (!floor_ptr->grid_array[ny][nx].m_idx)
2917                 {
2918                         if (tm_idx)
2919                         {
2920                                 msg_print(_("失敗!", "Failed!"));
2921                         }
2922                         else
2923                         {
2924                                 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
2925                         }
2926
2927                         break;
2928                 }
2929
2930                 if (!player_bold(attacker_ptr, ty, tx)) teleport_player_to(attacker_ptr, ty, tx, TELEPORT_NONMAGICAL);
2931                 update_monster(attacker_ptr, floor_ptr->grid_array[ny][nx].m_idx, TRUE);
2932
2933                 m_ptr = &floor_ptr->m_list[floor_ptr->grid_array[ny][nx].m_idx];
2934                 if (tm_idx != floor_ptr->grid_array[ny][nx].m_idx)
2935                 {
2936 #ifdef JP
2937                         msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "", m_ptr->ml ? "モンスター" : "何か");
2938 #else
2939                         msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
2940 #endif
2941                 }
2942                 else if (!player_bold(attacker_ptr, ty, tx))
2943                 {
2944                         GAME_TEXT m_name[MAX_NLEN];
2945                         monster_desc(attacker_ptr, m_name, m_ptr, 0);
2946                         msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
2947                 }
2948
2949                 if (!player_bold(attacker_ptr, ty, tx)) teleport_player_to(attacker_ptr, ty, tx, TELEPORT_NONMAGICAL);
2950                 moved = TRUE;
2951                 tmp_mdeath = py_attack(attacker_ptr, ny, nx, HISSATSU_NYUSIN);
2952
2953                 break;
2954         }
2955
2956         if (!moved && !player_bold(attacker_ptr, ty, tx)) teleport_player_to(attacker_ptr, ty, tx, TELEPORT_NONMAGICAL);
2957
2958         if (mdeath) *mdeath = tmp_mdeath;
2959         return TRUE;
2960 }
2961
2962
2963 /*!
2964  * @brief 全鏡の消去 / Remove all mirrors in this floor
2965  * @param caster_ptr プレーヤーへの参照ポインタ
2966  * @param explode 爆発処理を伴うならばTRUE
2967  * @return なし
2968  */
2969 void remove_all_mirrors(player_type *caster_ptr, bool explode)
2970 {
2971         for (POSITION x = 0; x < caster_ptr->current_floor_ptr->width; x++)
2972         {
2973                 for (POSITION y = 0; y < caster_ptr->current_floor_ptr->height; y++)
2974                 {
2975                         if (!is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[y][x]))
2976                                 continue;
2977
2978                         remove_mirror(caster_ptr, y, x);
2979                         if (!explode) continue;
2980
2981                         project(caster_ptr, 0, 2, y, x, caster_ptr->lev / 2 + 5, GF_SHARDS,
2982                                 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
2983                 }
2984         }
2985 }
2986
2987
2988 /*!
2989  * @brief 『一つの指輪』の効果処理 /
2990  * Hack -- activate the ring of power
2991  * @param caster_ptr プレーヤーへの参照ポインタ
2992  * @param dir 発動の方向ID
2993  * @return なし
2994  */
2995 void ring_of_power(player_type *caster_ptr, DIRECTION dir)
2996 {
2997         switch (randint1(10))
2998         {
2999         case 1:
3000         case 2:
3001         {
3002                 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
3003                 sound(SOUND_EVIL);
3004
3005                 /* Decrease all stats (permanently) */
3006                 (void)dec_stat(caster_ptr, A_STR, 50, TRUE);
3007                 (void)dec_stat(caster_ptr, A_INT, 50, TRUE);
3008                 (void)dec_stat(caster_ptr, A_WIS, 50, TRUE);
3009                 (void)dec_stat(caster_ptr, A_DEX, 50, TRUE);
3010                 (void)dec_stat(caster_ptr, A_CON, 50, TRUE);
3011                 (void)dec_stat(caster_ptr, A_CHR, 50, TRUE);
3012
3013                 /* Lose some experience (permanently) */
3014                 caster_ptr->exp -= (caster_ptr->exp / 4);
3015                 caster_ptr->max_exp -= (caster_ptr->exp / 4);
3016                 check_experience(caster_ptr);
3017
3018                 break;
3019         }
3020
3021         case 3:
3022         {
3023                 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
3024                 dispel_monsters(caster_ptr, 1000);
3025                 break;
3026         }
3027
3028         case 4:
3029         case 5:
3030         case 6:
3031         {
3032                 fire_ball(caster_ptr, GF_MANA, dir, 600, 3);
3033                 break;
3034         }
3035
3036         case 7:
3037         case 8:
3038         case 9:
3039         case 10:
3040         {
3041                 fire_bolt(caster_ptr, GF_MANA, dir, 500);
3042                 break;
3043         }
3044         }
3045 }
3046
3047
3048 /*!
3049 * @brief 運命の輪、並びにカオス的な効果の発動
3050 * @param caster_ptr プレーヤーへの参照ポインタ
3051 * @param spell ランダムな効果を選択するための基準ID
3052 * @return なし
3053 */
3054 void wild_magic(player_type *caster_ptr, int spell)
3055 {
3056         int type = SUMMON_MOLD + randint0(6);
3057         if (type < SUMMON_MOLD) type = SUMMON_MOLD;
3058         else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
3059
3060         floor_type *floor_ptr = caster_ptr->current_floor_ptr;
3061         switch (randint1(spell) + randint1(8) + 1)
3062         {
3063         case 1:
3064         case 2:
3065         case 3:
3066                 teleport_player(caster_ptr, 10, TELEPORT_PASSIVE);
3067                 break;
3068         case 4:
3069         case 5:
3070         case 6:
3071                 teleport_player(caster_ptr, 100, TELEPORT_PASSIVE);
3072                 break;
3073         case 7:
3074         case 8:
3075                 teleport_player(caster_ptr, 200, TELEPORT_PASSIVE);
3076                 break;
3077         case 9:
3078         case 10:
3079         case 11:
3080                 unlite_area(caster_ptr, 10, 3);
3081                 break;
3082         case 12:
3083         case 13:
3084         case 14:
3085                 lite_area(caster_ptr, damroll(2, 3), 2);
3086                 break;
3087         case 15:
3088                 destroy_doors_touch(caster_ptr);
3089                 break;
3090         case 16: case 17:
3091                 wall_breaker(caster_ptr);
3092         case 18:
3093                 sleep_monsters_touch(caster_ptr);
3094                 break;
3095         case 19:
3096         case 20:
3097                 trap_creation(caster_ptr, caster_ptr->y, caster_ptr->x);
3098                 break;
3099         case 21:
3100         case 22:
3101                 door_creation(caster_ptr, caster_ptr->y, caster_ptr->x);
3102                 break;
3103         case 23:
3104         case 24:
3105         case 25:
3106                 aggravate_monsters(caster_ptr, 0);
3107                 break;
3108         case 26:
3109                 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 5, 0);
3110                 break;
3111         case 27:
3112         case 28:
3113                 (void)gain_mutation(caster_ptr, 0);
3114                 break;
3115         case 29:
3116         case 30:
3117                 apply_disenchant(caster_ptr, 1);
3118                 break;
3119         case 31:
3120                 lose_all_info(caster_ptr);
3121                 break;
3122         case 32:
3123                 fire_ball(caster_ptr, GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
3124                 break;
3125         case 33:
3126                 wall_stone(caster_ptr);
3127                 break;
3128         case 34:
3129         case 35:
3130                 for (int counter = 0; counter < 8; counter++)
3131                 {
3132                         (void)summon_specific(caster_ptr, 0, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
3133                 }
3134
3135                 break;
3136         case 36:
3137         case 37:
3138                 activate_hi_summon(caster_ptr, caster_ptr->y, caster_ptr->x, FALSE);
3139                 break;
3140         case 38:
3141                 (void)summon_cyber(caster_ptr, -1, caster_ptr->y, caster_ptr->x);
3142                 break;
3143         default:
3144         {
3145                 int count = 0;
3146                 (void)activate_ty_curse(caster_ptr, FALSE, &count);
3147                 break;
3148         }
3149         }
3150 }
3151
3152
3153 /*!
3154 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
3155 * / Drop 10+1d10 meteor ball at random places near the player
3156 * @param caster_ptr プレーヤーへの参照ポインタ
3157 * @param dam ダメージ
3158 * @param rad 効力の半径
3159 * @return なし
3160 */
3161 void cast_meteor(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
3162 {
3163         int b = 10 + randint1(10);
3164         for (int i = 0; i < b; i++)
3165         {
3166                 POSITION y = 0, x = 0;
3167                 int count;
3168
3169                 for (count = 0; count <= 20; count++)
3170                 {
3171                         int dy, dx, d;
3172
3173                         x = caster_ptr->x - 8 + randint0(17);
3174                         y = caster_ptr->y - 8 + randint0(17);
3175                         dx = (caster_ptr->x > x) ? (caster_ptr->x - x) : (x - caster_ptr->x);
3176                         dy = (caster_ptr->y > y) ? (caster_ptr->y - y) : (y - caster_ptr->y);
3177                         d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
3178
3179                         if (d >= 9) continue;
3180
3181                         floor_type *floor_ptr = caster_ptr->current_floor_ptr;
3182                         if (!in_bounds(floor_ptr, y, x) || !projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)
3183                                 || !cave_have_flag_bold(floor_ptr, y, x, FF_PROJECT)) continue;
3184
3185                         break;
3186                 }
3187
3188                 if (count > 20) continue;
3189
3190                 project(caster_ptr, 0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
3191         }
3192 }
3193
3194
3195 /*!
3196 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
3197 * @param caster_ptr プレーヤーへの参照ポインタ
3198 * @param dam ダメージ
3199 * @param rad 効力の半径
3200 * @return ターゲットを指定し、実行したならばTRUEを返す。
3201 */
3202 bool cast_wrath_of_the_god(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
3203 {
3204         DIRECTION dir;
3205         if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
3206
3207         POSITION tx = caster_ptr->x + 99 * ddx[dir];
3208         POSITION ty = caster_ptr->y + 99 * ddy[dir];
3209         if ((dir == 5) && target_okay(caster_ptr))
3210         {
3211                 tx = target_col;
3212                 ty = target_row;
3213         }
3214
3215         POSITION x = caster_ptr->x;
3216         POSITION y = caster_ptr->y;
3217         POSITION nx, ny;
3218         while (TRUE)
3219         {
3220                 if ((y == ty) && (x == tx)) break;
3221
3222                 ny = y;
3223                 nx = x;
3224                 mmove2(&ny, &nx, caster_ptr->y, caster_ptr->x, ty, tx);
3225                 if (MAX_RANGE <= distance(caster_ptr->y, caster_ptr->x, ny, nx)) break;
3226                 if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, ny, nx, FF_PROJECT)) break;
3227                 if ((dir != 5) && caster_ptr->current_floor_ptr->grid_array[ny][nx].m_idx != 0) break;
3228
3229                 x = nx;
3230                 y = ny;
3231         }
3232
3233         tx = x;
3234         ty = y;
3235
3236         int b = 10 + randint1(10);
3237         for (int i = 0; i < b; i++)
3238         {
3239                 int count = 20, d = 0;
3240
3241                 while (count--)
3242                 {
3243                         int dx, dy;
3244
3245                         x = tx - 5 + randint0(11);
3246                         y = ty - 5 + randint0(11);
3247
3248                         dx = (tx > x) ? (tx - x) : (x - tx);
3249                         dy = (ty > y) ? (ty - y) : (y - ty);
3250
3251                         d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
3252                         if (d < 5) break;
3253                 }
3254
3255                 if (count < 0) continue;
3256
3257                 if (!in_bounds(caster_ptr->current_floor_ptr, y, x) ||
3258                         cave_stop_disintegration(caster_ptr->current_floor_ptr, y, x) ||
3259                         !in_disintegration_range(caster_ptr->current_floor_ptr, ty, tx, y, x))
3260                         continue;
3261
3262                 project(caster_ptr, 0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
3263         }
3264
3265         return TRUE;
3266 }
3267
3268
3269 /*!
3270 * @brief 「ワンダー」のランダムな効果を決定して処理する。
3271 * @param caster_ptr プレーヤーへの参照ポインタ
3272 * @param dir 方向ID
3273 * @return なし
3274 * @details
3275 * This spell should become more useful (more controlled) as the\n
3276 * player gains experience levels.  Thus, add 1/5 of the player's\n
3277 * level to the die roll.  This eliminates the worst effects later on,\n
3278 * while keeping the results quite random.  It also allows some potent\n
3279 * effects only at high level.
3280 */
3281 void cast_wonder(player_type *caster_ptr, DIRECTION dir)
3282 {
3283         PLAYER_LEVEL plev = caster_ptr->lev;
3284         int die = randint1(100) + plev / 5;
3285         int vir = virtue_number(caster_ptr, V_CHANCE);
3286         if (vir)
3287         {
3288                 if (caster_ptr->virtues[vir - 1] > 0)
3289                 {
3290                         while (randint1(400) < caster_ptr->virtues[vir - 1]) die++;
3291                 }
3292                 else
3293                 {
3294                         while (randint1(400) < (0 - caster_ptr->virtues[vir - 1])) die--;
3295                 }
3296         }
3297
3298         if (die < 26)
3299         {
3300                 chg_virtue(caster_ptr, V_CHANCE, 1);
3301         }
3302
3303         if (die > 100)
3304         {
3305                 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
3306         }
3307
3308         if (die < 8)
3309         {
3310                 clone_monster(caster_ptr, dir);
3311                 return;
3312         }
3313
3314         if (die < 14)
3315         {
3316                 speed_monster(caster_ptr, dir, plev);
3317                 return;
3318         }
3319
3320         if (die < 26)
3321         {
3322                 heal_monster(caster_ptr, dir, damroll(4, 6));
3323                 return;
3324         }
3325
3326         if (die < 31)
3327         {
3328                 poly_monster(caster_ptr, dir, plev);
3329                 return;
3330         }
3331
3332         if (die < 36)
3333         {
3334                 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_MISSILE, dir,
3335                         damroll(3 + ((plev - 1) / 5), 4));
3336                 return;
3337         }
3338
3339         if (die < 41)
3340         {
3341                 confuse_monster(caster_ptr, dir, plev);
3342                 return;
3343         }
3344
3345         if (die < 46)
3346         {
3347                 fire_ball(caster_ptr, GF_POIS, dir, 20 + (plev / 2), 3);
3348                 return;
3349         }
3350
3351         if (die < 51)
3352         {
3353                 (void)lite_line(caster_ptr, dir, damroll(6, 8));
3354                 return;
3355         }
3356
3357         if (die < 56)
3358         {
3359                 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_ELEC, dir,
3360                         damroll(3 + ((plev - 5) / 4), 8));
3361                 return;
3362         }
3363
3364         if (die < 61)
3365         {
3366                 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_COLD, dir,
3367                         damroll(5 + ((plev - 5) / 4), 8));
3368                 return;
3369         }
3370
3371         if (die < 66)
3372         {
3373                 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_ACID, dir,
3374                         damroll(6 + ((plev - 5) / 4), 8));
3375                 return;
3376         }
3377
3378         if (die < 71)
3379         {
3380                 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_FIRE, dir,
3381                         damroll(8 + ((plev - 5) / 4), 8));
3382                 return;
3383         }
3384
3385         if (die < 76)
3386         {
3387                 hypodynamic_bolt(caster_ptr, dir, 75);
3388                 return;
3389         }
3390
3391         if (die < 81)
3392         {
3393                 fire_ball(caster_ptr, GF_ELEC, dir, 30 + plev / 2, 2);
3394                 return;
3395         }
3396
3397         if (die < 86)
3398         {
3399                 fire_ball(caster_ptr, GF_ACID, dir, 40 + plev, 2);
3400                 return;
3401         }
3402
3403         if (die < 91)
3404         {
3405                 fire_ball(caster_ptr, GF_ICE, dir, 70 + plev, 3);
3406                 return;
3407         }
3408
3409         if (die < 96)
3410         {
3411                 fire_ball(caster_ptr, GF_FIRE, dir, 80 + plev, 3);
3412                 return;
3413         }
3414
3415         if (die < 101)
3416         {
3417                 hypodynamic_bolt(caster_ptr, dir, 100 + plev);
3418                 return;
3419         }
3420
3421         if (die < 104)
3422         {
3423                 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 12, 0);
3424                 return;
3425         }
3426
3427         if (die < 106)
3428         {
3429                 (void)destroy_area(caster_ptr, caster_ptr->y, caster_ptr->x, 13 + randint0(5), FALSE);
3430                 return;
3431         }
3432
3433         if (die < 108)
3434         {
3435                 symbol_genocide(caster_ptr, plev + 50, TRUE);
3436                 return;
3437         }
3438
3439         if (die < 110)
3440         {
3441                 dispel_monsters(caster_ptr, 120);
3442                 return;
3443         }
3444
3445         dispel_monsters(caster_ptr, 150);
3446         slow_monsters(caster_ptr, plev);
3447         sleep_monsters(caster_ptr, plev);
3448         hp_player(caster_ptr, 300);
3449 }
3450
3451
3452 /*!
3453 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
3454 * @param caster_ptr プレーヤーへの参照ポインタ
3455 * @param dir 方向ID
3456 * @return なし
3457 */
3458 void cast_invoke_spirits(player_type *caster_ptr, DIRECTION dir)
3459 {
3460         PLAYER_LEVEL plev = caster_ptr->lev;
3461         int die = randint1(100) + plev / 5;
3462         int vir = virtue_number(caster_ptr, V_CHANCE);
3463
3464         if (vir != 0)
3465         {
3466                 if (caster_ptr->virtues[vir - 1] > 0)
3467                 {
3468                         while (randint1(400) < caster_ptr->virtues[vir - 1]) die++;
3469                 }
3470                 else
3471                 {
3472                         while (randint1(400) < (0 - caster_ptr->virtues[vir - 1])) die--;
3473                 }
3474         }
3475
3476         msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
3477         if (die < 26)
3478                 chg_virtue(caster_ptr, V_CHANCE, 1);
3479
3480         if (die > 100)
3481         {
3482                 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
3483         }
3484
3485         if (die < 8)
3486         {
3487                 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
3488                         "Oh no! Mouldering forms rise from the earth around you!"));
3489
3490                 (void)summon_specific(caster_ptr, 0, caster_ptr->y, caster_ptr->x, caster_ptr->current_floor_ptr->dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
3491                 chg_virtue(caster_ptr, V_UNLIFE, 1);
3492         }
3493         else if (die < 14)
3494         {
3495                 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
3496
3497                 set_afraid(caster_ptr, caster_ptr->afraid + randint1(4) + 4);
3498         }
3499         else if (die < 26)
3500         {
3501                 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
3502                         "Your head is invaded by a horde of gibbering spectral voices..."));
3503
3504                 set_confused(caster_ptr, caster_ptr->confused + randint1(4) + 4);
3505         }
3506         else if (die < 31)
3507         {
3508                 poly_monster(caster_ptr, dir, plev);
3509         }
3510         else if (die < 36)
3511         {
3512                 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_MISSILE, dir,
3513                         damroll(3 + ((plev - 1) / 5), 4));
3514         }
3515         else if (die < 41)
3516         {
3517                 confuse_monster(caster_ptr, dir, plev);
3518         }
3519         else if (die < 46)
3520         {
3521                 fire_ball(caster_ptr, GF_POIS, dir, 20 + (plev / 2), 3);
3522         }
3523         else if (die < 51)
3524         {
3525                 (void)lite_line(caster_ptr, dir, damroll(6, 8));
3526         }
3527         else if (die < 56)
3528         {
3529                 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_ELEC, dir,
3530                         damroll(3 + ((plev - 5) / 4), 8));
3531         }
3532         else if (die < 61)
3533         {
3534                 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_COLD, dir,
3535                         damroll(5 + ((plev - 5) / 4), 8));
3536         }
3537         else if (die < 66)
3538         {
3539                 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_ACID, dir,
3540                         damroll(6 + ((plev - 5) / 4), 8));
3541         }
3542         else if (die < 71)
3543         {
3544                 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_FIRE, dir,
3545                         damroll(8 + ((plev - 5) / 4), 8));
3546         }
3547         else if (die < 76)
3548         {
3549                 hypodynamic_bolt(caster_ptr, dir, 75);
3550         }
3551         else if (die < 81)
3552         {
3553                 fire_ball(caster_ptr, GF_ELEC, dir, 30 + plev / 2, 2);
3554         }
3555         else if (die < 86)
3556         {
3557                 fire_ball(caster_ptr, GF_ACID, dir, 40 + plev, 2);
3558         }
3559         else if (die < 91)
3560         {
3561                 fire_ball(caster_ptr, GF_ICE, dir, 70 + plev, 3);
3562         }
3563         else if (die < 96)
3564         {
3565                 fire_ball(caster_ptr, GF_FIRE, dir, 80 + plev, 3);
3566         }
3567         else if (die < 101)
3568         {
3569                 hypodynamic_bolt(caster_ptr, dir, 100 + plev);
3570         }
3571         else if (die < 104)
3572         {
3573                 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 12, 0);
3574         }
3575         else if (die < 106)
3576         {
3577                 (void)destroy_area(caster_ptr, caster_ptr->y, caster_ptr->x, 13 + randint0(5), FALSE);
3578         }
3579         else if (die < 108)
3580         {
3581                 symbol_genocide(caster_ptr, plev + 50, TRUE);
3582         }
3583         else if (die < 110)
3584         {
3585                 dispel_monsters(caster_ptr, 120);
3586         }
3587         else
3588         {
3589                 dispel_monsters(caster_ptr, 150);
3590                 slow_monsters(caster_ptr, plev);
3591                 sleep_monsters(caster_ptr, plev);
3592                 hp_player(caster_ptr, 300);
3593         }
3594
3595         if (die < 31)
3596         {
3597                 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
3598                         "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
3599         }
3600 }
3601
3602
3603 /*!
3604 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
3605 * @param caster_ptr プレーヤーへの参照ポインタ
3606 * @return なし
3607 */
3608 void cast_shuffle(player_type *caster_ptr)
3609 {
3610         PLAYER_LEVEL plev = caster_ptr->lev;
3611         DIRECTION dir;
3612         int die;
3613         int vir = virtue_number(caster_ptr, V_CHANCE);
3614         int i;
3615
3616         if ((caster_ptr->pclass == CLASS_ROGUE) ||
3617                 (caster_ptr->pclass == CLASS_HIGH_MAGE) ||
3618                 (caster_ptr->pclass == CLASS_SORCERER))
3619                 die = (randint1(110)) + plev / 5;
3620         else
3621                 die = randint1(120);
3622
3623         if (vir)
3624         {
3625                 if (caster_ptr->virtues[vir - 1] > 0)
3626                 {
3627                         while (randint1(400) < caster_ptr->virtues[vir - 1]) die++;
3628                 }
3629                 else
3630                 {
3631                         while (randint1(400) < (0 - caster_ptr->virtues[vir - 1])) die--;
3632                 }
3633         }
3634
3635         msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
3636
3637         if (die < 30)
3638         {
3639                 chg_virtue(caster_ptr, V_CHANCE, 1);
3640         }
3641
3642         floor_type *floor_ptr = caster_ptr->current_floor_ptr;
3643         if (die < 7)
3644         {
3645                 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
3646
3647                 for (i = 0; i < randint1(3); i++)
3648                 {
3649                         activate_hi_summon(caster_ptr, caster_ptr->y, caster_ptr->x, FALSE);
3650                 }
3651
3652                 return;
3653         }
3654
3655         if (die < 14)
3656         {
3657                 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
3658                 summon_specific(caster_ptr, 0, caster_ptr->y, caster_ptr->x, floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
3659                 return;
3660         }
3661
3662         if (die < 18)
3663         {
3664                 int count = 0;
3665                 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
3666                 activate_ty_curse(caster_ptr, FALSE, &count);
3667                 return;
3668         }
3669
3670         if (die < 22)
3671         {
3672                 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
3673                 aggravate_monsters(caster_ptr, 0);
3674                 return;
3675         }
3676
3677         if (die < 26)
3678         {
3679                 msg_print(_("《愚者》だ。", "It's the Fool."));
3680                 do_dec_stat(caster_ptr, A_INT);
3681                 do_dec_stat(caster_ptr, A_WIS);
3682                 return;
3683         }
3684
3685         if (die < 30)
3686         {
3687                 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
3688                 trump_summoning(caster_ptr, 1, FALSE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
3689                 return;
3690         }
3691
3692         if (die < 33)
3693         {
3694                 msg_print(_("《月》だ。", "It's the Moon."));
3695                 unlite_area(caster_ptr, 10, 3);
3696                 return;
3697         }
3698
3699         if (die < 38)
3700         {
3701                 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
3702                 wild_magic(caster_ptr, randint0(32));
3703                 return;
3704         }
3705
3706         if (die < 40)
3707         {
3708                 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
3709                 teleport_player(caster_ptr, 10, TELEPORT_PASSIVE);
3710                 return;
3711         }
3712
3713         if (die < 42)
3714         {
3715                 msg_print(_("《正義》だ。", "It's Justice."));
3716                 set_blessed(caster_ptr, caster_ptr->lev, FALSE);
3717                 return;
3718         }
3719
3720         if (die < 47)
3721         {
3722                 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
3723                 teleport_player(caster_ptr, 100, TELEPORT_PASSIVE);
3724                 return;
3725         }
3726
3727         if (die < 52)
3728         {
3729                 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
3730                 teleport_player(caster_ptr, 200, TELEPORT_PASSIVE);
3731                 return;
3732         }
3733
3734         if (die < 60)
3735         {
3736                 msg_print(_("《塔》だ。", "It's the Tower."));
3737                 wall_breaker(caster_ptr);
3738                 return;
3739         }
3740
3741         if (die < 72)
3742         {
3743                 msg_print(_("《節制》だ。", "It's Temperance."));
3744                 sleep_monsters_touch(caster_ptr);
3745                 return;
3746         }
3747
3748         if (die < 80)
3749         {
3750                 msg_print(_("《塔》だ。", "It's the Tower."));
3751                 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 5, 0);
3752                 return;
3753         }
3754
3755         if (die < 82)
3756         {
3757                 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
3758                 trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_MOLD, 0L);
3759                 return;
3760         }
3761
3762         if (die < 84)
3763         {
3764                 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
3765                 trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_BAT, 0L);
3766                 return;
3767         }
3768
3769         if (die < 86)
3770         {
3771                 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
3772                 trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_VORTEX, 0L);
3773                 return;
3774         }
3775
3776         if (die < 88)
3777         {
3778                 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
3779                 trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
3780                 return;
3781         }
3782
3783         if (die < 96)
3784         {
3785                 msg_print(_("《恋人》だ。", "It's the Lovers."));
3786
3787                 if (get_aim_dir(caster_ptr, &dir))
3788                 {
3789                         charm_monster(caster_ptr, dir, MIN(caster_ptr->lev, 20));
3790                 }
3791
3792                 return;
3793         }
3794
3795         if (die < 101)
3796         {
3797                 msg_print(_("《隠者》だ。", "It's the Hermit."));
3798                 wall_stone(caster_ptr);
3799                 return;
3800         }
3801
3802         if (die < 111)
3803         {
3804                 msg_print(_("《審判》だ。", "It's the Judgement."));
3805                 roll_hitdice(caster_ptr, 0L);
3806                 lose_all_mutations(caster_ptr);
3807                 return;
3808         }
3809
3810         if (die < 120)
3811         {
3812                 msg_print(_("《太陽》だ。", "It's the Sun."));
3813                 chg_virtue(caster_ptr, V_KNOWLEDGE, 1);
3814                 chg_virtue(caster_ptr, V_ENLIGHTEN, 1);
3815                 wiz_lite(caster_ptr, FALSE);
3816                 return;
3817         }
3818
3819         msg_print(_("《世界》だ。", "It's the World."));
3820         if (caster_ptr->exp >= PY_MAX_EXP)
3821         {
3822                 return;
3823         }
3824
3825         s32b ee = (caster_ptr->exp / 25) + 1;
3826         if (ee > 5000) ee = 5000;
3827         msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
3828         gain_exp(caster_ptr, ee);
3829 }
3830
3831
3832 bool_hack vampirism(player_type *caster_ptr)
3833 {
3834         if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
3835         {
3836                 msg_print(_("なぜか攻撃することができない。", "Something prevents you from attacking."));
3837                 return FALSE;
3838         }
3839
3840         DIRECTION dir;
3841         if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return FALSE;
3842
3843         POSITION y = caster_ptr->y + ddy[dir];
3844         POSITION x = caster_ptr->x + ddx[dir];
3845         grid_type *g_ptr;
3846         g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
3847         stop_mouth(caster_ptr);
3848         if (!(g_ptr->m_idx))
3849         {
3850                 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
3851                 return FALSE;
3852         }
3853
3854         msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
3855
3856         int dummy = caster_ptr->lev * 2;
3857         if (!hypodynamic_bolt(caster_ptr, dir, dummy))
3858         {
3859                 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
3860                 return TRUE;
3861         }
3862
3863         if (caster_ptr->food < PY_FOOD_FULL)
3864                 (void)hp_player(caster_ptr, dummy);
3865         else
3866                 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
3867
3868         /* Gain nutritional sustenance: 150/hp drained */
3869         /* A Food ration gives 5000 food points (by contrast) */
3870         /* Don't ever get more than "Full" this way */
3871         /* But if we ARE Gorged,  it won't cure us */
3872         dummy = caster_ptr->food + MIN(5000, 100 * dummy);
3873         if (caster_ptr->food < PY_FOOD_MAX)   /* Not gorged already */
3874                 (void)set_food(caster_ptr, dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
3875         return TRUE;
3876 }
3877
3878
3879 /*!
3880 * ヒット&アウェイのレイシャルパワー/突然変異
3881 * @param caster_ptr プレーヤーへの参照ポインタ
3882 * @return コマンドの入力先にモンスターがいたらTRUE
3883 */
3884 bool hit_and_away(player_type *caster_ptr)
3885 {
3886         DIRECTION dir;
3887         if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return FALSE;
3888         POSITION y = caster_ptr->y + ddy[dir];
3889         POSITION x = caster_ptr->x + ddx[dir];
3890         if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
3891         {
3892                 py_attack(caster_ptr, y, x, 0);
3893                 if (randint0(caster_ptr->skill_dis) < 7)
3894                         msg_print(_("うまく逃げられなかった。", "You failed to run away."));
3895                 else
3896                         teleport_player(caster_ptr, 30, 0L);
3897                 return TRUE;
3898         }
3899
3900         msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
3901         msg_print(NULL);
3902         return FALSE;
3903 }
3904
3905
3906 /*!
3907 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
3908 * @param caster_ptr プレーヤーへの参照ポインタ
3909 * @return なし
3910 * @note
3911 * currently this function allows pseudo-id of any object,
3912 * including silly ones like potions & scrolls, which always
3913 * get '{average}'. This should be changed, either to stop such
3914 * items from being pseudo-id'd, or to allow psychometry to
3915 * detect whether the unidentified potion/scroll/etc is
3916 * good (Cure Light Wounds, Restore Strength, etc) or
3917 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
3918 */
3919 bool psychometry(player_type *caster_ptr)
3920 {
3921         concptr q = _("どのアイテムを調べますか?", "Meditate on which item? ");
3922         concptr s = _("調べるアイテムがありません。", "You have nothing appropriate.");
3923         object_type *o_ptr;
3924         OBJECT_IDX item;
3925         o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
3926         if (!o_ptr) return FALSE;
3927
3928         if (object_is_known(o_ptr))
3929         {
3930                 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
3931                 return TRUE;
3932         }
3933
3934         byte feel = value_check_aux1(o_ptr);
3935         GAME_TEXT o_name[MAX_NLEN];
3936         object_desc(caster_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
3937
3938         if (!feel)
3939         {
3940                 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
3941                 return TRUE;
3942         }
3943
3944 #ifdef JP
3945         msg_format("%sは%sという感じがする...", o_name, game_inscriptions[feel]);
3946 #else
3947         msg_format("You feel that the %s %s %s...",
3948                 o_name, ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
3949 #endif
3950
3951         o_ptr->ident |= (IDENT_SENSE);
3952         o_ptr->feeling = feel;
3953         o_ptr->marked |= OM_TOUCHED;
3954
3955         caster_ptr->update |= (PU_COMBINE | PU_REORDER);
3956         caster_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
3957
3958         bool okay = FALSE;
3959         switch (o_ptr->tval)
3960         {
3961         case TV_SHOT:
3962         case TV_ARROW:
3963         case TV_BOLT:
3964         case TV_BOW:
3965         case TV_DIGGING:
3966         case TV_HAFTED:
3967         case TV_POLEARM:
3968         case TV_SWORD:
3969         case TV_BOOTS:
3970         case TV_GLOVES:
3971         case TV_HELM:
3972         case TV_CROWN:
3973         case TV_SHIELD:
3974         case TV_CLOAK:
3975         case TV_SOFT_ARMOR:
3976         case TV_HARD_ARMOR:
3977         case TV_DRAG_ARMOR:
3978         case TV_CARD:
3979         case TV_RING:
3980         case TV_AMULET:
3981         case TV_LITE:
3982         case TV_FIGURINE:
3983                 okay = TRUE;
3984                 break;
3985         }
3986
3987         autopick_alter_item(caster_ptr, item, (bool)(okay && destroy_feeling));
3988         return TRUE;
3989 }
3990
3991
3992 bool draconian_breath(player_type *creature_ptr)
3993 {
3994         int Type = (one_in_(3) ? GF_COLD : GF_FIRE);
3995         concptr Type_desc = ((Type == GF_COLD) ? _("冷気", "cold") : _("炎", "fire"));
3996         DIRECTION dir;
3997         if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
3998
3999         if (randint1(100) < creature_ptr->lev)
4000         {
4001                 switch (creature_ptr->pclass)
4002                 {
4003                 case CLASS_WARRIOR:
4004                 case CLASS_BERSERKER:
4005                 case CLASS_RANGER:
4006                 case CLASS_TOURIST:
4007                 case CLASS_IMITATOR:
4008                 case CLASS_ARCHER:
4009                 case CLASS_SMITH:
4010                         if (one_in_(3))
4011                         {
4012                                 Type = GF_MISSILE;
4013                                 Type_desc = _("エレメント", "the elements");
4014                         }
4015                         else
4016                         {
4017                                 Type = GF_SHARDS;
4018                                 Type_desc = _("破片", "shards");
4019                         }
4020
4021                         break;
4022                 case CLASS_MAGE:
4023                 case CLASS_WARRIOR_MAGE:
4024                 case CLASS_HIGH_MAGE:
4025                 case CLASS_SORCERER:
4026                 case CLASS_MAGIC_EATER:
4027                 case CLASS_RED_MAGE:
4028                 case CLASS_BLUE_MAGE:
4029                 case CLASS_MIRROR_MASTER:
4030                         if (one_in_(3))
4031                         {
4032                                 Type = GF_MANA;
4033                                 Type_desc = _("魔力", "mana");
4034                         }
4035                         else
4036                         {
4037                                 Type = GF_DISENCHANT;
4038                                 Type_desc = _("劣化", "disenchantment");
4039                         }
4040
4041                         break;
4042                 case CLASS_CHAOS_WARRIOR:
4043                         if (!one_in_(3))
4044                         {
4045                                 Type = GF_CONFUSION;
4046                                 Type_desc = _("混乱", "confusion");
4047                         }
4048                         else
4049                         {
4050                                 Type = GF_CHAOS;
4051                                 Type_desc = _("カオス", "chaos");
4052                         }
4053
4054                         break;
4055                 case CLASS_MONK:
4056                 case CLASS_SAMURAI:
4057                 case CLASS_FORCETRAINER:
4058                         if (!one_in_(3))
4059                         {
4060                                 Type = GF_CONFUSION;
4061                                 Type_desc = _("混乱", "confusion");
4062                         }
4063                         else
4064                         {
4065                                 Type = GF_SOUND;
4066                                 Type_desc = _("轟音", "sound");
4067                         }
4068
4069                         break;
4070                 case CLASS_MINDCRAFTER:
4071                         if (!one_in_(3))
4072                         {
4073                                 Type = GF_CONFUSION;
4074                                 Type_desc = _("混乱", "confusion");
4075                         }
4076                         else
4077                         {
4078                                 Type = GF_PSI;
4079                                 Type_desc = _("精神エネルギー", "mental energy");
4080                         }
4081
4082                         break;
4083                 case CLASS_PRIEST:
4084                 case CLASS_PALADIN:
4085                         if (one_in_(3))
4086                         {
4087                                 Type = GF_HELL_FIRE;
4088                                 Type_desc = _("地獄の劫火", "hellfire");
4089                         }
4090                         else
4091                         {
4092                                 Type = GF_HOLY_FIRE;
4093                                 Type_desc = _("聖なる炎", "holy fire");
4094                         }
4095
4096                         break;
4097                 case CLASS_ROGUE:
4098                 case CLASS_NINJA:
4099                         if (one_in_(3))
4100                         {
4101                                 Type = GF_DARK;
4102                                 Type_desc = _("暗黒", "darkness");
4103                         }
4104                         else
4105                         {
4106                                 Type = GF_POIS;
4107                                 Type_desc = _("毒", "poison");
4108                         }
4109
4110                         break;
4111                 case CLASS_BARD:
4112                         if (!one_in_(3))
4113                         {
4114                                 Type = GF_SOUND;
4115                                 Type_desc = _("轟音", "sound");
4116                         }
4117                         else
4118                         {
4119                                 Type = GF_CONFUSION;
4120                                 Type_desc = _("混乱", "confusion");
4121                         }
4122
4123                         break;
4124                 }
4125         }
4126
4127         stop_mouth(creature_ptr);
4128         msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), Type_desc);
4129
4130         fire_breath(creature_ptr, Type, dir, creature_ptr->lev * 2, (creature_ptr->lev / 15) + 1);
4131         return TRUE;
4132 }
4133
4134
4135 bool android_inside_weapon(player_type *creature_ptr)
4136 {
4137         DIRECTION dir;
4138         if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
4139
4140         if (creature_ptr->lev < 10)
4141         {
4142                 msg_print(_("レイガンを発射した。", "You fire your ray gun."));
4143                 fire_bolt(creature_ptr, GF_MISSILE, dir, (creature_ptr->lev + 1) / 2);
4144                 return TRUE;
4145         }
4146
4147         if (creature_ptr->lev < 25)
4148         {
4149                 msg_print(_("ブラスターを発射した。", "You fire your blaster."));
4150                 fire_bolt(creature_ptr, GF_MISSILE, dir, creature_ptr->lev);
4151                 return TRUE;
4152         }
4153
4154         if (creature_ptr->lev < 35)
4155         {
4156                 msg_print(_("バズーカを発射した。", "You fire your bazooka."));
4157                 fire_ball(creature_ptr, GF_MISSILE, dir, creature_ptr->lev * 2, 2);
4158                 return TRUE;
4159         }
4160
4161         if (creature_ptr->lev < 45)
4162         {
4163                 msg_print(_("ビームキャノンを発射した。", "You fire a beam cannon."));
4164                 fire_beam(creature_ptr, GF_MISSILE, dir, creature_ptr->lev * 2);
4165                 return TRUE;
4166         }
4167
4168         msg_print(_("ロケットを発射した。", "You fire a rocket."));
4169         fire_rocket(creature_ptr, GF_ROCKET, dir, creature_ptr->lev * 5, 2);
4170         return TRUE;
4171 }
4172
4173
4174 bool create_ration(player_type *creature_ptr)
4175 {
4176         object_type *q_ptr;
4177         object_type forge;
4178         q_ptr = &forge;
4179
4180         /* Create the food ration */
4181         object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION));
4182
4183         /* Drop the object from heaven */
4184         (void)drop_near(creature_ptr, q_ptr, -1, creature_ptr->y, creature_ptr->x);
4185         msg_print(_("食事を料理して作った。", "You cook some food."));
4186         return TRUE;
4187 }
4188
4189
4190 void hayagake(player_type *creature_ptr)
4191 {
4192         if (creature_ptr->action == ACTION_HAYAGAKE)
4193         {
4194                 set_action(creature_ptr, ACTION_NONE);
4195                 creature_ptr->energy_use = 0;
4196                 return;
4197         }
4198
4199         grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
4200         feature_type *f_ptr = &f_info[g_ptr->feat];
4201
4202         if (!have_flag(f_ptr->flags, FF_PROJECT) ||
4203                 (!creature_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP)))
4204         {
4205                 msg_print(_("ここでは素早く動けない。", "You cannot run in here."));
4206         }
4207         else
4208         {
4209                 set_action(creature_ptr, ACTION_HAYAGAKE);
4210         }
4211
4212         creature_ptr->energy_use = 0;
4213 }
4214
4215
4216 bool double_attack(player_type *creature_ptr)
4217 {
4218         DIRECTION dir;
4219         if (!get_rep_dir(creature_ptr, &dir, FALSE)) return FALSE;
4220         POSITION y = creature_ptr->y + ddy[dir];
4221         POSITION x = creature_ptr->x + ddx[dir];
4222         if (!creature_ptr->current_floor_ptr->grid_array[y][x].m_idx)
4223         {
4224                 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
4225                 msg_print(NULL);
4226                 return TRUE;
4227         }
4228
4229         if (one_in_(3))
4230                 msg_print(_("あーたたたたたたたたたたたたたたたたたたたたたた!!!",
4231                         "Ahhhtatatatatatatatatatatatatatataatatatatattaaaaa!!!!"));
4232         else if (one_in_(2))
4233                 msg_print(_("無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄!!!",
4234                         "Mudamudamudamudamudamudamudamudamudamudamudamudamuda!!!!"));
4235         else
4236                 msg_print(_("オラオラオラオラオラオラオラオラオラオラオラオラ!!!",
4237                         "Oraoraoraoraoraoraoraoraoraoraoraoraoraoraoraoraora!!!!"));
4238
4239         py_attack(creature_ptr, y, x, 0);
4240         if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx)
4241         {
4242                 handle_stuff(creature_ptr);
4243                 py_attack(creature_ptr, y, x, 0);
4244         }
4245
4246         creature_ptr->energy_need += ENERGY_NEED();
4247         return TRUE;
4248 }
4249
4250
4251 bool comvert_hp_to_mp(player_type *creature_ptr)
4252 {
4253         int gain_sp = take_hit(creature_ptr, DAMAGE_USELIFE, creature_ptr->lev, _("HPからMPへの無謀な変換", "thoughtless conversion from HP to SP"), -1) / 5;
4254         if (!gain_sp)
4255         {
4256                 msg_print(_("変換に失敗した。", "You failed to convert."));
4257                 creature_ptr->redraw |= (PR_HP | PR_MANA);
4258                 return TRUE;
4259         }
4260
4261         creature_ptr->csp += gain_sp;
4262         if (creature_ptr->csp > creature_ptr->msp)
4263         {
4264                 creature_ptr->csp = creature_ptr->msp;
4265                 creature_ptr->csp_frac = 0;
4266         }
4267
4268         creature_ptr->redraw |= (PR_HP | PR_MANA);
4269         return TRUE;
4270 }
4271
4272
4273 bool comvert_mp_to_hp(player_type *creature_ptr)
4274 {
4275         if (creature_ptr->csp >= creature_ptr->lev / 5)
4276         {
4277                 creature_ptr->csp -= creature_ptr->lev / 5;
4278                 hp_player(creature_ptr, creature_ptr->lev);
4279         }
4280         else
4281         {
4282                 msg_print(_("変換に失敗した。", "You failed to convert."));
4283         }
4284
4285         creature_ptr->redraw |= (PR_HP | PR_MANA);
4286         return TRUE;
4287 }
4288
4289
4290 bool demonic_breath(player_type *creature_ptr)
4291 {
4292         DIRECTION dir;
4293         int type = (one_in_(2) ? GF_NETHER : GF_FIRE);
4294         if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
4295         stop_mouth(creature_ptr);
4296         msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), ((type == GF_NETHER) ? _("地獄", "nether") : _("火炎", "fire")));
4297         fire_breath(creature_ptr, type, dir, creature_ptr->lev * 3, (creature_ptr->lev / 15) + 1);
4298         return TRUE;
4299 }
4300
4301
4302 /*!
4303  * 静水
4304  * @param creature_ptr プレーヤーへの参照ポインタ
4305  * @return ペットを操っている場合を除きTRUE
4306 */
4307 bool mirror_concentration(player_type *creature_ptr)
4308 {
4309         if (total_friends)
4310         {
4311                 msg_print(_("今はペットを操ることに集中していないと。", "Your pets demand all of your attention."));
4312                 return FALSE;
4313         }
4314
4315         if (!is_mirror_grid(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]))
4316         {
4317                 msg_print(_("鏡の上でないと集中できない!", "There's no mirror here!"));
4318                 return TRUE;
4319         }
4320
4321         msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
4322
4323         creature_ptr->csp += (5 + creature_ptr->lev * creature_ptr->lev / 100);
4324         if (creature_ptr->csp >= creature_ptr->msp)
4325         {
4326                 creature_ptr->csp = creature_ptr->msp;
4327                 creature_ptr->csp_frac = 0;
4328         }
4329
4330         creature_ptr->redraw |= PR_MANA;
4331         return TRUE;
4332 }
4333
4334
4335 /*!
4336  * 剣の舞い
4337  * @param creature_ptr プレーヤーへの参照ポインタ
4338  * @return 常にTRUE
4339 */
4340 bool sword_dancing(player_type *creature_ptr)
4341 {
4342         DIRECTION dir;
4343         POSITION y = 0, x = 0;
4344         grid_type *g_ptr;
4345         for (int i = 0; i < 6; i++)
4346         {
4347                 dir = randint0(8);
4348                 y = creature_ptr->y + ddy_ddd[dir];
4349                 x = creature_ptr->x + ddx_ddd[dir];
4350                 g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
4351
4352                 /* Hack -- attack monsters */
4353                 if (g_ptr->m_idx)
4354                         py_attack(creature_ptr, y, x, 0);
4355                 else
4356                 {
4357                         msg_print(_("攻撃が空をきった。", "You attack the empty air."));
4358                 }
4359         }
4360
4361         return TRUE;
4362 }
4363
4364
4365 /*!
4366  * 幻惑の光
4367  * @param creature_ptr プレーヤーへの参照ポインタ
4368  * @return 常にTRUE
4369 */
4370 bool confusing_light(player_type *creature_ptr)
4371 {
4372         msg_print(_("辺りを睨んだ...", "You glare nearby monsters..."));
4373         slow_monsters(creature_ptr, creature_ptr->lev);
4374         stun_monsters(creature_ptr, creature_ptr->lev * 4);
4375         confuse_monsters(creature_ptr, creature_ptr->lev * 4);
4376         turn_monsters(creature_ptr, creature_ptr->lev * 4);
4377         stasis_monsters(creature_ptr, creature_ptr->lev * 4);
4378         return TRUE;
4379 }
4380
4381
4382 /*!
4383  * 荒馬慣らし
4384  * @param creature_ptr プレーヤーへの参照ポインタ
4385  * @return 結果はどうあれ騎乗したらTRUE
4386 */
4387 bool rodeo(player_type *creature_ptr)
4388 {
4389         GAME_TEXT m_name[MAX_NLEN];
4390         monster_type *m_ptr;
4391         monster_race *r_ptr;
4392         int rlev;
4393
4394         if (creature_ptr->riding)
4395         {
4396                 msg_print(_("今は乗馬中だ。", "You ARE riding."));
4397                 return FALSE;
4398         }
4399
4400         if (!do_cmd_riding(creature_ptr, TRUE)) return TRUE;
4401
4402         m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
4403         r_ptr = &r_info[m_ptr->r_idx];
4404         monster_desc(creature_ptr, m_name, m_ptr, 0);
4405         msg_format(_("%sに乗った。", "You ride on %s."), m_name);
4406
4407         if (is_pet(m_ptr)) return TRUE;
4408
4409         rlev = r_ptr->level;
4410
4411         if (r_ptr->flags1 & RF1_UNIQUE) rlev = rlev * 3 / 2;
4412         if (rlev > 60) rlev = 60 + (rlev - 60) / 2;
4413         if ((randint1(creature_ptr->skill_exp[GINOU_RIDING] / 120 + creature_ptr->lev * 2 / 3) > rlev)
4414                 && one_in_(2) && !creature_ptr->current_floor_ptr->inside_arena && !creature_ptr->phase_out
4415                 && !(r_ptr->flags7 & (RF7_GUARDIAN)) && !(r_ptr->flags1 & (RF1_QUESTOR))
4416                 && (rlev < creature_ptr->lev * 3 / 2 + randint0(creature_ptr->lev / 5)))
4417         {
4418                 msg_format(_("%sを手なずけた。", "You tame %s."), m_name);
4419                 set_pet(creature_ptr, m_ptr);
4420         }
4421         else
4422         {
4423                 msg_format(_("%sに振り落とされた!", "You have been thrown off by %s."), m_name);
4424                 rakuba(creature_ptr, 1, TRUE);
4425
4426                 /* 落馬処理に失敗してもとにかく乗馬解除 */
4427                 creature_ptr->riding = 0;
4428         }
4429
4430         return TRUE;
4431 }
4432
4433
4434 bool clear_mind(player_type *creature_ptr)
4435 {
4436         if (total_friends)
4437         {
4438                 msg_print(_("今はペットを操ることに集中していないと。", "Your pets demand all of your attention."));
4439                 return FALSE;
4440         }
4441
4442         msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
4443
4444         creature_ptr->csp += (3 + creature_ptr->lev / 20);
4445         if (creature_ptr->csp >= creature_ptr->msp)
4446         {
4447                 creature_ptr->csp = creature_ptr->msp;
4448                 creature_ptr->csp_frac = 0;
4449         }
4450
4451         creature_ptr->redraw |= (PR_MANA);
4452         return TRUE;
4453 }
4454
4455
4456 bool concentration(player_type *creature_ptr)
4457 {
4458         int max_csp = MAX(creature_ptr->msp * 4, creature_ptr->lev * 5 + 5);
4459
4460         if (total_friends)
4461         {
4462                 msg_print(_("今はペットを操ることに集中していないと。", "Your pets demand all of your attention."));
4463                 return FALSE;
4464         }
4465
4466         if (creature_ptr->special_defense & KATA_MASK)
4467         {
4468                 msg_print(_("今は構えに集中している。", "You're already concentrating on your stance."));
4469                 return FALSE;
4470         }
4471
4472         msg_print(_("精神を集中して気合いを溜めた。", "You concentrate to charge your power."));
4473
4474         creature_ptr->csp += creature_ptr->msp / 2;
4475         if (creature_ptr->csp >= max_csp)
4476         {
4477                 creature_ptr->csp = max_csp;
4478                 creature_ptr->csp_frac = 0;
4479         }
4480
4481         creature_ptr->redraw |= PR_MANA;
4482         return TRUE;
4483 }