OSDN Git Service

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