3 * @brief ものまねの処理実装 / Imitation code
6 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
7 * This software may be copied and distributed for educational, research,\n
8 * and not for profit purposes provided that this copyright and statement\n
9 * are included in all such copies. Other copyrights may also apply.\n
10 * 2014 Deskull rearranged comment for Doxygen.\n
14 #include "spells-summon.h"
15 #include "spells-status.h"
16 #include "cmd-spell.h"
21 * @brief 受け取ったパラメータに応じてものまねの効果情報をまとめたフォーマットを返す
22 * @param p 情報を返す文字列参照ポインタ
23 * @param power ものまねの効力の種類
27 static void mane_info(char *p, int power, HIT_POINT dam)
29 PLAYER_LEVEL plev = p_ptr->lev;
33 if ((power > 2 && power < 41) || (power > 41 && power < 59) || (power == 75))
34 sprintf(p, " %s%d", KWD_DAM, (int)dam);
40 sprintf(p, " %sd%d+%d", KWD_HEAL, plev * 3, plev);
43 sprintf(p, " %sd%d+%d", KWD_DURATION, 20+plev, plev);
46 sprintf(p, " %s%d", KWD_HEAL, plev*6);
49 sprintf(p, " %sd7+7", KWD_DURATION);
52 sprintf(p, " %s10", KWD_SPHERE);
55 sprintf(p, " %s%d", KWD_SPHERE, plev * 5);
58 sprintf(p, " %s5", KWD_SPHERE);
68 * @brief どのものまねを発動するか選択する処理 /
69 * Allow user to choose a imitation.
70 * @param sn 実行したものまねのIDを返す参照ポインタ(キャンセルなどの場合-1を返す)
71 * @param baigaesi TRUEならば倍返し上の処理として行う
72 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
74 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
75 * If the user hits escape, returns FALSE, and set '*sn' to -1
76 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
78 * The "prompt" should be "cast", "recite", or "study"
79 * The "known" should be TRUE for cast/pray, FALSE for study
81 * nb: This function has a (trivial) display bug which will be obvious
82 * when you run it. It's probably easy to fix but I haven't tried,
85 static int get_mane_power(int *sn, bool baigaesi)
92 PLAYER_LEVEL plev = p_ptr->lev;
98 concptr p = _("能力", "power");
103 /* Assume cancelled */
106 /* Nothing chosen yet */
112 num = p_ptr->mane_num;
114 /* Build a prompt (accept all spells) */
115 (void)strnfmt(out_val, 78,
116 _("(%c-%c, '*'で一覧, ESC) どの%sをまねますか?", "(%c-%c, *=List, ESC=exit) Use which %s? "),
117 I2A(0), I2A(num - 1), p);
119 /* Get a spell from the user */
121 choice= always_show_list ? ESCAPE:1 ;
124 if(choice==ESCAPE) choice = ' ';
125 else if( !get_com(out_val, &choice, TRUE) )break;
128 if ((choice == ' ') || (choice == '*') || (choice == '?'))
139 /* Display a list of spells */
141 put_str(_("名前", "Name"), y, x + 5);
142 put_str(_("失率 効果", "Fail Info"), y, x + 36);
145 /* Dump the spells */
146 for (i = 0; i < num; i++)
148 /* Access the spell */
149 spell = monster_powers[p_ptr->mane_spell[i]];
151 chance = spell.manefail;
153 /* Reduce failure rate by "effective" level adjustment */
154 if (plev > spell.level) chance -= 3 * (plev - spell.level);
156 /* Reduce failure rate by INT/WIS adjustment */
157 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[p_ptr->stat_ind[A_DEX]] - 2) / 2;
159 if (spell.manedam) chance = chance * (baigaesi ? p_ptr->mane_dam[i] * 2 : p_ptr->mane_dam[i]) / spell.manedam;
161 chance += p_ptr->to_m_chance;
163 /* Extract the minimum failure rate */
164 minfail = adj_mag_fail[p_ptr->stat_ind[spell.use_stat]];
166 /* Minimum failure rate */
167 if (chance < minfail) chance = minfail;
169 /* Stunning makes spells harder */
170 if (p_ptr->stun > 50) chance += 25;
171 else if (p_ptr->stun) chance += 15;
173 /* Always a 5 percent chance of working */
174 if (chance > 95) chance = 95;
177 mane_info(comment, p_ptr->mane_spell[i], (baigaesi ? p_ptr->mane_dam[i]*2 : p_ptr->mane_dam[i]));
179 /* Dump the spell --(-- */
180 sprintf(psi_desc, " %c) %-30s %3d%%%s",
183 prt(psi_desc, y + i + 1, x);
186 /* Clear the bottom line */
187 prt("", y + i + 1, x);
203 ask = isupper(choice);
206 if (ask) choice = (char)tolower(choice);
208 /* Extract request */
209 i = (islower(choice) ? A2I(choice) : -1);
211 /* Totally Illegal */
212 if ((i < 0) || (i >= num))
218 /* Save the spell index */
219 spell = monster_powers[p_ptr->mane_spell[i]];
227 (void) strnfmt(tmp_val, 78, _("%sをまねますか?", "Use %s? "), monster_powers[p_ptr->mane_spell[i]].name);
229 /* Belay that order */
230 if (!get_check(tmp_val)) continue;
236 if (redraw) screen_load();
238 p_ptr->window |= (PW_SPELL);
241 /* Abort if needed */
242 if (!flag) return (FALSE);
244 /* Save the choice */
247 damage = (baigaesi ? p_ptr->mane_dam[i]*2 : p_ptr->mane_dam[i]);
256 * do_cmd_cast calls this function if the player's class is 'imitator'.
257 * @param spell 発動するモンスター攻撃のID
258 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
260 static bool use_mane(int spell)
263 PLAYER_LEVEL plev = p_ptr->lev;
264 BIT_FLAGS mode = (PM_ALLOW_GROUP | PM_FORCE_PET);
265 BIT_FLAGS u_mode = 0L;
267 if (randint1(50+plev) < plev/10) u_mode = PM_ALLOW_UNIQUE;
275 msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
276 aggravate_monsters(0);
286 if (!target_set(TARGET_KILL)) return FALSE;
287 m_idx = cave[target_row][target_col].m_idx;
289 if (!player_has_los_bold(target_row, target_col)) break;
290 if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
291 dispel_monster_status(m_idx);
296 if (!get_aim_dir(&dir)) return FALSE;
297 else msg_print(_("ロケットを発射した。", "You fire a rocket."));
298 fire_rocket(GF_ROCKET, dir, damage, 2);
302 if (!get_aim_dir(&dir)) return FALSE;
303 else msg_print(_("矢を放った。", "You fire an arrow."));
304 fire_bolt(GF_ARROW, dir, damage);
317 if (!get_aim_dir(&dir)) return FALSE;
318 else msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
319 fire_breath(GF_ACID, dir, damage, (plev > 35 ? 3 : 2));
323 if (!get_aim_dir(&dir)) return FALSE;
324 else msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
325 fire_breath(GF_ELEC, dir, damage, (plev > 35 ? 3 : 2));
329 if (!get_aim_dir(&dir)) return FALSE;
330 else msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
331 fire_breath(GF_FIRE, dir, damage, (plev > 35 ? 3 : 2));
335 if (!get_aim_dir(&dir)) return FALSE;
336 else msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
337 fire_breath(GF_COLD, dir, damage, (plev > 35 ? 3 : 2));
341 if (!get_aim_dir(&dir)) return FALSE;
342 else msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
343 fire_breath(GF_POIS, dir, damage, (plev > 35 ? 3 : 2));
347 if (!get_aim_dir(&dir)) return FALSE;
348 else msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
349 fire_breath(GF_NETHER, dir, damage, (plev > 35 ? 3 : 2));
353 if (!get_aim_dir(&dir)) return FALSE;
354 else msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
355 fire_breath(GF_LITE, dir, damage, (plev > 35 ? 3 : 2));
359 if (!get_aim_dir(&dir)) return FALSE;
360 else msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
361 fire_breath(GF_DARK, dir, damage, (plev > 35 ? 3 : 2));
365 if (!get_aim_dir(&dir)) return FALSE;
366 else msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
367 fire_breath(GF_CONFUSION, dir, damage, (plev > 35 ? 3 : 2));
371 if (!get_aim_dir(&dir)) return FALSE;
372 else msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
373 fire_breath(GF_SOUND, dir, damage, (plev > 35 ? 3 : 2));
377 if (!get_aim_dir(&dir)) return FALSE;
378 else msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
379 fire_breath(GF_CHAOS, dir, damage, (plev > 35 ? 3 : 2));
383 if (!get_aim_dir(&dir)) return FALSE;
384 else msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
385 fire_breath(GF_DISENCHANT, dir, damage, (plev > 35 ? 3 : 2));
389 if (!get_aim_dir(&dir)) return FALSE;
390 else msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
391 fire_breath(GF_NEXUS, dir, damage, (plev > 35 ? 3 : 2));
395 if (!get_aim_dir(&dir)) return FALSE;
396 else msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
397 fire_breath(GF_TIME, dir, damage, (plev > 35 ? 3 : 2));
401 if (!get_aim_dir(&dir)) return FALSE;
402 else msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
403 fire_breath(GF_INERTIAL, dir, damage, (plev > 35 ? 3 : 2));
407 if (!get_aim_dir(&dir)) return FALSE;
408 else msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
409 fire_breath(GF_GRAVITY, dir, damage, (plev > 35 ? 3 : 2));
413 if (!get_aim_dir(&dir)) return FALSE;
414 else msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
415 fire_breath(GF_SHARDS, dir, damage, (plev > 35 ? 3 : 2));
419 if (!get_aim_dir(&dir)) return FALSE;
420 else msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
422 fire_breath(GF_PLASMA, dir, damage, (plev > 35 ? 3 : 2));
426 if (!get_aim_dir(&dir)) return FALSE;
427 else msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
429 fire_breath(GF_FORCE, dir, damage, (plev > 35 ? 3 : 2));
433 if (!get_aim_dir(&dir)) return FALSE;
434 else msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
436 fire_breath(GF_MANA, dir, damage, (plev > 35 ? 3 : 2));
440 if (!get_aim_dir(&dir)) return FALSE;
441 else msg_print(_("放射能球を放った。", "You cast a ball of radiation."));
443 fire_ball(GF_NUKE, dir, damage, 2);
447 if (!get_aim_dir(&dir)) return FALSE;
448 else msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
450 fire_breath(GF_NUKE, dir, damage, (plev > 35 ? 3 : 2));
454 if (!get_aim_dir(&dir)) return FALSE;
455 else msg_print(_("純ログルスを放った。", "You invoke a raw Logrus."));
457 fire_ball(GF_CHAOS, dir, damage, 4);
460 if (!get_aim_dir(&dir)) return FALSE;
461 else msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
463 fire_breath(GF_DISINTEGRATE, dir, damage, (plev > 35 ? 3 : 2));
466 if (!get_aim_dir(&dir)) return FALSE;
467 else msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball."));
469 fire_ball(GF_ACID, dir, damage, 2);
472 if (!get_aim_dir(&dir)) return FALSE;
473 else msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball."));
475 fire_ball(GF_ELEC, dir, damage, 2);
478 if (!get_aim_dir(&dir)) return FALSE;
479 else msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball."));
481 fire_ball(GF_FIRE, dir, damage, 2);
484 if (!get_aim_dir(&dir)) return FALSE;
485 else msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball."));
487 fire_ball(GF_COLD, dir, damage, 2);
490 if (!get_aim_dir(&dir)) return FALSE;
491 else msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud."));
493 fire_ball(GF_POIS, dir, damage, 2);
496 if (!get_aim_dir(&dir)) return FALSE;
497 else msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball."));
499 fire_ball(GF_NETHER, dir, damage, 2);
502 if (!get_aim_dir(&dir)) return FALSE;
503 else msg_print(_("流れるような身振りをした。", "You gesture fluidly."));
505 fire_ball(GF_WATER, dir, damage, 4);
508 if (!get_aim_dir(&dir)) return FALSE;
509 else msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm."));
511 fire_ball(GF_MANA, dir, damage, 4);
514 if (!get_aim_dir(&dir)) return FALSE;
515 else msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm."));
517 fire_ball(GF_DARK, dir, damage, 4);
520 if (!get_aim_dir(&dir)) return FALSE;
521 fire_ball_hide(GF_DRAIN_MANA, dir, randint1(plev*3)+plev, 0);
524 if (!get_aim_dir(&dir)) return FALSE;
525 fire_ball_hide(GF_MIND_BLAST, dir, damage, 0);
528 if (!get_aim_dir(&dir)) return FALSE;
529 fire_ball_hide(GF_BRAIN_SMASH, dir, damage, 0);
532 if (!get_aim_dir(&dir)) return FALSE;
533 fire_ball_hide(GF_CAUSE_1, dir, damage, 0);
536 if (!get_aim_dir(&dir)) return FALSE;
537 fire_ball_hide(GF_CAUSE_2, dir, damage, 0);
540 if (!get_aim_dir(&dir)) return FALSE;
541 fire_ball_hide(GF_CAUSE_3, dir, damage, 0);
544 if (!get_aim_dir(&dir)) return FALSE;
545 fire_ball_hide(GF_CAUSE_4, dir, damage, 0);
548 if (!get_aim_dir(&dir)) return FALSE;
549 else msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt."));
551 fire_bolt(GF_ACID, dir, damage);
554 if (!get_aim_dir(&dir)) return FALSE;
555 else msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt."));
557 fire_bolt(GF_ELEC, dir, damage);
560 if (!get_aim_dir(&dir)) return FALSE;
561 else msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt."));
563 fire_bolt(GF_FIRE, dir, damage);
566 if (!get_aim_dir(&dir)) return FALSE;
567 else msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt."));
569 fire_bolt(GF_COLD, dir, damage);
572 if (!get_aim_dir(&dir)) return FALSE;
573 else msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst."));
575 fire_ball(GF_LITE, dir, damage, 4);
578 if (!get_aim_dir(&dir)) return FALSE;
579 else msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt."));
581 fire_bolt(GF_NETHER, dir, damage);
584 if (!get_aim_dir(&dir)) return FALSE;
585 else msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt."));
587 fire_bolt(GF_WATER, dir, damage);
590 if (!get_aim_dir(&dir)) return FALSE;
591 else msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt."));
593 fire_bolt(GF_MANA, dir, damage);
596 if (!get_aim_dir(&dir)) return FALSE;
597 else msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt."));
599 fire_bolt(GF_PLASMA, dir, damage);
602 if (!get_aim_dir(&dir)) return FALSE;
603 else msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt."));
605 fire_bolt(GF_ICE, dir, damage);
607 case MS_MAGIC_MISSILE:
608 if (!get_aim_dir(&dir)) return FALSE;
609 else msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile."));
611 fire_bolt(GF_MISSILE, dir, damage);
614 if (!get_aim_dir(&dir)) return FALSE;
615 else msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion."));
617 fear_monster(dir, plev+10);
620 if (!get_aim_dir(&dir)) return FALSE;
621 confuse_monster(dir, plev * 2);
624 if (!get_aim_dir(&dir)) return FALSE;
625 else msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion."));
627 confuse_monster(dir, plev * 2);
630 if (!get_aim_dir(&dir)) return FALSE;
631 slow_monster(dir, plev);
634 if (!get_aim_dir(&dir)) return FALSE;
635 sleep_monster(dir, plev);
638 (void)set_fast(randint1(20 + plev) + plev, FALSE);
642 if (!get_aim_dir(&dir)) return FALSE;
643 else msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
645 fire_ball_hide(GF_HAND_DOOM, dir, 200, 0);
649 msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
650 (void)hp_player(plev*6);
655 msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
656 (void)set_invuln(randint1(7) + 7, FALSE);
659 teleport_player(10, 0L);
662 teleport_player(plev * 5, 0L);
666 if (damage == 1 || damage == 2)
667 msg_print(_("「『ザ・ワールド』!時は止まった!」", "You yell 'The World! Time has stopped!'"));
668 else if (damage == 3 || damage == 6)
669 msg_print(_("「時よ!」", "You yell 'Time!'"));
675 p_ptr->energy_need -= 1000 + (100 + randint1(200) + 200) * TURNS_PER_TICK / 10;
676 p_ptr->redraw |= (PR_MAP);
677 p_ptr->update |= (PU_MONSTERS);
678 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
688 GAME_TEXT m_name[MAX_NLEN];
690 if (!target_set(TARGET_KILL)) return FALSE;
691 if (!cave[target_row][target_col].m_idx) break;
692 if (!player_has_los_bold(target_row, target_col)) break;
693 if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
694 m_ptr = &m_list[cave[target_row][target_col].m_idx];
695 r_ptr = &r_info[m_ptr->r_idx];
696 monster_desc(m_name, m_ptr, 0);
697 if (r_ptr->flagsr & RFR_RES_TELE)
699 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
701 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
702 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
706 else if (r_ptr->level > randint1(100))
708 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
709 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
714 msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
716 teleport_monster_to(cave[target_row][target_col].m_idx, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE);
720 if (!get_aim_dir(&dir)) return FALSE;
722 (void)fire_beam(GF_AWAY_ALL, dir, plev);
726 return teleport_level_other(p_ptr);
730 if (!get_aim_dir(&dir)) return FALSE;
731 else msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
732 (void)fire_beam(GF_PSY_SPEAR, dir, damage);
736 msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
737 (void)unlite_area(10, 3);
741 if (!target_set(TARGET_KILL)) return FALSE;
742 msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackles evilly."));
743 trap_creation(target_row, target_col);
746 msg_print(_("しかし何も起きなかった。", "Nothing happen."));
749 msg_print(_("死者復活の呪文を唱えた。", "You cast a animate dead."));
750 (void)animate_dead(0, p_ptr->y, p_ptr->x);
755 if (!target_set(TARGET_KILL)) return FALSE;
757 msg_print(_("援軍を召喚した。", "You summon minions."));
758 for (k = 0;k < 4; k++)
760 (void)summon_kin_player(plev, target_row, target_col, (PM_FORCE_PET | PM_ALLOW_GROUP));
767 int max_cyber = (dun_level / 50) + randint1(3);
768 if (!target_set(TARGET_KILL)) return FALSE;
769 msg_print(_("サイバーデーモンを召喚した!", "You summon Cyberdemons!"));
770 if (max_cyber > 4) max_cyber = 4;
771 for (k = 0;k < max_cyber; k++)
772 summon_specific(-1, target_row, target_col, plev, SUMMON_CYBER, mode, '\0');
778 if (!target_set(TARGET_KILL)) return FALSE;
779 msg_print(_("仲間を召喚した。", "You summon help."));
780 for (k = 0;k < 1; k++)
781 summon_specific(-1, target_row, target_col, plev, 0, (mode | u_mode), '\0');
787 if (!target_set(TARGET_KILL)) return FALSE;
788 msg_print(_("モンスターを召喚した!", "You summon monsters!"));
789 for (k = 0;k < A_MAX; k++)
790 summon_specific(-1, target_row, target_col, plev, 0, (mode | u_mode), '\0');
796 if (!target_set(TARGET_KILL)) return FALSE;
797 msg_print(_("アリを召喚した。", "You summon ants."));
798 for (k = 0;k < A_MAX; k++)
799 summon_specific(-1, target_row, target_col, plev, SUMMON_ANT, mode, '\0');
805 if (!target_set(TARGET_KILL)) return FALSE;
806 msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
807 for (k = 0;k < A_MAX; k++)
808 summon_specific(-1, target_row, target_col, plev, SUMMON_SPIDER, mode, '\0');
814 if (!target_set(TARGET_KILL)) return FALSE;
815 msg_print(_("ハウンドを召喚した。", "You summon hounds."));
816 for (k = 0;k < 4; k++)
817 summon_specific(-1, target_row, target_col, plev, SUMMON_HOUND, mode, '\0');
823 if (!target_set(TARGET_KILL)) return FALSE;
824 msg_print(_("ヒドラを召喚した。", "You summon hydras."));
825 for (k = 0;k < 4; k++)
826 summon_specific(-1, target_row, target_col, plev, SUMMON_HYDRA, mode, '\0');
832 if (!target_set(TARGET_KILL)) return FALSE;
833 msg_print(_("天使を召喚した!", "You summon angel!"));
834 for (k = 0;k < 1; k++)
835 summon_specific(-1, target_row, target_col, plev, SUMMON_ANGEL, mode, '\0');
841 if (!target_set(TARGET_KILL)) return FALSE;
842 msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
843 for (k = 0;k < 1; k++)
844 summon_specific(-1, target_row, target_col, plev, SUMMON_DEMON, (mode | u_mode), '\0');
850 if (!target_set(TARGET_KILL)) return FALSE;
851 msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
852 for (k = 0;k < 1; k++)
853 summon_specific(-1, target_row, target_col, plev, SUMMON_UNDEAD, (mode | u_mode), '\0');
859 if (!target_set(TARGET_KILL)) return FALSE;
860 msg_print(_("ドラゴンを召喚した!", "You summon dragon!"));
861 for (k = 0;k < 1; k++)
862 summon_specific(-1, target_row, target_col, plev, SUMMON_DRAGON, (mode | u_mode), '\0');
868 if (!target_set(TARGET_KILL)) return FALSE;
869 msg_print(_("強力なアンデッドを召喚した!", "You summon greater undead!"));
870 for (k = 0;k < A_MAX; k++)
871 summon_specific(-1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode), '\0');
877 if (!target_set(TARGET_KILL)) return FALSE;
878 msg_print(_("古代ドラゴンを召喚した!", "You summon ancient dragons!"));
879 for (k = 0;k < 4; k++)
880 summon_specific(-1, target_row, target_col, plev, SUMMON_HI_DRAGON, (mode | u_mode), '\0');
886 if (!target_set(TARGET_KILL)) return FALSE;
887 msg_print(_("アンバーの王族を召喚した!", "You summon Lords of Amber!"));
888 for (k = 0;k < 4; k++)
889 summon_specific(-1, target_row, target_col, plev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE), '\0');
895 if (!target_set(TARGET_KILL)) return FALSE;
896 msg_print(_("特別な強敵を召喚した!", "You summon special opponents!"));
897 for (k = 0;k < 4; k++)
898 if (summon_specific(-1, target_row, target_col, plev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE), '\0')) count++;
899 for (k = count;k < 4; k++)
900 summon_specific(-1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode), '\0');
912 * @brief ものまねコマンドのメインルーチン /
913 * do_cmd_cast calls this function if the player's class is 'imitator'.
914 * @param baigaesi TRUEならば倍返し上の処理として行う
915 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
917 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
918 * If the user hits escape, returns FALSE, and set '*sn' to -1
919 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
921 * The "prompt" should be "cast", "recite", or "study"
922 * The "known" should be TRUE for cast/pray, FALSE for study
924 * nb: This function has a (trivial) display bug which will be obvious
925 * when you run it. It's probably easy to fix but I haven't tried,
928 bool do_cmd_mane(bool baigaesi)
933 PLAYER_LEVEL plev = p_ptr->lev;
938 /* not if confused */
941 msg_print(_("混乱していて集中できない!", "You are too confused!"));
945 if (!p_ptr->mane_num)
947 msg_print(_("まねられるものが何もない!", "You don't remember any action!"));
952 if (!get_mane_power(&n, baigaesi)) return FALSE;
954 spell = monster_powers[p_ptr->mane_spell[n]];
956 /* Spell failure chance */
957 chance = spell.manefail;
959 /* Reduce failure rate by "effective" level adjustment */
960 if (plev > spell.level) chance -= 3 * (plev - spell.level);
962 /* Reduce failure rate by 1 stat and DEX adjustment */
963 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[p_ptr->stat_ind[A_DEX]] - 2) / 2;
965 if (spell.manedam) chance = chance * damage / spell.manedam;
967 chance += p_ptr->to_m_chance;
969 /* Extract the minimum failure rate */
970 minfail = adj_mag_fail[p_ptr->stat_ind[spell.use_stat]];
972 /* Minimum failure rate */
973 if (chance < minfail) chance = minfail;
975 /* Stunning makes spells harder */
976 if (p_ptr->stun > 50) chance += 25;
977 else if (p_ptr->stun) chance += 15;
979 /* Always a 5 percent chance of working */
980 if (chance > 95) chance = 95;
983 if (randint0(100) < chance)
985 if (flush_failure) flush();
986 msg_print(_("ものまねに失敗した!", "You failed to concentrate hard enough!"));
994 cast = use_mane(p_ptr->mane_spell[n]);
996 if (!cast) return FALSE;
1000 for (j = n; j < p_ptr->mane_num;j++)
1002 p_ptr->mane_spell[j] = p_ptr->mane_spell[j+1];
1003 p_ptr->mane_dam[j] = p_ptr->mane_dam[j+1];
1006 p_ptr->energy_use = 100;
1008 p_ptr->redraw |= (PR_IMITATION);
1009 p_ptr->window |= (PW_PLAYER);
1010 p_ptr->window |= (PW_SPELL);