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 "floor/floor.h"
22 #include "game-option/disturbance-options.h"
23 #include "game-option/text-display-options.h"
24 #include "grid/grid.h"
25 #include "main/sound-definitions-table.h"
26 #include "main/sound-of-music.h"
27 #include "mind/mind-mage.h"
28 #include "monster-floor/monster-summon.h"
29 #include "monster-floor/place-monster-types.h"
30 #include "monster-race/monster-race.h"
31 #include "monster-race/race-flags-resistance.h"
32 #include "monster-race/race-flags1.h"
33 #include "monster/monster-describer.h"
34 #include "monster/monster-info.h"
35 #include "monster/monster-processor.h"
36 #include "monster/monster-status.h"
37 #include "mspell/monster-power-table.h"
38 #include "mspell/mspell-type.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 "status/bad-status-setter.h"
50 #include "status/body-improvement.h"
51 #include "status/buff-setter.h"
52 #include "system/floor-type-definition.h"
53 #include "target/target-setter.h"
54 #include "target/target-types.h"
55 #include "target/targeting.h"
56 #include "term/screen-processor.h"
57 #include "util/int-char-converter.h"
58 #include "view/display-messages.h"
63 * @brief 受け取ったパラメータに応じてものまねの効果情報をまとめたフォーマットを返す
64 * @param p 情報を返す文字列参照ポインタ
65 * @param power ものまねの効力の種類
69 static void mane_info(player_type *caster_ptr, char *p, int power, HIT_POINT dam)
71 PLAYER_LEVEL plev = caster_ptr->lev;
75 if ((power > 2 && power < 41) || (power > 41 && power < 59) || (power == 75))
76 sprintf(p, " %s%d", KWD_DAM, (int)dam);
80 sprintf(p, " %sd%d+%d", KWD_HEAL, plev * 3, plev);
83 sprintf(p, " %sd%d+%d", KWD_DURATION, 20 + plev, plev);
86 sprintf(p, " %s%d", KWD_HEAL, plev * 6);
89 sprintf(p, " %sd7+7", KWD_DURATION);
92 sprintf(p, " %s10", KWD_SPHERE);
95 sprintf(p, " %s%d", KWD_SPHERE, plev * 5);
98 sprintf(p, " %s5", KWD_SPHERE);
107 * @brief どのものまねを発動するか選択する処理 /
108 * Allow user to choose a imitation.
109 * @param sn 実行したものまねのIDを返す参照ポインタ(キャンセルなどの場合-1を返す)
110 * @param baigaesi TRUEならば倍返し上の処理として行う
111 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
113 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
114 * If the user hits escape, returns FALSE, and set '*sn' to -1
115 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
117 * The "prompt" should be "cast", "recite", or "study"
118 * The "known" should be TRUE for cast/pray, FALSE for study
120 * nb: This function has a (trivial) display bug which will be obvious
121 * when you run it. It's probably easy to fix but I haven't tried,
124 static int get_mane_power(player_type *caster_ptr, int *sn, bool baigaesi)
130 PERCENTAGE minfail = 0;
131 PLAYER_LEVEL plev = caster_ptr->lev;
132 PERCENTAGE chance = 0;
137 concptr p = _("能力", "power");
142 /* Assume cancelled */
148 num = caster_ptr->mane_num;
150 /* Build a prompt (accept all spells) */
151 (void)strnfmt(out_val, 78, _("(%c-%c, '*'で一覧, ESC) どの%sをまねますか?", "(%c-%c, *=List, ESC=exit) Use which %s? "), I2A(0), I2A(num - 1), p);
153 choice = always_show_list ? ESCAPE : 1;
155 if (choice == ESCAPE)
157 else if (!get_com(out_val, &choice, TRUE))
161 if ((choice == ' ') || (choice == '*') || (choice == '?')) {
168 /* Display a list of spells */
170 put_str(_("名前", "Name"), y, x + 5);
171 put_str(_("失率 効果", "Fail Info"), y, x + 36);
173 /* Dump the spells */
174 for (i = 0; i < num; i++) {
175 /* Access the spell */
176 spell = monster_powers[caster_ptr->mane_spell[i]];
178 chance = spell.manefail;
180 /* Reduce failure rate by "effective" level adjustment */
181 if (plev > spell.level)
182 chance -= 3 * (plev - spell.level);
184 /* Reduce failure rate by INT/WIS adjustment */
185 chance -= 3 * (adj_mag_stat[caster_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[caster_ptr->stat_ind[A_DEX]] - 2) / 2;
188 chance = chance * (baigaesi ? caster_ptr->mane_dam[i] * 2 : caster_ptr->mane_dam[i]) / spell.manedam;
190 chance += caster_ptr->to_m_chance;
192 /* Extract the minimum failure rate */
193 minfail = adj_mag_fail[caster_ptr->stat_ind[spell.use_stat]];
195 /* Minimum failure rate */
196 if (chance < minfail)
199 /* Stunning makes spells harder */
200 if (caster_ptr->stun > 50)
202 else if (caster_ptr->stun)
205 /* Always a 5 percent chance of working */
210 mane_info(caster_ptr, comment, caster_ptr->mane_spell[i], (baigaesi ? caster_ptr->mane_dam[i] * 2 : caster_ptr->mane_dam[i]));
212 /* Dump the spell --(-- */
213 sprintf(psi_desc, " %c) %-30s %3d%%%s", I2A(i), spell.name, chance, comment);
214 prt(psi_desc, y + i + 1, x);
217 /* Clear the bottom line */
218 prt("", y + i + 1, x);
233 ask = isupper(choice);
237 choice = (char)tolower(choice);
239 /* Extract request */
240 i = (islower(choice) ? A2I(choice) : -1);
242 /* Totally Illegal */
243 if ((i < 0) || (i >= num)) {
248 /* Save the spell index */
249 spell = monster_powers[caster_ptr->mane_spell[i]];
256 (void)strnfmt(tmp_val, 78, _("%sをまねますか?", "Use %s? "), monster_powers[caster_ptr->mane_spell[i]].name);
258 /* Belay that order */
259 if (!get_check(tmp_val))
269 caster_ptr->window |= (PW_SPELL);
270 handle_stuff(caster_ptr);
272 /* Abort if needed */
276 /* Save the choice */
279 damage = (baigaesi ? caster_ptr->mane_dam[i] * 2 : caster_ptr->mane_dam[i]);
287 * do_cmd_cast calls this function if the player's class is 'imitator'.
288 * @param caster_ptr プレーヤーへの参照ポインタ
289 * @param spell 発動するモンスター攻撃のID
290 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
292 static bool use_mane(player_type *caster_ptr, int spell)
295 PLAYER_LEVEL plev = caster_ptr->lev;
296 BIT_FLAGS mode = (PM_ALLOW_GROUP | PM_FORCE_PET);
297 BIT_FLAGS u_mode = 0L;
299 if (randint1(50 + plev) < plev / 10)
300 u_mode = PM_ALLOW_UNIQUE;
306 msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
307 aggravate_monsters(caster_ptr, 0);
316 if (!target_set(caster_ptr, TARGET_KILL))
318 m_idx = caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
321 if (!player_has_los_bold(caster_ptr, target_row, target_col))
323 if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col))
325 dispel_monster_status(caster_ptr, m_idx);
330 if (!get_aim_dir(caster_ptr, &dir))
333 msg_print(_("ロケットを発射した。", "You fire a rocket."));
334 fire_rocket(caster_ptr, GF_ROCKET, dir, damage, 2);
338 if (!get_aim_dir(caster_ptr, &dir))
341 msg_print(_("矢を放った。", "You fire an arrow."));
342 fire_bolt(caster_ptr, GF_ARROW, dir, damage);
355 if (!get_aim_dir(caster_ptr, &dir))
358 msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
359 fire_breath(caster_ptr, GF_ACID, dir, damage, (plev > 35 ? 3 : 2));
363 if (!get_aim_dir(caster_ptr, &dir))
366 msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
367 fire_breath(caster_ptr, GF_ELEC, dir, damage, (plev > 35 ? 3 : 2));
371 if (!get_aim_dir(caster_ptr, &dir))
374 msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
375 fire_breath(caster_ptr, GF_FIRE, dir, damage, (plev > 35 ? 3 : 2));
379 if (!get_aim_dir(caster_ptr, &dir))
382 msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
383 fire_breath(caster_ptr, GF_COLD, dir, damage, (plev > 35 ? 3 : 2));
387 if (!get_aim_dir(caster_ptr, &dir))
390 msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
391 fire_breath(caster_ptr, GF_POIS, dir, damage, (plev > 35 ? 3 : 2));
395 if (!get_aim_dir(caster_ptr, &dir))
398 msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
399 fire_breath(caster_ptr, GF_NETHER, dir, damage, (plev > 35 ? 3 : 2));
403 if (!get_aim_dir(caster_ptr, &dir))
406 msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
407 fire_breath(caster_ptr, GF_LITE, dir, damage, (plev > 35 ? 3 : 2));
411 if (!get_aim_dir(caster_ptr, &dir))
414 msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
415 fire_breath(caster_ptr, GF_DARK, dir, damage, (plev > 35 ? 3 : 2));
419 if (!get_aim_dir(caster_ptr, &dir))
422 msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
423 fire_breath(caster_ptr, GF_CONFUSION, dir, damage, (plev > 35 ? 3 : 2));
427 if (!get_aim_dir(caster_ptr, &dir))
430 msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
431 fire_breath(caster_ptr, GF_SOUND, dir, damage, (plev > 35 ? 3 : 2));
435 if (!get_aim_dir(caster_ptr, &dir))
438 msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
439 fire_breath(caster_ptr, GF_CHAOS, dir, damage, (plev > 35 ? 3 : 2));
443 if (!get_aim_dir(caster_ptr, &dir))
446 msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
447 fire_breath(caster_ptr, GF_DISENCHANT, dir, damage, (plev > 35 ? 3 : 2));
451 if (!get_aim_dir(caster_ptr, &dir))
454 msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
455 fire_breath(caster_ptr, GF_NEXUS, dir, damage, (plev > 35 ? 3 : 2));
459 if (!get_aim_dir(caster_ptr, &dir))
462 msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
463 fire_breath(caster_ptr, GF_TIME, dir, damage, (plev > 35 ? 3 : 2));
467 if (!get_aim_dir(caster_ptr, &dir))
470 msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
471 fire_breath(caster_ptr, GF_INERTIAL, dir, damage, (plev > 35 ? 3 : 2));
475 if (!get_aim_dir(caster_ptr, &dir))
478 msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
479 fire_breath(caster_ptr, GF_GRAVITY, dir, damage, (plev > 35 ? 3 : 2));
483 if (!get_aim_dir(caster_ptr, &dir))
486 msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
487 fire_breath(caster_ptr, GF_SHARDS, dir, damage, (plev > 35 ? 3 : 2));
491 if (!get_aim_dir(caster_ptr, &dir))
494 msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
496 fire_breath(caster_ptr, GF_PLASMA, dir, damage, (plev > 35 ? 3 : 2));
500 if (!get_aim_dir(caster_ptr, &dir))
503 msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
505 fire_breath(caster_ptr, GF_FORCE, dir, damage, (plev > 35 ? 3 : 2));
509 if (!get_aim_dir(caster_ptr, &dir))
512 msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
514 fire_breath(caster_ptr, GF_MANA, dir, damage, (plev > 35 ? 3 : 2));
518 if (!get_aim_dir(caster_ptr, &dir))
521 msg_print(_("放射能球を放った。", "You cast a ball of radiation."));
523 fire_ball(caster_ptr, GF_NUKE, dir, damage, 2);
527 if (!get_aim_dir(caster_ptr, &dir))
530 msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
532 fire_breath(caster_ptr, GF_NUKE, dir, damage, (plev > 35 ? 3 : 2));
536 if (!get_aim_dir(caster_ptr, &dir))
539 msg_print(_("純ログルスを放った。", "You invoke a raw Logrus."));
541 fire_ball(caster_ptr, GF_CHAOS, dir, damage, 4);
544 if (!get_aim_dir(caster_ptr, &dir))
547 msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
549 fire_breath(caster_ptr, GF_DISINTEGRATE, dir, damage, (plev > 35 ? 3 : 2));
552 if (!get_aim_dir(caster_ptr, &dir))
555 msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball."));
557 fire_ball(caster_ptr, GF_ACID, dir, damage, 2);
560 if (!get_aim_dir(caster_ptr, &dir))
563 msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball."));
565 fire_ball(caster_ptr, GF_ELEC, dir, damage, 2);
568 if (!get_aim_dir(caster_ptr, &dir))
571 msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball."));
573 fire_ball(caster_ptr, GF_FIRE, dir, damage, 2);
576 if (!get_aim_dir(caster_ptr, &dir))
579 msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball."));
581 fire_ball(caster_ptr, GF_COLD, dir, damage, 2);
584 if (!get_aim_dir(caster_ptr, &dir))
587 msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud."));
589 fire_ball(caster_ptr, GF_POIS, dir, damage, 2);
592 if (!get_aim_dir(caster_ptr, &dir))
595 msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball."));
597 fire_ball(caster_ptr, GF_NETHER, dir, damage, 2);
600 if (!get_aim_dir(caster_ptr, &dir))
603 msg_print(_("流れるような身振りをした。", "You gesture fluidly."));
605 fire_ball(caster_ptr, GF_WATER, dir, damage, 4);
608 if (!get_aim_dir(caster_ptr, &dir))
611 msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm."));
613 fire_ball(caster_ptr, GF_MANA, dir, damage, 4);
616 if (!get_aim_dir(caster_ptr, &dir))
619 msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm."));
621 fire_ball(caster_ptr, GF_DARK, dir, damage, 4);
624 if (!get_aim_dir(caster_ptr, &dir))
626 fire_ball_hide(caster_ptr, GF_DRAIN_MANA, dir, randint1(plev * 3) + plev, 0);
629 if (!get_aim_dir(caster_ptr, &dir))
631 fire_ball_hide(caster_ptr, GF_MIND_BLAST, dir, damage, 0);
634 if (!get_aim_dir(caster_ptr, &dir))
636 fire_ball_hide(caster_ptr, GF_BRAIN_SMASH, dir, damage, 0);
639 if (!get_aim_dir(caster_ptr, &dir))
641 fire_ball_hide(caster_ptr, GF_CAUSE_1, dir, damage, 0);
644 if (!get_aim_dir(caster_ptr, &dir))
646 fire_ball_hide(caster_ptr, GF_CAUSE_2, dir, damage, 0);
649 if (!get_aim_dir(caster_ptr, &dir))
651 fire_ball_hide(caster_ptr, GF_CAUSE_3, dir, damage, 0);
654 if (!get_aim_dir(caster_ptr, &dir))
656 fire_ball_hide(caster_ptr, GF_CAUSE_4, dir, damage, 0);
659 if (!get_aim_dir(caster_ptr, &dir))
662 msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt."));
664 fire_bolt(caster_ptr, GF_ACID, dir, damage);
667 if (!get_aim_dir(caster_ptr, &dir))
670 msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt."));
672 fire_bolt(caster_ptr, GF_ELEC, dir, damage);
675 if (!get_aim_dir(caster_ptr, &dir))
678 msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt."));
680 fire_bolt(caster_ptr, GF_FIRE, dir, damage);
683 if (!get_aim_dir(caster_ptr, &dir))
686 msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt."));
688 fire_bolt(caster_ptr, GF_COLD, dir, damage);
691 if (!get_aim_dir(caster_ptr, &dir))
694 msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst."));
696 fire_ball(caster_ptr, GF_LITE, dir, damage, 4);
699 if (!get_aim_dir(caster_ptr, &dir))
702 msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt."));
704 fire_bolt(caster_ptr, GF_NETHER, dir, damage);
707 if (!get_aim_dir(caster_ptr, &dir))
710 msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt."));
712 fire_bolt(caster_ptr, GF_WATER, dir, damage);
715 if (!get_aim_dir(caster_ptr, &dir))
718 msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt."));
720 fire_bolt(caster_ptr, GF_MANA, dir, damage);
723 if (!get_aim_dir(caster_ptr, &dir))
726 msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt."));
728 fire_bolt(caster_ptr, GF_PLASMA, dir, damage);
731 if (!get_aim_dir(caster_ptr, &dir))
734 msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt."));
736 fire_bolt(caster_ptr, GF_ICE, dir, damage);
738 case MS_MAGIC_MISSILE:
739 if (!get_aim_dir(caster_ptr, &dir))
742 msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile."));
744 fire_bolt(caster_ptr, GF_MISSILE, dir, damage);
747 if (!get_aim_dir(caster_ptr, &dir))
750 msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion."));
752 fear_monster(caster_ptr, dir, plev + 10);
755 if (!get_aim_dir(caster_ptr, &dir))
757 confuse_monster(caster_ptr, dir, plev * 2);
760 if (!get_aim_dir(caster_ptr, &dir))
763 msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion."));
765 confuse_monster(caster_ptr, dir, plev * 2);
768 if (!get_aim_dir(caster_ptr, &dir))
770 slow_monster(caster_ptr, dir, plev);
773 if (!get_aim_dir(caster_ptr, &dir))
775 sleep_monster(caster_ptr, dir, plev);
778 (void)set_fast(caster_ptr, randint1(20 + plev) + plev, FALSE);
781 if (!get_aim_dir(caster_ptr, &dir))
784 msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
786 fire_ball_hide(caster_ptr, GF_HAND_DOOM, dir, 200, 0);
790 msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
791 (void)hp_player(caster_ptr, plev * 6);
792 (void)set_stun(caster_ptr, 0);
793 (void)set_cut(caster_ptr, 0);
796 msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
797 (void)set_invuln(caster_ptr, randint1(7) + 7, FALSE);
800 teleport_player(caster_ptr, 10, TELEPORT_SPONTANEOUS);
803 teleport_player(caster_ptr, plev * 5, TELEPORT_SPONTANEOUS);
806 (void)time_walk(caster_ptr);
813 GAME_TEXT m_name[MAX_NLEN];
815 if (!target_set(caster_ptr, TARGET_KILL))
817 if (!caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx)
819 if (!player_has_los_bold(caster_ptr, target_row, target_col))
821 if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col))
823 m_ptr = &caster_ptr->current_floor_ptr->m_list[caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx];
824 r_ptr = &r_info[m_ptr->r_idx];
825 monster_desc(caster_ptr, m_name, m_ptr, 0);
826 if (r_ptr->flagsr & RFR_RES_TELE) {
827 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL)) {
828 if (is_original_ap_and_seen(caster_ptr, m_ptr))
829 r_ptr->r_flagsr |= RFR_RES_TELE;
830 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
833 } else if (r_ptr->level > randint1(100)) {
834 if (is_original_ap_and_seen(caster_ptr, m_ptr))
835 r_ptr->r_flagsr |= RFR_RES_TELE;
836 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
841 msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
844 caster_ptr, caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx, caster_ptr->y, caster_ptr->x, 100, TELEPORT_PASSIVE);
848 if (!get_aim_dir(caster_ptr, &dir))
851 (void)fire_beam(caster_ptr, GF_AWAY_ALL, dir, plev);
855 return teleport_level_other(caster_ptr);
859 if (!get_aim_dir(caster_ptr, &dir))
862 msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
863 (void)fire_beam(caster_ptr, GF_PSY_SPEAR, dir, damage);
867 msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
868 (void)unlite_area(caster_ptr, 10, 3);
872 if (!target_set(caster_ptr, TARGET_KILL))
874 msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackle evilly."));
875 trap_creation(caster_ptr, target_row, target_col);
878 msg_print(_("しかし何も起きなかった。", "Nothing happen."));
881 msg_print(_("死者復活の呪文を唱えた。", "You animate the dead."));
882 (void)animate_dead(caster_ptr, 0, caster_ptr->y, caster_ptr->x);
886 if (!target_set(caster_ptr, TARGET_KILL))
889 msg_print(_("援軍を召喚した。", "You summon minions."));
890 for (k = 0; k < 4; k++) {
891 (void)summon_kin_player(caster_ptr, plev, target_row, target_col, (PM_FORCE_PET | PM_ALLOW_GROUP));
897 int max_cyber = (caster_ptr->current_floor_ptr->dun_level / 50) + randint1(3);
898 if (!target_set(caster_ptr, TARGET_KILL))
900 msg_print(_("サイバーデーモンを召喚した!", "You summon Cyberdemons!"));
903 for (k = 0; k < max_cyber; k++)
904 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_CYBER, mode);
909 if (!target_set(caster_ptr, TARGET_KILL))
911 msg_print(_("仲間を召喚した。", "You summon help."));
912 for (k = 0; k < 1; k++)
913 summon_specific(caster_ptr, -1, target_row, target_col, plev, 0, (mode | u_mode));
916 case MS_S_MONSTERS: {
918 if (!target_set(caster_ptr, TARGET_KILL))
920 msg_print(_("モンスターを召喚した!", "You summon monsters!"));
921 for (k = 0; k < 6; k++)
922 summon_specific(caster_ptr, -1, target_row, target_col, plev, 0, (mode | u_mode));
927 if (!target_set(caster_ptr, TARGET_KILL))
929 msg_print(_("アリを召喚した。", "You summon ants."));
930 for (k = 0; k < 6; k++)
931 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_ANT, mode);
936 if (!target_set(caster_ptr, TARGET_KILL))
938 msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
939 for (k = 0; k < 6; k++)
940 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_SPIDER, mode);
945 if (!target_set(caster_ptr, TARGET_KILL))
947 msg_print(_("ハウンドを召喚した。", "You summon hounds."));
948 for (k = 0; k < 4; k++)
949 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HOUND, mode);
954 if (!target_set(caster_ptr, TARGET_KILL))
956 msg_print(_("ヒドラを召喚した。", "You summon hydras."));
957 for (k = 0; k < 4; k++)
958 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HYDRA, mode);
963 if (!target_set(caster_ptr, TARGET_KILL))
965 msg_print(_("天使を召喚した!", "You summon an angel!"));
966 for (k = 0; k < 1; k++)
967 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_ANGEL, mode);
972 if (!target_set(caster_ptr, TARGET_KILL))
974 msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
975 for (k = 0; k < 1; k++)
976 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_DEMON, (mode | u_mode));
981 if (!target_set(caster_ptr, TARGET_KILL))
983 msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
984 for (k = 0; k < 1; k++)
985 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_UNDEAD, (mode | u_mode));
990 if (!target_set(caster_ptr, TARGET_KILL))
992 msg_print(_("ドラゴンを召喚した!", "You summon a dragon!"));
993 for (k = 0; k < 1; k++)
994 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_DRAGON, (mode | u_mode));
997 case MS_S_HI_UNDEAD: {
999 if (!target_set(caster_ptr, TARGET_KILL))
1001 msg_print(_("強力なアンデッドを召喚した!", "You summon greater undead!"));
1002 for (k = 0; k < 6; k++)
1003 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
1006 case MS_S_HI_DRAGON: {
1008 if (!target_set(caster_ptr, TARGET_KILL))
1010 msg_print(_("古代ドラゴンを召喚した!", "You summon ancient dragons!"));
1011 for (k = 0; k < 4; k++)
1012 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_DRAGON, (mode | u_mode));
1015 case MS_S_AMBERITE: {
1017 if (!target_set(caster_ptr, TARGET_KILL))
1019 msg_print(_("アンバーの王族を召喚した!", "You summon Lords of Amber!"));
1020 for (k = 0; k < 4; k++)
1021 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
1026 if (!target_set(caster_ptr, TARGET_KILL))
1028 msg_print(_("特別な強敵を召喚した!", "You summon special opponents!"));
1029 for (k = 0; k < 4; k++)
1030 if (summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE)))
1032 for (k = count; k < 4; k++)
1033 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
1044 * @brief ものまねコマンドのメインルーチン /
1045 * do_cmd_cast calls this function if the player's class is 'imitator'.
1046 * @param baigaesi TRUEならば倍返し上の処理として行う
1047 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
1049 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
1050 * If the user hits escape, returns FALSE, and set '*sn' to -1
1051 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
1053 * The "prompt" should be "cast", "recite", or "study"
1054 * The "known" should be TRUE for cast/pray, FALSE for study
1056 * nb: This function has a (trivial) display bug which will be obvious
1057 * when you run it. It's probably easy to fix but I haven't tried,
1060 bool do_cmd_mane(player_type *creature_ptr, bool baigaesi)
1064 PERCENTAGE minfail = 0;
1065 PLAYER_LEVEL plev = creature_ptr->lev;
1066 monster_power spell;
1069 if (cmd_limit_confused(creature_ptr))
1072 if (!creature_ptr->mane_num) {
1073 msg_print(_("まねられるものが何もない!", "You don't remember any action!"));
1077 if (!get_mane_power(creature_ptr, &n, baigaesi))
1080 spell = monster_powers[creature_ptr->mane_spell[n]];
1082 /* Spell failure chance */
1083 chance = spell.manefail;
1085 /* Reduce failure rate by "effective" level adjustment */
1086 if (plev > spell.level)
1087 chance -= 3 * (plev - spell.level);
1089 /* Reduce failure rate by 1 stat and DEX adjustment */
1090 chance -= 3 * (adj_mag_stat[creature_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[creature_ptr->stat_ind[A_DEX]] - 2) / 2;
1093 chance = chance * damage / spell.manedam;
1095 chance += creature_ptr->to_m_chance;
1097 /* Extract the minimum failure rate */
1098 minfail = adj_mag_fail[creature_ptr->stat_ind[spell.use_stat]];
1100 /* Minimum failure rate */
1101 if (chance < minfail)
1104 /* Stunning makes spells harder */
1105 if (creature_ptr->stun > 50)
1107 else if (creature_ptr->stun)
1110 /* Always a 5 percent chance of working */
1115 if (randint0(100) < chance) {
1118 msg_print(_("ものまねに失敗した!", "You failed to concentrate hard enough!"));
1122 cast = use_mane(creature_ptr, creature_ptr->mane_spell[n]);
1127 creature_ptr->mane_num--;
1128 for (j = n; j < creature_ptr->mane_num; j++) {
1129 creature_ptr->mane_spell[j] = creature_ptr->mane_spell[j + 1];
1130 creature_ptr->mane_dam[j] = creature_ptr->mane_dam[j + 1];
1133 take_turn(creature_ptr, 100);
1135 creature_ptr->redraw |= (PR_IMITATION);
1136 creature_ptr->window |= (PW_PLAYER);
1137 creature_ptr->window |= (PW_SPELL);