OSDN Git Service

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