OSDN Git Service

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