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 "monster/monster2.h"
24 #include "object-enchant/activation-info-table.h"
25 #include "object-enchant/artifact.h"
26 #include "object-enchant/dragon-breaths-table.h"
27 #include "object-enchant/object-ego.h"
28 #include "object/item-use-flags.h"
29 #include "object/object-flags.h"
30 #include "object/object-hook.h"
31 #include "object/object-kind.h"
32 #include "object/object-info.h"
33 #include "monster/place-monster-types.h"
34 #include "monster/smart-learn-types.h"
35 #include "player/avatar.h"
36 #include "player/player-damage.h"
37 #include "player/player-effects.h"
38 #include "player/player-races-table.h"
39 #include "spell-kind/earthquake.h"
40 #include "spell-kind/spells-beam.h"
41 #include "spell-kind/spells-charm.h"
42 #include "spell-kind/spells-detection.h"
43 #include "spell-kind/spells-floor.h"
44 #include "spell-kind/spells-genocide.h"
45 #include "spell-kind/spells-grid.h"
46 #include "spell-kind/spells-launcher.h"
47 #include "spell-kind/spells-lite.h"
48 #include "spell-kind/spells-neighbor.h"
49 #include "spell-kind/spells-random.h"
50 #include "spell-kind/spells-sight.h"
51 #include "spell-kind/spells-specific-bolt.h"
52 #include "spell-kind/spells-teleport.h"
53 #include "spell-realm/spells-hex.h"
54 #include "spell/process-effect.h"
55 #include "spell/spells-object.h"
56 #include "spell/spells-status.h"
57 #include "spell/spells-summon.h"
58 #include "spell/spells-type.h"
59 #include "spell/spells3.h"
60 #include "sv-definition/sv-lite-types.h"
61 #include "sv-definition/sv-ring-types.h"
62 #include "world/world.h"
65 * @brief 装備を発動するコマンドのサブルーチン /
66 * Activate a wielded object. Wielded objects never stack.
67 * And even if they did, activatable objects never stack.
68 * @param item 発動するオブジェクトの所持品ID
72 * Currently, only (some) artifacts, and Dragon Scale Mail, can be activated.
73 * But one could, for example, easily make an activatable "Ring of Plasma".
74 * Note that it always takes a turn to activate an artifact, even if
75 * the user hits "escape" at the "direction" prompt.
78 void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
86 o_ptr = ref_item(user_ptr, item);
87 take_turn(user_ptr, 100);
88 lev = k_info[o_ptr->k_idx].level;
90 /* Hack -- use artifact level instead */
91 if (object_is_fixed_artifact(o_ptr)) lev = a_info[o_ptr->name1].level;
92 else if (object_is_random_artifact(o_ptr))
94 const activation_type* const act_ptr = find_activation_info(o_ptr);
99 else if (((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)) && o_ptr->name2) lev = e_info[o_ptr->name2].level;
101 /* Base chance of success */
102 chance = user_ptr->skill_dev;
104 /* Confusion hurts skill */
105 if (user_ptr->confused) chance = chance / 2;
108 if (chance > fail) fail -= (chance - fail) * 2;
109 else chance -= (fail - chance) * 2;
110 if (fail < USE_DEVICE) fail = USE_DEVICE;
111 if (chance < USE_DEVICE) chance = USE_DEVICE;
113 if (cmd_limit_time_walk(user_ptr)) return;
115 if (user_ptr->pclass == CLASS_BERSERKER) success = FALSE;
116 else if (chance > fail)
118 if (randint0(chance * 2) < fail) success = FALSE;
123 if (randint0(fail * 2) < chance) success = TRUE;
124 else success = FALSE;
130 if (flush_failure) flush();
131 msg_print(_("うまく始動させることができなかった。", "You failed to activate it properly."));
136 /* Check the recharge */
139 msg_print(_("それは微かに音を立て、輝き、消えた...", "It whines, glows and fades..."));
143 /* Some lights need enough fuel for activation */
144 if (!o_ptr->xtra4 && (o_ptr->tval == TV_FLASK) &&
145 ((o_ptr->sval == SV_LITE_TORCH) || (o_ptr->sval == SV_LITE_LANTERN)))
147 msg_print(_("燃料がない。", "It has no fuel."));
152 /* Activate the artifact */
153 msg_print(_("始動させた...", "You activate it..."));
157 /* Activate object */
158 if (activation_index(o_ptr))
160 (void)activate_artifact(user_ptr, o_ptr);
162 user_ptr->window |= (PW_INVEN | PW_EQUIP);
169 else if (o_ptr->tval == TV_WHISTLE)
171 if (music_singing_any(user_ptr)) stop_singing(user_ptr);
172 if (hex_spelling_any(user_ptr)) stop_hex_spell_all(user_ptr);
175 MONSTER_IDX pet_ctr, i;
180 /* Allocate the "who" array */
181 C_MAKE(who, current_world_ptr->max_m_idx, MONSTER_IDX);
183 /* Process the monsters (backwards) */
184 for (pet_ctr = user_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--)
186 if (is_pet(&user_ptr->current_floor_ptr->m_list[pet_ctr]) && (user_ptr->riding != pet_ctr))
187 who[max_pet++] = pet_ctr;
190 ang_sort(who, &dummy_why, max_pet, ang_sort_comp_pet, ang_sort_swap_hook);
192 /* Process the monsters (backwards) */
193 for (i = 0; i < max_pet; i++)
196 teleport_monster_to(user_ptr, pet_ctr, user_ptr->y, user_ptr->x, 100, TELEPORT_PASSIVE);
199 /* Free the "who" array */
200 C_KILL(who, current_world_ptr->max_m_idx, MONSTER_IDX);
202 o_ptr->timeout = 100 + randint1(100);
205 else if (o_ptr->tval == TV_CAPTURE)
209 bool old_target_pet = target_pet;
211 if (!get_aim_dir(user_ptr, &dir))
213 target_pet = old_target_pet;
216 target_pet = old_target_pet;
218 if (fire_ball(user_ptr, GF_CAPTURE, dir, 0, 0))
220 o_ptr->pval = (PARAMETER_VALUE)cap_mon;
221 o_ptr->xtra3 = (XTRA8)cap_mspeed;
222 o_ptr->xtra4 = (XTRA16)cap_hp;
223 o_ptr->xtra5 = (XTRA16)cap_maxhp;
230 if (o_ptr->inscription)
231 strcpy(buf, quark_str(o_ptr->inscription));
233 for (s = buf; *s && (*s != '#'); s++)
236 if (iskanji(*s)) s++;
246 t = quark_str(cap_nickname);
259 o_ptr->inscription = quark_add(buf);
266 if (!get_direction(user_ptr, &dir, FALSE, FALSE)) return;
267 if (monster_can_enter(user_ptr, user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0))
269 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)))
271 if (o_ptr->xtra3) user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3;
272 if (o_ptr->xtra5) user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5;
273 if (o_ptr->xtra4) user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].hp = o_ptr->xtra4;
274 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;
275 if (o_ptr->inscription)
284 t = quark_str(o_ptr->inscription);
285 for (t = quark_str(o_ptr->inscription); *t && (*t != '#'); t++)
288 if (iskanji(*t)) t++;
313 if (quote && *(s - 1) == '\'')
317 user_ptr->current_floor_ptr->m_list[hack_m_idx_ii].nickname = quark_add(buf);
318 t = quark_str(o_ptr->inscription);
320 while (*t && (*t != '#'))
327 o_ptr->inscription = quark_add(buf);
338 msg_print(_("おっと、解放に失敗した。", "Oops. You failed to release your pet."));
340 calc_android_exp(user_ptr);
345 msg_print(_("おっと、このアイテムは始動できない。", "Oops. That object cannot be activated."));
349 * @brief 装備を発動するコマンドのメインルーチン /
350 * @param user_ptr プレーヤーへの参照ポインタ
353 void do_cmd_activate(player_type *user_ptr)
358 if (user_ptr->wild_mode) return;
359 if (cmd_limit_arena(user_ptr)) return;
361 if (user_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
363 set_action(user_ptr, ACTION_NONE);
366 item_tester_hook = item_tester_hook_activate;
368 q = _("どのアイテムを始動させますか? ", "Activate which item? ");
369 s = _("始動できるアイテムを装備していない。", "You have nothing to activate.");
371 if (!choose_object(user_ptr, &item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0)) return;
373 /* Activate the item */
374 exe_activate(user_ptr, item);
378 * @brief 発動によるブレスの属性をアイテムの耐性から選択し、実行を処理する。/ Dragon breath activation
379 * @details 対象となる耐性は dragonbreath_info テーブルを参照のこと。
380 * @param user_ptr プレーヤーへの参照ポインタ
381 * @param o_ptr 対象のオブジェクト構造体ポインタ
382 * @return 発動実行の是非を返す。
384 static bool activate_dragon_breath(player_type *user_ptr, object_type *o_ptr)
386 BIT_FLAGS flgs[TR_FLAG_SIZE]; /* for resistance flags */
392 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
394 object_flags(o_ptr, flgs);
396 for (i = 0; dragonbreath_info[i].flag != 0; i++)
398 if (have_flag(flgs, dragonbreath_info[i].flag))
400 type[n] = dragonbreath_info[i].type;
401 name[n] = dragonbreath_info[i].name;
405 if (n == 0) return FALSE;
408 if (music_singing_any(user_ptr)) stop_singing(user_ptr);
409 if (hex_spelling_any(user_ptr)) stop_hex_spell_all(user_ptr);
412 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), name[t]);
413 fire_breath(user_ptr, type[t], dir, 250, 4);
420 * @brief アイテムの発動効果を処理する。
421 * @param user_ptr プレーヤーへの参照ポインタ
422 * @param o_ptr 対象のオブジェクト構造体ポインタ
423 * @return 発動実行の是非を返す。
425 bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
427 PLAYER_LEVEL plev = user_ptr->lev;
430 concptr name = k_name + k_info[o_ptr->k_idx].name;
431 const activation_type* const act_ptr = find_activation_info(o_ptr);
433 /* Maybe forgot adding information to activation_info table ? */
434 msg_print("Activation information is not found.");
438 /* Activate for attack */
439 switch (act_ptr->index)
443 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
444 msg_print(_("太陽光線が放たれた。", "A line of sunlight appears."));
445 (void)lite_line(user_ptr, dir, damroll(6, 8));
451 msg_print(_("それは眩しいくらいに明るく輝いている...", "It glows extremely brightly..."));
452 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
453 fire_bolt(user_ptr, GF_MISSILE, dir, damroll(2, 6));
459 msg_print(_("それは濃緑色に脈動している...", "It throbs deep green..."));
460 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
461 fire_ball(user_ptr, GF_POIS, dir, 12, 3);
467 msg_print(_("それは火花に覆われた...", "It is covered in sparks..."));
468 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
469 fire_bolt(user_ptr, GF_ELEC, dir, damroll(4, 8));
475 msg_print(_("それは酸に覆われた...", "It is covered in acid..."));
476 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
477 fire_bolt(user_ptr, GF_ACID, dir, damroll(5, 8));
483 msg_print(_("それは霜に覆われた...", "It is covered in frost..."));
484 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
485 fire_bolt(user_ptr, GF_COLD, dir, damroll(6, 8));
491 msg_print(_("それは炎に覆われた...", "It is covered in fire..."));
492 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
493 fire_bolt(user_ptr, GF_FIRE, dir, damroll(9, 8));
499 msg_print(_("それは霜に覆われた...", "It is covered in frost..."));
500 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
501 fire_ball(user_ptr, GF_COLD, dir, 48, 2);
507 msg_print(_("それは青く激しく輝いた...", "It glows an intense blue..."));
508 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
509 fire_ball(user_ptr, GF_COLD, dir, 100, 2);
515 msg_print(_("明るく白色に輝いている...", "It glows bright white..."));
516 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
517 fire_ball(user_ptr, GF_COLD, dir, 400, 3);
523 msg_print(_("それは赤く激しく輝いた...", "It glows an intense red..."));
524 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
525 fire_ball(user_ptr, GF_FIRE, dir, 72, 2);
531 msg_format(_("%sから炎が吹き出した...", "The %s rages in fire..."), name);
532 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
533 fire_ball(user_ptr, GF_FIRE, dir, 120, 3);
539 msg_print(_("深赤色に輝いている...", "It glows deep red..."));
540 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
541 fire_ball(user_ptr, GF_FIRE, dir, 300, 3);
547 msg_print(_("それは赤く激しく輝いた...", "It glows an intense red..."));
548 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
549 fire_ball(user_ptr, GF_FIRE, dir, 100, 2);
555 msg_print(_("電気がパチパチ音を立てた...", "It crackles with electricity..."));
556 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
557 fire_ball(user_ptr, GF_ELEC, dir, 100, 3);
563 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
564 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
565 fire_ball(user_ptr, GF_ELEC, dir, 500, 3);
571 msg_print(_("それは黒く激しく輝いた...", "It glows an intense black..."));
572 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
573 fire_ball(user_ptr, GF_ACID, dir, 100, 2);
579 msg_print(_("それは緑に激しく輝いた...", "It glows an intense green..."));
580 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
581 fire_ball(user_ptr, GF_NUKE, dir, 100, 2);
585 case ACT_HYPODYNAMIA_1:
587 msg_format(_("あなたは%sに敵を締め殺すよう命じた。", "You order the %s to strangle your opponent."), name);
588 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
589 hypodynamic_bolt(user_ptr, dir, 100);
593 case ACT_HYPODYNAMIA_2:
595 msg_print(_("黒く輝いている...", "It glows black..."));
596 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
597 hypodynamic_bolt(user_ptr, dir, 120);
603 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
604 for (dummy = 0; dummy < 3; dummy++)
606 if (hypodynamic_bolt(user_ptr, dir, 50))
607 hp_player(user_ptr, 50);
614 msg_print(_("魔法のトゲが現れた...", "It grows magical spikes..."));
615 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
616 fire_bolt(user_ptr, GF_ARROW, dir, 150);
628 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
629 for (dummy = 0; dummy < 3; dummy++)
631 if (hypodynamic_bolt(user_ptr, dir, 100))
632 hp_player(user_ptr, 100);
640 msg_print(_("様々な色の火花を発している...", "It glows in scintillating colours..."));
641 call_chaos(user_ptr);
647 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
648 msg_print(_("ロケットを発射した!", "You launch a rocket!"));
649 fire_ball(user_ptr, GF_ROCKET, dir, 250 + plev * 3, 2);
655 msg_print(_("神聖な雰囲気が充満した...", "It floods the area with goodness..."));
656 dispel_evil(user_ptr, user_ptr->lev * 5);
662 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
663 msg_print(_("あなたはエレメントのブレスを吐いた。", "You breathe the elements."));
664 fire_breath(user_ptr, GF_MISSILE, dir, 300, 4);
670 msg_print(_("邪悪な雰囲気が充満した...", "It floods the area with evil..."));
671 dispel_good(user_ptr, user_ptr->lev * 5);
677 msg_format(_("%sに魔法のトゲが現れた...", "The %s grows magical spikes..."), name);
678 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
679 fire_bolt(user_ptr, GF_ARROW, dir, 150);
685 msg_format(_("%sが深い青色に鼓動している...", "The %s throbs deep blue..."), name);
686 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
687 fire_ball(user_ptr, GF_WATER, dir, 200, 3);
693 msg_format(_("%sが深い闇に覆われた...", "The %s is coverd in pitch-darkness..."), name);
694 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
695 fire_ball(user_ptr, GF_DARK, dir, 250, 4);
701 msg_format(_("%sが青白く光った...", "The %s glows pale..."), name);
702 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
703 fire_ball(user_ptr, GF_MANA, dir, 250, 4);
709 msg_print(_("あなたは害虫を一掃した。", "You exterminate small life."));
710 (void)dispel_monsters(user_ptr, 4);
714 case ACT_BLINDING_LIGHT:
716 msg_format(_("%sが眩しい光で輝いた...", "The %s gleams with blinding light..."), name);
717 fire_ball(user_ptr, GF_LITE, 0, 300, 6);
718 confuse_monsters(user_ptr, 3 * user_ptr->lev / 2);
724 msg_format(_("%sは漆黒に輝いた...", "The %s glows intensely black..."), name);
725 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
726 ring_of_power(user_ptr, dir);
730 case ACT_CAST_BA_STAR:
732 HIT_POINT num = damroll(5, 3);
733 POSITION y = 0, x = 0;
735 msg_format(_("%sが稲妻で覆われた...", "The %s is surrounded by lightning..."), name);
736 for (k = 0; k < num; k++)
742 scatter(user_ptr, &y, &x, user_ptr->y, user_ptr->x, 4, 0);
743 if (!cave_have_flag_bold(user_ptr->current_floor_ptr, y, x, FF_PROJECT)) continue;
744 if (!player_bold(user_ptr, y, x)) break;
747 project(user_ptr, 0, 3, y, x, 150, GF_ELEC,
748 (PROJECT_THRU | PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
754 case ACT_BLADETURNER:
756 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
757 msg_print(_("あなたはエレメントのブレスを吐いた。", "You breathe the elements."));
758 fire_breath(user_ptr, GF_MISSILE, dir, 300, 4);
759 msg_print(_("鎧が様々な色に輝いた...", "Your armor glows many colours..."));
760 (void)set_afraid(user_ptr, 0);
761 (void)set_hero(user_ptr, randint1(50) + 50, FALSE);
762 (void)hp_player(user_ptr, 10);
763 (void)set_blessed(user_ptr, randint1(50) + 50, FALSE);
764 (void)set_oppose_acid(user_ptr, randint1(50) + 50, FALSE);
765 (void)set_oppose_elec(user_ptr, randint1(50) + 50, FALSE);
766 (void)set_oppose_fire(user_ptr, randint1(50) + 50, FALSE);
767 (void)set_oppose_cold(user_ptr, randint1(50) + 50, FALSE);
768 (void)set_oppose_pois(user_ptr, randint1(50) + 50, FALSE);
774 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
775 fire_breath(user_ptr, GF_FIRE, dir, 200, 2);
776 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
778 (void)set_oppose_fire(user_ptr, randint1(20) + 20, FALSE);
785 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
786 fire_breath(user_ptr, GF_COLD, dir, 200, 2);
787 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
789 (void)set_oppose_cold(user_ptr, randint1(20) + 20, FALSE);
796 if (!activate_dragon_breath(user_ptr, o_ptr)) return FALSE;
800 /* Activate for other offensive action */
803 msg_print(_("様々な色の火花を発している...", "It glows in scintillating colours..."));
804 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
805 confuse_monster(user_ptr, dir, 20);
811 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
812 sleep_monsters_touch(user_ptr);
818 earthquake(user_ptr, user_ptr->y, user_ptr->x, 5, 0);
824 turn_monsters(user_ptr, 40 + user_ptr->lev);
830 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
831 (void)fire_beam(user_ptr, GF_AWAY_ALL, dir, plev);
835 case ACT_BANISH_EVIL:
837 if (banish_evil(user_ptr, 100))
839 msg_print(_("アーティファクトの力が邪悪を打ち払った!", "The power of the artifact banishes evil!"));
846 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
847 (void)symbol_genocide(user_ptr, 200, TRUE);
853 msg_print(_("ひどく鋭い音が流れ出た...", "It lets out a long, shrill note..."));
854 (void)mass_genocide(user_ptr, 200, TRUE);
860 if (music_singing_any(user_ptr)) stop_singing(user_ptr);
861 if (hex_spelling_any(user_ptr)) stop_hex_spell_all(user_ptr);
862 msg_print(_("あなたは力強い突風を吹き鳴らした。周囲の敵が震え上っている!",
863 "You wind a mighty blast; your enemies tremble!"));
864 (void)turn_monsters(user_ptr, (3 * user_ptr->lev / 2) + 10);
870 if (o_ptr->name1 == ART_HYOUSIGI)
872 msg_print(_("拍子木を打った。", "You beat your wooden clappers."));
876 msg_format(_("%sは不快な物音を立てた。", "The %s sounds an unpleasant noise."), name);
878 aggravate_monsters(user_ptr, 0);
882 /* Activate for summoning / charming */
884 case ACT_CHARM_ANIMAL:
886 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
887 (void)charm_animal(user_ptr, dir, plev);
891 case ACT_CHARM_UNDEAD:
893 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
894 (void)control_one_undead(user_ptr, dir, plev);
898 case ACT_CHARM_OTHER:
900 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
901 (void)charm_monster(user_ptr, dir, plev * 2);
905 case ACT_CHARM_ANIMALS:
907 (void)charm_animals(user_ptr, plev * 2);
911 case ACT_CHARM_OTHERS:
913 charm_monsters(user_ptr, plev * 2);
917 case ACT_SUMMON_ANIMAL:
919 (void)summon_specific(user_ptr, -1, user_ptr->y, user_ptr->x, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET));
923 case ACT_SUMMON_PHANTOM:
925 msg_print(_("幻霊を召喚した。", "You summon a phantasmal servant."));
926 (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));
930 case ACT_SUMMON_ELEMENTAL:
931 if (!cast_summon_elemental(user_ptr, (plev * 3) / 2)) return FALSE;
934 case ACT_SUMMON_DEMON:
936 cast_summon_demon(user_ptr, (plev * 3) / 2);
940 case ACT_SUMMON_UNDEAD:
941 if (!cast_summon_undead(user_ptr, (plev * 3) / 2)) return FALSE;
944 case ACT_SUMMON_HOUND:
945 if (!cast_summon_hound(user_ptr, (plev * 3) / 2)) return FALSE;
948 case ACT_SUMMON_DAWN:
950 msg_print(_("暁の師団を召喚した。", "You summon the Legion of the Dawn."));
951 (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));
955 case ACT_SUMMON_OCTOPUS:
956 if (!cast_summon_octopus(user_ptr)) return FALSE;
959 /* Activate for healing */
961 case ACT_CHOIR_SINGS:
963 msg_print(_("天国の歌が聞こえる...", "A heavenly choir sings..."));
964 (void)cure_critical_wounds(user_ptr, 777);
965 (void)set_hero(user_ptr, randint1(25) + 25, FALSE);
971 (void)set_afraid(user_ptr, 0);
972 (void)hp_player(user_ptr, 30);
978 msg_print(_("深紫色の光を発している...", "It radiates deep purple..."));
979 (void)cure_serious_wounds(user_ptr, 4, 8);
983 case ACT_CURE_POISON:
985 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
986 (void)set_afraid(user_ptr, 0);
987 (void)set_poisoned(user_ptr, 0);
993 msg_print(_("深紅に輝いている...", "It glows a deep red..."));
994 restore_level(user_ptr);
1000 msg_print(_("濃緑色に輝いている...", "It glows a deep green..."));
1001 (void)restore_all_status(user_ptr);
1002 (void)restore_level(user_ptr);
1008 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
1009 msg_print(_("体内に暖かい鼓動が感じられる...", "You feel a warm tingling inside..."));
1010 (void)cure_critical_wounds(user_ptr, 700);
1016 msg_print(_("白く明るく輝いている...", "It glows a bright white..."));
1017 msg_print(_("ひじょうに気分がよい...", "You feel much better..."));
1018 (void)cure_critical_wounds(user_ptr, 1000);
1024 msg_format(_("%sの優しさに癒される...", "the %s cures you affectionately ..."), name);
1025 true_healing(user_ptr, 0);
1029 case ACT_CURE_MANA_FULL:
1031 msg_format(_("%sが青白く光った...", "The %s glows pale..."), name);
1032 restore_mana(user_ptr, TRUE);
1036 /* Activate for timed effect */
1040 (void)set_tim_esp(user_ptr, randint1(30) + 25, FALSE);
1046 (void)berserk(user_ptr, randint1(25) + 25);
1052 msg_format(_("%sから鋭い音が流れ出た...", "The %s lets out a shrill wail..."), name);
1053 k = 3 * user_ptr->lev;
1054 (void)set_protevil(user_ptr, randint1(25) + k, FALSE);
1058 case ACT_RESIST_ALL:
1060 msg_print(_("様々な色に輝いている...", "It glows many colours..."));
1061 (void)set_oppose_acid(user_ptr, randint1(40) + 40, FALSE);
1062 (void)set_oppose_elec(user_ptr, randint1(40) + 40, FALSE);
1063 (void)set_oppose_fire(user_ptr, randint1(40) + 40, FALSE);
1064 (void)set_oppose_cold(user_ptr, randint1(40) + 40, FALSE);
1065 (void)set_oppose_pois(user_ptr, randint1(40) + 40, FALSE);
1071 msg_print(_("明るく緑色に輝いている...", "It glows bright green..."));
1072 (void)set_fast(user_ptr, randint1(20) + 20, FALSE);
1076 case ACT_XTRA_SPEED:
1078 msg_print(_("明るく輝いている...", "It glows brightly..."));
1079 (void)set_fast(user_ptr, randint1(75) + 75, FALSE);
1085 set_wraith_form(user_ptr, randint1(plev / 2) + (plev / 2), FALSE);
1091 (void)set_invuln(user_ptr, randint1(8) + 8, FALSE);
1097 (void)heroism(user_ptr, 25);
1101 case ACT_HERO_SPEED:
1103 (void)set_fast(user_ptr, randint1(50) + 50, FALSE);
1104 (void)heroism(user_ptr, 50);
1108 case ACT_RESIST_ACID:
1110 msg_format(_("%sが黒く輝いた...", "The %s grows black."), name);
1111 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ACID))
1113 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
1114 fire_ball(user_ptr, GF_ACID, dir, 100, 2);
1116 (void)set_oppose_acid(user_ptr, randint1(20) + 20, FALSE);
1120 case ACT_RESIST_FIRE:
1122 msg_format(_("%sが赤く輝いた...", "The %s grows red."), name);
1123 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
1125 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
1126 fire_ball(user_ptr, GF_FIRE, dir, 100, 2);
1128 (void)set_oppose_fire(user_ptr, randint1(20) + 20, FALSE);
1132 case ACT_RESIST_COLD:
1134 msg_format(_("%sが白く輝いた...", "The %s grows white."), name);
1135 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
1137 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
1138 fire_ball(user_ptr, GF_COLD, dir, 100, 2);
1140 (void)set_oppose_cold(user_ptr, randint1(20) + 20, FALSE);
1144 case ACT_RESIST_ELEC:
1146 msg_format(_("%sが青く輝いた...", "The %s grows blue."), name);
1147 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ELEC))
1149 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
1150 fire_ball(user_ptr, GF_ELEC, dir, 100, 2);
1152 (void)set_oppose_elec(user_ptr, randint1(20) + 20, FALSE);
1156 case ACT_RESIST_POIS:
1158 msg_format(_("%sが緑に輝いた...", "The %s grows green."), name);
1159 (void)set_oppose_pois(user_ptr, randint1(20) + 20, FALSE);
1163 /* Activate for general purpose effect (detection etc.) */
1167 msg_format(_("%sから澄んだ光があふれ出た...", "The %s wells with clear light..."), name);
1168 lite_area(user_ptr, damroll(2, 15), 3);
1174 msg_print(_("眩しく輝いた...", "It shines brightly..."));
1175 map_area(user_ptr, DETECT_RAD_MAP);
1176 lite_area(user_ptr, damroll(2, 15), 3);
1180 case ACT_DETECT_ALL:
1182 msg_print(_("白く明るく輝いている...", "It glows bright white..."));
1183 msg_print(_("心にイメージが浮かんできた...", "An image forms in your mind..."));
1184 detect_all(user_ptr, DETECT_RAD_DEFAULT);
1188 case ACT_DETECT_XTRA:
1190 msg_print(_("明るく輝いている...", "It glows brightly..."));
1191 detect_all(user_ptr, DETECT_RAD_DEFAULT);
1193 identify_fully(user_ptr, FALSE, 0);
1199 msg_print(_("黄色く輝いている...", "It glows yellow..."));
1200 identify_fully(user_ptr, FALSE, 0);
1206 if (!ident_spell(user_ptr, FALSE, 0)) return FALSE;
1210 case ACT_RUNE_EXPLO:
1212 msg_print(_("明るい赤色に輝いている...", "It glows bright red..."));
1213 explosive_rune(user_ptr, user_ptr->y, user_ptr->x);
1219 msg_print(_("ブルーに明るく輝いている...", "It glows light blue..."));
1220 warding_glyph(user_ptr);
1226 (void)set_food(user_ptr, PY_FOOD_MAX - 1);
1232 msg_print(_("明るい赤色に輝いている...", "It glows bright red..."));
1233 destroy_doors_touch(user_ptr);
1239 msg_print(_("鼓動している...", "It pulsates..."));
1240 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
1241 wall_to_mud(user_ptr, dir, 20 + randint1(30));
1247 recharge(user_ptr, 130);
1253 msg_print(_("明るい黄色に輝いている...", "It glows bright yellow..."));
1254 (void)alchemy(user_ptr);
1260 msg_print(_("次元の扉が開いた。目的地を選んで下さい。", "You open a dimensional gate. Choose a destination."));
1261 if (!dimension_door(user_ptr)) return FALSE;
1268 msg_print(_("周りの空間が歪んでいる...", "It twists space around you..."));
1269 teleport_player(user_ptr, 100, TELEPORT_SPONTANEOUS);
1275 msg_print(_("やわらかな白色に輝いている...", "It glows soft white..."));
1276 if (!recall_player(user_ptr, randint0(21) + 15)) return FALSE;
1282 msg_format(_("%sは赤く明るく光った!", "The %s flashes bright red!"), name);
1283 chg_virtue(user_ptr, V_KNOWLEDGE, 1);
1284 chg_virtue(user_ptr, V_ENLIGHTEN, 1);
1285 wiz_lite(user_ptr, FALSE);
1287 msg_format(_("%sはあなたの体力を奪った...", "The %s drains your vitality..."), name);
1288 take_hit(user_ptr, DAMAGE_LOSELIFE, damroll(3, 8), _("審判の宝石", "the Jewel of Judgement"), -1);
1290 (void)detect_traps(user_ptr, DETECT_RAD_DEFAULT, TRUE);
1291 (void)detect_doors(user_ptr, DETECT_RAD_DEFAULT);
1292 (void)detect_stairs(user_ptr, DETECT_RAD_DEFAULT);
1294 if (get_check(_("帰還の力を使いますか?", "Activate recall? ")))
1296 (void)recall_player(user_ptr, randint0(21) + 15);
1302 case ACT_TELEKINESIS:
1304 if (!get_aim_dir(user_ptr, &dir)) return FALSE;
1305 msg_format(_("%sを伸ばした。", "You stretched your %s."), name);
1306 fetch(user_ptr, dir, 500, TRUE);
1310 case ACT_DETECT_UNIQUE:
1313 monster_type *m_ptr;
1314 monster_race *r_ptr;
1315 msg_print(_("奇妙な場所が頭の中に浮かんだ...", "Some strange places show up in your mind. And you see ..."));
1316 /* Process the monsters (backwards) */
1317 for (i = user_ptr->current_floor_ptr->m_max - 1; i >= 1; i--)
1319 m_ptr = &user_ptr->current_floor_ptr->m_list[i];
1321 /* Ignore "dead" monsters */
1322 if (!monster_is_valid(m_ptr)) continue;
1324 r_ptr = &r_info[m_ptr->r_idx];
1326 if (r_ptr->flags1 & RF1_UNIQUE)
1328 msg_format(_("%s. ", "%s. "), r_name + r_ptr->name);
1336 switch (randint1(13))
1338 case 1: case 2: case 3: case 4: case 5:
1339 teleport_player(user_ptr, 10, TELEPORT_SPONTANEOUS);
1341 case 6: case 7: case 8: case 9: case 10:
1342 teleport_player(user_ptr, 222, TELEPORT_SPONTANEOUS);
1345 (void)stair_creation(user_ptr);
1348 if (get_check(_("この階を去りますか?", "Leave this level? ")))
1350 if (autosave_l) do_cmd_save_game(user_ptr, TRUE);
1351 user_ptr->leaving = TRUE;
1357 case ACT_DISP_CURSE_XTRA:
1359 msg_format(_("%sが真実を照らし出す...", "The %s exhibits the truth..."), name);
1360 (void)remove_all_curse(user_ptr);
1361 (void)probing(user_ptr);
1365 case ACT_BRAND_FIRE_BOLTS:
1367 msg_format(_("%sが深紅に輝いた...", "Your %s glows deep red..."), name);
1368 brand_bolts(user_ptr);
1372 case ACT_RECHARGE_XTRA:
1374 msg_format(_("%sが白く輝いた...", "The %s gleams with blinding light..."), name);
1375 if (!recharge(user_ptr, 1000)) return FALSE;
1380 msg_print(_("石が隠された秘密を写し出した...", "The stone reveals hidden mysteries..."));
1381 if (!perilous_secrets(user_ptr)) return FALSE;
1386 msg_print(_("力強く四股を踏んだ。", "You stamp. (as if you are in a ring.)"));
1387 (void)set_afraid(user_ptr, 0);
1388 (void)set_hero(user_ptr, randint1(20) + 20, FALSE);
1389 dispel_evil(user_ptr, user_ptr->lev * 3);
1393 case ACT_PHASE_DOOR:
1395 teleport_player(user_ptr, 10, TELEPORT_SPONTANEOUS);
1399 case ACT_DETECT_ALL_MONS:
1401 (void)detect_monsters_invis(user_ptr, 255);
1402 (void)detect_monsters_normal(user_ptr, 255);
1406 case ACT_ULTIMATE_RESIST:
1408 TIME_EFFECT v = randint1(25) + 25;
1409 (void)set_afraid(user_ptr, 0);
1410 (void)set_hero(user_ptr, v, FALSE);
1411 (void)hp_player(user_ptr, 10);
1412 (void)set_blessed(user_ptr, v, FALSE);
1413 (void)set_oppose_acid(user_ptr, v, FALSE);
1414 (void)set_oppose_elec(user_ptr, v, FALSE);
1415 (void)set_oppose_fire(user_ptr, v, FALSE);
1416 (void)set_oppose_cold(user_ptr, v, FALSE);
1417 (void)set_oppose_pois(user_ptr, v, FALSE);
1418 (void)set_ultimate_res(user_ptr, v, FALSE);
1423 cosmic_cast_off(user_ptr, o_ptr);
1426 case ACT_FALLING_STAR:
1428 msg_print(_("あなたは妖刀に魅入られた…", "You are enchanted by cursed blade..."));
1429 msg_print(_("「狂ほしく 血のごとき 月はのぼれり 秘めおきし 魔剣 いずこぞや」", "'Behold the blade arts.'"));
1434 case ACT_GRAND_CROSS:
1436 msg_print(_("「闇に還れ!」", "You say, 'Return to darkness!'"));
1437 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);
1441 case ACT_TELEPORT_LEVEL:
1443 if (!get_check(_("本当に他の階にテレポートしますか?", "Are you sure? (Teleport Level)"))) return FALSE;
1444 teleport_level(user_ptr, 0);
1448 case ACT_STRAIN_HASTE:
1451 msg_format(_("%sはあなたの体力を奪った...", "The %s drains your vitality..."), name);
1452 take_hit(user_ptr, DAMAGE_LOSELIFE, damroll(3, 8), _("加速した疲労", "the strain of haste"), -1);
1453 t = 25 + randint1(25);
1454 (void)set_fast(user_ptr, user_ptr->fast + t, FALSE);
1459 if (!fishing(user_ptr)) return FALSE;
1463 mitokohmon(user_ptr);
1468 /* Only for Muramasa */
1469 if (o_ptr->name1 != ART_MURAMASA) return FALSE;
1470 if (get_check(_("本当に使いますか?", "Are you sure?!")))
1472 msg_print(_("村正が震えた...", "The Muramasa pulsates..."));
1473 do_inc_stat(user_ptr, A_STR);
1476 msg_print(_("村正は壊れた!", "The Muramasa is destroyed!"));
1477 curse_weapon_object(user_ptr, TRUE, o_ptr);
1483 case ACT_BLOODY_MOON:
1485 /* Only for Bloody Moon */
1486 if (o_ptr->name1 != ART_BLOOD) return FALSE;
1487 msg_print(_("鎌が明るく輝いた...", "Your scythe glows brightly!"));
1488 get_bloody_moon_flags(o_ptr);
1489 if (user_ptr->prace == RACE_ANDROID) calc_android_exp(user_ptr);
1490 user_ptr->update |= (PU_BONUS | PU_HP);
1495 if (o_ptr->name1 != ART_CRIMSON) return FALSE;
1496 msg_print(_("せっかくだから『クリムゾン』をぶっぱなすぜ!", "I'll fire CRIMSON! SEKKAKUDAKARA!"));
1497 if (!fire_crimson(user_ptr)) return FALSE;
1502 msg_format(_("Unknown activation effect: %d.", "Unknown activation effect: %d."), act_ptr->index);
1507 /* Set activation timeout */
1508 if (act_ptr->timeout.constant >= 0) {
1509 o_ptr->timeout = (s16b)act_ptr->timeout.constant;
1510 if (act_ptr->timeout.dice > 0) {
1511 o_ptr->timeout += randint1(act_ptr->timeout.dice);
1515 /* Activations that have special timeout */
1516 switch (act_ptr->index) {
1518 o_ptr->timeout = ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) ? 200 : 250;
1521 o_ptr->timeout = ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) ? 200 : 250;
1524 o_ptr->timeout = 3 * (user_ptr->lev + 10);
1530 msg_format("Special timeout is not implemented: %d.", act_ptr->index);