2 * @brief プレイヤーの発動コマンド実装
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"
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
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.
76 void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
84 o_ptr = ref_item(user_ptr, item);
85 take_turn(user_ptr, 100);
86 lev = k_info[o_ptr->k_idx].level;
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))
92 const activation_type* const act_ptr = find_activation_info(o_ptr);
97 else if (((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)) && o_ptr->name2) lev = e_info[o_ptr->name2].level;
99 /* Base chance of success */
100 chance = user_ptr->skill_dev;
102 /* Confusion hurts skill */
103 if (user_ptr->confused) chance = chance / 2;
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;
111 if (cmd_limit_time_walk(user_ptr)) return;
113 if (user_ptr->pclass == CLASS_BERSERKER) success = FALSE;
114 else if (chance > fail)
116 if (randint0(chance * 2) < fail) success = FALSE;
121 if (randint0(fail * 2) < chance) success = TRUE;
122 else success = FALSE;
128 if (flush_failure) flush();
129 msg_print(_("うまく始動させることができなかった。", "You failed to activate it properly."));
134 /* Check the recharge */
137 msg_print(_("それは微かに音を立て、輝き、消えた...", "It whines, glows and fades..."));
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)))
145 msg_print(_("燃料がない。", "It has no fuel."));
150 /* Activate the artifact */
151 msg_print(_("始動させた...", "You activate it..."));
155 /* Activate object */
156 if (activation_index(o_ptr))
158 (void)activate_artifact(user_ptr, o_ptr);
160 user_ptr->window |= (PW_INVEN | PW_EQUIP);
167 else if (o_ptr->tval == TV_WHISTLE)
169 if (music_singing_any(user_ptr)) stop_singing(user_ptr);
170 if (hex_spelling_any(user_ptr)) stop_hex_spell_all(user_ptr);
173 MONSTER_IDX pet_ctr, i;
178 /* Allocate the "who" array */
179 C_MAKE(who, current_world_ptr->max_m_idx, MONSTER_IDX);
181 /* Process the monsters (backwards) */
182 for (pet_ctr = user_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--)
184 if (is_pet(&user_ptr->current_floor_ptr->m_list[pet_ctr]) && (user_ptr->riding != pet_ctr))
185 who[max_pet++] = pet_ctr;
188 ang_sort(who, &dummy_why, max_pet, ang_sort_comp_pet, ang_sort_swap_hook);
190 /* Process the monsters (backwards) */
191 for (i = 0; i < max_pet; i++)
194 teleport_monster_to(user_ptr, pet_ctr, user_ptr->y, user_ptr->x, 100, TELEPORT_PASSIVE);
197 /* Free the "who" array */
198 C_KILL(who, current_world_ptr->max_m_idx, MONSTER_IDX);
200 o_ptr->timeout = 100 + randint1(100);
203 else if (o_ptr->tval == TV_CAPTURE)
207 bool old_target_pet = target_pet;
209 if (!get_aim_dir(user_ptr, &dir))
211 target_pet = old_target_pet;
214 target_pet = old_target_pet;
216 if (fire_ball(user_ptr, GF_CAPTURE, dir, 0, 0))
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;
228 if (o_ptr->inscription)
229 strcpy(buf, quark_str(o_ptr->inscription));
231 for (s = buf; *s && (*s != '#'); s++)
234 if (iskanji(*s)) s++;
244 t = quark_str(cap_nickname);
257 o_ptr->inscription = quark_add(buf);
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))
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)))
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)
282 t = quark_str(o_ptr->inscription);
283 for (t = quark_str(o_ptr->inscription); *t && (*t != '#'); t++)
286 if (iskanji(*t)) t++;
311 if (quote && *(s - 1) == '\'')
315 user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].nickname = quark_add(buf);
316 t = quark_str(o_ptr->inscription);
318 while (*t && (*t != '#'))
325 o_ptr->inscription = quark_add(buf);
336 msg_print(_("おっと、解放に失敗した。", "Oops. You failed to release your pet."));
338 calc_android_exp(user_ptr);
343 msg_print(_("おっと、このアイテムは始動できない。", "Oops. That object cannot be activated."));
347 * @brief 装備を発動するコマンドのメインルーチン /
348 * @param user_ptr プレーヤーへの参照ポインタ
351 void do_cmd_activate(player_type *user_ptr)
356 if (user_ptr->wild_mode) return;
357 if (cmd_limit_arena(user_ptr)) return;
359 if (user_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
361 set_action(user_ptr, ACTION_NONE);
364 item_tester_hook = item_tester_hook_activate;
366 q = _("どのアイテムを始動させますか? ", "Activate which item? ");
367 s = _("始動できるアイテムを装備していない。", "You have nothing to activate.");
369 if (!choose_object(user_ptr, &item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0)) return;
371 /* Activate the item */
372 exe_activate(user_ptr, item);
376 * @brief 発動によるブレスの属性をアイテムの耐性から選択し、実行を処理する。/ Dragon breath activation
377 * @details 対象となる耐性は dragonbreath_info テーブルを参照のこと。
378 * @param user_ptr プレーヤーへの参照ポインタ
379 * @param o_ptr 対象のオブジェクト構造体ポインタ
380 * @return 発動実行の是非を返す。
382 static bool activate_dragon_breath(player_type *user_ptr, object_type *o_ptr)
384 BIT_FLAGS flgs[TR_FLAG_SIZE]; /* for resistance flags */
390 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
392 object_flags(o_ptr, flgs);
394 for (i = 0; dragonbreath_info[i].flag != 0; i++)
396 if (have_flag(flgs, dragonbreath_info[i].flag))
398 type[n] = dragonbreath_info[i].type;
399 name[n] = dragonbreath_info[i].name;
403 if (n == 0) return FALSE;
406 if (music_singing_any(user_ptr)) stop_singing(user_ptr);
407 if (hex_spelling_any(user_ptr)) stop_hex_spell_all(user_ptr);
410 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), name[t]);
411 fire_breath(user_ptr, type[t], dir, 250, 4);
418 * @brief アイテムの発動効果を処理する。
419 * @param user_ptr プレーヤーへの参照ポインタ
420 * @param o_ptr 対象のオブジェクト構造体ポインタ
421 * @return 発動実行の是非を返す。
423 bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
425 PLAYER_LEVEL plev = user_ptr->lev;
428 concptr name = k_name + k_info[o_ptr->k_idx].name;
429 const activation_type* const act_ptr = find_activation_info(o_ptr);
431 /* Maybe forgot adding information to activation_info table ? */
432 msg_print("Activation information is not found.");
436 /* Activate for attack */
437 switch (act_ptr->index)
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));
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));
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);
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));
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));
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));
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));
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
583 case ACT_HYPODYNAMIA_1:
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);
591 case ACT_HYPODYNAMIA_2:
593 msg_print(_("黒く輝いている...", "It glows black..."));
594 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
595 hypodynamic_bolt(user_ptr, dir, 120);
601 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
602 for (dummy = 0; dummy < 3; dummy++)
604 if (hypodynamic_bolt(user_ptr, dir, 50))
605 hp_player(user_ptr, 50);
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);
626 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
627 for (dummy = 0; dummy < 3; dummy++)
629 if (hypodynamic_bolt(user_ptr, dir, 100))
630 hp_player(user_ptr, 100);
638 msg_print(_("様々な色の火花を発している...", "It glows in scintillating colours..."));
639 call_chaos(user_ptr);
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);
653 msg_print(_("神聖な雰囲気が充満した...", "It floods the area with goodness..."));
654 dispel_evil(user_ptr, user_ptr->lev * 5);
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);
668 msg_print(_("邪悪な雰囲気が充満した...", "It floods the area with evil..."));
669 dispel_good(user_ptr, user_ptr->lev * 5);
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);
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);
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);
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);
707 msg_print(_("あなたは害虫を一掃した。", "You exterminate small life."));
708 (void)dispel_monsters(user_ptr, 4);
712 case ACT_BLINDING_LIGHT:
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);
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);
728 case ACT_CAST_BA_STAR:
730 HIT_POINT num = damroll(5, 3);
731 POSITION y = 0, x = 0;
733 msg_format(_("%sが稲妻で覆われた...", "The %s is surrounded by lightning..."), name);
734 for (k = 0; k < num; k++)
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;
745 project(user_ptr, 0, 3, y, x, 150, GF_ELEC,
746 (PROJECT_THRU | PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
752 case ACT_BLADETURNER:
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);
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))
776 (void)set_oppose_fire(user_ptr, randint1(20) + 20, FALSE);
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))
787 (void)set_oppose_cold(user_ptr, randint1(20) + 20, FALSE);
794 if (!activate_dragon_breath(user_ptr, o_ptr)) return FALSE;
798 /* Activate for other offensive action */
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);
809 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
810 sleep_monsters_touch(user_ptr);
816 earthquake(user_ptr, user_ptr->y, user_ptr->x, 5, 0);
822 turn_monsters(user_ptr, 40 + user_ptr->lev);
828 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
829 (void)fire_beam(user_ptr, GF_AWAY_ALL, dir, plev);
833 case ACT_BANISH_EVIL:
835 if (banish_evil(user_ptr, 100))
837 msg_print(_("アーティファクトの力が邪悪を打ち払った!", "The power of the artifact banishes evil!"));
844 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
845 (void)symbol_genocide(user_ptr, 200, TRUE);
851 msg_print(_("ひどく鋭い音が流れ出た...", "It lets out a long, shrill note..."));
852 (void)mass_genocide(user_ptr, 200, TRUE);
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);
868 if (o_ptr->name1 == ART_HYOUSIGI)
870 msg_print(_("拍子木を打った。", "You beat your wooden clappers."));
874 msg_format(_("%sは不快な物音を立てた。", "The %s sounds an unpleasant noise."), name);
876 aggravate_monsters(user_ptr, 0);
880 /* Activate for summoning / charming */
882 case ACT_CHARM_ANIMAL:
884 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
885 (void)charm_animal(user_ptr, dir, plev);
889 case ACT_CHARM_UNDEAD:
891 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
892 (void)control_one_undead(user_ptr, dir, plev);
896 case ACT_CHARM_OTHER:
898 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
899 (void)charm_monster(user_ptr, dir, plev * 2);
903 case ACT_CHARM_ANIMALS:
905 (void)charm_animals(user_ptr, plev * 2);
909 case ACT_CHARM_OTHERS:
911 charm_monsters(user_ptr, plev * 2);
915 case ACT_SUMMON_ANIMAL:
917 (void)summon_specific(user_ptr, -1, user_ptr->y, user_ptr->x, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET));
921 case ACT_SUMMON_PHANTOM:
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));
928 case ACT_SUMMON_ELEMENTAL:
929 if (!cast_summon_elemental(user_ptr, (plev * 3) / 2)) return FALSE;
932 case ACT_SUMMON_DEMON:
934 cast_summon_demon(user_ptr, (plev * 3) / 2);
938 case ACT_SUMMON_UNDEAD:
939 if (!cast_summon_undead(user_ptr, (plev * 3) / 2)) return FALSE;
942 case ACT_SUMMON_HOUND:
943 if (!cast_summon_hound(user_ptr, (plev * 3) / 2)) return FALSE;
946 case ACT_SUMMON_DAWN:
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));
953 case ACT_SUMMON_OCTOPUS:
954 if (!cast_summon_octopus(user_ptr)) return FALSE;
957 /* Activate for healing */
959 case ACT_CHOIR_SINGS:
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);
969 (void)set_afraid(user_ptr, 0);
970 (void)hp_player(user_ptr, 30);
976 msg_print(_("深紫色の光を発している...", "It radiates deep purple..."));
977 (void)cure_serious_wounds(user_ptr, 4, 8);
981 case ACT_CURE_POISON:
983 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
984 (void)set_afraid(user_ptr, 0);
985 (void)set_poisoned(user_ptr, 0);
991 msg_print(_("深紅に輝いている...", "It glows a deep red..."));
992 restore_level(user_ptr);
998 msg_print(_("濃緑色に輝いている...", "It glows a deep green..."));
999 (void)restore_all_status(user_ptr);
1000 (void)restore_level(user_ptr);
1006 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
1007 msg_print(_("体内に暖かい鼓動が感じられる...", "You feel a warm tingling inside..."));
1008 (void)cure_critical_wounds(user_ptr, 700);
1014 msg_print(_("白く明るく輝いている...", "It glows a bright white..."));
1015 msg_print(_("ひじょうに気分がよい...", "You feel much better..."));
1016 (void)cure_critical_wounds(user_ptr, 1000);
1022 msg_format(_("%sの優しさに癒される...", "the %s cures you affectionately ..."), name);
1023 true_healing(user_ptr, 0);
1027 case ACT_CURE_MANA_FULL:
1029 msg_format(_("%sが青白く光った...", "The %s glows pale..."), name);
1030 restore_mana(user_ptr, TRUE);
1034 /* Activate for timed effect */
1038 (void)set_tim_esp(user_ptr, randint1(30) + 25, FALSE);
1044 (void)berserk(user_ptr, randint1(25) + 25);
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);
1056 case ACT_RESIST_ALL:
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);
1069 msg_print(_("明るく緑色に輝いている...", "It glows bright green..."));
1070 (void)set_fast(user_ptr, randint1(20) + 20, FALSE);
1074 case ACT_XTRA_SPEED:
1076 msg_print(_("明るく輝いている...", "It glows brightly..."));
1077 (void)set_fast(user_ptr, randint1(75) + 75, FALSE);
1083 set_wraith_form(user_ptr, randint1(plev / 2) + (plev / 2), FALSE);
1089 (void)set_invuln(user_ptr, randint1(8) + 8, FALSE);
1095 (void)heroism(user_ptr, 25);
1099 case ACT_HERO_SPEED:
1101 (void)set_fast(user_ptr, randint1(50) + 50, FALSE);
1102 (void)heroism(user_ptr, 50);
1106 case ACT_RESIST_ACID:
1108 msg_format(_("%sが黒く輝いた...", "The %s grows black."), name);
1109 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ACID))
1111 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
1112 fire_ball(user_ptr, GF_ACID, dir, 100, 2);
1114 (void)set_oppose_acid(user_ptr, randint1(20) + 20, FALSE);
1118 case ACT_RESIST_FIRE:
1120 msg_format(_("%sが赤く輝いた...", "The %s grows red."), name);
1121 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
1123 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
1124 fire_ball(user_ptr, GF_FIRE, dir, 100, 2);
1126 (void)set_oppose_fire(user_ptr, randint1(20) + 20, FALSE);
1130 case ACT_RESIST_COLD:
1132 msg_format(_("%sが白く輝いた...", "The %s grows white."), name);
1133 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
1135 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
1136 fire_ball(user_ptr, GF_COLD, dir, 100, 2);
1138 (void)set_oppose_cold(user_ptr, randint1(20) + 20, FALSE);
1142 case ACT_RESIST_ELEC:
1144 msg_format(_("%sが青く輝いた...", "The %s grows blue."), name);
1145 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ELEC))
1147 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
1148 fire_ball(user_ptr, GF_ELEC, dir, 100, 2);
1150 (void)set_oppose_elec(user_ptr, randint1(20) + 20, FALSE);
1154 case ACT_RESIST_POIS:
1156 msg_format(_("%sが緑に輝いた...", "The %s grows green."), name);
1157 (void)set_oppose_pois(user_ptr, randint1(20) + 20, FALSE);
1161 /* Activate for general purpose effect (detection etc.) */
1165 msg_format(_("%sから澄んだ光があふれ出た...", "The %s wells with clear light..."), name);
1166 lite_area(user_ptr, damroll(2, 15), 3);
1172 msg_print(_("眩しく輝いた...", "It shines brightly..."));
1173 map_area(user_ptr, DETECT_RAD_MAP);
1174 lite_area(user_ptr, damroll(2, 15), 3);
1178 case ACT_DETECT_ALL:
1180 msg_print(_("白く明るく輝いている...", "It glows bright white..."));
1181 msg_print(_("心にイメージが浮かんできた...", "An image forms in your mind..."));
1182 detect_all(user_ptr, DETECT_RAD_DEFAULT);
1186 case ACT_DETECT_XTRA:
1188 msg_print(_("明るく輝いている...", "It glows brightly..."));
1189 detect_all(user_ptr, DETECT_RAD_DEFAULT);
1191 identify_fully(user_ptr, FALSE, 0);
1197 msg_print(_("黄色く輝いている...", "It glows yellow..."));
1198 identify_fully(user_ptr, FALSE, 0);
1204 if (!ident_spell(user_ptr, FALSE, 0)) return FALSE;
1208 case ACT_RUNE_EXPLO:
1210 msg_print(_("明るい赤色に輝いている...", "It glows bright red..."));
1211 explosive_rune(user_ptr, user_ptr->y, user_ptr->x);
1217 msg_print(_("ブルーに明るく輝いている...", "It glows light blue..."));
1218 warding_glyph(user_ptr);
1224 (void)set_food(user_ptr, PY_FOOD_MAX - 1);
1230 msg_print(_("明るい赤色に輝いている...", "It glows bright red..."));
1231 destroy_doors_touch(user_ptr);
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));
1245 recharge(user_ptr, 130);
1251 msg_print(_("明るい黄色に輝いている...", "It glows bright yellow..."));
1252 (void)alchemy(user_ptr);
1258 msg_print(_("次元の扉が開いた。目的地を選んで下さい。", "You open a dimensional gate. Choose a destination."));
1259 if (!dimension_door(user_ptr)) return FALSE;
1266 msg_print(_("周りの空間が歪んでいる...", "It twists space around you..."));
1267 teleport_player(user_ptr, 100, TELEPORT_SPONTANEOUS);
1273 msg_print(_("やわらかな白色に輝いている...", "It glows soft white..."));
1274 if (!recall_player(user_ptr, randint0(21) + 15)) return FALSE;
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);
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);
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);
1292 if (get_check(_("帰還の力を使いますか?", "Activate recall? ")))
1294 (void)recall_player(user_ptr, randint0(21) + 15);
1300 case ACT_TELEKINESIS:
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);
1308 case ACT_DETECT_UNIQUE:
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--)
1317 m_ptr = &user_ptr->current_floor_ptr->m_list[i];
1319 /* Ignore "dead" monsters */
1320 if (!monster_is_valid(m_ptr)) continue;
1322 r_ptr = &r_info[m_ptr->r_idx];
1324 if (r_ptr->flags1 & RF1_UNIQUE)
1326 msg_format(_("%s. ", "%s. "), r_name + r_ptr->name);
1334 switch (randint1(13))
1336 case 1: case 2: case 3: case 4: case 5:
1337 teleport_player(user_ptr, 10, TELEPORT_SPONTANEOUS);
1339 case 6: case 7: case 8: case 9: case 10:
1340 teleport_player(user_ptr, 222, TELEPORT_SPONTANEOUS);
1343 (void)stair_creation(user_ptr);
1346 if (get_check(_("この階を去りますか?", "Leave this level? ")))
1348 if (autosave_l) do_cmd_save_game(user_ptr, TRUE);
1349 user_ptr->leaving = TRUE;
1355 case ACT_DISP_CURSE_XTRA:
1357 msg_format(_("%sが真実を照らし出す...", "The %s exhibits the truth..."), name);
1358 (void)remove_all_curse(user_ptr);
1359 (void)probing(user_ptr);
1363 case ACT_BRAND_FIRE_BOLTS:
1365 msg_format(_("%sが深紅に輝いた...", "Your %s glows deep red..."), name);
1366 brand_bolts(user_ptr);
1370 case ACT_RECHARGE_XTRA:
1372 msg_format(_("%sが白く輝いた...", "The %s gleams with blinding light..."), name);
1373 if (!recharge(user_ptr, 1000)) return FALSE;
1378 msg_print(_("石が隠された秘密を写し出した...", "The stone reveals hidden mysteries..."));
1379 if (!perilous_secrets(user_ptr)) return FALSE;
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);
1391 case ACT_PHASE_DOOR:
1393 teleport_player(user_ptr, 10, TELEPORT_SPONTANEOUS);
1397 case ACT_DETECT_ALL_MONS:
1399 (void)detect_monsters_invis(user_ptr, 255);
1400 (void)detect_monsters_normal(user_ptr, 255);
1404 case ACT_ULTIMATE_RESIST:
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);
1421 cosmic_cast_off(user_ptr, o_ptr);
1424 case ACT_FALLING_STAR:
1426 msg_print(_("あなたは妖刀に魅入られた…", "You are enchanted by cursed blade..."));
1427 msg_print(_("「狂ほしく 血のごとき 月はのぼれり 秘めおきし 魔剣 いずこぞや」", "'Behold the blade arts.'"));
1432 case ACT_GRAND_CROSS:
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);
1439 case ACT_TELEPORT_LEVEL:
1441 if (!get_check(_("本当に他の階にテレポートしますか?", "Are you sure? (Teleport Level)"))) return FALSE;
1442 teleport_level(user_ptr, 0);
1446 case ACT_STRAIN_HASTE:
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);
1457 if (!fishing(user_ptr)) return FALSE;
1461 mitokohmon(user_ptr);
1466 /* Only for Muramasa */
1467 if (o_ptr->name1 != ART_MURAMASA) return FALSE;
1468 if (get_check(_("本当に使いますか?", "Are you sure?!")))
1470 msg_print(_("村正が震えた...", "The Muramasa pulsates..."));
1471 do_inc_stat(user_ptr, A_STR);
1474 msg_print(_("村正は壊れた!", "The Muramasa is destroyed!"));
1475 curse_weapon_object(user_ptr, TRUE, o_ptr);
1481 case ACT_BLOODY_MOON:
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);
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;
1500 msg_format(_("Unknown activation effect: %d.", "Unknown activation effect: %d."), act_ptr->index);
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);
1513 /* Activations that have special timeout */
1514 switch (act_ptr->index) {
1516 o_ptr->timeout = ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) ? 200 : 250;
1519 o_ptr->timeout = ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) ? 200 : 250;
1522 o_ptr->timeout = 3 * (user_ptr->lev + 10);
1528 msg_format("Special timeout is not implemented: %d.", act_ptr->index);