OSDN Git Service

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