OSDN Git Service

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