OSDN Git Service

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