OSDN Git Service

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