OSDN Git Service

[Refactor] #37353 PROJECT_* 定義を新規ファイル projection.h へ移動。 / Move PROJECT_* definition...
[hengband/hengband.git] / src / cmd-activate.c
1 /*!
2 * @file cmd-activate.c
3 * @brief プレイヤーの発動コマンド実装
4 * @date 2018/09/07
5 * @details
6 * cmd6.cより分離。
7 */
8
9 #include "angband.h"
10 #include "cmd-activate.h"
11 #include "object-hook.h"
12 #include "spells-summon.h"
13 #include "sort.h"
14 #include "projection.h"
15
16 /*!
17 * @brief ペット入りモンスターボールをソートするための比較関数
18 * @param u 所持品配列の参照ポインタ
19 * @param v 未使用
20 * @param a 所持品ID1
21 * @param b 所持品ID2
22 * @return 1の方が大であればTRUE
23 */
24 static bool ang_sort_comp_pet(vptr u, vptr v, int a, int b)
25 {
26         u16b *who = (u16b*)(u);
27
28         int w1 = who[a];
29         int w2 = who[b];
30
31         monster_type *m_ptr1 = &m_list[w1];
32         monster_type *m_ptr2 = &m_list[w2];
33         monster_race *r_ptr1 = &r_info[m_ptr1->r_idx];
34         monster_race *r_ptr2 = &r_info[m_ptr2->r_idx];
35
36         /* Unused */
37         (void)v;
38
39         if (m_ptr1->nickname && !m_ptr2->nickname) return TRUE;
40         if (m_ptr2->nickname && !m_ptr1->nickname) return FALSE;
41
42         if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return TRUE;
43         if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return FALSE;
44
45         if (r_ptr1->level > r_ptr2->level) return TRUE;
46         if (r_ptr2->level > r_ptr1->level) return FALSE;
47
48         if (m_ptr1->hp > m_ptr2->hp) return TRUE;
49         if (m_ptr2->hp > m_ptr1->hp) return FALSE;
50
51         return w1 <= w2;
52 }
53
54
55 /*!
56  * @brief 装備を発動するコマンドのサブルーチン /
57  * Activate a wielded object.  Wielded objects never stack.
58  * And even if they did, activatable objects never stack.
59  * @param item 発動するオブジェクトの所持品ID
60  * @return なし
61  * @details
62  * <pre>
63  * Currently, only (some) artifacts, and Dragon Scale Mail, can be activated.
64  * But one could, for example, easily make an activatable "Ring of Plasma".
65  * Note that it always takes a turn to activate an artifact, even if
66  * the user hits "escape" at the "direction" prompt.
67  * </pre>
68  */
69 void do_cmd_activate_aux(INVENTORY_IDX item)
70 {
71         DIRECTION dir;
72         DEPTH lev;
73         int chance, fail;
74         object_type *o_ptr;
75         bool success;
76
77
78         /* Get the item (in the pack) */
79         if (item >= 0)
80         {
81                 o_ptr = &inventory[item];
82         }
83
84         /* Get the item (on the floor) */
85         else
86         {
87                 o_ptr = &o_list[0 - item];
88         }
89
90         p_ptr->energy_use = 100;
91
92         /* Extract the item level */
93         lev = k_info[o_ptr->k_idx].level;
94
95         /* Hack -- use artifact level instead */
96         if (object_is_fixed_artifact(o_ptr)) lev = a_info[o_ptr->name1].level;
97         else if (object_is_random_artifact(o_ptr))
98         {
99                 const activation_type* const act_ptr = find_activation_info(o_ptr);
100                 if (act_ptr) {
101                         lev = act_ptr->level;
102                 }
103         }
104         else if (((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)) && o_ptr->name2) lev = e_info[o_ptr->name2].level;
105
106         /* Base chance of success */
107         chance = p_ptr->skill_dev;
108
109         /* Confusion hurts skill */
110         if (p_ptr->confused) chance = chance / 2;
111
112         fail = lev+5;
113         if (chance > fail) fail -= (chance - fail)*2;
114         else chance -= (fail - chance)*2;
115         if (fail < USE_DEVICE) fail = USE_DEVICE;
116         if (chance < USE_DEVICE) chance = USE_DEVICE;
117
118         if (world_player)
119         {
120                 if (flush_failure) flush();
121                 msg_print(_("止まった時の中ではうまく働かないようだ。", "It shows no reaction."));
122                 sound(SOUND_FAIL);
123                 return;
124         }
125
126         if (p_ptr->pclass == CLASS_BERSERKER) success = FALSE;
127         else if (chance > fail)
128         {
129                 if (randint0(chance*2) < fail) success = FALSE;
130                 else success = TRUE;
131         }
132         else
133         {
134                 if (randint0(fail*2) < chance) success = TRUE;
135                 else success = FALSE;
136         }
137
138         /* Roll for usage */
139         if (!success)
140         {
141                 if (flush_failure) flush();
142                 msg_print(_("うまく始動させることができなかった。", "You failed to activate it properly."));
143                 sound(SOUND_FAIL);
144                 return;
145         }
146
147         /* Check the recharge */
148         if (o_ptr->timeout)
149         {
150                 msg_print(_("それは微かに音を立て、輝き、消えた...", "It whines, glows and fades..."));
151                 return;
152         }
153
154         /* Some lights need enough fuel for activation */
155         if (!o_ptr->xtra4 && (o_ptr->tval == TV_FLASK) &&
156                 ((o_ptr->sval == SV_LITE_TORCH) || (o_ptr->sval == SV_LITE_LANTERN)))
157         {
158                 msg_print(_("燃料がない。", "It has no fuel."));
159                 p_ptr->energy_use = 0;
160                 return;
161         }
162
163         /* Activate the artifact */
164         msg_print(_("始動させた...", "You activate it..."));
165
166         sound(SOUND_ZAP);
167
168         /* Activate object */
169         if (activation_index(o_ptr))
170         {
171                 (void)activate_artifact(o_ptr);
172
173                 p_ptr->window |= (PW_INVEN | PW_EQUIP);
174
175                 /* Success */
176                 return;
177         }
178
179         /* Special items */
180         else if (o_ptr->tval == TV_WHISTLE)
181         {
182                 if (music_singing_any()) stop_singing();
183                 if (hex_spelling_any()) stop_hex_spell_all();
184
185                 {
186                         IDX pet_ctr, i;
187                         MONSTER_IDX *who;
188                         int max_pet = 0;
189                         u16b dummy_why;
190
191                         /* Allocate the "who" array */
192                         C_MAKE(who, max_m_idx, MONSTER_IDX);
193
194                         /* Process the monsters (backwards) */
195                         for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--)
196                         {
197                                 if (is_pet(&m_list[pet_ctr]) && (p_ptr->riding != pet_ctr))
198                                   who[max_pet++] = pet_ctr;
199                         }
200
201                         /* Select the sort method */
202                         ang_sort_comp = ang_sort_comp_pet;
203                         ang_sort_swap = ang_sort_swap_hook;
204
205                         ang_sort(who, &dummy_why, max_pet);
206
207                         /* Process the monsters (backwards) */
208                         for (i = 0; i < max_pet; i++)
209                         {
210                                 pet_ctr = who[i];
211                                 teleport_monster_to(pet_ctr, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE);
212                         }
213
214                         /* Free the "who" array */
215                         C_KILL(who, max_m_idx, IDX);
216                 }
217                 o_ptr->timeout = 100 + randint1(100);
218                 return;
219         }
220         else if (o_ptr->tval == TV_CAPTURE)
221         {
222                 if(!o_ptr->pval)
223                 {
224                         bool old_target_pet = target_pet;
225                         target_pet = TRUE;
226                         if (!get_aim_dir(&dir))
227                         {
228                                 target_pet = old_target_pet;
229                                 return;
230                         }
231                         target_pet = old_target_pet;
232
233                         if(fire_ball(GF_CAPTURE, dir, 0, 0))
234                         {
235                                 o_ptr->pval = (PARAMETER_VALUE)cap_mon;
236                                 o_ptr->xtra3 = (XTRA8)cap_mspeed;
237                                 o_ptr->xtra4 = (XTRA16)cap_hp;
238                                 o_ptr->xtra5 = (XTRA16)cap_maxhp;
239                                 if (cap_nickname)
240                                 {
241                                         concptr t;
242                                         char *s;
243                                         char buf[80] = "";
244
245                                         if (o_ptr->inscription)
246                                                 strcpy(buf, quark_str(o_ptr->inscription));
247                                         s = buf;
248                                         for (s = buf;*s && (*s != '#'); s++)
249                                         {
250 #ifdef JP
251                                                 if (iskanji(*s)) s++;
252 #endif
253                                         }
254                                         *s = '#';
255                                         s++;
256 #ifdef JP
257  /*nothing*/
258 #else
259                                         *s++ = '\'';
260 #endif
261                                         t = quark_str(cap_nickname);
262                                         while (*t)
263                                         {
264                                                 *s = *t;
265                                                 s++;
266                                                 t++;
267                                         }
268 #ifdef JP
269  /*nothing*/
270 #else
271                                         *s++ = '\'';
272 #endif
273                                         *s = '\0';
274                                         o_ptr->inscription = quark_add(buf);
275                                 }
276                         }
277                 }
278                 else
279                 {
280                         success = FALSE;
281                         if (!get_direction(&dir, FALSE, FALSE)) return;
282                         if (monster_can_enter(p_ptr->y + ddy[dir], p_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0))
283                         {
284                                 if (place_monster_aux(0, p_ptr->y + ddy[dir], p_ptr->x + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE)))
285                                 {
286                                         if (o_ptr->xtra3) m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3;
287                                         if (o_ptr->xtra5) m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5;
288                                         if (o_ptr->xtra4) m_list[hack_m_idx_ii].hp = o_ptr->xtra4;
289                                         m_list[hack_m_idx_ii].maxhp = m_list[hack_m_idx_ii].max_maxhp;
290                                         if (o_ptr->inscription)
291                                         {
292                                                 char buf[80];
293                                                 concptr t;
294 #ifndef JP
295                                                 bool quote = FALSE;
296 #endif
297
298                                                 t = quark_str(o_ptr->inscription);
299                                                 for (t = quark_str(o_ptr->inscription);*t && (*t != '#'); t++)
300                                                 {
301 #ifdef JP
302                                                         if (iskanji(*t)) t++;
303 #endif
304                                                 }
305                                                 if (*t)
306                                                 {
307                                                         char *s = buf;
308                                                         t++;
309 #ifdef JP
310                                                         /* nothing */
311 #else
312                                                         if (*t =='\'')
313                                                         {
314                                                                 t++;
315                                                                 quote = TRUE;
316                                                         }
317 #endif
318                                                         while(*t)
319                                                         {
320                                                                 *s = *t;
321                                                                 t++;
322                                                                 s++;
323                                                         }
324 #ifdef JP
325                                                         /* nothing */
326 #else
327                                                         if (quote && *(s-1) =='\'')
328                                                                 s--;
329 #endif
330                                                         *s = '\0';
331                                                         m_list[hack_m_idx_ii].nickname = quark_add(buf);
332                                                         t = quark_str(o_ptr->inscription);
333                                                         s = buf;
334                                                         while(*t && (*t != '#'))
335                                                         {
336                                                                 *s = *t;
337                                                                 t++;
338                                                                 s++;
339                                                         }
340                                                         *s = '\0';
341                                                         o_ptr->inscription = quark_add(buf);
342                                                 }
343                                         }
344                                         o_ptr->pval = 0;
345                                         o_ptr->xtra3 = 0;
346                                         o_ptr->xtra4 = 0;
347                                         o_ptr->xtra5 = 0;
348                                         success = TRUE;
349                                 }
350                         }
351                         if (!success)
352                                 msg_print(_("おっと、解放に失敗した。", "Oops.  You failed to release your pet."));
353                 }
354                 calc_android_exp();
355                 return;
356         }
357
358         /* Mistake */
359         msg_print(_("おっと、このアイテムは始動できない。", "Oops.  That object cannot be activated."));
360 }
361
362 /*!
363  * @brief 装備を発動するコマンドのメインルーチン /
364  * @return なし
365  */
366 void do_cmd_activate(void)
367 {
368         OBJECT_IDX item;
369         concptr q, s;
370
371         if (p_ptr->wild_mode) return;
372
373         if (p_ptr->inside_arena)
374         {
375                 msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
376                 msg_print(NULL);
377                 return;
378         }
379
380         if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
381         {
382                 set_action(ACTION_NONE);
383         }
384
385         item_tester_hook = item_tester_hook_activate;
386
387         q = _("どのアイテムを始動させますか? ", "Activate which item? ");
388         s = _("始動できるアイテムを装備していない。", "You have nothing to activate.");
389
390         if (!choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT))) return;
391
392         /* Activate the item */
393         do_cmd_activate_aux(item);
394 }
395
396 /*!
397 * @brief 発動によるブレスの属性をアイテムの耐性から選択し、実行を処理する。/ Dragon breath activation
398 * @details 対象となる耐性は dragonbreath_info テーブルを参照のこと。
399 * @param o_ptr 対象のオブジェクト構造体ポインタ
400 * @return 発動実行の是非を返す。
401 */
402 static bool activate_dragon_breath(object_type *o_ptr)
403 {
404         BIT_FLAGS flgs[TR_FLAG_SIZE]; /* for resistance flags */
405         int type[20];
406         concptr name[20];
407         int i, t, n = 0;
408         DIRECTION dir;
409
410         if (!get_aim_dir(&dir)) return FALSE;
411
412         object_flags(o_ptr, flgs);
413
414         for (i = 0; dragonbreath_info[i].flag != 0; i++)
415         {
416                 if (have_flag(flgs, dragonbreath_info[i].flag))
417                 {
418                         type[n] = dragonbreath_info[i].type;
419                         name[n] = dragonbreath_info[i].name;
420                         n++;
421                 }
422         }
423
424         /* Paranoia */
425         if (n == 0) return FALSE;
426
427         /* Stop speaking */
428         if (music_singing_any()) stop_singing();
429         if (hex_spelling_any()) stop_hex_spell_all();
430
431         t = randint0(n);
432         msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), name[t]);
433         fire_breath(type[t], dir, 250, 4);
434
435         return TRUE;
436 }
437
438 /*!
439  * @brief アイテムの発動効果を処理する。
440  * @param o_ptr 対象のオブジェクト構造体ポインタ
441  * @return 発動実行の是非を返す。
442  */
443 bool activate_artifact(object_type *o_ptr)
444 {
445         PLAYER_LEVEL plev = p_ptr->lev;
446         int k, dummy = 0;
447         DIRECTION dir;
448         concptr name = k_name + k_info[o_ptr->k_idx].name;
449         const activation_type* const act_ptr = find_activation_info(o_ptr);
450
451         /* Paranoia */
452         if (!act_ptr) {
453                 /* Maybe forgot adding information to activation_info table ? */
454                 msg_print("Activation information is not found.");
455                 return FALSE;
456         }
457
458         /* Activate for attack */
459         switch (act_ptr->index)
460         {
461         case ACT_SUNLIGHT:
462         {
463                 if (!get_aim_dir(&dir)) return FALSE;
464                 msg_print(_("太陽光線が放たれた。", "A line of sunlight appears."));
465                 (void)lite_line(dir, damroll(6, 8));
466                 break;
467         }
468
469         case ACT_BO_MISS_1:
470         {
471                 msg_print(_("それは眩しいくらいに明るく輝いている...", "It glows extremely brightly..."));
472                 if (!get_aim_dir(&dir)) return FALSE;
473                 fire_bolt(GF_MISSILE, dir, damroll(2, 6));
474                 break;
475         }
476
477         case ACT_BA_POIS_1:
478         {
479                 msg_print(_("それは濃緑色に脈動している...", "It throbs deep green..."));
480                 if (!get_aim_dir(&dir)) return FALSE;
481                 fire_ball(GF_POIS, dir, 12, 3);
482                 break;
483         }
484
485         case ACT_BO_ELEC_1:
486         {
487                 msg_print(_("それは火花に覆われた...", "It is covered in sparks..."));
488                 if (!get_aim_dir(&dir)) return FALSE;
489                 fire_bolt(GF_ELEC, dir, damroll(4, 8));
490                 break;
491         }
492
493         case ACT_BO_ACID_1:
494         {
495                 msg_print(_("それは酸に覆われた...", "It is covered in acid..."));
496                 if (!get_aim_dir(&dir)) return FALSE;
497                 fire_bolt(GF_ACID, dir, damroll(5, 8));
498                 break;
499         }
500
501         case ACT_BO_COLD_1:
502         {
503                 msg_print(_("それは霜に覆われた...", "It is covered in frost..."));
504                 if (!get_aim_dir(&dir)) return FALSE;
505                 fire_bolt(GF_COLD, dir, damroll(6, 8));
506                 break;
507         }
508
509         case ACT_BO_FIRE_1:
510         {
511                 msg_print(_("それは炎に覆われた...", "It is covered in fire..."));
512                 if (!get_aim_dir(&dir)) return FALSE;
513                 fire_bolt(GF_FIRE, dir, damroll(9, 8));
514                 break;
515         }
516
517         case ACT_BA_COLD_1:
518         {
519                 msg_print(_("それは霜に覆われた...", "It is covered in frost..."));
520                 if (!get_aim_dir(&dir)) return FALSE;
521                 fire_ball(GF_COLD, dir, 48, 2);
522                 break;
523         }
524
525         case ACT_BA_COLD_2:
526         {
527                 msg_print(_("それは青く激しく輝いた...", "It glows an intense blue..."));
528                 if (!get_aim_dir(&dir)) return FALSE;
529                 fire_ball(GF_COLD, dir, 100, 2);
530                 break;
531         }
532
533         case ACT_BA_COLD_3:
534         {
535                 msg_print(_("明るく白色に輝いている...", "It glows bright white..."));
536                 if (!get_aim_dir(&dir)) return FALSE;
537                 fire_ball(GF_COLD, dir, 400, 3);
538                 break;
539         }
540
541         case ACT_BA_FIRE_1:
542         {
543                 msg_print(_("それは赤く激しく輝いた...", "It glows an intense red..."));
544                 if (!get_aim_dir(&dir)) return FALSE;
545                 fire_ball(GF_FIRE, dir, 72, 2);
546                 break;
547         }
548
549         case ACT_BA_FIRE_2:
550         {
551                 msg_format(_("%sから炎が吹き出した...", "The %s rages in fire..."), name);
552                 if (!get_aim_dir(&dir)) return FALSE;
553                 fire_ball(GF_FIRE, dir, 120, 3);
554                 break;
555         }
556
557         case ACT_BA_FIRE_3:
558         {
559                 msg_print(_("深赤色に輝いている...", "It glows deep red..."));
560                 if (!get_aim_dir(&dir)) return FALSE;
561                 fire_ball(GF_FIRE, dir, 300, 3);
562                 break;
563         }
564
565         case ACT_BA_FIRE_4:
566         {
567                 msg_print(_("それは赤く激しく輝いた...", "It glows an intense red..."));
568                 if (!get_aim_dir(&dir)) return FALSE;
569                 fire_ball(GF_FIRE, dir, 100, 2);
570                 break;
571         }
572
573         case ACT_BA_ELEC_2:
574         {
575                 msg_print(_("電気がパチパチ音を立てた...", "It crackles with electricity..."));
576                 if (!get_aim_dir(&dir)) return FALSE;
577                 fire_ball(GF_ELEC, dir, 100, 3);
578                 break;
579         }
580
581         case ACT_BA_ELEC_3:
582         {
583                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
584                 if (!get_aim_dir(&dir)) return FALSE;
585                 fire_ball(GF_ELEC, dir, 500, 3);
586                 break;
587         }
588
589         case ACT_BA_ACID_1:
590         {
591                 msg_print(_("それは黒く激しく輝いた...", "It glows an intense black..."));
592                 if (!get_aim_dir(&dir)) return FALSE;
593                 fire_ball(GF_ACID, dir, 100, 2);
594                 break;
595         }
596
597         case ACT_BA_NUKE_1:
598         {
599                 msg_print(_("それは緑に激しく輝いた...", "It glows an intense green..."));
600                 if (!get_aim_dir(&dir)) return FALSE;
601                 fire_ball(GF_NUKE, dir, 100, 2);
602                 break;
603         }
604
605         case ACT_HYPODYNAMIA_1:
606         {
607                 msg_format(_("あなたは%sに敵を締め殺すよう命じた。", "You order the %s to strangle your opponent."), name);
608                 if (!get_aim_dir(&dir)) return FALSE;
609                 if (hypodynamic_bolt(dir, 100))
610                         break;
611         }
612
613         case ACT_HYPODYNAMIA_2:
614         {
615                 msg_print(_("黒く輝いている...", "It glows black..."));
616                 if (!get_aim_dir(&dir)) return FALSE;
617                 hypodynamic_bolt(dir, 120);
618                 break;
619         }
620
621         case ACT_DRAIN_1:
622         {
623                 if (!get_aim_dir(&dir)) return FALSE;
624                 for (dummy = 0; dummy < 3; dummy++)
625                 {
626                         if (hypodynamic_bolt(dir, 50))
627                                 hp_player(50);
628                 }
629                 break;
630         }
631
632         case ACT_BO_MISS_2:
633         {
634                 msg_print(_("魔法のトゲが現れた...", "It grows magical spikes..."));
635                 if (!get_aim_dir(&dir)) return FALSE;
636                 fire_bolt(GF_ARROW, dir, 150);
637                 break;
638         }
639
640         case ACT_WHIRLWIND:
641         {
642                 massacre();
643                 break;
644         }
645
646         case ACT_DRAIN_2:
647         {
648                 if (!get_aim_dir(&dir)) return FALSE;
649                 for (dummy = 0; dummy < 3; dummy++)
650                 {
651                         if (hypodynamic_bolt(dir, 100))
652                                 hp_player(100);
653                 }
654                 break;
655         }
656
657
658         case ACT_CALL_CHAOS:
659         {
660                 msg_print(_("様々な色の火花を発している...", "It glows in scintillating colours..."));
661                 call_chaos();
662                 break;
663         }
664
665         case ACT_ROCKET:
666         {
667                 if (!get_aim_dir(&dir)) return FALSE;
668                 msg_print(_("ロケットを発射した!", "You launch a rocket!"));
669                 fire_ball(GF_ROCKET, dir, 250 + plev * 3, 2);
670                 break;
671         }
672
673         case ACT_DISP_EVIL:
674         {
675                 msg_print(_("神聖な雰囲気が充満した...", "It floods the area with goodness..."));
676                 dispel_evil(p_ptr->lev * 5);
677                 break;
678         }
679
680         case ACT_BA_MISS_3:
681         {
682                 if (!get_aim_dir(&dir)) return FALSE;
683                 msg_print(_("あなたはエレメントのブレスを吐いた。", "You breathe the elements."));
684                 fire_breath(GF_MISSILE, dir, 300, 4);
685                 break;
686         }
687
688         case ACT_DISP_GOOD:
689         {
690                 msg_print(_("邪悪な雰囲気が充満した...", "It floods the area with evil..."));
691                 dispel_good(p_ptr->lev * 5);
692                 break;
693         }
694
695         case ACT_BO_MANA:
696         {
697                 msg_format(_("%sに魔法のトゲが現れた...", "The %s grows magical spikes..."), name);
698                 if (!get_aim_dir(&dir)) return FALSE;
699                 fire_bolt(GF_ARROW, dir, 150);
700                 break;
701         }
702
703         case ACT_BA_WATER:
704         {
705                 msg_format(_("%sが深い青色に鼓動している...", "The %s throbs deep blue..."), name);
706                 if (!get_aim_dir(&dir)) return FALSE;
707                 fire_ball(GF_WATER, dir, 200, 3);
708                 break;
709         }
710
711         case ACT_BA_DARK:
712         {
713                 msg_format(_("%sが深い闇に覆われた...", "The %s is coverd in pitch-darkness..."), name);
714                 if (!get_aim_dir(&dir)) return FALSE;
715                 fire_ball(GF_DARK, dir, 250, 4);
716                 break;
717         }
718
719         case ACT_BA_MANA:
720         {
721                 msg_format(_("%sが青白く光った...", "The %s glows pale..."), name);
722                 if (!get_aim_dir(&dir)) return FALSE;
723                 fire_ball(GF_MANA, dir, 250, 4);
724                 break;
725         }
726
727         case ACT_PESTICIDE:
728         {
729                 msg_print(_("あなたは害虫を一掃した。", "You exterminate small life."));
730                 (void)dispel_monsters(4);
731                 break;
732         }
733
734         case ACT_BLINDING_LIGHT:
735         {
736                 msg_format(_("%sが眩しい光で輝いた...", "The %s gleams with blinding light..."), name);
737                 fire_ball(GF_LITE, 0, 300, 6);
738                 confuse_monsters(3 * p_ptr->lev / 2);
739                 break;
740         }
741
742         case ACT_BIZARRE:
743         {
744                 msg_format(_("%sは漆黒に輝いた...", "The %s glows intensely black..."), name);
745                 if (!get_aim_dir(&dir)) return FALSE;
746                 ring_of_power(dir);
747                 break;
748         }
749
750         case ACT_CAST_BA_STAR:
751         {
752                 HIT_POINT num = damroll(5, 3);
753                 POSITION y = 0, x = 0;
754                 int attempts;
755                 msg_format(_("%sが稲妻で覆われた...", "The %s is surrounded by lightning..."), name);
756                 for (k = 0; k < num; k++)
757                 {
758                         attempts = 1000;
759
760                         while (attempts--)
761                         {
762                                 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
763                                 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
764                                 if (!player_bold(y, x)) break;
765                         }
766
767                         project(0, 3, y, x, 150, GF_ELEC,
768                                 (PROJECT_THRU | PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
769                 }
770
771                 break;
772         }
773
774         case ACT_BLADETURNER:
775         {
776                 if (!get_aim_dir(&dir)) return FALSE;
777                 msg_print(_("あなたはエレメントのブレスを吐いた。", "You breathe the elements."));
778                 fire_breath(GF_MISSILE, dir, 300, 4);
779                 msg_print(_("鎧が様々な色に輝いた...", "Your armor glows many colours..."));
780                 (void)set_afraid(0);
781                 (void)set_hero(randint1(50) + 50, FALSE);
782                 (void)hp_player(10);
783                 (void)set_blessed(randint1(50) + 50, FALSE);
784                 (void)set_oppose_acid(randint1(50) + 50, FALSE);
785                 (void)set_oppose_elec(randint1(50) + 50, FALSE);
786                 (void)set_oppose_fire(randint1(50) + 50, FALSE);
787                 (void)set_oppose_cold(randint1(50) + 50, FALSE);
788                 (void)set_oppose_pois(randint1(50) + 50, FALSE);
789                 break;
790         }
791
792         case ACT_BR_FIRE:
793         {
794                 if (!get_aim_dir(&dir)) return FALSE;
795                 fire_breath(GF_FIRE, dir, 200, 2);
796                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
797                 {
798                         (void)set_oppose_fire(randint1(20) + 20, FALSE);
799                 }
800                 break;
801         }
802
803         case ACT_BR_COLD:
804         {
805                 if (!get_aim_dir(&dir)) return FALSE;
806                 fire_breath(GF_COLD, dir, 200, 2);
807                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
808                 {
809                         (void)set_oppose_cold(randint1(20) + 20, FALSE);
810                 }
811                 break;
812         }
813
814         case ACT_BR_DRAGON:
815         {
816                 if (!activate_dragon_breath(o_ptr)) return FALSE;
817                 break;
818         }
819
820         /* Activate for other offensive action */
821         case ACT_CONFUSE:
822         {
823                 msg_print(_("様々な色の火花を発している...", "It glows in scintillating colours..."));
824                 if (!get_aim_dir(&dir)) return FALSE;
825                 confuse_monster(dir, 20);
826                 break;
827         }
828
829         case ACT_SLEEP:
830         {
831                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
832                 sleep_monsters_touch();
833                 break;
834         }
835
836         case ACT_QUAKE:
837         {
838                 earthquake(p_ptr->y, p_ptr->x, 5);
839                 break;
840         }
841
842         case ACT_TERROR:
843         {
844                 turn_monsters(40 + p_ptr->lev);
845                 break;
846         }
847
848         case ACT_TELE_AWAY:
849         {
850                 if (!get_aim_dir(&dir)) return FALSE;
851                 (void)fire_beam(GF_AWAY_ALL, dir, plev);
852                 break;
853         }
854
855         case ACT_BANISH_EVIL:
856         {
857                 if (banish_evil(100))
858                 {
859                         msg_print(_("アーティファクトの力が邪悪を打ち払った!", "The power of the artifact banishes evil!"));
860                 }
861                 break;
862         }
863
864         case ACT_GENOCIDE:
865         {
866                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
867                 (void)symbol_genocide(200, TRUE);
868                 break;
869         }
870
871         case ACT_MASS_GENO:
872         {
873                 msg_print(_("ひどく鋭い音が流れ出た...", "It lets out a long, shrill note..."));
874                 (void)mass_genocide(200, TRUE);
875                 break;
876         }
877
878         case ACT_SCARE_AREA:
879         {
880                 if (music_singing_any()) stop_singing();
881                 if (hex_spelling_any()) stop_hex_spell_all();
882                 msg_print(_("あなたは力強い突風を吹き鳴らした。周囲の敵が震え上っている!",
883                         "You wind a mighty blast; your enemies tremble!"));
884                 (void)turn_monsters((3 * p_ptr->lev / 2) + 10);
885                 break;
886         }
887
888         case ACT_AGGRAVATE:
889         {
890                 if (o_ptr->name1 == ART_HYOUSIGI)
891                 {
892                         msg_print(_("拍子木を打った。", "You beat Your wooden clappers."));
893                 }
894                 else
895                 {
896                         msg_format(_("%sは不快な物音を立てた。", "The %s sounds an unpleasant noise."), name);
897                 }
898                 aggravate_monsters(0);
899                 break;
900         }
901
902         /* Activate for summoning / charming */
903
904         case ACT_CHARM_ANIMAL:
905         {
906                 if (!get_aim_dir(&dir)) return FALSE;
907                 (void)charm_animal(dir, plev);
908                 break;
909         }
910
911         case ACT_CHARM_UNDEAD:
912         {
913                 if (!get_aim_dir(&dir)) return FALSE;
914                 (void)control_one_undead(dir, plev);
915                 break;
916         }
917
918         case ACT_CHARM_OTHER:
919         {
920                 if (!get_aim_dir(&dir)) return FALSE;
921                 (void)charm_monster(dir, plev * 2);
922                 break;
923         }
924
925         case ACT_CHARM_ANIMALS:
926         {
927                 (void)charm_animals(plev * 2);
928                 break;
929         }
930
931         case ACT_CHARM_OTHERS:
932         {
933                 charm_monsters(plev * 2);
934                 break;
935         }
936
937         case ACT_SUMMON_ANIMAL:
938         {
939                 (void)summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET), '\0');
940                 break;
941         }
942
943         case ACT_SUMMON_PHANTOM:
944         {
945                 msg_print(_("幻霊を召喚した。", "You summon a phantasmal servant."));
946                 (void)summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET), '\0');
947                 break;
948         }
949
950         case ACT_SUMMON_ELEMENTAL:
951         {
952                 bool pet = one_in_(3);
953                 BIT_FLAGS mode = 0L;
954
955                 if (!(pet && (plev < 50))) mode |= PM_ALLOW_GROUP;
956                 if (pet) mode |= PM_FORCE_PET;
957                 else mode |= PM_NO_PET;
958
959                 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((plev * 3) / 2), SUMMON_ELEMENTAL, mode, '\0'))
960                 {
961                         msg_print(_("エレメンタルが現れた...", "An elemental materializes..."));
962                         if (pet)
963                                 msg_print(_("あなたに服従しているようだ。", "It seems obedient to you."));
964                         else
965                                 msg_print(_("それをコントロールできなかった!", "You fail to control it!"));
966                 }
967
968                 break;
969         }
970
971         case ACT_SUMMON_DEMON:
972         {
973                 cast_summon_demon((plev * 3) / 2);
974                 break;
975         }
976
977         case ACT_SUMMON_UNDEAD:
978         {
979                 bool pet = one_in_(3);
980                 int type;
981                 BIT_FLAGS mode = 0L;
982
983                 type = (plev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD);
984
985                 if (!pet || ((plev > 24) && one_in_(3))) mode |= PM_ALLOW_GROUP;
986                 if (pet) mode |= PM_FORCE_PET;
987                 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
988
989                 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((plev * 3) / 2), type, mode, '\0'))
990                 {
991                         msg_print(_("冷たい風があなたの周りに吹き始めた。それは腐敗臭を運んでいる...",
992                                 "Cold winds begin to blow around you, carrying with them the stench of decay..."));
993                         if (pet)
994                                 msg_print(_("古えの死せる者共があなたに仕えるため土から甦った!",
995                                         "Ancient, long-dead forms arise from the ground to serve you!"));
996                         else
997                                 msg_print(_("死者が甦った。眠りを妨げるあなたを罰するために!",
998                                         "'The dead arise... to punish you for disturbing them!'"));
999                 }
1000
1001                 break;
1002         }
1003
1004         case ACT_SUMMON_HOUND:
1005         {
1006                 BIT_FLAGS mode = PM_ALLOW_GROUP;
1007                 bool pet = !one_in_(5);
1008                 if (pet) mode |= PM_FORCE_PET;
1009                 else mode |= PM_NO_PET;
1010
1011                 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((p_ptr->lev * 3) / 2), SUMMON_HOUND, mode, '\0'))
1012                 {
1013
1014                         if (pet)
1015                                 msg_print(_("ハウンドがあなたの下僕として出現した。",
1016                                         "A group of hounds appear as your servant."));
1017                         else
1018                                 msg_print(_("ハウンドはあなたに牙を向けている!",
1019                                         "A group of hounds appear as your enemy!"));
1020                 }
1021
1022                 break;
1023         }
1024
1025         case ACT_SUMMON_DAWN:
1026         {
1027                 msg_print(_("暁の師団を召喚した。", "You summon the Legion of the Dawn."));
1028                 (void)summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, SUMMON_DAWN, (PM_ALLOW_GROUP | PM_FORCE_PET), '\0');
1029                 break;
1030         }
1031
1032         case ACT_SUMMON_OCTOPUS:
1033         {
1034                 BIT_FLAGS mode = PM_ALLOW_GROUP;
1035                 bool pet = !one_in_(5);
1036                 if (pet) mode |= PM_FORCE_PET;
1037
1038                 if (summon_named_creature(0, p_ptr->y, p_ptr->x, MON_JIZOTAKO, mode))
1039                 {
1040                         if (pet)
1041                                 msg_print(_("蛸があなたの下僕として出現した。", "A group of octopuses appear as your servant."));
1042                         else
1043                                 msg_print(_("蛸はあなたを睨んでいる!", "A group of octopuses appear as your enemy!"));
1044                 }
1045
1046                 break;
1047         }
1048
1049         /* Activate for healing */
1050
1051         case ACT_CHOIR_SINGS:
1052         {
1053                 msg_print(_("天国の歌が聞こえる...", "A heavenly choir sings..."));
1054                 (void)cure_critical_wounds(777);
1055                 (void)set_hero(randint1(25) + 25, FALSE);
1056                 break;
1057         }
1058
1059         case ACT_CURE_LW:
1060         {
1061                 (void)set_afraid(0);
1062                 (void)hp_player(30);
1063                 break;
1064         }
1065
1066         case ACT_CURE_MW:
1067         {
1068                 msg_print(_("深紫色の光を発している...", "It radiates deep purple..."));
1069                 (void)cure_serious_wounds(4, 8);
1070                 break;
1071         }
1072
1073         case ACT_CURE_POISON:
1074         {
1075                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
1076                 (void)set_afraid(0);
1077                 (void)set_poisoned(0);
1078                 break;
1079         }
1080
1081         case ACT_REST_EXP:
1082         {
1083                 msg_print(_("深紅に輝いている...", "It glows a deep red..."));
1084                 restore_level();
1085                 break;
1086         }
1087
1088         case ACT_REST_ALL:
1089         {
1090                 msg_print(_("濃緑色に輝いている...", "It glows a deep green..."));
1091                 (void)restore_all_status();
1092                 (void)restore_level();
1093                 break;
1094         }
1095
1096         case ACT_CURE_700:
1097         {
1098                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
1099                 msg_print(_("体内に暖かい鼓動が感じられる...", "You feel a warm tingling inside..."));
1100                 (void)cure_critical_wounds(700);
1101                 break;
1102         }
1103
1104         case ACT_CURE_1000:
1105         {
1106                 msg_print(_("白く明るく輝いている...", "It glows a bright white..."));
1107                 msg_print(_("ひじょうに気分がよい...", "You feel much better..."));
1108                 (void)cure_critical_wounds(1000);
1109                 break;
1110         }
1111
1112         case ACT_CURING:
1113         {
1114                 msg_format(_("%sの優しさに癒される...", "the %s cures you affectionately ..."), name);
1115                 true_healing(0);
1116                 break;
1117         }
1118
1119         case ACT_CURE_MANA_FULL:
1120         {
1121                 msg_format(_("%sが青白く光った...", "The %s glows pale..."), name);
1122                 restore_mana(TRUE);
1123                 break;
1124         }
1125
1126         /* Activate for timed effect */
1127
1128         case ACT_ESP:
1129         {
1130                 (void)set_tim_esp(randint1(30) + 25, FALSE);
1131                 break;
1132         }
1133
1134         case ACT_BERSERK:
1135         {
1136                 (void)berserk(randint1(25) + 25);
1137                 break;
1138         }
1139
1140         case ACT_PROT_EVIL:
1141         {
1142                 msg_format(_("%sから鋭い音が流れ出た...", "The %s lets out a shrill wail..."), name);
1143                 k = 3 * p_ptr->lev;
1144                 (void)set_protevil(randint1(25) + k, FALSE);
1145                 break;
1146         }
1147
1148         case ACT_RESIST_ALL:
1149         {
1150                 msg_print(_("様々な色に輝いている...", "It glows many colours..."));
1151                 (void)set_oppose_acid(randint1(40) + 40, FALSE);
1152                 (void)set_oppose_elec(randint1(40) + 40, FALSE);
1153                 (void)set_oppose_fire(randint1(40) + 40, FALSE);
1154                 (void)set_oppose_cold(randint1(40) + 40, FALSE);
1155                 (void)set_oppose_pois(randint1(40) + 40, FALSE);
1156                 break;
1157         }
1158
1159         case ACT_SPEED:
1160         {
1161                 msg_print(_("明るく緑色に輝いている...", "It glows bright green..."));
1162                 (void)set_fast(randint1(20) + 20, FALSE);
1163                 break;
1164         }
1165
1166         case ACT_XTRA_SPEED:
1167         {
1168                 msg_print(_("明るく輝いている...", "It glows brightly..."));
1169                 (void)set_fast(randint1(75) + 75, FALSE);
1170                 break;
1171         }
1172
1173         case ACT_WRAITH:
1174         {
1175                 set_wraith_form(randint1(plev / 2) + (plev / 2), FALSE);
1176                 break;
1177         }
1178
1179         case ACT_INVULN:
1180         {
1181                 (void)set_invuln(randint1(8) + 8, FALSE);
1182                 break;
1183         }
1184
1185         case ACT_HERO:
1186         {
1187                 (void)heroism(25);
1188                 break;
1189         }
1190
1191         case ACT_HERO_SPEED:
1192         {
1193                 (void)set_fast(randint1(50) + 50, FALSE);
1194                 (void)heroism(50);
1195                 break;
1196         }
1197
1198         case ACT_RESIST_ACID:
1199         {
1200                 msg_format(_("%sが黒く輝いた...", "The %s grows black."), name);
1201                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ACID))
1202                 {
1203                         if (!get_aim_dir(&dir)) return FALSE;
1204                         fire_ball(GF_ACID, dir, 100, 2);
1205                 }
1206                 (void)set_oppose_acid(randint1(20) + 20, FALSE);
1207                 break;
1208         }
1209
1210         case ACT_RESIST_FIRE:
1211         {
1212                 msg_format(_("%sが赤く輝いた...", "The %s grows red."), name);
1213                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
1214                 {
1215                         if (!get_aim_dir(&dir)) return FALSE;
1216                         fire_ball(GF_FIRE, dir, 100, 2);
1217                 }
1218                 (void)set_oppose_fire(randint1(20) + 20, FALSE);
1219                 break;
1220         }
1221
1222         case ACT_RESIST_COLD:
1223         {
1224                 msg_format(_("%sが白く輝いた...", "The %s grows white."), name);
1225                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
1226                 {
1227                         if (!get_aim_dir(&dir)) return FALSE;
1228                         fire_ball(GF_COLD, dir, 100, 2);
1229                 }
1230                 (void)set_oppose_cold(randint1(20) + 20, FALSE);
1231                 break;
1232         }
1233
1234         case ACT_RESIST_ELEC:
1235         {
1236                 msg_format(_("%sが青く輝いた...", "The %s grows blue."), name);
1237                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ELEC))
1238                 {
1239                         if (!get_aim_dir(&dir)) return FALSE;
1240                         fire_ball(GF_ELEC, dir, 100, 2);
1241                 }
1242                 (void)set_oppose_elec(randint1(20) + 20, FALSE);
1243                 break;
1244         }
1245
1246         case ACT_RESIST_POIS:
1247         {
1248                 msg_format(_("%sが緑に輝いた...", "The %s grows green."), name);
1249                 (void)set_oppose_pois(randint1(20) + 20, FALSE);
1250                 break;
1251         }
1252
1253         /* Activate for general purpose effect (detection etc.) */
1254
1255         case ACT_LIGHT:
1256         {
1257                 msg_format(_("%sから澄んだ光があふれ出た...", "The %s wells with clear light..."), name);
1258                 lite_area(damroll(2, 15), 3);
1259                 break;
1260         }
1261
1262         case ACT_MAP_LIGHT:
1263         {
1264                 msg_print(_("眩しく輝いた...", "It shines brightly..."));
1265                 map_area(DETECT_RAD_MAP);
1266                 lite_area(damroll(2, 15), 3);
1267                 break;
1268         }
1269
1270         case ACT_DETECT_ALL:
1271         {
1272                 msg_print(_("白く明るく輝いている...", "It glows bright white..."));
1273                 msg_print(_("心にイメージが浮かんできた...", "An image forms in your mind..."));
1274                 detect_all(DETECT_RAD_DEFAULT);
1275                 break;
1276         }
1277
1278         case ACT_DETECT_XTRA:
1279         {
1280                 msg_print(_("明るく輝いている...", "It glows brightly..."));
1281                 detect_all(DETECT_RAD_DEFAULT);
1282                 probing();
1283                 identify_fully(FALSE);
1284                 break;
1285         }
1286
1287         case ACT_ID_FULL:
1288         {
1289                 msg_print(_("黄色く輝いている...", "It glows yellow..."));
1290                 identify_fully(FALSE);
1291                 break;
1292         }
1293
1294         case ACT_ID_PLAIN:
1295         {
1296                 if (!ident_spell(FALSE)) return FALSE;
1297                 break;
1298         }
1299
1300         case ACT_RUNE_EXPLO:
1301         {
1302                 msg_print(_("明るい赤色に輝いている...", "It glows bright red..."));
1303                 explosive_rune();
1304                 break;
1305         }
1306
1307         case ACT_RUNE_PROT:
1308         {
1309                 msg_print(_("ブルーに明るく輝いている...", "It glows light blue..."));
1310                 warding_glyph();
1311                 break;
1312         }
1313
1314         case ACT_SATIATE:
1315         {
1316                 (void)set_food(PY_FOOD_MAX - 1);
1317                 break;
1318         }
1319
1320         case ACT_DEST_DOOR:
1321         {
1322                 msg_print(_("明るい赤色に輝いている...", "It glows bright red..."));
1323                 destroy_doors_touch();
1324                 break;
1325         }
1326
1327         case ACT_STONE_MUD:
1328         {
1329                 msg_print(_("鼓動している...", "It pulsates..."));
1330                 if (!get_aim_dir(&dir)) return FALSE;
1331                 wall_to_mud(dir, 20 + randint1(30));
1332                 break;
1333         }
1334
1335         case ACT_RECHARGE:
1336         {
1337                 recharge(130);
1338                 break;
1339         }
1340
1341         case ACT_ALCHEMY:
1342         {
1343                 msg_print(_("明るい黄色に輝いている...", "It glows bright yellow..."));
1344                 (void)alchemy();
1345                 break;
1346         }
1347
1348         case ACT_DIM_DOOR:
1349         {
1350                 msg_print(_("次元の扉が開いた。目的地を選んで下さい。", "You open a dimensional gate. Choose a destination."));
1351                 if (!dimension_door()) return FALSE;
1352                 break;
1353         }
1354
1355
1356         case ACT_TELEPORT:
1357         {
1358                 msg_print(_("周りの空間が歪んでいる...", "It twists space around you..."));
1359                 teleport_player(100, 0L);
1360                 break;
1361         }
1362
1363         case ACT_RECALL:
1364         {
1365                 msg_print(_("やわらかな白色に輝いている...", "It glows soft white..."));
1366                 if (!recall_player(p_ptr, randint0(21) + 15)) return FALSE;
1367                 break;
1368         }
1369
1370         case ACT_JUDGE:
1371         {
1372                 msg_format(_("%sは赤く明るく光った!", "The %s flashes bright red!"), name);
1373                 chg_virtue(V_KNOWLEDGE, 1);
1374                 chg_virtue(V_ENLIGHTEN, 1);
1375                 wiz_lite(FALSE);
1376
1377                 msg_format(_("%sはあなたの体力を奪った...", "The %s drains your vitality..."), name);
1378                 take_hit(DAMAGE_LOSELIFE, damroll(3, 8), _("審判の宝石", "the Jewel of Judgement"), -1);
1379
1380                 (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
1381                 (void)detect_doors(DETECT_RAD_DEFAULT);
1382                 (void)detect_stairs(DETECT_RAD_DEFAULT);
1383
1384                 if (get_check(_("帰還の力を使いますか?", "Activate recall? ")))
1385                 {
1386                         (void)recall_player(p_ptr, randint0(21) + 15);
1387                 }
1388
1389                 break;
1390         }
1391
1392         case ACT_TELEKINESIS:
1393         {
1394                 if (!get_aim_dir(&dir)) return FALSE;
1395                 msg_format(_("%sを伸ばした。", "You stretched your %s."), name);
1396                 fetch(dir, 500, TRUE);
1397                 break;
1398         }
1399
1400         case ACT_DETECT_UNIQUE:
1401         {
1402                 int i;
1403                 monster_type *m_ptr;
1404                 monster_race *r_ptr;
1405                 msg_print(_("奇妙な場所が頭の中に浮かんだ...", "Some strange places show up in your mind. And you see ..."));
1406                 /* Process the monsters (backwards) */
1407                 for (i = m_max - 1; i >= 1; i--)
1408                 {
1409                         /* Access the monster */
1410                         m_ptr = &m_list[i];
1411
1412                         /* Ignore "dead" monsters */
1413                         if (!m_ptr->r_idx) continue;
1414
1415                         r_ptr = &r_info[m_ptr->r_idx];
1416
1417                         if (r_ptr->flags1 & RF1_UNIQUE)
1418                         {
1419                                 msg_format(_("%s. ", "%s. "), r_name + r_ptr->name);
1420                         }
1421                 }
1422                 break;
1423         }
1424
1425         case ACT_ESCAPE:
1426         {
1427                 switch (randint1(13))
1428                 {
1429                 case 1: case 2: case 3: case 4: case 5:
1430                         teleport_player(10, 0L);
1431                         break;
1432                 case 6: case 7: case 8: case 9: case 10:
1433                         teleport_player(222, 0L);
1434                         break;
1435                 case 11: case 12:
1436                         (void)stair_creation();
1437                         break;
1438                 default:
1439                         if (get_check(_("この階を去りますか?", "Leave this level? ")))
1440                         {
1441                                 if (autosave_l) do_cmd_save_game(TRUE);
1442
1443                                 /* Leaving */
1444                                 p_ptr->leaving = TRUE;
1445                         }
1446                 }
1447                 break;
1448         }
1449
1450         case ACT_DISP_CURSE_XTRA:
1451         {
1452                 msg_format(_("%sが真実を照らし出す...", "The %s exhibits the truth..."), name);
1453                 (void)remove_all_curse();
1454                 (void)probing();
1455                 break;
1456         }
1457
1458         case ACT_BRAND_FIRE_BOLTS:
1459         {
1460                 msg_format(_("%sが深紅に輝いた...", "Your %s glows deep red..."), name);
1461                 (void)brand_bolts();
1462                 break;
1463         }
1464
1465         case ACT_RECHARGE_XTRA:
1466         {
1467                 msg_format(_("%sが白く輝いた...", "The %s gleams with blinding light..."), name);
1468                 if (!recharge(1000)) return FALSE;
1469                 break;
1470         }
1471
1472         case ACT_LORE:
1473         {
1474                 msg_print(_("石が隠された秘密を写し出した...", "The stone reveals hidden mysteries..."));
1475                 if (!ident_spell(FALSE)) return FALSE;
1476
1477                 if (mp_ptr->spell_book)
1478                 {
1479                         /* Sufficient mana */
1480                         if (20 <= p_ptr->csp)
1481                         {
1482                                 /* Use some mana */
1483                                 p_ptr->csp -= 20;
1484                         }
1485
1486                         /* Over-exert the player */
1487                         else
1488                         {
1489                                 int oops = 20 - p_ptr->csp;
1490
1491                                 /* No mana left */
1492                                 p_ptr->csp = 0;
1493                                 p_ptr->csp_frac = 0;
1494
1495                                 msg_print(_("石を制御できない!", "You are too weak to control the stone!"));
1496                                 /* Hack -- Bypass free action */
1497                                 (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
1498
1499                                 /* Confusing. */
1500                                 (void)set_confused(p_ptr->confused + randint1(5 * oops + 1));
1501                         }
1502                         p_ptr->redraw |= (PR_MANA);
1503                 }
1504                 take_hit(DAMAGE_LOSELIFE, damroll(1, 12), _("危険な秘密", "perilous secrets"), -1);
1505                 /* Confusing. */
1506                 if (one_in_(5)) (void)set_confused(p_ptr->confused + randint1(10));
1507
1508                 /* Exercise a little care... */
1509                 if (one_in_(20)) take_hit(DAMAGE_LOSELIFE, damroll(4, 10), _("危険な秘密", "perilous secrets"), -1);
1510                 break;
1511         }
1512
1513         case ACT_SHIKOFUMI:
1514         {
1515                 msg_print(_("力強く四股を踏んだ。", "You stamp. (as if you are in a ring.)"));
1516                 (void)set_afraid(0);
1517                 (void)set_hero(randint1(20) + 20, FALSE);
1518                 dispel_evil(p_ptr->lev * 3);
1519                 break;
1520         }
1521
1522         case ACT_PHASE_DOOR:
1523         {
1524                 teleport_player(10, 0L);
1525                 break;
1526         }
1527
1528         case ACT_DETECT_ALL_MONS:
1529         {
1530                 (void)detect_monsters_invis(255);
1531                 (void)detect_monsters_normal(255);
1532                 break;
1533         }
1534
1535         case ACT_ULTIMATE_RESIST:
1536         {
1537                 TIME_EFFECT v = randint1(25) + 25;
1538                 (void)set_afraid(0);
1539                 (void)set_hero(v, FALSE);
1540                 (void)hp_player(10);
1541                 (void)set_blessed(v, FALSE);
1542                 (void)set_oppose_acid(v, FALSE);
1543                 (void)set_oppose_elec(v, FALSE);
1544                 (void)set_oppose_fire(v, FALSE);
1545                 (void)set_oppose_cold(v, FALSE);
1546                 (void)set_oppose_pois(v, FALSE);
1547                 (void)set_ultimate_res(v, FALSE);
1548                 break;
1549         }
1550
1551
1552         /* Unique activation */
1553         case ACT_CAST_OFF:
1554         {
1555                 INVENTORY_IDX inv;
1556                 int t;
1557                 OBJECT_IDX o_idx;
1558                 GAME_TEXT o_name[MAX_NLEN];
1559                 object_type forge;
1560
1561                 /* Cast off activated item */
1562                 for (inv = INVEN_RARM; inv <= INVEN_FEET; inv++)
1563                 {
1564                         if (o_ptr == &inventory[inv]) break;
1565                 }
1566
1567                 /* Paranoia */
1568                 if (inv > INVEN_FEET) return FALSE;
1569
1570                 object_copy(&forge, o_ptr);
1571                 inven_item_increase(inv, (0 - o_ptr->number));
1572                 inven_item_optimize(inv);
1573                 o_idx = drop_near(&forge, 0, p_ptr->y, p_ptr->x);
1574                 o_ptr = &o_list[o_idx];
1575
1576                 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1577                 msg_format(_("%sを脱ぎ捨てた。", "You cast off %s."), o_name);
1578
1579                 /* Get effects */
1580                 msg_print(_("「燃え上がれ俺の小宇宙!」", "You say, 'Burn up my cosmo!"));
1581                 t = 20 + randint1(20);
1582                 (void)set_blind(p_ptr->blind + t);
1583                 (void)set_afraid(0);
1584                 (void)set_tim_esp(p_ptr->tim_esp + t, FALSE);
1585                 (void)set_tim_regen(p_ptr->tim_regen + t, FALSE);
1586                 (void)set_hero(p_ptr->hero + t, FALSE);
1587                 (void)set_blessed(p_ptr->blessed + t, FALSE);
1588                 (void)set_fast(p_ptr->fast + t, FALSE);
1589                 (void)set_shero(p_ptr->shero + t, FALSE);
1590                 if (p_ptr->pclass == CLASS_FORCETRAINER)
1591                 {
1592                         P_PTR_KI = plev * 5 + 190;
1593                         msg_print(_("気が爆発寸前になった。", "Your force are immediatly before explosion."));
1594                 }
1595
1596                 break;
1597         }
1598
1599         case ACT_FALLING_STAR:
1600         {
1601                 msg_print(_("あなたは妖刀に魅入られた…", "You are enchanted by cursed blade..."));
1602                 msg_print(_("「狂ほしく 血のごとき 月はのぼれり 秘めおきし 魔剣 いずこぞや」", "'Behold the blade arts.'"));
1603                 massacre();
1604                 break;
1605         }
1606
1607         case ACT_GRAND_CROSS:
1608         {
1609                 msg_print(_("「闇に還れ!」", "You say, 'Return to darkness!'"));
1610                 project(0, 8, p_ptr->y, p_ptr->x, (randint1(100) + 200) * 2, GF_HOLY_FIRE, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
1611                 break;
1612         }
1613
1614         case ACT_TELEPORT_LEVEL:
1615         {
1616                 if (!get_check(_("本当に他の階にテレポートしますか?", "Are you sure? (Teleport Level)"))) return FALSE;
1617                 teleport_level(0);
1618                 break;
1619         }
1620
1621         case ACT_STRAIN_HASTE:
1622         {
1623                 int t;
1624                 msg_format(_("%sはあなたの体力を奪った...", "The %s drains your vitality..."), name);
1625                 take_hit(DAMAGE_LOSELIFE, damroll(3, 8), _("加速した疲労", "the strain of haste"), -1);
1626                 t = 25 + randint1(25);
1627                 (void)set_fast(p_ptr->fast + t, FALSE);
1628                 break;
1629         }
1630
1631         case ACT_FISHING:
1632         {
1633                 POSITION x, y;
1634
1635                 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
1636                 y = p_ptr->y + ddy[dir];
1637                 x = p_ptr->x + ddx[dir];
1638                 p_ptr->fishing_dir = dir;
1639                 if (!cave_have_flag_bold(y, x, FF_WATER))
1640                 {
1641                         msg_print(_("そこは水辺ではない。", "There is no fishing place."));
1642                         return FALSE;
1643                 }
1644                 else if (cave[y][x].m_idx)
1645                 {
1646                         GAME_TEXT m_name[MAX_NLEN];
1647                         monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
1648                         msg_format(_("%sが邪魔だ!", "%^s is stand in your way."), m_name);
1649                         p_ptr->energy_use = 0;
1650                         return FALSE;
1651                 }
1652                 set_action(ACTION_FISH);
1653                 p_ptr->redraw |= (PR_STATE);
1654                 break;
1655         }
1656
1657         case ACT_INROU:
1658         {
1659                 int count = 0, i;
1660                 monster_type *m_ptr;
1661                 concptr kakusan = "";
1662
1663                 if (summon_named_creature(0, p_ptr->y, p_ptr->x, MON_SUKE, PM_FORCE_PET))
1664                 {
1665                         msg_print(_("『助さん』が現れた。", "Suke-san apperars."));
1666                         kakusan = "Suke-san";
1667                         count++;
1668                 }
1669                 if (summon_named_creature(0, p_ptr->y, p_ptr->x, MON_KAKU, PM_FORCE_PET))
1670                 {
1671                         msg_print(_("『格さん』が現れた。", "Kaku-san appears."));
1672                         kakusan = "Kaku-san";
1673                         count++;
1674                 }
1675                 if (!count)
1676                 {
1677                         for (i = m_max - 1; i > 0; i--)
1678                         {
1679                                 m_ptr = &m_list[i];
1680                                 if (!m_ptr->r_idx) continue;
1681                                 if (!((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) continue;
1682                                 if (!los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)) continue;
1683                                 if (!projectable(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)) continue;
1684                                 count++;
1685                                 break;
1686                         }
1687                 }
1688
1689                 if (count)
1690                 {
1691                         msg_format(_("「者ども、ひかえおろう!!!このお方をどなたとこころえる。」",
1692                                 "%^s says 'WHO do you think this person is! Bow your head, down your knees!'"), kakusan);
1693                         sukekaku = TRUE;
1694                         stun_monsters(120);
1695                         confuse_monsters(120);
1696                         turn_monsters(120);
1697                         stasis_monsters(120);
1698                         sukekaku = FALSE;
1699                 }
1700                 else
1701                 {
1702                         msg_print(_("しかし、何も起きなかった。", "Nothing happen."));
1703                 }
1704                 break;
1705         }
1706
1707         case ACT_MURAMASA:
1708         {
1709                 /* Only for Muramasa */
1710                 if (o_ptr->name1 != ART_MURAMASA) return FALSE;
1711                 if (get_check(_("本当に使いますか?", "Are you sure?!")))
1712                 {
1713                         msg_print(_("村正が震えた...", "The Muramasa pulsates..."));
1714                         do_inc_stat(A_STR);
1715                         if (one_in_(2))
1716                         {
1717                                 msg_print(_("村正は壊れた!", "The Muramasa is destroyed!"));
1718                                 curse_weapon_object(TRUE, o_ptr);
1719                         }
1720                 }
1721                 break;
1722         }
1723
1724         case ACT_BLOODY_MOON:
1725         {
1726                 /* Only for Bloody Moon */
1727                 if (o_ptr->name1 != ART_BLOOD) return FALSE;
1728                 msg_print(_("鎌が明るく輝いた...", "Your scythe glows brightly!"));
1729                 get_bloody_moon_flags(o_ptr);
1730                 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
1731                 p_ptr->update |= (PU_BONUS | PU_HP);
1732                 break;
1733         }
1734
1735         case ACT_CRIMSON:
1736         {
1737                 int num = 1;
1738                 int i;
1739                 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1740                 int tx, ty;
1741
1742                 /* Only for Crimson */
1743                 if (o_ptr->name1 != ART_CRIMSON) return FALSE;
1744
1745                 msg_print(_("せっかくだから『クリムゾン』をぶっぱなすぜ!", "I'll fire CRIMSON! SEKKAKUDAKARA!"));
1746
1747                 if (!get_aim_dir(&dir)) return FALSE;
1748
1749                 /* Use the given direction */
1750                 tx = p_ptr->x + 99 * ddx[dir];
1751                 ty = p_ptr->y + 99 * ddy[dir];
1752
1753                 /* Hack -- Use an actual "target" */
1754                 if ((dir == 5) && target_okay())
1755                 {
1756                         tx = target_col;
1757                         ty = target_row;
1758                 }
1759
1760                 if (p_ptr->pclass == CLASS_ARCHER)
1761                 {
1762                         /* Extra shot at level 10 */
1763                         if (p_ptr->lev >= 10) num++;
1764
1765                         /* Extra shot at level 30 */
1766                         if (p_ptr->lev >= 30) num++;
1767
1768                         /* Extra shot at level 45 */
1769                         if (p_ptr->lev >= 45) num++;
1770                 }
1771
1772                 for (i = 0; i < num; i++)
1773                         project(0, p_ptr->lev / 20 + 1, ty, tx, p_ptr->lev*p_ptr->lev * 6 / 50, GF_ROCKET, flg, -1);
1774                 break;
1775         }
1776
1777         default:
1778         {
1779                 msg_format(_("Unknown activation effect: %d.", "Unknown activation effect: %d."), act_ptr->index);
1780                 return FALSE;
1781         }
1782         }
1783
1784         /* Set activation timeout */
1785         if (act_ptr->timeout.constant >= 0) {
1786                 o_ptr->timeout = (s16b)act_ptr->timeout.constant;
1787                 if (act_ptr->timeout.dice > 0) {
1788                         o_ptr->timeout += randint1(act_ptr->timeout.dice);
1789                 }
1790         }
1791         else {
1792                 /* Activations that have special timeout */
1793                 switch (act_ptr->index) {
1794                 case ACT_BR_FIRE:
1795                         o_ptr->timeout = ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) ? 200 : 250;
1796                         break;
1797                 case ACT_BR_COLD:
1798                         o_ptr->timeout = ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) ? 200 : 250;
1799                         break;
1800                 case ACT_TERROR:
1801                         o_ptr->timeout = 3 * (p_ptr->lev + 10);
1802                         break;
1803                 case ACT_MURAMASA:
1804                         /* Nothing to do */
1805                         break;
1806                 default:
1807                         msg_format("Special timeout is not implemented: %d.", act_ptr->index);
1808                         return FALSE;
1809                 }
1810         }
1811
1812         return TRUE;
1813 }
1814
1815 /*!
1816  * @brief 固定アーティファクト『ブラッディムーン』の特性を変更する。
1817  * @details スレイ2d2種、及びone_resistance()による耐性1d2種、pval2種を得る。
1818  * @param o_ptr 対象のオブジェクト構造体(ブラッディムーン)のポインタ
1819  * @return なし
1820  */
1821 void get_bloody_moon_flags(object_type *o_ptr)
1822 {
1823         int dummy, i;
1824
1825         for (i = 0; i < TR_FLAG_SIZE; i++)
1826                 o_ptr->art_flags[i] = a_info[ART_BLOOD].flags[i];
1827
1828         dummy = randint1(2) + randint1(2);
1829         for (i = 0; i < dummy; i++)
1830         {
1831                 int flag = randint0(26);
1832                 if (flag >= 20) add_flag(o_ptr->art_flags, TR_KILL_UNDEAD + flag - 20);
1833                 else if (flag == 19) add_flag(o_ptr->art_flags, TR_KILL_ANIMAL);
1834                 else if (flag == 18) add_flag(o_ptr->art_flags, TR_SLAY_HUMAN);
1835                 else add_flag(o_ptr->art_flags, TR_CHAOTIC + flag);
1836         }
1837
1838         dummy = randint1(2);
1839         for (i = 0; i < dummy; i++) one_resistance(o_ptr);
1840
1841         for (i = 0; i < 2; i++)
1842         {
1843                 int tmp = randint0(11);
1844                 if (tmp < A_MAX) add_flag(o_ptr->art_flags, TR_STR + tmp);
1845                 else add_flag(o_ptr->art_flags, TR_STEALTH + tmp - 6);
1846         }
1847 }
1848
1849