OSDN Git Service

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