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
19 #include "spells-summon.h"
20 #include "spells-status.h"
21 #include "monster-status.h"
22 #include "monster-spell.h"
23 #include "monster-process.h"
24 #include "cmd-spell.h"
25 #include "player-status.h"
26 #include "player-effects.h"
27 #include "cmd-basic.h"
28 #include "targeting.h"
33 * @brief 受け取ったパラメータに応じてものまねの効果情報をまとめたフォーマットを返す
34 * @param p 情報を返す文字列参照ポインタ
35 * @param power ものまねの効力の種類
39 static void mane_info(char *p, int power, HIT_POINT dam)
41 PLAYER_LEVEL plev = p_ptr->lev;
45 if ((power > 2 && power < 41) || (power > 41 && power < 59) || (power == 75))
46 sprintf(p, " %s%d", KWD_DAM, (int)dam);
52 sprintf(p, " %sd%d+%d", KWD_HEAL, plev * 3, plev);
55 sprintf(p, " %sd%d+%d", KWD_DURATION, 20+plev, plev);
58 sprintf(p, " %s%d", KWD_HEAL, plev*6);
61 sprintf(p, " %sd7+7", KWD_DURATION);
64 sprintf(p, " %s10", KWD_SPHERE);
67 sprintf(p, " %s%d", KWD_SPHERE, plev * 5);
70 sprintf(p, " %s5", KWD_SPHERE);
80 * @brief どのものまねを発動するか選択する処理 /
81 * Allow user to choose a imitation.
82 * @param sn 実行したものまねのIDを返す参照ポインタ(キャンセルなどの場合-1を返す)
83 * @param baigaesi TRUEならば倍返し上の処理として行う
84 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
86 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
87 * If the user hits escape, returns FALSE, and set '*sn' to -1
88 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
90 * The "prompt" should be "cast", "recite", or "study"
91 * The "known" should be TRUE for cast/pray, FALSE for study
93 * nb: This function has a (trivial) display bug which will be obvious
94 * when you run it. It's probably easy to fix but I haven't tried,
97 static int get_mane_power(int *sn, bool baigaesi)
103 PERCENTAGE minfail = 0;
104 PLAYER_LEVEL plev = p_ptr->lev;
105 PERCENTAGE chance = 0;
110 concptr p = _("能力", "power");
115 /* Assume cancelled */
118 /* Nothing chosen yet */
124 num = p_ptr->mane_num;
126 /* Build a prompt (accept all spells) */
127 (void)strnfmt(out_val, 78,
128 _("(%c-%c, '*'で一覧, ESC) どの%sをまねますか?", "(%c-%c, *=List, ESC=exit) Use which %s? "),
129 I2A(0), I2A(num - 1), p);
131 choice= always_show_list ? ESCAPE:1 ;
134 if(choice==ESCAPE) choice = ' ';
135 else if( !get_com(out_val, &choice, TRUE) )break;
138 if ((choice == ' ') || (choice == '*') || (choice == '?'))
147 /* Display a list of spells */
149 put_str(_("名前", "Name"), y, x + 5);
150 put_str(_("失率 効果", "Fail Info"), y, x + 36);
153 /* Dump the spells */
154 for (i = 0; i < num; i++)
156 /* Access the spell */
157 spell = monster_powers[p_ptr->mane_spell[i]];
159 chance = spell.manefail;
161 /* Reduce failure rate by "effective" level adjustment */
162 if (plev > spell.level) chance -= 3 * (plev - spell.level);
164 /* Reduce failure rate by INT/WIS adjustment */
165 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[p_ptr->stat_ind[A_DEX]] - 2) / 2;
167 if (spell.manedam) chance = chance * (baigaesi ? p_ptr->mane_dam[i] * 2 : p_ptr->mane_dam[i]) / spell.manedam;
169 chance += p_ptr->to_m_chance;
171 /* Extract the minimum failure rate */
172 minfail = adj_mag_fail[p_ptr->stat_ind[spell.use_stat]];
174 /* Minimum failure rate */
175 if (chance < minfail) chance = minfail;
177 /* Stunning makes spells harder */
178 if (p_ptr->stun > 50) chance += 25;
179 else if (p_ptr->stun) chance += 15;
181 /* Always a 5 percent chance of working */
182 if (chance > 95) chance = 95;
185 mane_info(comment, p_ptr->mane_spell[i], (baigaesi ? p_ptr->mane_dam[i]*2 : p_ptr->mane_dam[i]));
187 /* Dump the spell --(-- */
188 sprintf(psi_desc, " %c) %-30s %3d%%%s",
191 prt(psi_desc, y + i + 1, x);
194 /* Clear the bottom line */
195 prt("", y + i + 1, x);
211 ask = isupper(choice);
214 if (ask) choice = (char)tolower(choice);
216 /* Extract request */
217 i = (islower(choice) ? A2I(choice) : -1);
219 /* Totally Illegal */
220 if ((i < 0) || (i >= num))
226 /* Save the spell index */
227 spell = monster_powers[p_ptr->mane_spell[i]];
235 (void) strnfmt(tmp_val, 78, _("%sをまねますか?", "Use %s? "), monster_powers[p_ptr->mane_spell[i]].name);
237 /* Belay that order */
238 if (!get_check(tmp_val)) continue;
244 if (redraw) screen_load();
246 p_ptr->window |= (PW_SPELL);
249 /* Abort if needed */
250 if (!flag) return (FALSE);
252 /* Save the choice */
255 damage = (baigaesi ? p_ptr->mane_dam[i]*2 : p_ptr->mane_dam[i]);
264 * do_cmd_cast calls this function if the player's class is 'imitator'.
265 * @param spell 発動するモンスター攻撃のID
266 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
268 static bool use_mane(int spell)
271 PLAYER_LEVEL plev = p_ptr->lev;
272 BIT_FLAGS mode = (PM_ALLOW_GROUP | PM_FORCE_PET);
273 BIT_FLAGS u_mode = 0L;
275 if (randint1(50+plev) < plev/10) u_mode = PM_ALLOW_UNIQUE;
283 msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
284 aggravate_monsters(0);
294 if (!target_set(TARGET_KILL)) return FALSE;
295 m_idx = current_floor_ptr->grid_array[target_row][target_col].m_idx;
297 if (!player_has_los_bold(target_row, target_col)) break;
298 if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
299 dispel_monster_status(m_idx);
304 if (!get_aim_dir(&dir)) return FALSE;
305 else msg_print(_("ロケットを発射した。", "You fire a rocket."));
306 fire_rocket(GF_ROCKET, dir, damage, 2);
310 if (!get_aim_dir(&dir)) return FALSE;
311 else msg_print(_("矢を放った。", "You fire an arrow."));
312 fire_bolt(GF_ARROW, dir, damage);
325 if (!get_aim_dir(&dir)) return FALSE;
326 else msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
327 fire_breath(GF_ACID, dir, damage, (plev > 35 ? 3 : 2));
331 if (!get_aim_dir(&dir)) return FALSE;
332 else msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
333 fire_breath(GF_ELEC, dir, damage, (plev > 35 ? 3 : 2));
337 if (!get_aim_dir(&dir)) return FALSE;
338 else msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
339 fire_breath(GF_FIRE, dir, damage, (plev > 35 ? 3 : 2));
343 if (!get_aim_dir(&dir)) return FALSE;
344 else msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
345 fire_breath(GF_COLD, dir, damage, (plev > 35 ? 3 : 2));
349 if (!get_aim_dir(&dir)) return FALSE;
350 else msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
351 fire_breath(GF_POIS, dir, damage, (plev > 35 ? 3 : 2));
355 if (!get_aim_dir(&dir)) return FALSE;
356 else msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
357 fire_breath(GF_NETHER, dir, damage, (plev > 35 ? 3 : 2));
361 if (!get_aim_dir(&dir)) return FALSE;
362 else msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
363 fire_breath(GF_LITE, dir, damage, (plev > 35 ? 3 : 2));
367 if (!get_aim_dir(&dir)) return FALSE;
368 else msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
369 fire_breath(GF_DARK, dir, damage, (plev > 35 ? 3 : 2));
373 if (!get_aim_dir(&dir)) return FALSE;
374 else msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
375 fire_breath(GF_CONFUSION, dir, damage, (plev > 35 ? 3 : 2));
379 if (!get_aim_dir(&dir)) return FALSE;
380 else msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
381 fire_breath(GF_SOUND, dir, damage, (plev > 35 ? 3 : 2));
385 if (!get_aim_dir(&dir)) return FALSE;
386 else msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
387 fire_breath(GF_CHAOS, dir, damage, (plev > 35 ? 3 : 2));
391 if (!get_aim_dir(&dir)) return FALSE;
392 else msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
393 fire_breath(GF_DISENCHANT, dir, damage, (plev > 35 ? 3 : 2));
397 if (!get_aim_dir(&dir)) return FALSE;
398 else msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
399 fire_breath(GF_NEXUS, dir, damage, (plev > 35 ? 3 : 2));
403 if (!get_aim_dir(&dir)) return FALSE;
404 else msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
405 fire_breath(GF_TIME, dir, damage, (plev > 35 ? 3 : 2));
409 if (!get_aim_dir(&dir)) return FALSE;
410 else msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
411 fire_breath(GF_INERTIAL, dir, damage, (plev > 35 ? 3 : 2));
415 if (!get_aim_dir(&dir)) return FALSE;
416 else msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
417 fire_breath(GF_GRAVITY, dir, damage, (plev > 35 ? 3 : 2));
421 if (!get_aim_dir(&dir)) return FALSE;
422 else msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
423 fire_breath(GF_SHARDS, dir, damage, (plev > 35 ? 3 : 2));
427 if (!get_aim_dir(&dir)) return FALSE;
428 else msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
430 fire_breath(GF_PLASMA, dir, damage, (plev > 35 ? 3 : 2));
434 if (!get_aim_dir(&dir)) return FALSE;
435 else msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
437 fire_breath(GF_FORCE, dir, damage, (plev > 35 ? 3 : 2));
441 if (!get_aim_dir(&dir)) return FALSE;
442 else msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
444 fire_breath(GF_MANA, dir, damage, (plev > 35 ? 3 : 2));
448 if (!get_aim_dir(&dir)) return FALSE;
449 else msg_print(_("放射能球を放った。", "You cast a ball of radiation."));
451 fire_ball(GF_NUKE, dir, damage, 2);
455 if (!get_aim_dir(&dir)) return FALSE;
456 else msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
458 fire_breath(GF_NUKE, dir, damage, (plev > 35 ? 3 : 2));
462 if (!get_aim_dir(&dir)) return FALSE;
463 else msg_print(_("純ログルスを放った。", "You invoke a raw Logrus."));
465 fire_ball(GF_CHAOS, dir, damage, 4);
468 if (!get_aim_dir(&dir)) return FALSE;
469 else msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
471 fire_breath(GF_DISINTEGRATE, dir, damage, (plev > 35 ? 3 : 2));
474 if (!get_aim_dir(&dir)) return FALSE;
475 else msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball."));
477 fire_ball(GF_ACID, dir, damage, 2);
480 if (!get_aim_dir(&dir)) return FALSE;
481 else msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball."));
483 fire_ball(GF_ELEC, dir, damage, 2);
486 if (!get_aim_dir(&dir)) return FALSE;
487 else msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball."));
489 fire_ball(GF_FIRE, dir, damage, 2);
492 if (!get_aim_dir(&dir)) return FALSE;
493 else msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball."));
495 fire_ball(GF_COLD, dir, damage, 2);
498 if (!get_aim_dir(&dir)) return FALSE;
499 else msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud."));
501 fire_ball(GF_POIS, dir, damage, 2);
504 if (!get_aim_dir(&dir)) return FALSE;
505 else msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball."));
507 fire_ball(GF_NETHER, dir, damage, 2);
510 if (!get_aim_dir(&dir)) return FALSE;
511 else msg_print(_("流れるような身振りをした。", "You gesture fluidly."));
513 fire_ball(GF_WATER, dir, damage, 4);
516 if (!get_aim_dir(&dir)) return FALSE;
517 else msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm."));
519 fire_ball(GF_MANA, dir, damage, 4);
522 if (!get_aim_dir(&dir)) return FALSE;
523 else msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm."));
525 fire_ball(GF_DARK, dir, damage, 4);
528 if (!get_aim_dir(&dir)) return FALSE;
529 fire_ball_hide(GF_DRAIN_MANA, dir, randint1(plev*3)+plev, 0);
532 if (!get_aim_dir(&dir)) return FALSE;
533 fire_ball_hide(GF_MIND_BLAST, dir, damage, 0);
536 if (!get_aim_dir(&dir)) return FALSE;
537 fire_ball_hide(GF_BRAIN_SMASH, dir, damage, 0);
540 if (!get_aim_dir(&dir)) return FALSE;
541 fire_ball_hide(GF_CAUSE_1, dir, damage, 0);
544 if (!get_aim_dir(&dir)) return FALSE;
545 fire_ball_hide(GF_CAUSE_2, dir, damage, 0);
548 if (!get_aim_dir(&dir)) return FALSE;
549 fire_ball_hide(GF_CAUSE_3, dir, damage, 0);
552 if (!get_aim_dir(&dir)) return FALSE;
553 fire_ball_hide(GF_CAUSE_4, dir, damage, 0);
556 if (!get_aim_dir(&dir)) return FALSE;
557 else msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt."));
559 fire_bolt(GF_ACID, dir, damage);
562 if (!get_aim_dir(&dir)) return FALSE;
563 else msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt."));
565 fire_bolt(GF_ELEC, dir, damage);
568 if (!get_aim_dir(&dir)) return FALSE;
569 else msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt."));
571 fire_bolt(GF_FIRE, dir, damage);
574 if (!get_aim_dir(&dir)) return FALSE;
575 else msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt."));
577 fire_bolt(GF_COLD, dir, damage);
580 if (!get_aim_dir(&dir)) return FALSE;
581 else msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst."));
583 fire_ball(GF_LITE, dir, damage, 4);
586 if (!get_aim_dir(&dir)) return FALSE;
587 else msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt."));
589 fire_bolt(GF_NETHER, dir, damage);
592 if (!get_aim_dir(&dir)) return FALSE;
593 else msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt."));
595 fire_bolt(GF_WATER, dir, damage);
598 if (!get_aim_dir(&dir)) return FALSE;
599 else msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt."));
601 fire_bolt(GF_MANA, dir, damage);
604 if (!get_aim_dir(&dir)) return FALSE;
605 else msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt."));
607 fire_bolt(GF_PLASMA, dir, damage);
610 if (!get_aim_dir(&dir)) return FALSE;
611 else msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt."));
613 fire_bolt(GF_ICE, dir, damage);
615 case MS_MAGIC_MISSILE:
616 if (!get_aim_dir(&dir)) return FALSE;
617 else msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile."));
619 fire_bolt(GF_MISSILE, dir, damage);
622 if (!get_aim_dir(&dir)) return FALSE;
623 else msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion."));
625 fear_monster(dir, plev+10);
628 if (!get_aim_dir(&dir)) return FALSE;
629 confuse_monster(dir, plev * 2);
632 if (!get_aim_dir(&dir)) return FALSE;
633 else msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion."));
635 confuse_monster(dir, plev * 2);
638 if (!get_aim_dir(&dir)) return FALSE;
639 slow_monster(dir, plev);
642 if (!get_aim_dir(&dir)) return FALSE;
643 sleep_monster(dir, plev);
646 (void)set_fast(randint1(20 + plev) + plev, FALSE);
650 if (!get_aim_dir(&dir)) return FALSE;
651 else msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
653 fire_ball_hide(GF_HAND_DOOM, dir, 200, 0);
657 msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
658 (void)hp_player(plev*6);
663 msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
664 (void)set_invuln(randint1(7) + 7, FALSE);
667 teleport_player(10, 0L);
670 teleport_player(plev * 5, 0L);
673 (void)time_walk(p_ptr);
681 GAME_TEXT m_name[MAX_NLEN];
683 if (!target_set(TARGET_KILL)) return FALSE;
684 if (!current_floor_ptr->grid_array[target_row][target_col].m_idx) break;
685 if (!player_has_los_bold(target_row, target_col)) break;
686 if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
687 m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[target_row][target_col].m_idx];
688 r_ptr = &r_info[m_ptr->r_idx];
689 monster_desc(m_name, m_ptr, 0);
690 if (r_ptr->flagsr & RFR_RES_TELE)
692 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
694 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
695 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
699 else if (r_ptr->level > randint1(100))
701 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
702 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
707 msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
709 teleport_monster_to(current_floor_ptr->grid_array[target_row][target_col].m_idx, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE);
713 if (!get_aim_dir(&dir)) return FALSE;
715 (void)fire_beam(GF_AWAY_ALL, dir, plev);
719 return teleport_level_other(p_ptr);
723 if (!get_aim_dir(&dir)) return FALSE;
724 else msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
725 (void)fire_beam(GF_PSY_SPEAR, dir, damage);
729 msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
730 (void)unlite_area(10, 3);
734 if (!target_set(TARGET_KILL)) return FALSE;
735 msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackles evilly."));
736 trap_creation(target_row, target_col);
739 msg_print(_("しかし何も起きなかった。", "Nothing happen."));
742 msg_print(_("死者復活の呪文を唱えた。", "You cast a animate dead."));
743 (void)animate_dead(0, p_ptr->y, p_ptr->x);
748 if (!target_set(TARGET_KILL)) return FALSE;
750 msg_print(_("援軍を召喚した。", "You summon minions."));
751 for (k = 0;k < 4; k++)
753 (void)summon_kin_player(plev, target_row, target_col, (PM_FORCE_PET | PM_ALLOW_GROUP));
760 int max_cyber = (current_floor_ptr->dun_level / 50) + randint1(3);
761 if (!target_set(TARGET_KILL)) return FALSE;
762 msg_print(_("サイバーデーモンを召喚した!", "You summon Cyberdemons!"));
763 if (max_cyber > 4) max_cyber = 4;
764 for (k = 0;k < max_cyber; k++)
765 summon_specific(-1, target_row, target_col, plev, SUMMON_CYBER, mode);
771 if (!target_set(TARGET_KILL)) return FALSE;
772 msg_print(_("仲間を召喚した。", "You summon help."));
773 for (k = 0;k < 1; k++)
774 summon_specific(-1, target_row, target_col, plev, 0, (mode | u_mode));
780 if (!target_set(TARGET_KILL)) return FALSE;
781 msg_print(_("モンスターを召喚した!", "You summon monsters!"));
782 for (k = 0; k < 6; k++)
783 summon_specific(-1, target_row, target_col, plev, 0, (mode | u_mode));
789 if (!target_set(TARGET_KILL)) return FALSE;
790 msg_print(_("アリを召喚した。", "You summon ants."));
791 for (k = 0; k < 6; k++)
792 summon_specific(-1, target_row, target_col, plev, SUMMON_ANT, mode);
798 if (!target_set(TARGET_KILL)) return FALSE;
799 msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
800 for (k = 0; k < 6; k++)
801 summon_specific(-1, target_row, target_col, plev, SUMMON_SPIDER, mode);
807 if (!target_set(TARGET_KILL)) return FALSE;
808 msg_print(_("ハウンドを召喚した。", "You summon hounds."));
809 for (k = 0; k < 4; k++)
810 summon_specific(-1, target_row, target_col, plev, SUMMON_HOUND, mode);
816 if (!target_set(TARGET_KILL)) return FALSE;
817 msg_print(_("ヒドラを召喚した。", "You summon hydras."));
818 for (k = 0; k < 4; k++)
819 summon_specific(-1, target_row, target_col, plev, SUMMON_HYDRA, mode);
825 if (!target_set(TARGET_KILL)) return FALSE;
826 msg_print(_("天使を召喚した!", "You summon angel!"));
827 for (k = 0; k < 1; k++)
828 summon_specific(-1, target_row, target_col, plev, SUMMON_ANGEL, mode);
834 if (!target_set(TARGET_KILL)) return FALSE;
835 msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
836 for (k = 0; k < 1; k++)
837 summon_specific(-1, target_row, target_col, plev, SUMMON_DEMON, (mode | u_mode));
843 if (!target_set(TARGET_KILL)) return FALSE;
844 msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
845 for (k = 0; k < 1; k++)
846 summon_specific(-1, target_row, target_col, plev, SUMMON_UNDEAD, (mode | u_mode));
852 if (!target_set(TARGET_KILL)) return FALSE;
853 msg_print(_("ドラゴンを召喚した!", "You summon dragon!"));
854 for (k = 0; k < 1; k++)
855 summon_specific(-1, target_row, target_col, plev, SUMMON_DRAGON, (mode | u_mode));
861 if (!target_set(TARGET_KILL)) return FALSE;
862 msg_print(_("強力なアンデッドを召喚した!", "You summon greater undead!"));
863 for (k = 0; k < 6; k++)
864 summon_specific(-1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
870 if (!target_set(TARGET_KILL)) return FALSE;
871 msg_print(_("古代ドラゴンを召喚した!", "You summon ancient dragons!"));
872 for (k = 0; k < 4; k++)
873 summon_specific(-1, target_row, target_col, plev, SUMMON_HI_DRAGON, (mode | u_mode));
879 if (!target_set(TARGET_KILL)) return FALSE;
880 msg_print(_("アンバーの王族を召喚した!", "You summon Lords of Amber!"));
881 for (k = 0; k < 4; k++)
882 summon_specific(-1, target_row, target_col, plev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
888 if (!target_set(TARGET_KILL)) return FALSE;
889 msg_print(_("特別な強敵を召喚した!", "You summon special opponents!"));
890 for (k = 0;k < 4; k++)
891 if (summon_specific(-1, target_row, target_col, plev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE))) count++;
892 for (k = count;k < 4; k++)
893 summon_specific(-1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
905 * @brief ものまねコマンドのメインルーチン /
906 * do_cmd_cast calls this function if the player's class is 'imitator'.
907 * @param baigaesi TRUEならば倍返し上の処理として行う
908 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
910 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
911 * If the user hits escape, returns FALSE, and set '*sn' to -1
912 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
914 * The "prompt" should be "cast", "recite", or "study"
915 * The "known" should be TRUE for cast/pray, FALSE for study
917 * nb: This function has a (trivial) display bug which will be obvious
918 * when you run it. It's probably easy to fix but I haven't tried,
921 bool do_cmd_mane(bool baigaesi)
925 PERCENTAGE minfail = 0;
926 PLAYER_LEVEL plev = p_ptr->lev;
930 if (cmd_limit_confused(p_ptr)) return FALSE;
932 if (!p_ptr->mane_num)
934 msg_print(_("まねられるものが何もない!", "You don't remember any action!"));
938 if (!get_mane_power(&n, baigaesi)) return FALSE;
940 spell = monster_powers[p_ptr->mane_spell[n]];
942 /* Spell failure chance */
943 chance = spell.manefail;
945 /* Reduce failure rate by "effective" level adjustment */
946 if (plev > spell.level) chance -= 3 * (plev - spell.level);
948 /* Reduce failure rate by 1 stat and DEX adjustment */
949 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[p_ptr->stat_ind[A_DEX]] - 2) / 2;
951 if (spell.manedam) chance = chance * damage / spell.manedam;
953 chance += p_ptr->to_m_chance;
955 /* Extract the minimum failure rate */
956 minfail = adj_mag_fail[p_ptr->stat_ind[spell.use_stat]];
958 /* Minimum failure rate */
959 if (chance < minfail) chance = minfail;
961 /* Stunning makes spells harder */
962 if (p_ptr->stun > 50) chance += 25;
963 else if (p_ptr->stun) chance += 15;
965 /* Always a 5 percent chance of working */
966 if (chance > 95) chance = 95;
969 if (randint0(100) < chance)
971 if (flush_failure) flush();
972 msg_print(_("ものまねに失敗した!", "You failed to concentrate hard enough!"));
978 cast = use_mane(p_ptr->mane_spell[n]);
979 if (!cast) return FALSE;
983 for (j = n; j < p_ptr->mane_num;j++)
985 p_ptr->mane_spell[j] = p_ptr->mane_spell[j+1];
986 p_ptr->mane_dam[j] = p_ptr->mane_dam[j+1];
989 take_turn(p_ptr, 100);
991 p_ptr->redraw |= (PR_IMITATION);
992 p_ptr->window |= (PW_PLAYER);
993 p_ptr->window |= (PW_SPELL);