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"
17 #include "player-status.h"
22 * @brief 受け取ったパラメータに応じてものまねの効果情報をまとめたフォーマットを返す
23 * @param p 情報を返す文字列参照ポインタ
24 * @param power ものまねの効力の種類
28 static void mane_info(char *p, int power, HIT_POINT dam)
30 PLAYER_LEVEL plev = p_ptr->lev;
34 if ((power > 2 && power < 41) || (power > 41 && power < 59) || (power == 75))
35 sprintf(p, " %s%d", KWD_DAM, (int)dam);
41 sprintf(p, " %sd%d+%d", KWD_HEAL, plev * 3, plev);
44 sprintf(p, " %sd%d+%d", KWD_DURATION, 20+plev, plev);
47 sprintf(p, " %s%d", KWD_HEAL, plev*6);
50 sprintf(p, " %sd7+7", KWD_DURATION);
53 sprintf(p, " %s10", KWD_SPHERE);
56 sprintf(p, " %s%d", KWD_SPHERE, plev * 5);
59 sprintf(p, " %s5", KWD_SPHERE);
69 * @brief どのものまねを発動するか選択する処理 /
70 * Allow user to choose a imitation.
71 * @param sn 実行したものまねのIDを返す参照ポインタ(キャンセルなどの場合-1を返す)
72 * @param baigaesi TRUEならば倍返し上の処理として行う
73 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
75 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
76 * If the user hits escape, returns FALSE, and set '*sn' to -1
77 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
79 * The "prompt" should be "cast", "recite", or "study"
80 * The "known" should be TRUE for cast/pray, FALSE for study
82 * nb: This function has a (trivial) display bug which will be obvious
83 * when you run it. It's probably easy to fix but I haven't tried,
86 static int get_mane_power(int *sn, bool baigaesi)
93 PLAYER_LEVEL plev = p_ptr->lev;
99 concptr p = _("能力", "power");
104 /* Assume cancelled */
107 /* Nothing chosen yet */
113 num = p_ptr->mane_num;
115 /* Build a prompt (accept all spells) */
116 (void)strnfmt(out_val, 78,
117 _("(%c-%c, '*'で一覧, ESC) どの%sをまねますか?", "(%c-%c, *=List, ESC=exit) Use which %s? "),
118 I2A(0), I2A(num - 1), p);
120 /* Get a spell from the user */
122 choice= always_show_list ? ESCAPE:1 ;
125 if(choice==ESCAPE) choice = ' ';
126 else if( !get_com(out_val, &choice, TRUE) )break;
129 if ((choice == ' ') || (choice == '*') || (choice == '?'))
140 /* Display a list of spells */
142 put_str(_("名前", "Name"), y, x + 5);
143 put_str(_("失率 効果", "Fail Info"), y, x + 36);
146 /* Dump the spells */
147 for (i = 0; i < num; i++)
149 /* Access the spell */
150 spell = monster_powers[p_ptr->mane_spell[i]];
152 chance = spell.manefail;
154 /* Reduce failure rate by "effective" level adjustment */
155 if (plev > spell.level) chance -= 3 * (plev - spell.level);
157 /* Reduce failure rate by INT/WIS adjustment */
158 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[p_ptr->stat_ind[A_DEX]] - 2) / 2;
160 if (spell.manedam) chance = chance * (baigaesi ? p_ptr->mane_dam[i] * 2 : p_ptr->mane_dam[i]) / spell.manedam;
162 chance += p_ptr->to_m_chance;
164 /* Extract the minimum failure rate */
165 minfail = adj_mag_fail[p_ptr->stat_ind[spell.use_stat]];
167 /* Minimum failure rate */
168 if (chance < minfail) chance = minfail;
170 /* Stunning makes spells harder */
171 if (p_ptr->stun > 50) chance += 25;
172 else if (p_ptr->stun) chance += 15;
174 /* Always a 5 percent chance of working */
175 if (chance > 95) chance = 95;
178 mane_info(comment, p_ptr->mane_spell[i], (baigaesi ? p_ptr->mane_dam[i]*2 : p_ptr->mane_dam[i]));
180 /* Dump the spell --(-- */
181 sprintf(psi_desc, " %c) %-30s %3d%%%s",
184 prt(psi_desc, y + i + 1, x);
187 /* Clear the bottom line */
188 prt("", y + i + 1, x);
204 ask = isupper(choice);
207 if (ask) choice = (char)tolower(choice);
209 /* Extract request */
210 i = (islower(choice) ? A2I(choice) : -1);
212 /* Totally Illegal */
213 if ((i < 0) || (i >= num))
219 /* Save the spell index */
220 spell = monster_powers[p_ptr->mane_spell[i]];
228 (void) strnfmt(tmp_val, 78, _("%sをまねますか?", "Use %s? "), monster_powers[p_ptr->mane_spell[i]].name);
230 /* Belay that order */
231 if (!get_check(tmp_val)) continue;
237 if (redraw) screen_load();
239 p_ptr->window |= (PW_SPELL);
242 /* Abort if needed */
243 if (!flag) return (FALSE);
245 /* Save the choice */
248 damage = (baigaesi ? p_ptr->mane_dam[i]*2 : p_ptr->mane_dam[i]);
257 * do_cmd_cast calls this function if the player's class is 'imitator'.
258 * @param spell 発動するモンスター攻撃のID
259 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
261 static bool use_mane(int spell)
264 PLAYER_LEVEL plev = p_ptr->lev;
265 BIT_FLAGS mode = (PM_ALLOW_GROUP | PM_FORCE_PET);
266 BIT_FLAGS u_mode = 0L;
268 if (randint1(50+plev) < plev/10) u_mode = PM_ALLOW_UNIQUE;
276 msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
277 aggravate_monsters(0);
287 if (!target_set(TARGET_KILL)) return FALSE;
288 m_idx = cave[target_row][target_col].m_idx;
290 if (!player_has_los_bold(target_row, target_col)) break;
291 if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
292 dispel_monster_status(m_idx);
297 if (!get_aim_dir(&dir)) return FALSE;
298 else msg_print(_("ロケットを発射した。", "You fire a rocket."));
299 fire_rocket(GF_ROCKET, dir, damage, 2);
303 if (!get_aim_dir(&dir)) return FALSE;
304 else msg_print(_("矢を放った。", "You fire an arrow."));
305 fire_bolt(GF_ARROW, dir, damage);
318 if (!get_aim_dir(&dir)) return FALSE;
319 else msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
320 fire_breath(GF_ACID, dir, damage, (plev > 35 ? 3 : 2));
324 if (!get_aim_dir(&dir)) return FALSE;
325 else msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
326 fire_breath(GF_ELEC, dir, damage, (plev > 35 ? 3 : 2));
330 if (!get_aim_dir(&dir)) return FALSE;
331 else msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
332 fire_breath(GF_FIRE, dir, damage, (plev > 35 ? 3 : 2));
336 if (!get_aim_dir(&dir)) return FALSE;
337 else msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
338 fire_breath(GF_COLD, dir, damage, (plev > 35 ? 3 : 2));
342 if (!get_aim_dir(&dir)) return FALSE;
343 else msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
344 fire_breath(GF_POIS, dir, damage, (plev > 35 ? 3 : 2));
348 if (!get_aim_dir(&dir)) return FALSE;
349 else msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
350 fire_breath(GF_NETHER, dir, damage, (plev > 35 ? 3 : 2));
354 if (!get_aim_dir(&dir)) return FALSE;
355 else msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
356 fire_breath(GF_LITE, dir, damage, (plev > 35 ? 3 : 2));
360 if (!get_aim_dir(&dir)) return FALSE;
361 else msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
362 fire_breath(GF_DARK, dir, damage, (plev > 35 ? 3 : 2));
366 if (!get_aim_dir(&dir)) return FALSE;
367 else msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
368 fire_breath(GF_CONFUSION, dir, damage, (plev > 35 ? 3 : 2));
372 if (!get_aim_dir(&dir)) return FALSE;
373 else msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
374 fire_breath(GF_SOUND, dir, damage, (plev > 35 ? 3 : 2));
378 if (!get_aim_dir(&dir)) return FALSE;
379 else msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
380 fire_breath(GF_CHAOS, dir, damage, (plev > 35 ? 3 : 2));
384 if (!get_aim_dir(&dir)) return FALSE;
385 else msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
386 fire_breath(GF_DISENCHANT, dir, damage, (plev > 35 ? 3 : 2));
390 if (!get_aim_dir(&dir)) return FALSE;
391 else msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
392 fire_breath(GF_NEXUS, dir, damage, (plev > 35 ? 3 : 2));
396 if (!get_aim_dir(&dir)) return FALSE;
397 else msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
398 fire_breath(GF_TIME, dir, damage, (plev > 35 ? 3 : 2));
402 if (!get_aim_dir(&dir)) return FALSE;
403 else msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
404 fire_breath(GF_INERTIAL, dir, damage, (plev > 35 ? 3 : 2));
408 if (!get_aim_dir(&dir)) return FALSE;
409 else msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
410 fire_breath(GF_GRAVITY, dir, damage, (plev > 35 ? 3 : 2));
414 if (!get_aim_dir(&dir)) return FALSE;
415 else msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
416 fire_breath(GF_SHARDS, dir, damage, (plev > 35 ? 3 : 2));
420 if (!get_aim_dir(&dir)) return FALSE;
421 else msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
423 fire_breath(GF_PLASMA, dir, damage, (plev > 35 ? 3 : 2));
427 if (!get_aim_dir(&dir)) return FALSE;
428 else msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
430 fire_breath(GF_FORCE, dir, damage, (plev > 35 ? 3 : 2));
434 if (!get_aim_dir(&dir)) return FALSE;
435 else msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
437 fire_breath(GF_MANA, dir, damage, (plev > 35 ? 3 : 2));
441 if (!get_aim_dir(&dir)) return FALSE;
442 else msg_print(_("放射能球を放った。", "You cast a ball of radiation."));
444 fire_ball(GF_NUKE, dir, damage, 2);
448 if (!get_aim_dir(&dir)) return FALSE;
449 else msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
451 fire_breath(GF_NUKE, dir, damage, (plev > 35 ? 3 : 2));
455 if (!get_aim_dir(&dir)) return FALSE;
456 else msg_print(_("純ログルスを放った。", "You invoke a raw Logrus."));
458 fire_ball(GF_CHAOS, dir, damage, 4);
461 if (!get_aim_dir(&dir)) return FALSE;
462 else msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
464 fire_breath(GF_DISINTEGRATE, dir, damage, (plev > 35 ? 3 : 2));
467 if (!get_aim_dir(&dir)) return FALSE;
468 else msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball."));
470 fire_ball(GF_ACID, dir, damage, 2);
473 if (!get_aim_dir(&dir)) return FALSE;
474 else msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball."));
476 fire_ball(GF_ELEC, dir, damage, 2);
479 if (!get_aim_dir(&dir)) return FALSE;
480 else msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball."));
482 fire_ball(GF_FIRE, dir, damage, 2);
485 if (!get_aim_dir(&dir)) return FALSE;
486 else msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball."));
488 fire_ball(GF_COLD, dir, damage, 2);
491 if (!get_aim_dir(&dir)) return FALSE;
492 else msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud."));
494 fire_ball(GF_POIS, dir, damage, 2);
497 if (!get_aim_dir(&dir)) return FALSE;
498 else msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball."));
500 fire_ball(GF_NETHER, dir, damage, 2);
503 if (!get_aim_dir(&dir)) return FALSE;
504 else msg_print(_("流れるような身振りをした。", "You gesture fluidly."));
506 fire_ball(GF_WATER, dir, damage, 4);
509 if (!get_aim_dir(&dir)) return FALSE;
510 else msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm."));
512 fire_ball(GF_MANA, dir, damage, 4);
515 if (!get_aim_dir(&dir)) return FALSE;
516 else msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm."));
518 fire_ball(GF_DARK, dir, damage, 4);
521 if (!get_aim_dir(&dir)) return FALSE;
522 fire_ball_hide(GF_DRAIN_MANA, dir, randint1(plev*3)+plev, 0);
525 if (!get_aim_dir(&dir)) return FALSE;
526 fire_ball_hide(GF_MIND_BLAST, dir, damage, 0);
529 if (!get_aim_dir(&dir)) return FALSE;
530 fire_ball_hide(GF_BRAIN_SMASH, dir, damage, 0);
533 if (!get_aim_dir(&dir)) return FALSE;
534 fire_ball_hide(GF_CAUSE_1, dir, damage, 0);
537 if (!get_aim_dir(&dir)) return FALSE;
538 fire_ball_hide(GF_CAUSE_2, dir, damage, 0);
541 if (!get_aim_dir(&dir)) return FALSE;
542 fire_ball_hide(GF_CAUSE_3, dir, damage, 0);
545 if (!get_aim_dir(&dir)) return FALSE;
546 fire_ball_hide(GF_CAUSE_4, dir, damage, 0);
549 if (!get_aim_dir(&dir)) return FALSE;
550 else msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt."));
552 fire_bolt(GF_ACID, dir, damage);
555 if (!get_aim_dir(&dir)) return FALSE;
556 else msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt."));
558 fire_bolt(GF_ELEC, dir, damage);
561 if (!get_aim_dir(&dir)) return FALSE;
562 else msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt."));
564 fire_bolt(GF_FIRE, dir, damage);
567 if (!get_aim_dir(&dir)) return FALSE;
568 else msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt."));
570 fire_bolt(GF_COLD, dir, damage);
573 if (!get_aim_dir(&dir)) return FALSE;
574 else msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst."));
576 fire_ball(GF_LITE, dir, damage, 4);
579 if (!get_aim_dir(&dir)) return FALSE;
580 else msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt."));
582 fire_bolt(GF_NETHER, dir, damage);
585 if (!get_aim_dir(&dir)) return FALSE;
586 else msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt."));
588 fire_bolt(GF_WATER, dir, damage);
591 if (!get_aim_dir(&dir)) return FALSE;
592 else msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt."));
594 fire_bolt(GF_MANA, dir, damage);
597 if (!get_aim_dir(&dir)) return FALSE;
598 else msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt."));
600 fire_bolt(GF_PLASMA, dir, damage);
603 if (!get_aim_dir(&dir)) return FALSE;
604 else msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt."));
606 fire_bolt(GF_ICE, dir, damage);
608 case MS_MAGIC_MISSILE:
609 if (!get_aim_dir(&dir)) return FALSE;
610 else msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile."));
612 fire_bolt(GF_MISSILE, dir, damage);
615 if (!get_aim_dir(&dir)) return FALSE;
616 else msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion."));
618 fear_monster(dir, plev+10);
621 if (!get_aim_dir(&dir)) return FALSE;
622 confuse_monster(dir, plev * 2);
625 if (!get_aim_dir(&dir)) return FALSE;
626 else msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion."));
628 confuse_monster(dir, plev * 2);
631 if (!get_aim_dir(&dir)) return FALSE;
632 slow_monster(dir, plev);
635 if (!get_aim_dir(&dir)) return FALSE;
636 sleep_monster(dir, plev);
639 (void)set_fast(randint1(20 + plev) + plev, FALSE);
643 if (!get_aim_dir(&dir)) return FALSE;
644 else msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
646 fire_ball_hide(GF_HAND_DOOM, dir, 200, 0);
650 msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
651 (void)hp_player(plev*6);
656 msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
657 (void)set_invuln(randint1(7) + 7, FALSE);
660 teleport_player(10, 0L);
663 teleport_player(plev * 5, 0L);
666 p_ptr->timewalk = TRUE;
667 if (damage == 1 || damage == 2)
668 msg_print(_("「『ザ・ワールド』!時は止まった!」", "You yell 'The World! Time has stopped!'"));
669 else if (damage == 3 || damage == 6)
670 msg_print(_("「時よ!」", "You yell 'Time!'"));
676 p_ptr->energy_need -= 1000 + (100 + randint1(200) + 200) * TURNS_PER_TICK / 10;
677 p_ptr->redraw |= (PR_MAP);
678 p_ptr->update |= (PU_MONSTERS);
679 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
689 GAME_TEXT m_name[MAX_NLEN];
691 if (!target_set(TARGET_KILL)) return FALSE;
692 if (!cave[target_row][target_col].m_idx) break;
693 if (!player_has_los_bold(target_row, target_col)) break;
694 if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
695 m_ptr = &m_list[cave[target_row][target_col].m_idx];
696 r_ptr = &r_info[m_ptr->r_idx];
697 monster_desc(m_name, m_ptr, 0);
698 if (r_ptr->flagsr & RFR_RES_TELE)
700 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
702 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
703 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
707 else if (r_ptr->level > randint1(100))
709 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
710 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
715 msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
717 teleport_monster_to(cave[target_row][target_col].m_idx, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE);
721 if (!get_aim_dir(&dir)) return FALSE;
723 (void)fire_beam(GF_AWAY_ALL, dir, plev);
727 return teleport_level_other(p_ptr);
731 if (!get_aim_dir(&dir)) return FALSE;
732 else msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
733 (void)fire_beam(GF_PSY_SPEAR, dir, damage);
737 msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
738 (void)unlite_area(10, 3);
742 if (!target_set(TARGET_KILL)) return FALSE;
743 msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackles evilly."));
744 trap_creation(target_row, target_col);
747 msg_print(_("しかし何も起きなかった。", "Nothing happen."));
750 msg_print(_("死者復活の呪文を唱えた。", "You cast a animate dead."));
751 (void)animate_dead(0, p_ptr->y, p_ptr->x);
756 if (!target_set(TARGET_KILL)) return FALSE;
758 msg_print(_("援軍を召喚した。", "You summon minions."));
759 for (k = 0;k < 4; k++)
761 (void)summon_kin_player(plev, target_row, target_col, (PM_FORCE_PET | PM_ALLOW_GROUP));
768 int max_cyber = (dun_level / 50) + randint1(3);
769 if (!target_set(TARGET_KILL)) return FALSE;
770 msg_print(_("サイバーデーモンを召喚した!", "You summon Cyberdemons!"));
771 if (max_cyber > 4) max_cyber = 4;
772 for (k = 0;k < max_cyber; k++)
773 summon_specific(-1, target_row, target_col, plev, SUMMON_CYBER, mode, '\0');
779 if (!target_set(TARGET_KILL)) return FALSE;
780 msg_print(_("仲間を召喚した。", "You summon help."));
781 for (k = 0;k < 1; k++)
782 summon_specific(-1, target_row, target_col, plev, 0, (mode | u_mode), '\0');
788 if (!target_set(TARGET_KILL)) return FALSE;
789 msg_print(_("モンスターを召喚した!", "You summon monsters!"));
790 for (k = 0;k < A_MAX; k++)
791 summon_specific(-1, target_row, target_col, plev, 0, (mode | u_mode), '\0');
797 if (!target_set(TARGET_KILL)) return FALSE;
798 msg_print(_("アリを召喚した。", "You summon ants."));
799 for (k = 0;k < A_MAX; k++)
800 summon_specific(-1, target_row, target_col, plev, SUMMON_ANT, mode, '\0');
806 if (!target_set(TARGET_KILL)) return FALSE;
807 msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
808 for (k = 0;k < A_MAX; k++)
809 summon_specific(-1, target_row, target_col, plev, SUMMON_SPIDER, mode, '\0');
815 if (!target_set(TARGET_KILL)) return FALSE;
816 msg_print(_("ハウンドを召喚した。", "You summon hounds."));
817 for (k = 0;k < 4; k++)
818 summon_specific(-1, target_row, target_col, plev, SUMMON_HOUND, mode, '\0');
824 if (!target_set(TARGET_KILL)) return FALSE;
825 msg_print(_("ヒドラを召喚した。", "You summon hydras."));
826 for (k = 0;k < 4; k++)
827 summon_specific(-1, target_row, target_col, plev, SUMMON_HYDRA, mode, '\0');
833 if (!target_set(TARGET_KILL)) return FALSE;
834 msg_print(_("天使を召喚した!", "You summon angel!"));
835 for (k = 0;k < 1; k++)
836 summon_specific(-1, target_row, target_col, plev, SUMMON_ANGEL, mode, '\0');
842 if (!target_set(TARGET_KILL)) return FALSE;
843 msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
844 for (k = 0;k < 1; k++)
845 summon_specific(-1, target_row, target_col, plev, SUMMON_DEMON, (mode | u_mode), '\0');
851 if (!target_set(TARGET_KILL)) return FALSE;
852 msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
853 for (k = 0;k < 1; k++)
854 summon_specific(-1, target_row, target_col, plev, SUMMON_UNDEAD, (mode | u_mode), '\0');
860 if (!target_set(TARGET_KILL)) return FALSE;
861 msg_print(_("ドラゴンを召喚した!", "You summon dragon!"));
862 for (k = 0;k < 1; k++)
863 summon_specific(-1, target_row, target_col, plev, SUMMON_DRAGON, (mode | u_mode), '\0');
869 if (!target_set(TARGET_KILL)) return FALSE;
870 msg_print(_("強力なアンデッドを召喚した!", "You summon greater undead!"));
871 for (k = 0;k < A_MAX; k++)
872 summon_specific(-1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode), '\0');
878 if (!target_set(TARGET_KILL)) return FALSE;
879 msg_print(_("古代ドラゴンを召喚した!", "You summon ancient dragons!"));
880 for (k = 0;k < 4; k++)
881 summon_specific(-1, target_row, target_col, plev, SUMMON_HI_DRAGON, (mode | u_mode), '\0');
887 if (!target_set(TARGET_KILL)) return FALSE;
888 msg_print(_("アンバーの王族を召喚した!", "You summon Lords of Amber!"));
889 for (k = 0;k < 4; k++)
890 summon_specific(-1, target_row, target_col, plev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE), '\0');
896 if (!target_set(TARGET_KILL)) return FALSE;
897 msg_print(_("特別な強敵を召喚した!", "You summon special opponents!"));
898 for (k = 0;k < 4; k++)
899 if (summon_specific(-1, target_row, target_col, plev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE), '\0')) count++;
900 for (k = count;k < 4; k++)
901 summon_specific(-1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode), '\0');
913 * @brief ものまねコマンドのメインルーチン /
914 * do_cmd_cast calls this function if the player's class is 'imitator'.
915 * @param baigaesi TRUEならば倍返し上の処理として行う
916 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
918 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
919 * If the user hits escape, returns FALSE, and set '*sn' to -1
920 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
922 * The "prompt" should be "cast", "recite", or "study"
923 * The "known" should be TRUE for cast/pray, FALSE for study
925 * nb: This function has a (trivial) display bug which will be obvious
926 * when you run it. It's probably easy to fix but I haven't tried,
929 bool do_cmd_mane(bool baigaesi)
934 PLAYER_LEVEL plev = p_ptr->lev;
938 if (cmd_limit_confused(p_ptr)) return FALSE;
940 if (!p_ptr->mane_num)
942 msg_print(_("まねられるものが何もない!", "You don't remember any action!"));
947 if (!get_mane_power(&n, baigaesi)) return FALSE;
949 spell = monster_powers[p_ptr->mane_spell[n]];
951 /* Spell failure chance */
952 chance = spell.manefail;
954 /* Reduce failure rate by "effective" level adjustment */
955 if (plev > spell.level) chance -= 3 * (plev - spell.level);
957 /* Reduce failure rate by 1 stat and DEX adjustment */
958 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[p_ptr->stat_ind[A_DEX]] - 2) / 2;
960 if (spell.manedam) chance = chance * damage / spell.manedam;
962 chance += p_ptr->to_m_chance;
964 /* Extract the minimum failure rate */
965 minfail = adj_mag_fail[p_ptr->stat_ind[spell.use_stat]];
967 /* Minimum failure rate */
968 if (chance < minfail) chance = minfail;
970 /* Stunning makes spells harder */
971 if (p_ptr->stun > 50) chance += 25;
972 else if (p_ptr->stun) chance += 15;
974 /* Always a 5 percent chance of working */
975 if (chance > 95) chance = 95;
978 if (randint0(100) < chance)
980 if (flush_failure) flush();
981 msg_print(_("ものまねに失敗した!", "You failed to concentrate hard enough!"));
989 cast = use_mane(p_ptr->mane_spell[n]);
991 if (!cast) return FALSE;
995 for (j = n; j < p_ptr->mane_num;j++)
997 p_ptr->mane_spell[j] = p_ptr->mane_spell[j+1];
998 p_ptr->mane_dam[j] = p_ptr->mane_dam[j+1];
1001 take_turn(p_ptr, 100);;
1003 p_ptr->redraw |= (PR_IMITATION);
1004 p_ptr->window |= (PW_PLAYER);
1005 p_ptr->window |= (PW_SPELL);