OSDN Git Service

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