OSDN Git Service

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