OSDN Git Service

[Refactor] #40014 Separated smart-learn-types.h from monster.h
[hengband/hengband.git] / src / cmd-item / cmd-activate.c
1 /*!
2  * @brief プレイヤーの発動コマンド実装
3  * @date 2018/09/07
4  * @author deskull
5  */
6
7 #include "cmd-item/cmd-activate.h"
8 #include "art-definition/art-bow-types.h"
9 #include "art-definition/art-sword-types.h"
10 #include "art-definition/art-weapon-types.h"
11 #include "art-definition/random-art-effects.h"
12 #include "cmd-io/cmd-save.h"
13 #include "cmd/cmd-basic.h"
14 #include "core/sort.h"
15 #include "effect/effect-characteristics.h"
16 #include "effect/spells-effect-util.h"
17 #include "floor/floor.h"
18 #include "inventory/player-inventory.h"
19 #include "io/files-util.h"
20 #include "io/targeting.h"
21 #include "main/sound-definitions-table.h"
22 #include "monster/monster-status.h"
23 #include "object-enchant/activation-info-table.h"
24 #include "object-enchant/artifact.h"
25 #include "object-enchant/dragon-breaths-table.h"
26 #include "object-enchant/object-ego.h"
27 #include "object/item-use-flags.h"
28 #include "object/object-flags.h"
29 #include "object/object-hook.h"
30 #include "object/object-kind.h"
31 #include "object/object-info.h"
32 #include "monster/smart-learn-types.h"
33 #include "player/avatar.h"
34 #include "player/player-damage.h"
35 #include "player/player-effects.h"
36 #include "player/player-races-table.h"
37 #include "spell-kind/earthquake.h"
38 #include "spell-kind/spells-beam.h"
39 #include "spell-kind/spells-charm.h"
40 #include "spell-kind/spells-detection.h"
41 #include "spell-kind/spells-floor.h"
42 #include "spell-kind/spells-genocide.h"
43 #include "spell-kind/spells-grid.h"
44 #include "spell-kind/spells-launcher.h"
45 #include "spell-kind/spells-lite.h"
46 #include "spell-kind/spells-neighbor.h"
47 #include "spell-kind/spells-random.h"
48 #include "spell-kind/spells-sight.h"
49 #include "spell-kind/spells-specific-bolt.h"
50 #include "spell-kind/spells-teleport.h"
51 #include "spell-realm/spells-hex.h"
52 #include "spell/process-effect.h"
53 #include "spell/spells-object.h"
54 #include "spell/spells-status.h"
55 #include "spell/spells-summon.h"
56 #include "spell/spells-type.h"
57 #include "spell/spells3.h"
58 #include "sv-definition/sv-lite-types.h"
59 #include "sv-definition/sv-ring-types.h"
60 #include "world/world.h"
61
62 /*!
63  * @brief 装備を発動するコマンドのサブルーチン /
64  * Activate a wielded object.  Wielded objects never stack.
65  * And even if they did, activatable objects never stack.
66  * @param item 発動するオブジェクトの所持品ID
67  * @return なし
68  * @details
69  * <pre>
70  * Currently, only (some) artifacts, and Dragon Scale Mail, can be activated.
71  * But one could, for example, easily make an activatable "Ring of Plasma".
72  * Note that it always takes a turn to activate an artifact, even if
73  * the user hits "escape" at the "direction" prompt.
74  * </pre>
75  */
76 void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
77 {
78         DIRECTION dir;
79         DEPTH lev;
80         int chance, fail;
81         object_type *o_ptr;
82         bool success;
83
84         o_ptr = ref_item(user_ptr, item);
85         take_turn(user_ptr, 100);
86         lev = k_info[o_ptr->k_idx].level;
87
88         /* Hack -- use artifact level instead */
89         if (object_is_fixed_artifact(o_ptr)) lev = a_info[o_ptr->name1].level;
90         else if (object_is_random_artifact(o_ptr))
91         {
92                 const activation_type* const act_ptr = find_activation_info(o_ptr);
93                 if (act_ptr) {
94                         lev = act_ptr->level;
95                 }
96         }
97         else if (((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)) && o_ptr->name2) lev = e_info[o_ptr->name2].level;
98
99         /* Base chance of success */
100         chance = user_ptr->skill_dev;
101
102         /* Confusion hurts skill */
103         if (user_ptr->confused) chance = chance / 2;
104
105         fail = lev + 5;
106         if (chance > fail) fail -= (chance - fail) * 2;
107         else chance -= (fail - chance) * 2;
108         if (fail < USE_DEVICE) fail = USE_DEVICE;
109         if (chance < USE_DEVICE) chance = USE_DEVICE;
110
111         if (cmd_limit_time_walk(user_ptr)) return;
112
113         if (user_ptr->pclass == CLASS_BERSERKER) success = FALSE;
114         else if (chance > fail)
115         {
116                 if (randint0(chance * 2) < fail) success = FALSE;
117                 else success = TRUE;
118         }
119         else
120         {
121                 if (randint0(fail * 2) < chance) success = TRUE;
122                 else success = FALSE;
123         }
124
125         /* Roll for usage */
126         if (!success)
127         {
128                 if (flush_failure) flush();
129                 msg_print(_("うまく始動させることができなかった。", "You failed to activate it properly."));
130                 sound(SOUND_FAIL);
131                 return;
132         }
133
134         /* Check the recharge */
135         if (o_ptr->timeout)
136         {
137                 msg_print(_("それは微かに音を立て、輝き、消えた...", "It whines, glows and fades..."));
138                 return;
139         }
140
141         /* Some lights need enough fuel for activation */
142         if (!o_ptr->xtra4 && (o_ptr->tval == TV_FLASK) &&
143                 ((o_ptr->sval == SV_LITE_TORCH) || (o_ptr->sval == SV_LITE_LANTERN)))
144         {
145                 msg_print(_("燃料がない。", "It has no fuel."));
146                 free_turn(user_ptr);
147                 return;
148         }
149
150         /* Activate the artifact */
151         msg_print(_("始動させた...", "You activate it..."));
152
153         sound(SOUND_ZAP);
154
155         /* Activate object */
156         if (activation_index(o_ptr))
157         {
158                 (void)activate_artifact(user_ptr, o_ptr);
159
160                 user_ptr->window |= (PW_INVEN | PW_EQUIP);
161
162                 /* Success */
163                 return;
164         }
165
166         /* Special items */
167         else if (o_ptr->tval == TV_WHISTLE)
168         {
169                 if (music_singing_any(user_ptr)) stop_singing(user_ptr);
170                 if (hex_spelling_any(user_ptr)) stop_hex_spell_all(user_ptr);
171
172                 {
173                         MONSTER_IDX pet_ctr, i;
174                         MONSTER_IDX *who;
175                         int max_pet = 0;
176                         u16b dummy_why;
177
178                         /* Allocate the "who" array */
179                         C_MAKE(who, current_world_ptr->max_m_idx, MONSTER_IDX);
180
181                         /* Process the monsters (backwards) */
182                         for (pet_ctr = user_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--)
183                         {
184                                 if (is_pet(&user_ptr->current_floor_ptr->m_list[pet_ctr]) && (user_ptr->riding != pet_ctr))
185                                         who[max_pet++] = pet_ctr;
186                         }
187
188                         ang_sort(who, &dummy_why, max_pet, ang_sort_comp_pet, ang_sort_swap_hook);
189
190                         /* Process the monsters (backwards) */
191                         for (i = 0; i < max_pet; i++)
192                         {
193                                 pet_ctr = who[i];
194                                 teleport_monster_to(user_ptr, pet_ctr, user_ptr->y, user_ptr->x, 100, TELEPORT_PASSIVE);
195                         }
196
197                         /* Free the "who" array */
198                         C_KILL(who, current_world_ptr->max_m_idx, MONSTER_IDX);
199                 }
200                 o_ptr->timeout = 100 + randint1(100);
201                 return;
202         }
203         else if (o_ptr->tval == TV_CAPTURE)
204         {
205                 if (!o_ptr->pval)
206                 {
207                         bool old_target_pet = target_pet;
208                         target_pet = TRUE;
209                         if (!get_aim_dir(user_ptr, &dir))
210                         {
211                                 target_pet = old_target_pet;
212                                 return;
213                         }
214                         target_pet = old_target_pet;
215
216                         if (fire_ball(user_ptr, GF_CAPTURE, dir, 0, 0))
217                         {
218                                 o_ptr->pval = (PARAMETER_VALUE)cap_mon;
219                                 o_ptr->xtra3 = (XTRA8)cap_mspeed;
220                                 o_ptr->xtra4 = (XTRA16)cap_hp;
221                                 o_ptr->xtra5 = (XTRA16)cap_maxhp;
222                                 if (cap_nickname)
223                                 {
224                                         concptr t;
225                                         char *s;
226                                         char buf[80] = "";
227
228                                         if (o_ptr->inscription)
229                                                 strcpy(buf, quark_str(o_ptr->inscription));
230                                         s = buf;
231                                         for (s = buf; *s && (*s != '#'); s++)
232                                         {
233 #ifdef JP
234                                                 if (iskanji(*s)) s++;
235 #endif
236                                         }
237                                         *s = '#';
238                                         s++;
239 #ifdef JP
240                                         /*nothing*/
241 #else
242                                         *s++ = '\'';
243 #endif
244                                         t = quark_str(cap_nickname);
245                                         while (*t)
246                                         {
247                                                 *s = *t;
248                                                 s++;
249                                                 t++;
250                                         }
251 #ifdef JP
252                                         /*nothing*/
253 #else
254                                         *s++ = '\'';
255 #endif
256                                         *s = '\0';
257                                         o_ptr->inscription = quark_add(buf);
258                                 }
259                         }
260                 }
261                 else
262                 {
263                         success = FALSE;
264                         if (!get_direction(user_ptr, &dir, FALSE, FALSE)) return;
265                         if (monster_can_enter(user_ptr, user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0))
266                         {
267                                 if (place_monster_aux(user_ptr, 0, user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE)))
268                                 {
269                                         if (o_ptr->xtra3) user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3;
270                                         if (o_ptr->xtra5) user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5;
271                                         if (o_ptr->xtra4) user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].hp = o_ptr->xtra4;
272                                         user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].maxhp = user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].max_maxhp;
273                                         if (o_ptr->inscription)
274                                         {
275                                                 char buf[80];
276                                                 concptr t;
277 #ifdef JP
278 #else
279                                                 bool quote = FALSE;
280 #endif
281
282                                                 t = quark_str(o_ptr->inscription);
283                                                 for (t = quark_str(o_ptr->inscription); *t && (*t != '#'); t++)
284                                                 {
285 #ifdef JP
286                                                         if (iskanji(*t)) t++;
287 #endif
288                                                 }
289                                                 if (*t)
290                                                 {
291                                                         char *s = buf;
292                                                         t++;
293 #ifdef JP
294                                                         /* nothing */
295 #else
296                                                         if (*t == '\'')
297                                                         {
298                                                                 t++;
299                                                                 quote = TRUE;
300                                                         }
301 #endif
302                                                         while (*t)
303                                                         {
304                                                                 *s = *t;
305                                                                 t++;
306                                                                 s++;
307                                                         }
308 #ifdef JP
309                                                         /* nothing */
310 #else
311                                                         if (quote && *(s - 1) == '\'')
312                                                                 s--;
313 #endif
314                                                         *s = '\0';
315                                                         user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].nickname = quark_add(buf);
316                                                         t = quark_str(o_ptr->inscription);
317                                                         s = buf;
318                                                         while (*t && (*t != '#'))
319                                                         {
320                                                                 *s = *t;
321                                                                 t++;
322                                                                 s++;
323                                                         }
324                                                         *s = '\0';
325                                                         o_ptr->inscription = quark_add(buf);
326                                                 }
327                                         }
328                                         o_ptr->pval = 0;
329                                         o_ptr->xtra3 = 0;
330                                         o_ptr->xtra4 = 0;
331                                         o_ptr->xtra5 = 0;
332                                         success = TRUE;
333                                 }
334                         }
335                         if (!success)
336                                 msg_print(_("おっと、解放に失敗した。", "Oops.  You failed to release your pet."));
337                 }
338                 calc_android_exp(user_ptr);
339                 return;
340         }
341
342         /* Mistake */
343         msg_print(_("おっと、このアイテムは始動できない。", "Oops.  That object cannot be activated."));
344 }
345
346 /*!
347  * @brief 装備を発動するコマンドのメインルーチン /
348  * @param user_ptr プレーヤーへの参照ポインタ
349  * @return なし
350  */
351 void do_cmd_activate(player_type *user_ptr)
352 {
353         OBJECT_IDX item;
354         concptr q, s;
355
356         if (user_ptr->wild_mode) return;
357         if (cmd_limit_arena(user_ptr)) return;
358
359         if (user_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
360         {
361                 set_action(user_ptr, ACTION_NONE);
362         }
363
364         item_tester_hook = item_tester_hook_activate;
365
366         q = _("どのアイテムを始動させますか? ", "Activate which item? ");
367         s = _("始動できるアイテムを装備していない。", "You have nothing to activate.");
368
369         if (!choose_object(user_ptr, &item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0)) return;
370
371         /* Activate the item */
372         exe_activate(user_ptr, item);
373 }
374
375 /*!
376 * @brief 発動によるブレスの属性をアイテムの耐性から選択し、実行を処理する。/ Dragon breath activation
377 * @details 対象となる耐性は dragonbreath_info テーブルを参照のこと。
378 * @param user_ptr プレーヤーへの参照ポインタ
379 * @param o_ptr 対象のオブジェクト構造体ポインタ
380 * @return 発動実行の是非を返す。
381 */
382 static bool activate_dragon_breath(player_type *user_ptr, object_type *o_ptr)
383 {
384         BIT_FLAGS flgs[TR_FLAG_SIZE]; /* for resistance flags */
385         int type[20];
386         concptr name[20];
387         int i, t, n = 0;
388         DIRECTION dir;
389
390         if (!get_aim_dir(user_ptr, &dir)) return FALSE;
391
392         object_flags(o_ptr, flgs);
393
394         for (i = 0; dragonbreath_info[i].flag != 0; i++)
395         {
396                 if (have_flag(flgs, dragonbreath_info[i].flag))
397                 {
398                         type[n] = dragonbreath_info[i].type;
399                         name[n] = dragonbreath_info[i].name;
400                         n++;
401                 }
402         }
403         if (n == 0) return FALSE;
404
405         /* Stop speaking */
406         if (music_singing_any(user_ptr)) stop_singing(user_ptr);
407         if (hex_spelling_any(user_ptr)) stop_hex_spell_all(user_ptr);
408
409         t = randint0(n);
410         msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), name[t]);
411         fire_breath(user_ptr, type[t], dir, 250, 4);
412
413         return TRUE;
414 }
415
416
417 /*!
418  * @brief アイテムの発動効果を処理する。
419  * @param user_ptr プレーヤーへの参照ポインタ
420  * @param o_ptr 対象のオブジェクト構造体ポインタ
421  * @return 発動実行の是非を返す。
422  */
423 bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
424 {
425         PLAYER_LEVEL plev = user_ptr->lev;
426         int k, dummy = 0;
427         DIRECTION dir;
428         concptr name = k_name + k_info[o_ptr->k_idx].name;
429         const activation_type* const act_ptr = find_activation_info(o_ptr);
430         if (!act_ptr) {
431                 /* Maybe forgot adding information to activation_info table ? */
432                 msg_print("Activation information is not found.");
433                 return FALSE;
434         }
435
436         /* Activate for attack */
437         switch (act_ptr->index)
438         {
439         case ACT_SUNLIGHT:
440         {
441                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
442                 msg_print(_("太陽光線が放たれた。", "A line of sunlight appears."));
443                 (void)lite_line(user_ptr, dir, damroll(6, 8));
444                 break;
445         }
446
447         case ACT_BO_MISS_1:
448         {
449                 msg_print(_("それは眩しいくらいに明るく輝いている...", "It glows extremely brightly..."));
450                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
451                 fire_bolt(user_ptr, GF_MISSILE, dir, damroll(2, 6));
452                 break;
453         }
454
455         case ACT_BA_POIS_1:
456         {
457                 msg_print(_("それは濃緑色に脈動している...", "It throbs deep green..."));
458                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
459                 fire_ball(user_ptr, GF_POIS, dir, 12, 3);
460                 break;
461         }
462
463         case ACT_BO_ELEC_1:
464         {
465                 msg_print(_("それは火花に覆われた...", "It is covered in sparks..."));
466                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
467                 fire_bolt(user_ptr, GF_ELEC, dir, damroll(4, 8));
468                 break;
469         }
470
471         case ACT_BO_ACID_1:
472         {
473                 msg_print(_("それは酸に覆われた...", "It is covered in acid..."));
474                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
475                 fire_bolt(user_ptr, GF_ACID, dir, damroll(5, 8));
476                 break;
477         }
478
479         case ACT_BO_COLD_1:
480         {
481                 msg_print(_("それは霜に覆われた...", "It is covered in frost..."));
482                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
483                 fire_bolt(user_ptr, GF_COLD, dir, damroll(6, 8));
484                 break;
485         }
486
487         case ACT_BO_FIRE_1:
488         {
489                 msg_print(_("それは炎に覆われた...", "It is covered in fire..."));
490                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
491                 fire_bolt(user_ptr, GF_FIRE, dir, damroll(9, 8));
492                 break;
493         }
494
495         case ACT_BA_COLD_1:
496         {
497                 msg_print(_("それは霜に覆われた...", "It is covered in frost..."));
498                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
499                 fire_ball(user_ptr, GF_COLD, dir, 48, 2);
500                 break;
501         }
502
503         case ACT_BA_COLD_2:
504         {
505                 msg_print(_("それは青く激しく輝いた...", "It glows an intense blue..."));
506                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
507                 fire_ball(user_ptr, GF_COLD, dir, 100, 2);
508                 break;
509         }
510
511         case ACT_BA_COLD_3:
512         {
513                 msg_print(_("明るく白色に輝いている...", "It glows bright white..."));
514                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
515                 fire_ball(user_ptr, GF_COLD, dir, 400, 3);
516                 break;
517         }
518
519         case ACT_BA_FIRE_1:
520         {
521                 msg_print(_("それは赤く激しく輝いた...", "It glows an intense red..."));
522                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
523                 fire_ball(user_ptr, GF_FIRE, dir, 72, 2);
524                 break;
525         }
526
527         case ACT_BA_FIRE_2:
528         {
529                 msg_format(_("%sから炎が吹き出した...", "The %s rages in fire..."), name);
530                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
531                 fire_ball(user_ptr, GF_FIRE, dir, 120, 3);
532                 break;
533         }
534
535         case ACT_BA_FIRE_3:
536         {
537                 msg_print(_("深赤色に輝いている...", "It glows deep red..."));
538                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
539                 fire_ball(user_ptr, GF_FIRE, dir, 300, 3);
540                 break;
541         }
542
543         case ACT_BA_FIRE_4:
544         {
545                 msg_print(_("それは赤く激しく輝いた...", "It glows an intense red..."));
546                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
547                 fire_ball(user_ptr, GF_FIRE, dir, 100, 2);
548                 break;
549         }
550
551         case ACT_BA_ELEC_2:
552         {
553                 msg_print(_("電気がパチパチ音を立てた...", "It crackles with electricity..."));
554                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
555                 fire_ball(user_ptr, GF_ELEC, dir, 100, 3);
556                 break;
557         }
558
559         case ACT_BA_ELEC_3:
560         {
561                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
562                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
563                 fire_ball(user_ptr, GF_ELEC, dir, 500, 3);
564                 break;
565         }
566
567         case ACT_BA_ACID_1:
568         {
569                 msg_print(_("それは黒く激しく輝いた...", "It glows an intense black..."));
570                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
571                 fire_ball(user_ptr, GF_ACID, dir, 100, 2);
572                 break;
573         }
574
575         case ACT_BA_NUKE_1:
576         {
577                 msg_print(_("それは緑に激しく輝いた...", "It glows an intense green..."));
578                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
579                 fire_ball(user_ptr, GF_NUKE, dir, 100, 2);
580                 break;
581         }
582
583         case ACT_HYPODYNAMIA_1:
584         {
585                 msg_format(_("あなたは%sに敵を締め殺すよう命じた。", "You order the %s to strangle your opponent."), name);
586                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
587                 hypodynamic_bolt(user_ptr, dir, 100);
588                 break;
589         }
590
591         case ACT_HYPODYNAMIA_2:
592         {
593                 msg_print(_("黒く輝いている...", "It glows black..."));
594                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
595                 hypodynamic_bolt(user_ptr, dir, 120);
596                 break;
597         }
598
599         case ACT_DRAIN_1:
600         {
601                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
602                 for (dummy = 0; dummy < 3; dummy++)
603                 {
604                         if (hypodynamic_bolt(user_ptr, dir, 50))
605                                 hp_player(user_ptr, 50);
606                 }
607                 break;
608         }
609
610         case ACT_BO_MISS_2:
611         {
612                 msg_print(_("魔法のトゲが現れた...", "It grows magical spikes..."));
613                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
614                 fire_bolt(user_ptr, GF_ARROW, dir, 150);
615                 break;
616         }
617
618         case ACT_WHIRLWIND:
619         {
620                 massacre(user_ptr);
621                 break;
622         }
623
624         case ACT_DRAIN_2:
625         {
626                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
627                 for (dummy = 0; dummy < 3; dummy++)
628                 {
629                         if (hypodynamic_bolt(user_ptr, dir, 100))
630                                 hp_player(user_ptr, 100);
631                 }
632                 break;
633         }
634
635
636         case ACT_CALL_CHAOS:
637         {
638                 msg_print(_("様々な色の火花を発している...", "It glows in scintillating colours..."));
639                 call_chaos(user_ptr);
640                 break;
641         }
642
643         case ACT_ROCKET:
644         {
645                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
646                 msg_print(_("ロケットを発射した!", "You launch a rocket!"));
647                 fire_ball(user_ptr, GF_ROCKET, dir, 250 + plev * 3, 2);
648                 break;
649         }
650
651         case ACT_DISP_EVIL:
652         {
653                 msg_print(_("神聖な雰囲気が充満した...", "It floods the area with goodness..."));
654                 dispel_evil(user_ptr, user_ptr->lev * 5);
655                 break;
656         }
657
658         case ACT_BA_MISS_3:
659         {
660                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
661                 msg_print(_("あなたはエレメントのブレスを吐いた。", "You breathe the elements."));
662                 fire_breath(user_ptr, GF_MISSILE, dir, 300, 4);
663                 break;
664         }
665
666         case ACT_DISP_GOOD:
667         {
668                 msg_print(_("邪悪な雰囲気が充満した...", "It floods the area with evil..."));
669                 dispel_good(user_ptr, user_ptr->lev * 5);
670                 break;
671         }
672
673         case ACT_BO_MANA:
674         {
675                 msg_format(_("%sに魔法のトゲが現れた...", "The %s grows magical spikes..."), name);
676                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
677                 fire_bolt(user_ptr, GF_ARROW, dir, 150);
678                 break;
679         }
680
681         case ACT_BA_WATER:
682         {
683                 msg_format(_("%sが深い青色に鼓動している...", "The %s throbs deep blue..."), name);
684                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
685                 fire_ball(user_ptr, GF_WATER, dir, 200, 3);
686                 break;
687         }
688
689         case ACT_BA_DARK:
690         {
691                 msg_format(_("%sが深い闇に覆われた...", "The %s is coverd in pitch-darkness..."), name);
692                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
693                 fire_ball(user_ptr, GF_DARK, dir, 250, 4);
694                 break;
695         }
696
697         case ACT_BA_MANA:
698         {
699                 msg_format(_("%sが青白く光った...", "The %s glows pale..."), name);
700                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
701                 fire_ball(user_ptr, GF_MANA, dir, 250, 4);
702                 break;
703         }
704
705         case ACT_PESTICIDE:
706         {
707                 msg_print(_("あなたは害虫を一掃した。", "You exterminate small life."));
708                 (void)dispel_monsters(user_ptr, 4);
709                 break;
710         }
711
712         case ACT_BLINDING_LIGHT:
713         {
714                 msg_format(_("%sが眩しい光で輝いた...", "The %s gleams with blinding light..."), name);
715                 fire_ball(user_ptr, GF_LITE, 0, 300, 6);
716                 confuse_monsters(user_ptr, 3 * user_ptr->lev / 2);
717                 break;
718         }
719
720         case ACT_BIZARRE:
721         {
722                 msg_format(_("%sは漆黒に輝いた...", "The %s glows intensely black..."), name);
723                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
724                 ring_of_power(user_ptr, dir);
725                 break;
726         }
727
728         case ACT_CAST_BA_STAR:
729         {
730                 HIT_POINT num = damroll(5, 3);
731                 POSITION y = 0, x = 0;
732                 int attempts;
733                 msg_format(_("%sが稲妻で覆われた...", "The %s is surrounded by lightning..."), name);
734                 for (k = 0; k < num; k++)
735                 {
736                         attempts = 1000;
737
738                         while (attempts--)
739                         {
740                                 scatter(user_ptr, &y, &x, user_ptr->y, user_ptr->x, 4, 0);
741                                 if (!cave_have_flag_bold(user_ptr->current_floor_ptr, y, x, FF_PROJECT)) continue;
742                                 if (!player_bold(user_ptr, y, x)) break;
743                         }
744
745                         project(user_ptr, 0, 3, y, x, 150, GF_ELEC,
746                                 (PROJECT_THRU | PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
747                 }
748
749                 break;
750         }
751
752         case ACT_BLADETURNER:
753         {
754                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
755                 msg_print(_("あなたはエレメントのブレスを吐いた。", "You breathe the elements."));
756                 fire_breath(user_ptr, GF_MISSILE, dir, 300, 4);
757                 msg_print(_("鎧が様々な色に輝いた...", "Your armor glows many colours..."));
758                 (void)set_afraid(user_ptr, 0);
759                 (void)set_hero(user_ptr, randint1(50) + 50, FALSE);
760                 (void)hp_player(user_ptr, 10);
761                 (void)set_blessed(user_ptr, randint1(50) + 50, FALSE);
762                 (void)set_oppose_acid(user_ptr, randint1(50) + 50, FALSE);
763                 (void)set_oppose_elec(user_ptr, randint1(50) + 50, FALSE);
764                 (void)set_oppose_fire(user_ptr, randint1(50) + 50, FALSE);
765                 (void)set_oppose_cold(user_ptr, randint1(50) + 50, FALSE);
766                 (void)set_oppose_pois(user_ptr, randint1(50) + 50, FALSE);
767                 break;
768         }
769
770         case ACT_BR_FIRE:
771         {
772                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
773                 fire_breath(user_ptr, GF_FIRE, dir, 200, 2);
774                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
775                 {
776                         (void)set_oppose_fire(user_ptr, randint1(20) + 20, FALSE);
777                 }
778                 break;
779         }
780
781         case ACT_BR_COLD:
782         {
783                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
784                 fire_breath(user_ptr, GF_COLD, dir, 200, 2);
785                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
786                 {
787                         (void)set_oppose_cold(user_ptr, randint1(20) + 20, FALSE);
788                 }
789                 break;
790         }
791
792         case ACT_BR_DRAGON:
793         {
794                 if (!activate_dragon_breath(user_ptr, o_ptr)) return FALSE;
795                 break;
796         }
797
798         /* Activate for other offensive action */
799         case ACT_CONFUSE:
800         {
801                 msg_print(_("様々な色の火花を発している...", "It glows in scintillating colours..."));
802                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
803                 confuse_monster(user_ptr, dir, 20);
804                 break;
805         }
806
807         case ACT_SLEEP:
808         {
809                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
810                 sleep_monsters_touch(user_ptr);
811                 break;
812         }
813
814         case ACT_QUAKE:
815         {
816                 earthquake(user_ptr, user_ptr->y, user_ptr->x, 5, 0);
817                 break;
818         }
819
820         case ACT_TERROR:
821         {
822                 turn_monsters(user_ptr, 40 + user_ptr->lev);
823                 break;
824         }
825
826         case ACT_TELE_AWAY:
827         {
828                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
829                 (void)fire_beam(user_ptr, GF_AWAY_ALL, dir, plev);
830                 break;
831         }
832
833         case ACT_BANISH_EVIL:
834         {
835                 if (banish_evil(user_ptr, 100))
836                 {
837                         msg_print(_("アーティファクトの力が邪悪を打ち払った!", "The power of the artifact banishes evil!"));
838                 }
839                 break;
840         }
841
842         case ACT_GENOCIDE:
843         {
844                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
845                 (void)symbol_genocide(user_ptr, 200, TRUE);
846                 break;
847         }
848
849         case ACT_MASS_GENO:
850         {
851                 msg_print(_("ひどく鋭い音が流れ出た...", "It lets out a long, shrill note..."));
852                 (void)mass_genocide(user_ptr, 200, TRUE);
853                 break;
854         }
855
856         case ACT_SCARE_AREA:
857         {
858                 if (music_singing_any(user_ptr)) stop_singing(user_ptr);
859                 if (hex_spelling_any(user_ptr)) stop_hex_spell_all(user_ptr);
860                 msg_print(_("あなたは力強い突風を吹き鳴らした。周囲の敵が震え上っている!",
861                         "You wind a mighty blast; your enemies tremble!"));
862                 (void)turn_monsters(user_ptr, (3 * user_ptr->lev / 2) + 10);
863                 break;
864         }
865
866         case ACT_AGGRAVATE:
867         {
868                 if (o_ptr->name1 == ART_HYOUSIGI)
869                 {
870                         msg_print(_("拍子木を打った。", "You beat your wooden clappers."));
871                 }
872                 else
873                 {
874                         msg_format(_("%sは不快な物音を立てた。", "The %s sounds an unpleasant noise."), name);
875                 }
876                 aggravate_monsters(user_ptr, 0);
877                 break;
878         }
879
880         /* Activate for summoning / charming */
881
882         case ACT_CHARM_ANIMAL:
883         {
884                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
885                 (void)charm_animal(user_ptr, dir, plev);
886                 break;
887         }
888
889         case ACT_CHARM_UNDEAD:
890         {
891                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
892                 (void)control_one_undead(user_ptr, dir, plev);
893                 break;
894         }
895
896         case ACT_CHARM_OTHER:
897         {
898                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
899                 (void)charm_monster(user_ptr, dir, plev * 2);
900                 break;
901         }
902
903         case ACT_CHARM_ANIMALS:
904         {
905                 (void)charm_animals(user_ptr, plev * 2);
906                 break;
907         }
908
909         case ACT_CHARM_OTHERS:
910         {
911                 charm_monsters(user_ptr, plev * 2);
912                 break;
913         }
914
915         case ACT_SUMMON_ANIMAL:
916         {
917                 (void)summon_specific(user_ptr, -1, user_ptr->y, user_ptr->x, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET));
918                 break;
919         }
920
921         case ACT_SUMMON_PHANTOM:
922         {
923                 msg_print(_("幻霊を召喚した。", "You summon a phantasmal servant."));
924                 (void)summon_specific(user_ptr, -1, user_ptr->y, user_ptr->x, user_ptr->current_floor_ptr->dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET));
925                 break;
926         }
927
928         case ACT_SUMMON_ELEMENTAL:
929                 if (!cast_summon_elemental(user_ptr, (plev * 3) / 2)) return FALSE;
930                 break;
931
932         case ACT_SUMMON_DEMON:
933         {
934                 cast_summon_demon(user_ptr, (plev * 3) / 2);
935                 break;
936         }
937
938         case ACT_SUMMON_UNDEAD:
939                 if (!cast_summon_undead(user_ptr, (plev * 3) / 2)) return FALSE;
940                 break;
941
942         case ACT_SUMMON_HOUND:
943                 if (!cast_summon_hound(user_ptr, (plev * 3) / 2)) return FALSE;
944                 break;
945
946         case ACT_SUMMON_DAWN:
947         {
948                 msg_print(_("暁の師団を召喚した。", "You summon the Legion of the Dawn."));
949                 (void)summon_specific(user_ptr, -1, user_ptr->y, user_ptr->x, user_ptr->current_floor_ptr->dun_level, SUMMON_DAWN, (PM_ALLOW_GROUP | PM_FORCE_PET));
950                 break;
951         }
952
953         case ACT_SUMMON_OCTOPUS:
954                 if (!cast_summon_octopus(user_ptr)) return FALSE;
955                 break;
956
957                 /* Activate for healing */
958
959         case ACT_CHOIR_SINGS:
960         {
961                 msg_print(_("天国の歌が聞こえる...", "A heavenly choir sings..."));
962                 (void)cure_critical_wounds(user_ptr, 777);
963                 (void)set_hero(user_ptr, randint1(25) + 25, FALSE);
964                 break;
965         }
966
967         case ACT_CURE_LW:
968         {
969                 (void)set_afraid(user_ptr, 0);
970                 (void)hp_player(user_ptr, 30);
971                 break;
972         }
973
974         case ACT_CURE_MW:
975         {
976                 msg_print(_("深紫色の光を発している...", "It radiates deep purple..."));
977                 (void)cure_serious_wounds(user_ptr, 4, 8);
978                 break;
979         }
980
981         case ACT_CURE_POISON:
982         {
983                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
984                 (void)set_afraid(user_ptr, 0);
985                 (void)set_poisoned(user_ptr, 0);
986                 break;
987         }
988
989         case ACT_REST_EXP:
990         {
991                 msg_print(_("深紅に輝いている...", "It glows a deep red..."));
992                 restore_level(user_ptr);
993                 break;
994         }
995
996         case ACT_REST_ALL:
997         {
998                 msg_print(_("濃緑色に輝いている...", "It glows a deep green..."));
999                 (void)restore_all_status(user_ptr);
1000                 (void)restore_level(user_ptr);
1001                 break;
1002         }
1003
1004         case ACT_CURE_700:
1005         {
1006                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
1007                 msg_print(_("体内に暖かい鼓動が感じられる...", "You feel a warm tingling inside..."));
1008                 (void)cure_critical_wounds(user_ptr, 700);
1009                 break;
1010         }
1011
1012         case ACT_CURE_1000:
1013         {
1014                 msg_print(_("白く明るく輝いている...", "It glows a bright white..."));
1015                 msg_print(_("ひじょうに気分がよい...", "You feel much better..."));
1016                 (void)cure_critical_wounds(user_ptr, 1000);
1017                 break;
1018         }
1019
1020         case ACT_CURING:
1021         {
1022                 msg_format(_("%sの優しさに癒される...", "the %s cures you affectionately ..."), name);
1023                 true_healing(user_ptr, 0);
1024                 break;
1025         }
1026
1027         case ACT_CURE_MANA_FULL:
1028         {
1029                 msg_format(_("%sが青白く光った...", "The %s glows pale..."), name);
1030                 restore_mana(user_ptr, TRUE);
1031                 break;
1032         }
1033
1034         /* Activate for timed effect */
1035
1036         case ACT_ESP:
1037         {
1038                 (void)set_tim_esp(user_ptr, randint1(30) + 25, FALSE);
1039                 break;
1040         }
1041
1042         case ACT_BERSERK:
1043         {
1044                 (void)berserk(user_ptr, randint1(25) + 25);
1045                 break;
1046         }
1047
1048         case ACT_PROT_EVIL:
1049         {
1050                 msg_format(_("%sから鋭い音が流れ出た...", "The %s lets out a shrill wail..."), name);
1051                 k = 3 * user_ptr->lev;
1052                 (void)set_protevil(user_ptr, randint1(25) + k, FALSE);
1053                 break;
1054         }
1055
1056         case ACT_RESIST_ALL:
1057         {
1058                 msg_print(_("様々な色に輝いている...", "It glows many colours..."));
1059                 (void)set_oppose_acid(user_ptr, randint1(40) + 40, FALSE);
1060                 (void)set_oppose_elec(user_ptr, randint1(40) + 40, FALSE);
1061                 (void)set_oppose_fire(user_ptr, randint1(40) + 40, FALSE);
1062                 (void)set_oppose_cold(user_ptr, randint1(40) + 40, FALSE);
1063                 (void)set_oppose_pois(user_ptr, randint1(40) + 40, FALSE);
1064                 break;
1065         }
1066
1067         case ACT_SPEED:
1068         {
1069                 msg_print(_("明るく緑色に輝いている...", "It glows bright green..."));
1070                 (void)set_fast(user_ptr, randint1(20) + 20, FALSE);
1071                 break;
1072         }
1073
1074         case ACT_XTRA_SPEED:
1075         {
1076                 msg_print(_("明るく輝いている...", "It glows brightly..."));
1077                 (void)set_fast(user_ptr, randint1(75) + 75, FALSE);
1078                 break;
1079         }
1080
1081         case ACT_WRAITH:
1082         {
1083                 set_wraith_form(user_ptr, randint1(plev / 2) + (plev / 2), FALSE);
1084                 break;
1085         }
1086
1087         case ACT_INVULN:
1088         {
1089                 (void)set_invuln(user_ptr, randint1(8) + 8, FALSE);
1090                 break;
1091         }
1092
1093         case ACT_HERO:
1094         {
1095                 (void)heroism(user_ptr, 25);
1096                 break;
1097         }
1098
1099         case ACT_HERO_SPEED:
1100         {
1101                 (void)set_fast(user_ptr, randint1(50) + 50, FALSE);
1102                 (void)heroism(user_ptr, 50);
1103                 break;
1104         }
1105
1106         case ACT_RESIST_ACID:
1107         {
1108                 msg_format(_("%sが黒く輝いた...", "The %s grows black."), name);
1109                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ACID))
1110                 {
1111                         if (!get_aim_dir(user_ptr, &dir)) return FALSE;
1112                         fire_ball(user_ptr, GF_ACID, dir, 100, 2);
1113                 }
1114                 (void)set_oppose_acid(user_ptr, randint1(20) + 20, FALSE);
1115                 break;
1116         }
1117
1118         case ACT_RESIST_FIRE:
1119         {
1120                 msg_format(_("%sが赤く輝いた...", "The %s grows red."), name);
1121                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
1122                 {
1123                         if (!get_aim_dir(user_ptr, &dir)) return FALSE;
1124                         fire_ball(user_ptr, GF_FIRE, dir, 100, 2);
1125                 }
1126                 (void)set_oppose_fire(user_ptr, randint1(20) + 20, FALSE);
1127                 break;
1128         }
1129
1130         case ACT_RESIST_COLD:
1131         {
1132                 msg_format(_("%sが白く輝いた...", "The %s grows white."), name);
1133                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
1134                 {
1135                         if (!get_aim_dir(user_ptr, &dir)) return FALSE;
1136                         fire_ball(user_ptr, GF_COLD, dir, 100, 2);
1137                 }
1138                 (void)set_oppose_cold(user_ptr, randint1(20) + 20, FALSE);
1139                 break;
1140         }
1141
1142         case ACT_RESIST_ELEC:
1143         {
1144                 msg_format(_("%sが青く輝いた...", "The %s grows blue."), name);
1145                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ELEC))
1146                 {
1147                         if (!get_aim_dir(user_ptr, &dir)) return FALSE;
1148                         fire_ball(user_ptr, GF_ELEC, dir, 100, 2);
1149                 }
1150                 (void)set_oppose_elec(user_ptr, randint1(20) + 20, FALSE);
1151                 break;
1152         }
1153
1154         case ACT_RESIST_POIS:
1155         {
1156                 msg_format(_("%sが緑に輝いた...", "The %s grows green."), name);
1157                 (void)set_oppose_pois(user_ptr, randint1(20) + 20, FALSE);
1158                 break;
1159         }
1160
1161         /* Activate for general purpose effect (detection etc.) */
1162
1163         case ACT_LIGHT:
1164         {
1165                 msg_format(_("%sから澄んだ光があふれ出た...", "The %s wells with clear light..."), name);
1166                 lite_area(user_ptr, damroll(2, 15), 3);
1167                 break;
1168         }
1169
1170         case ACT_MAP_LIGHT:
1171         {
1172                 msg_print(_("眩しく輝いた...", "It shines brightly..."));
1173                 map_area(user_ptr, DETECT_RAD_MAP);
1174                 lite_area(user_ptr, damroll(2, 15), 3);
1175                 break;
1176         }
1177
1178         case ACT_DETECT_ALL:
1179         {
1180                 msg_print(_("白く明るく輝いている...", "It glows bright white..."));
1181                 msg_print(_("心にイメージが浮かんできた...", "An image forms in your mind..."));
1182                 detect_all(user_ptr, DETECT_RAD_DEFAULT);
1183                 break;
1184         }
1185
1186         case ACT_DETECT_XTRA:
1187         {
1188                 msg_print(_("明るく輝いている...", "It glows brightly..."));
1189                 detect_all(user_ptr, DETECT_RAD_DEFAULT);
1190                 probing(user_ptr);
1191                 identify_fully(user_ptr, FALSE, 0);
1192                 break;
1193         }
1194
1195         case ACT_ID_FULL:
1196         {
1197                 msg_print(_("黄色く輝いている...", "It glows yellow..."));
1198                 identify_fully(user_ptr, FALSE, 0);
1199                 break;
1200         }
1201
1202         case ACT_ID_PLAIN:
1203         {
1204                 if (!ident_spell(user_ptr, FALSE, 0)) return FALSE;
1205                 break;
1206         }
1207
1208         case ACT_RUNE_EXPLO:
1209         {
1210                 msg_print(_("明るい赤色に輝いている...", "It glows bright red..."));
1211                 explosive_rune(user_ptr, user_ptr->y, user_ptr->x);
1212                 break;
1213         }
1214
1215         case ACT_RUNE_PROT:
1216         {
1217                 msg_print(_("ブルーに明るく輝いている...", "It glows light blue..."));
1218                 warding_glyph(user_ptr);
1219                 break;
1220         }
1221
1222         case ACT_SATIATE:
1223         {
1224                 (void)set_food(user_ptr, PY_FOOD_MAX - 1);
1225                 break;
1226         }
1227
1228         case ACT_DEST_DOOR:
1229         {
1230                 msg_print(_("明るい赤色に輝いている...", "It glows bright red..."));
1231                 destroy_doors_touch(user_ptr);
1232                 break;
1233         }
1234
1235         case ACT_STONE_MUD:
1236         {
1237                 msg_print(_("鼓動している...", "It pulsates..."));
1238                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
1239                 wall_to_mud(user_ptr, dir, 20 + randint1(30));
1240                 break;
1241         }
1242
1243         case ACT_RECHARGE:
1244         {
1245                 recharge(user_ptr, 130);
1246                 break;
1247         }
1248
1249         case ACT_ALCHEMY:
1250         {
1251                 msg_print(_("明るい黄色に輝いている...", "It glows bright yellow..."));
1252                 (void)alchemy(user_ptr);
1253                 break;
1254         }
1255
1256         case ACT_DIM_DOOR:
1257         {
1258                 msg_print(_("次元の扉が開いた。目的地を選んで下さい。", "You open a dimensional gate. Choose a destination."));
1259                 if (!dimension_door(user_ptr)) return FALSE;
1260                 break;
1261         }
1262
1263
1264         case ACT_TELEPORT:
1265         {
1266                 msg_print(_("周りの空間が歪んでいる...", "It twists space around you..."));
1267                 teleport_player(user_ptr, 100, TELEPORT_SPONTANEOUS);
1268                 break;
1269         }
1270
1271         case ACT_RECALL:
1272         {
1273                 msg_print(_("やわらかな白色に輝いている...", "It glows soft white..."));
1274                 if (!recall_player(user_ptr, randint0(21) + 15)) return FALSE;
1275                 break;
1276         }
1277
1278         case ACT_JUDGE:
1279         {
1280                 msg_format(_("%sは赤く明るく光った!", "The %s flashes bright red!"), name);
1281                 chg_virtue(user_ptr, V_KNOWLEDGE, 1);
1282                 chg_virtue(user_ptr, V_ENLIGHTEN, 1);
1283                 wiz_lite(user_ptr, FALSE);
1284
1285                 msg_format(_("%sはあなたの体力を奪った...", "The %s drains your vitality..."), name);
1286                 take_hit(user_ptr, DAMAGE_LOSELIFE, damroll(3, 8), _("審判の宝石", "the Jewel of Judgement"), -1);
1287
1288                 (void)detect_traps(user_ptr, DETECT_RAD_DEFAULT, TRUE);
1289                 (void)detect_doors(user_ptr, DETECT_RAD_DEFAULT);
1290                 (void)detect_stairs(user_ptr, DETECT_RAD_DEFAULT);
1291
1292                 if (get_check(_("帰還の力を使いますか?", "Activate recall? ")))
1293                 {
1294                         (void)recall_player(user_ptr, randint0(21) + 15);
1295                 }
1296
1297                 break;
1298         }
1299
1300         case ACT_TELEKINESIS:
1301         {
1302                 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
1303                 msg_format(_("%sを伸ばした。", "You stretched your %s."), name);
1304                 fetch(user_ptr, dir, 500, TRUE);
1305                 break;
1306         }
1307
1308         case ACT_DETECT_UNIQUE:
1309         {
1310                 int i;
1311                 monster_type *m_ptr;
1312                 monster_race *r_ptr;
1313                 msg_print(_("奇妙な場所が頭の中に浮かんだ...", "Some strange places show up in your mind. And you see ..."));
1314                 /* Process the monsters (backwards) */
1315                 for (i = user_ptr->current_floor_ptr->m_max - 1; i >= 1; i--)
1316                 {
1317                         m_ptr = &user_ptr->current_floor_ptr->m_list[i];
1318
1319                         /* Ignore "dead" monsters */
1320                         if (!monster_is_valid(m_ptr)) continue;
1321
1322                         r_ptr = &r_info[m_ptr->r_idx];
1323
1324                         if (r_ptr->flags1 & RF1_UNIQUE)
1325                         {
1326                                 msg_format(_("%s. ", "%s. "), r_name + r_ptr->name);
1327                         }
1328                 }
1329                 break;
1330         }
1331
1332         case ACT_ESCAPE:
1333         {
1334                 switch (randint1(13))
1335                 {
1336                 case 1: case 2: case 3: case 4: case 5:
1337                         teleport_player(user_ptr, 10, TELEPORT_SPONTANEOUS);
1338                         break;
1339                 case 6: case 7: case 8: case 9: case 10:
1340                         teleport_player(user_ptr, 222, TELEPORT_SPONTANEOUS);
1341                         break;
1342                 case 11: case 12:
1343                         (void)stair_creation(user_ptr);
1344                         break;
1345                 default:
1346                         if (get_check(_("この階を去りますか?", "Leave this level? ")))
1347                         {
1348                                 if (autosave_l) do_cmd_save_game(user_ptr, TRUE);
1349                                 user_ptr->leaving = TRUE;
1350                         }
1351                 }
1352                 break;
1353         }
1354
1355         case ACT_DISP_CURSE_XTRA:
1356         {
1357                 msg_format(_("%sが真実を照らし出す...", "The %s exhibits the truth..."), name);
1358                 (void)remove_all_curse(user_ptr);
1359                 (void)probing(user_ptr);
1360                 break;
1361         }
1362
1363         case ACT_BRAND_FIRE_BOLTS:
1364         {
1365                 msg_format(_("%sが深紅に輝いた...", "Your %s glows deep red..."), name);
1366                 brand_bolts(user_ptr);
1367                 break;
1368         }
1369
1370         case ACT_RECHARGE_XTRA:
1371         {
1372                 msg_format(_("%sが白く輝いた...", "The %s gleams with blinding light..."), name);
1373                 if (!recharge(user_ptr, 1000)) return FALSE;
1374                 break;
1375         }
1376
1377         case ACT_LORE:
1378                 msg_print(_("石が隠された秘密を写し出した...", "The stone reveals hidden mysteries..."));
1379                 if (!perilous_secrets(user_ptr)) return FALSE;
1380                 break;
1381
1382         case ACT_SHIKOFUMI:
1383         {
1384                 msg_print(_("力強く四股を踏んだ。", "You stamp. (as if you are in a ring.)"));
1385                 (void)set_afraid(user_ptr, 0);
1386                 (void)set_hero(user_ptr, randint1(20) + 20, FALSE);
1387                 dispel_evil(user_ptr, user_ptr->lev * 3);
1388                 break;
1389         }
1390
1391         case ACT_PHASE_DOOR:
1392         {
1393                 teleport_player(user_ptr, 10, TELEPORT_SPONTANEOUS);
1394                 break;
1395         }
1396
1397         case ACT_DETECT_ALL_MONS:
1398         {
1399                 (void)detect_monsters_invis(user_ptr, 255);
1400                 (void)detect_monsters_normal(user_ptr, 255);
1401                 break;
1402         }
1403
1404         case ACT_ULTIMATE_RESIST:
1405         {
1406                 TIME_EFFECT v = randint1(25) + 25;
1407                 (void)set_afraid(user_ptr, 0);
1408                 (void)set_hero(user_ptr, v, FALSE);
1409                 (void)hp_player(user_ptr, 10);
1410                 (void)set_blessed(user_ptr, v, FALSE);
1411                 (void)set_oppose_acid(user_ptr, v, FALSE);
1412                 (void)set_oppose_elec(user_ptr, v, FALSE);
1413                 (void)set_oppose_fire(user_ptr, v, FALSE);
1414                 (void)set_oppose_cold(user_ptr, v, FALSE);
1415                 (void)set_oppose_pois(user_ptr, v, FALSE);
1416                 (void)set_ultimate_res(user_ptr, v, FALSE);
1417                 break;
1418         }
1419
1420         case ACT_CAST_OFF:
1421                 cosmic_cast_off(user_ptr, o_ptr);
1422                 break;
1423
1424         case ACT_FALLING_STAR:
1425         {
1426                 msg_print(_("あなたは妖刀に魅入られた…", "You are enchanted by cursed blade..."));
1427                 msg_print(_("「狂ほしく 血のごとき 月はのぼれり 秘めおきし 魔剣 いずこぞや」", "'Behold the blade arts.'"));
1428                 massacre(user_ptr);
1429                 break;
1430         }
1431
1432         case ACT_GRAND_CROSS:
1433         {
1434                 msg_print(_("「闇に還れ!」", "You say, 'Return to darkness!'"));
1435                 project(user_ptr, 0, 8, user_ptr->y, user_ptr->x, (randint1(100) + 200) * 2, GF_HOLY_FIRE, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
1436                 break;
1437         }
1438
1439         case ACT_TELEPORT_LEVEL:
1440         {
1441                 if (!get_check(_("本当に他の階にテレポートしますか?", "Are you sure? (Teleport Level)"))) return FALSE;
1442                 teleport_level(user_ptr, 0);
1443                 break;
1444         }
1445
1446         case ACT_STRAIN_HASTE:
1447         {
1448                 int t;
1449                 msg_format(_("%sはあなたの体力を奪った...", "The %s drains your vitality..."), name);
1450                 take_hit(user_ptr, DAMAGE_LOSELIFE, damroll(3, 8), _("加速した疲労", "the strain of haste"), -1);
1451                 t = 25 + randint1(25);
1452                 (void)set_fast(user_ptr, user_ptr->fast + t, FALSE);
1453                 break;
1454         }
1455
1456         case ACT_FISHING:
1457                 if (!fishing(user_ptr)) return FALSE;
1458                 break;
1459
1460         case ACT_INROU:
1461                 mitokohmon(user_ptr);
1462                 break;
1463
1464         case ACT_MURAMASA:
1465         {
1466                 /* Only for Muramasa */
1467                 if (o_ptr->name1 != ART_MURAMASA) return FALSE;
1468                 if (get_check(_("本当に使いますか?", "Are you sure?!")))
1469                 {
1470                         msg_print(_("村正が震えた...", "The Muramasa pulsates..."));
1471                         do_inc_stat(user_ptr, A_STR);
1472                         if (one_in_(2))
1473                         {
1474                                 msg_print(_("村正は壊れた!", "The Muramasa is destroyed!"));
1475                                 curse_weapon_object(user_ptr, TRUE, o_ptr);
1476                         }
1477                 }
1478                 break;
1479         }
1480
1481         case ACT_BLOODY_MOON:
1482         {
1483                 /* Only for Bloody Moon */
1484                 if (o_ptr->name1 != ART_BLOOD) return FALSE;
1485                 msg_print(_("鎌が明るく輝いた...", "Your scythe glows brightly!"));
1486                 get_bloody_moon_flags(o_ptr);
1487                 if (user_ptr->prace == RACE_ANDROID) calc_android_exp(user_ptr);
1488                 user_ptr->update |= (PU_BONUS | PU_HP);
1489                 break;
1490         }
1491
1492         case ACT_CRIMSON:
1493                 if (o_ptr->name1 != ART_CRIMSON) return FALSE;
1494                 msg_print(_("せっかくだから『クリムゾン』をぶっぱなすぜ!", "I'll fire CRIMSON! SEKKAKUDAKARA!"));
1495                 if (!fire_crimson(user_ptr)) return FALSE;
1496                 break;
1497
1498         default:
1499         {
1500                 msg_format(_("Unknown activation effect: %d.", "Unknown activation effect: %d."), act_ptr->index);
1501                 return FALSE;
1502         }
1503         }
1504
1505         /* Set activation timeout */
1506         if (act_ptr->timeout.constant >= 0) {
1507                 o_ptr->timeout = (s16b)act_ptr->timeout.constant;
1508                 if (act_ptr->timeout.dice > 0) {
1509                         o_ptr->timeout += randint1(act_ptr->timeout.dice);
1510                 }
1511         }
1512         else {
1513                 /* Activations that have special timeout */
1514                 switch (act_ptr->index) {
1515                 case ACT_BR_FIRE:
1516                         o_ptr->timeout = ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) ? 200 : 250;
1517                         break;
1518                 case ACT_BR_COLD:
1519                         o_ptr->timeout = ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) ? 200 : 250;
1520                         break;
1521                 case ACT_TERROR:
1522                         o_ptr->timeout = 3 * (user_ptr->lev + 10);
1523                         break;
1524                 case ACT_MURAMASA:
1525                         /* Nothing to do */
1526                         break;
1527                 default:
1528                         msg_format("Special timeout is not implemented: %d.", act_ptr->index);
1529                         return FALSE;
1530                 }
1531         }
1532
1533         return TRUE;
1534 }