OSDN Git Service

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