OSDN Git Service

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