2 * @brief ものまねの処理実装 / Imitation code
5 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
6 * This software may be copied and distributed for educational, research,\n
7 * and not for profit purposes provided that this copyright and statement\n
8 * are included in all such copies. Other copyrights may also apply.\n
9 * 2014 Deskull rearranged comment for Doxygen.\n
12 #include "action/action-limited.h"
13 #include "cmd-action/cmd-spell.h"
14 #include "core/asking-player.h"
15 #include "core/hp-mp-processor.h"
16 #include "core/player-redraw-types.h"
17 #include "core/stuff-handler.h"
18 #include "core/window-redrawer.h"
19 #include "floor/cave.h"
20 #include "floor/floor-object.h"
21 #include "game-option/disturbance-options.h"
22 #include "game-option/text-display-options.h"
23 #include "grid/grid.h"
24 #include "main/sound-definitions-table.h"
25 #include "main/sound-of-music.h"
26 #include "mind/mind-mage.h"
27 #include "monster-floor/monster-summon.h"
28 #include "monster-floor/place-monster-types.h"
29 #include "monster-race/monster-race.h"
30 #include "monster-race/race-flags-resistance.h"
31 #include "monster-race/race-flags1.h"
32 #include "monster/monster-describer.h"
33 #include "monster/monster-info.h"
34 #include "monster/monster-processor.h"
35 #include "monster/monster-status.h"
36 #include "mspell/monster-power-table.h"
37 #include "mspell/mspell-type.h"
38 #include "player/player-status-table.h"
39 #include "player/player-status.h"
40 #include "spell-kind/spells-launcher.h"
41 #include "spell-kind/spells-lite.h"
42 #include "spell-kind/spells-neighbor.h"
43 #include "spell-kind/spells-sight.h"
44 #include "spell-kind/spells-teleport.h"
45 #include "spell-kind/spells-world.h"
46 #include "spell/spell-types.h"
47 #include "spell/spells-status.h"
48 #include "spell/spells-summon.h"
49 #include "spell/summon-types.h"
50 #include "status/bad-status-setter.h"
51 #include "status/body-improvement.h"
52 #include "status/buff-setter.h"
53 #include "system/floor-type-definition.h"
54 #include "target/projection-path-calculator.h"
55 #include "target/target-checker.h"
56 #include "target/target-getter.h"
57 #include "target/target-setter.h"
58 #include "target/target-types.h"
59 #include "term/screen-processor.h"
60 #include "util/int-char-converter.h"
61 #include "view/display-messages.h"
66 * @brief 受け取ったパラメータに応じてものまねの効果情報をまとめたフォーマットを返す
67 * @param p 情報を返す文字列参照ポインタ
68 * @param power ものまねの効力の種類
72 static void mane_info(player_type *caster_ptr, char *p, int power, HIT_POINT dam)
74 PLAYER_LEVEL plev = caster_ptr->lev;
78 if ((power > 2 && power < 41) || (power > 41 && power < 59) || (power == 75))
79 sprintf(p, " %s%d", KWD_DAM, (int)dam);
83 sprintf(p, " %sd%d+%d", KWD_HEAL, plev * 3, plev);
86 sprintf(p, " %sd%d+%d", KWD_DURATION, 20 + plev, plev);
89 sprintf(p, " %s%d", KWD_HEAL, plev * 6);
92 sprintf(p, " %sd7+7", KWD_DURATION);
95 sprintf(p, " %s10", KWD_SPHERE);
98 sprintf(p, " %s%d", KWD_SPHERE, plev * 5);
101 sprintf(p, " %s5", KWD_SPHERE);
110 * @brief どのものまねを発動するか選択する処理 /
111 * Allow user to choose a imitation.
112 * @param sn 実行したものまねのIDを返す参照ポインタ(キャンセルなどの場合-1を返す)
113 * @param baigaesi TRUEならば倍返し上の処理として行う
114 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
116 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
117 * If the user hits escape, returns FALSE, and set '*sn' to -1
118 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
120 * The "prompt" should be "cast", "recite", or "study"
121 * The "known" should be TRUE for cast/pray, FALSE for study
123 * nb: This function has a (trivial) display bug which will be obvious
124 * when you run it. It's probably easy to fix but I haven't tried,
127 static int get_mane_power(player_type *caster_ptr, int *sn, bool baigaesi)
133 PERCENTAGE minfail = 0;
134 PLAYER_LEVEL plev = caster_ptr->lev;
135 PERCENTAGE chance = 0;
138 char out_val[MAX_MONSTER_NAME];
140 concptr p = _("能力", "power");
145 /* Assume cancelled */
151 num = caster_ptr->mane_num;
153 /* Build a prompt (accept all spells) */
154 (void)strnfmt(out_val, 78, _("(%c-%c, '*'で一覧, ESC) どの%sをまねますか?", "(%c-%c, *=List, ESC=exit) Use which %s? "), I2A(0), I2A(num - 1), p);
156 choice = always_show_list ? ESCAPE : 1;
158 if (choice == ESCAPE)
160 else if (!get_com(out_val, &choice, TRUE))
164 if ((choice == ' ') || (choice == '*') || (choice == '?')) {
171 /* Display a list of spells */
173 put_str(_("名前", "Name"), y, x + 5);
174 put_str(_("失率 効果", "Fail Info"), y, x + 36);
176 /* Dump the spells */
177 for (i = 0; i < num; i++) {
178 /* Access the spell */
179 spell = monster_powers[caster_ptr->mane_spell[i]];
181 chance = spell.manefail;
183 /* Reduce failure rate by "effective" level adjustment */
184 if (plev > spell.level)
185 chance -= 3 * (plev - spell.level);
187 /* Reduce failure rate by INT/WIS adjustment */
188 chance -= 3 * (adj_mag_stat[caster_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[caster_ptr->stat_ind[A_DEX]] - 2) / 2;
191 chance = chance * (baigaesi ? caster_ptr->mane_dam[i] * 2 : caster_ptr->mane_dam[i]) / spell.manedam;
193 chance += caster_ptr->to_m_chance;
195 /* Extract the minimum failure rate */
196 minfail = adj_mag_fail[caster_ptr->stat_ind[spell.use_stat]];
198 /* Minimum failure rate */
199 if (chance < minfail)
202 /* Stunning makes spells harder */
203 if (caster_ptr->stun > 50)
205 else if (caster_ptr->stun)
208 /* Always a 5 percent chance of working */
213 mane_info(caster_ptr, comment, caster_ptr->mane_spell[i], (baigaesi ? caster_ptr->mane_dam[i] * 2 : caster_ptr->mane_dam[i]));
215 /* Dump the spell --(-- */
216 sprintf(psi_desc, " %c) %-30s %3d%%%s", I2A(i), spell.name, chance, comment);
217 prt(psi_desc, y + i + 1, x);
220 /* Clear the bottom line */
221 prt("", y + i + 1, x);
236 ask = isupper(choice);
240 choice = (char)tolower(choice);
242 /* Extract request */
243 i = (islower(choice) ? A2I(choice) : -1);
245 /* Totally Illegal */
246 if ((i < 0) || (i >= num)) {
251 /* Save the spell index */
252 spell = monster_powers[caster_ptr->mane_spell[i]];
259 (void)strnfmt(tmp_val, 78, _("%sをまねますか?", "Use %s? "), monster_powers[caster_ptr->mane_spell[i]].name);
261 /* Belay that order */
262 if (!get_check(tmp_val))
272 caster_ptr->window_flags |= (PW_SPELL);
273 handle_stuff(caster_ptr);
275 /* Abort if needed */
279 /* Save the choice */
282 damage = (baigaesi ? caster_ptr->mane_dam[i] * 2 : caster_ptr->mane_dam[i]);
290 * do_cmd_cast calls this function if the player's class is 'imitator'.
291 * @param caster_ptr プレーヤーへの参照ポインタ
292 * @param spell 発動するモンスター攻撃のID
293 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
295 static bool use_mane(player_type *caster_ptr, int spell)
298 PLAYER_LEVEL plev = caster_ptr->lev;
299 BIT_FLAGS mode = (PM_ALLOW_GROUP | PM_FORCE_PET);
300 BIT_FLAGS u_mode = 0L;
302 if (randint1(50 + plev) < plev / 10)
303 u_mode = PM_ALLOW_UNIQUE;
308 msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
309 aggravate_monsters(caster_ptr, 0);
318 if (!target_set(caster_ptr, TARGET_KILL))
320 m_idx = caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
323 if (!player_has_los_bold(caster_ptr, target_row, target_col))
325 if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col))
327 dispel_monster_status(caster_ptr, m_idx);
332 if (!get_aim_dir(caster_ptr, &dir))
335 msg_print(_("ロケットを発射した。", "You fire a rocket."));
336 fire_rocket(caster_ptr, GF_ROCKET, dir, damage, 2);
340 if (!get_aim_dir(caster_ptr, &dir))
343 msg_print(_("矢を放った。", "You fire an arrow."));
344 fire_bolt(caster_ptr, GF_ARROW, dir, damage);
357 if (!get_aim_dir(caster_ptr, &dir))
360 msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
361 fire_breath(caster_ptr, GF_ACID, dir, damage, (plev > 35 ? 3 : 2));
365 if (!get_aim_dir(caster_ptr, &dir))
368 msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
369 fire_breath(caster_ptr, GF_ELEC, dir, damage, (plev > 35 ? 3 : 2));
373 if (!get_aim_dir(caster_ptr, &dir))
376 msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
377 fire_breath(caster_ptr, GF_FIRE, dir, damage, (plev > 35 ? 3 : 2));
381 if (!get_aim_dir(caster_ptr, &dir))
384 msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
385 fire_breath(caster_ptr, GF_COLD, dir, damage, (plev > 35 ? 3 : 2));
389 if (!get_aim_dir(caster_ptr, &dir))
392 msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
393 fire_breath(caster_ptr, GF_POIS, dir, damage, (plev > 35 ? 3 : 2));
397 if (!get_aim_dir(caster_ptr, &dir))
400 msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
401 fire_breath(caster_ptr, GF_NETHER, dir, damage, (plev > 35 ? 3 : 2));
405 if (!get_aim_dir(caster_ptr, &dir))
408 msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
409 fire_breath(caster_ptr, GF_LITE, dir, damage, (plev > 35 ? 3 : 2));
413 if (!get_aim_dir(caster_ptr, &dir))
416 msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
417 fire_breath(caster_ptr, GF_DARK, dir, damage, (plev > 35 ? 3 : 2));
421 if (!get_aim_dir(caster_ptr, &dir))
424 msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
425 fire_breath(caster_ptr, GF_CONFUSION, dir, damage, (plev > 35 ? 3 : 2));
429 if (!get_aim_dir(caster_ptr, &dir))
432 msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
433 fire_breath(caster_ptr, GF_SOUND, dir, damage, (plev > 35 ? 3 : 2));
437 if (!get_aim_dir(caster_ptr, &dir))
440 msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
441 fire_breath(caster_ptr, GF_CHAOS, dir, damage, (plev > 35 ? 3 : 2));
445 if (!get_aim_dir(caster_ptr, &dir))
448 msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
449 fire_breath(caster_ptr, GF_DISENCHANT, dir, damage, (plev > 35 ? 3 : 2));
453 if (!get_aim_dir(caster_ptr, &dir))
456 msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
457 fire_breath(caster_ptr, GF_NEXUS, dir, damage, (plev > 35 ? 3 : 2));
461 if (!get_aim_dir(caster_ptr, &dir))
464 msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
465 fire_breath(caster_ptr, GF_TIME, dir, damage, (plev > 35 ? 3 : 2));
469 if (!get_aim_dir(caster_ptr, &dir))
472 msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
473 fire_breath(caster_ptr, GF_INERTIAL, dir, damage, (plev > 35 ? 3 : 2));
477 if (!get_aim_dir(caster_ptr, &dir))
480 msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
481 fire_breath(caster_ptr, GF_GRAVITY, dir, damage, (plev > 35 ? 3 : 2));
485 if (!get_aim_dir(caster_ptr, &dir))
488 msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
489 fire_breath(caster_ptr, GF_SHARDS, dir, damage, (plev > 35 ? 3 : 2));
493 if (!get_aim_dir(caster_ptr, &dir))
496 msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
498 fire_breath(caster_ptr, GF_PLASMA, dir, damage, (plev > 35 ? 3 : 2));
502 if (!get_aim_dir(caster_ptr, &dir))
505 msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
507 fire_breath(caster_ptr, GF_FORCE, dir, damage, (plev > 35 ? 3 : 2));
511 if (!get_aim_dir(caster_ptr, &dir))
514 msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
516 fire_breath(caster_ptr, GF_MANA, dir, damage, (plev > 35 ? 3 : 2));
520 if (!get_aim_dir(caster_ptr, &dir))
523 msg_print(_("放射能球を放った。", "You cast a ball of radiation."));
525 fire_ball(caster_ptr, GF_NUKE, dir, damage, 2);
529 if (!get_aim_dir(caster_ptr, &dir))
532 msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
534 fire_breath(caster_ptr, GF_NUKE, dir, damage, (plev > 35 ? 3 : 2));
538 if (!get_aim_dir(caster_ptr, &dir))
541 msg_print(_("純ログルスを放った。", "You invoke a raw Logrus."));
543 fire_ball(caster_ptr, GF_CHAOS, dir, damage, 4);
546 if (!get_aim_dir(caster_ptr, &dir))
549 msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
551 fire_breath(caster_ptr, GF_DISINTEGRATE, dir, damage, (plev > 35 ? 3 : 2));
554 if (!get_aim_dir(caster_ptr, &dir))
557 msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball."));
559 fire_ball(caster_ptr, GF_ACID, dir, damage, 2);
562 if (!get_aim_dir(caster_ptr, &dir))
565 msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball."));
567 fire_ball(caster_ptr, GF_ELEC, dir, damage, 2);
570 if (!get_aim_dir(caster_ptr, &dir))
573 msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball."));
575 fire_ball(caster_ptr, GF_FIRE, dir, damage, 2);
578 if (!get_aim_dir(caster_ptr, &dir))
581 msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball."));
583 fire_ball(caster_ptr, GF_COLD, dir, damage, 2);
586 if (!get_aim_dir(caster_ptr, &dir))
589 msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud."));
591 fire_ball(caster_ptr, GF_POIS, dir, damage, 2);
594 if (!get_aim_dir(caster_ptr, &dir))
597 msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball."));
599 fire_ball(caster_ptr, GF_NETHER, dir, damage, 2);
602 if (!get_aim_dir(caster_ptr, &dir))
605 msg_print(_("流れるような身振りをした。", "You gesture fluidly."));
607 fire_ball(caster_ptr, GF_WATER, dir, damage, 4);
610 if (!get_aim_dir(caster_ptr, &dir))
613 msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm."));
615 fire_ball(caster_ptr, GF_MANA, dir, damage, 4);
618 if (!get_aim_dir(caster_ptr, &dir))
621 msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm."));
623 fire_ball(caster_ptr, GF_DARK, dir, damage, 4);
626 if (!get_aim_dir(caster_ptr, &dir))
628 fire_ball_hide(caster_ptr, GF_DRAIN_MANA, dir, randint1(plev * 3) + plev, 0);
631 if (!get_aim_dir(caster_ptr, &dir))
633 fire_ball_hide(caster_ptr, GF_MIND_BLAST, dir, damage, 0);
636 if (!get_aim_dir(caster_ptr, &dir))
638 fire_ball_hide(caster_ptr, GF_BRAIN_SMASH, dir, damage, 0);
641 if (!get_aim_dir(caster_ptr, &dir))
643 fire_ball_hide(caster_ptr, GF_CAUSE_1, dir, damage, 0);
646 if (!get_aim_dir(caster_ptr, &dir))
648 fire_ball_hide(caster_ptr, GF_CAUSE_2, dir, damage, 0);
651 if (!get_aim_dir(caster_ptr, &dir))
653 fire_ball_hide(caster_ptr, GF_CAUSE_3, dir, damage, 0);
656 if (!get_aim_dir(caster_ptr, &dir))
658 fire_ball_hide(caster_ptr, GF_CAUSE_4, dir, damage, 0);
661 if (!get_aim_dir(caster_ptr, &dir))
664 msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt."));
666 fire_bolt(caster_ptr, GF_ACID, dir, damage);
669 if (!get_aim_dir(caster_ptr, &dir))
672 msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt."));
674 fire_bolt(caster_ptr, GF_ELEC, dir, damage);
677 if (!get_aim_dir(caster_ptr, &dir))
680 msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt."));
682 fire_bolt(caster_ptr, GF_FIRE, dir, damage);
685 if (!get_aim_dir(caster_ptr, &dir))
688 msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt."));
690 fire_bolt(caster_ptr, GF_COLD, dir, damage);
693 if (!get_aim_dir(caster_ptr, &dir))
696 msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst."));
698 fire_ball(caster_ptr, GF_LITE, dir, damage, 4);
701 if (!get_aim_dir(caster_ptr, &dir))
704 msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt."));
706 fire_bolt(caster_ptr, GF_NETHER, dir, damage);
709 if (!get_aim_dir(caster_ptr, &dir))
712 msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt."));
714 fire_bolt(caster_ptr, GF_WATER, dir, damage);
717 if (!get_aim_dir(caster_ptr, &dir))
720 msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt."));
722 fire_bolt(caster_ptr, GF_MANA, dir, damage);
725 if (!get_aim_dir(caster_ptr, &dir))
728 msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt."));
730 fire_bolt(caster_ptr, GF_PLASMA, dir, damage);
733 if (!get_aim_dir(caster_ptr, &dir))
736 msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt."));
738 fire_bolt(caster_ptr, GF_ICE, dir, damage);
740 case MS_MAGIC_MISSILE:
741 if (!get_aim_dir(caster_ptr, &dir))
744 msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile."));
746 fire_bolt(caster_ptr, GF_MISSILE, dir, damage);
749 if (!get_aim_dir(caster_ptr, &dir))
752 msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion."));
754 fear_monster(caster_ptr, dir, plev + 10);
757 if (!get_aim_dir(caster_ptr, &dir))
759 confuse_monster(caster_ptr, dir, plev * 2);
762 if (!get_aim_dir(caster_ptr, &dir))
765 msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion."));
767 confuse_monster(caster_ptr, dir, plev * 2);
770 if (!get_aim_dir(caster_ptr, &dir))
772 slow_monster(caster_ptr, dir, plev);
775 if (!get_aim_dir(caster_ptr, &dir))
777 sleep_monster(caster_ptr, dir, plev);
780 (void)set_fast(caster_ptr, randint1(20 + plev) + plev, FALSE);
783 if (!get_aim_dir(caster_ptr, &dir))
786 msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
788 fire_ball_hide(caster_ptr, GF_HAND_DOOM, dir, 200, 0);
792 msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
793 (void)hp_player(caster_ptr, plev * 6);
794 (void)set_stun(caster_ptr, 0);
795 (void)set_cut(caster_ptr, 0);
798 msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
799 (void)set_invuln(caster_ptr, randint1(7) + 7, FALSE);
802 teleport_player(caster_ptr, 10, TELEPORT_SPONTANEOUS);
805 teleport_player(caster_ptr, plev * 5, TELEPORT_SPONTANEOUS);
808 (void)time_walk(caster_ptr);
815 GAME_TEXT m_name[MAX_NLEN];
817 if (!target_set(caster_ptr, TARGET_KILL))
819 if (!caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx)
821 if (!player_has_los_bold(caster_ptr, target_row, target_col))
823 if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col))
825 m_ptr = &caster_ptr->current_floor_ptr->m_list[caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx];
826 r_ptr = &r_info[m_ptr->r_idx];
827 monster_desc(caster_ptr, m_name, m_ptr, 0);
828 if (r_ptr->flagsr & RFR_RES_TELE) {
829 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL)) {
830 if (is_original_ap_and_seen(caster_ptr, m_ptr))
831 r_ptr->r_flagsr |= RFR_RES_TELE;
832 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
835 } else if (r_ptr->level > randint1(100)) {
836 if (is_original_ap_and_seen(caster_ptr, m_ptr))
837 r_ptr->r_flagsr |= RFR_RES_TELE;
838 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
843 msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
846 caster_ptr, caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx, caster_ptr->y, caster_ptr->x, 100, TELEPORT_PASSIVE);
850 if (!get_aim_dir(caster_ptr, &dir))
853 (void)fire_beam(caster_ptr, GF_AWAY_ALL, dir, plev);
857 return teleport_level_other(caster_ptr);
861 if (!get_aim_dir(caster_ptr, &dir))
864 msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
865 (void)fire_beam(caster_ptr, GF_PSY_SPEAR, dir, damage);
869 msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
870 (void)unlite_area(caster_ptr, 10, 3);
874 if (!target_set(caster_ptr, TARGET_KILL))
876 msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackle evilly."));
877 trap_creation(caster_ptr, target_row, target_col);
880 msg_print(_("しかし何も起きなかった。", "Nothing happens."));
883 msg_print(_("死者復活の呪文を唱えた。", "You animate the dead."));
884 (void)animate_dead(caster_ptr, 0, caster_ptr->y, caster_ptr->x);
888 if (!target_set(caster_ptr, TARGET_KILL))
891 msg_print(_("援軍を召喚した。", "You summon minions."));
892 for (k = 0; k < 4; k++) {
893 (void)summon_kin_player(caster_ptr, plev, target_row, target_col, (PM_FORCE_PET | PM_ALLOW_GROUP));
899 int max_cyber = (caster_ptr->current_floor_ptr->dun_level / 50) + randint1(3);
900 if (!target_set(caster_ptr, TARGET_KILL))
902 msg_print(_("サイバーデーモンを召喚した!", "You summon Cyberdemons!"));
905 for (k = 0; k < max_cyber; k++)
906 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_CYBER, mode);
911 if (!target_set(caster_ptr, TARGET_KILL))
913 msg_print(_("仲間を召喚した。", "You summon help."));
914 for (k = 0; k < 1; k++)
915 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_NONE, (mode | u_mode));
918 case MS_S_MONSTERS: {
920 if (!target_set(caster_ptr, TARGET_KILL))
922 msg_print(_("モンスターを召喚した!", "You summon monsters!"));
923 for (k = 0; k < 6; k++)
924 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_NONE, (mode | u_mode));
929 if (!target_set(caster_ptr, TARGET_KILL))
931 msg_print(_("アリを召喚した。", "You summon ants."));
932 for (k = 0; k < 6; k++)
933 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_ANT, mode);
938 if (!target_set(caster_ptr, TARGET_KILL))
940 msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
941 for (k = 0; k < 6; k++)
942 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_SPIDER, mode);
947 if (!target_set(caster_ptr, TARGET_KILL))
949 msg_print(_("ハウンドを召喚した。", "You summon hounds."));
950 for (k = 0; k < 4; k++)
951 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HOUND, mode);
956 if (!target_set(caster_ptr, TARGET_KILL))
958 msg_print(_("ヒドラを召喚した。", "You summon hydras."));
959 for (k = 0; k < 4; k++)
960 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HYDRA, mode);
965 if (!target_set(caster_ptr, TARGET_KILL))
967 msg_print(_("天使を召喚した!", "You summon an angel!"));
968 for (k = 0; k < 1; k++)
969 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_ANGEL, mode);
974 if (!target_set(caster_ptr, TARGET_KILL))
976 msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
977 for (k = 0; k < 1; k++)
978 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_DEMON, (mode | u_mode));
983 if (!target_set(caster_ptr, TARGET_KILL))
985 msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
986 for (k = 0; k < 1; k++)
987 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_UNDEAD, (mode | u_mode));
992 if (!target_set(caster_ptr, TARGET_KILL))
994 msg_print(_("ドラゴンを召喚した!", "You summon a dragon!"));
995 for (k = 0; k < 1; k++)
996 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_DRAGON, (mode | u_mode));
999 case MS_S_HI_UNDEAD: {
1001 if (!target_set(caster_ptr, TARGET_KILL))
1003 msg_print(_("強力なアンデッドを召喚した!", "You summon greater undead!"));
1004 for (k = 0; k < 6; k++)
1005 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
1008 case MS_S_HI_DRAGON: {
1010 if (!target_set(caster_ptr, TARGET_KILL))
1012 msg_print(_("古代ドラゴンを召喚した!", "You summon ancient dragons!"));
1013 for (k = 0; k < 4; k++)
1014 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_DRAGON, (mode | u_mode));
1017 case MS_S_AMBERITE: {
1019 if (!target_set(caster_ptr, TARGET_KILL))
1021 msg_print(_("アンバーの王族を召喚した!", "You summon Lords of Amber!"));
1022 for (k = 0; k < 4; k++)
1023 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
1028 if (!target_set(caster_ptr, TARGET_KILL))
1030 msg_print(_("特別な強敵を召喚した!", "You summon special opponents!"));
1031 for (k = 0; k < 4; k++)
1032 if (summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE)))
1034 for (k = count; k < 4; k++)
1035 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
1046 * @brief ものまねコマンドのメインルーチン /
1047 * do_cmd_cast calls this function if the player's class is 'imitator'.
1048 * @param baigaesi TRUEならば倍返し上の処理として行う
1049 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
1051 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
1052 * If the user hits escape, returns FALSE, and set '*sn' to -1
1053 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
1055 * The "prompt" should be "cast", "recite", or "study"
1056 * The "known" should be TRUE for cast/pray, FALSE for study
1058 * nb: This function has a (trivial) display bug which will be obvious
1059 * when you run it. It's probably easy to fix but I haven't tried,
1062 bool do_cmd_mane(player_type *creature_ptr, bool baigaesi)
1066 PERCENTAGE minfail = 0;
1067 PLAYER_LEVEL plev = creature_ptr->lev;
1068 monster_power spell;
1071 if (cmd_limit_confused(creature_ptr))
1074 if (!creature_ptr->mane_num) {
1075 msg_print(_("まねられるものが何もない!", "You don't remember any action!"));
1079 if (!get_mane_power(creature_ptr, &n, baigaesi))
1082 spell = monster_powers[creature_ptr->mane_spell[n]];
1084 /* Spell failure chance */
1085 chance = spell.manefail;
1087 /* Reduce failure rate by "effective" level adjustment */
1088 if (plev > spell.level)
1089 chance -= 3 * (plev - spell.level);
1091 /* Reduce failure rate by 1 stat and DEX adjustment */
1092 chance -= 3 * (adj_mag_stat[creature_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[creature_ptr->stat_ind[A_DEX]] - 2) / 2;
1095 chance = chance * damage / spell.manedam;
1097 chance += creature_ptr->to_m_chance;
1099 /* Extract the minimum failure rate */
1100 minfail = adj_mag_fail[creature_ptr->stat_ind[spell.use_stat]];
1102 /* Minimum failure rate */
1103 if (chance < minfail)
1106 /* Stunning makes spells harder */
1107 if (creature_ptr->stun > 50)
1109 else if (creature_ptr->stun)
1112 /* Always a 5 percent chance of working */
1117 if (randint0(100) < chance) {
1120 msg_print(_("ものまねに失敗した!", "You failed to concentrate hard enough!"));
1124 cast = use_mane(creature_ptr, creature_ptr->mane_spell[n]);
1129 creature_ptr->mane_num--;
1130 for (j = n; j < creature_ptr->mane_num; j++) {
1131 creature_ptr->mane_spell[j] = creature_ptr->mane_spell[j + 1];
1132 creature_ptr->mane_dam[j] = creature_ptr->mane_dam[j + 1];
1135 take_turn(creature_ptr, 100);
1137 creature_ptr->redraw |= (PR_IMITATION);
1138 creature_ptr->window_flags |= (PW_PLAYER);
1139 creature_ptr->window_flags |= (PW_SPELL);