OSDN Git Service

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