OSDN Git Service

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