OSDN Git Service

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