OSDN Git Service

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