OSDN Git Service

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