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
18 * @brief 受け取ったパラメータに応じてものまねの効果情報をまとめたフォーマットを返す
19 * @param p 情報を返す文字列参照ポインタ
20 * @param power ものまねの効力の種類
24 static void mane_info(char *p, int power, HIT_POINT dam)
26 PLAYER_LEVEL plev = p_ptr->lev;
27 cptr s_dam = _("損傷:", "dam ");
28 cptr s_dur = _("期間:", "dur ");
29 cptr s_range = _("範囲:", "range ");
30 cptr s_heal = _("回復:", "heal ");
34 if ((power > 2 && power < 41) || (power > 41 && power < 59) || (power == 75))
35 sprintf(p, " %s%d", s_dam, (int)dam);
41 sprintf(p, " %sd%d+%d", s_heal, plev * 3, plev);
44 sprintf(p, " %sd%d+%d", s_dur, 20+plev, plev);
47 sprintf(p, " %s%d", s_heal, plev*6);
50 sprintf(p, " %sd7+7", s_dur);
53 sprintf(p, " %s10", s_range);
56 sprintf(p, " %s%d", s_range, plev * 5);
59 sprintf(p, " %s5", s_range);
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 cptr 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);
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;
678 p_ptr->redraw |= (PR_MAP);
679 p_ptr->update |= (PU_MONSTERS);
681 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
691 GAME_TEXT m_name[80];
693 if (!target_set(TARGET_KILL)) return FALSE;
694 if (!cave[target_row][target_col].m_idx) break;
695 if (!player_has_los_bold(target_row, target_col)) break;
696 if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
697 m_ptr = &m_list[cave[target_row][target_col].m_idx];
698 r_ptr = &r_info[m_ptr->r_idx];
699 monster_desc(m_name, m_ptr, 0);
700 if (r_ptr->flagsr & RFR_RES_TELE)
702 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
704 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
705 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
709 else if (r_ptr->level > randint1(100))
711 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
712 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
717 msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
719 teleport_monster_to(cave[target_row][target_col].m_idx, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE);
723 if (!get_aim_dir(&dir)) return FALSE;
725 (void)fire_beam(GF_AWAY_ALL, dir, plev);
732 GAME_TEXT m_name[80];
734 if (!target_set(TARGET_KILL)) return FALSE;
735 target_m_idx = cave[target_row][target_col].m_idx;
736 if (!target_m_idx) break;
737 if (!player_has_los_bold(target_row, target_col)) break;
738 if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
739 m_ptr = &m_list[target_m_idx];
740 r_ptr = &r_info[m_ptr->r_idx];
741 monster_desc(m_name, m_ptr, 0);
742 msg_format(_("%^sの足を指さした。", "You gesture at %^s's feet."), m_name);
744 if ((r_ptr->flagsr & (RFR_EFF_RES_NEXU_MASK | RFR_RES_TELE)) ||
745 (r_ptr->flags1 & RF1_QUESTOR) || (r_ptr->level + randint1(50) > plev + randint1(60)))
747 msg_print(_("しかし効果がなかった!", "%^s is unaffected!"));
749 else teleport_level(target_m_idx);
754 if (!get_aim_dir(&dir)) return FALSE;
755 else msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
756 (void)fire_beam(GF_PSY_SPEAR, dir, damage);
760 msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
761 (void)unlite_area(10, 3);
765 if (!target_set(TARGET_KILL)) return FALSE;
766 msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackles evilly."));
767 trap_creation(target_row, target_col);
770 msg_print(_("しかし何も起きなかった。", "Nothing happen."));
773 msg_print(_("死者復活の呪文を唱えた。", "You cast a animate dead."));
774 (void)animate_dead(0, p_ptr->y, p_ptr->x);
779 if (!target_set(TARGET_KILL)) return FALSE;
781 msg_print(_("援軍を召喚した。", "You summon minions."));
782 for (k = 0;k < 4; k++)
784 (void)summon_kin_player(plev, target_row, target_col, (PM_FORCE_PET | PM_ALLOW_GROUP));
791 int max_cyber = (dun_level / 50) + randint1(3);
792 if (!target_set(TARGET_KILL)) return FALSE;
793 msg_print(_("サイバーデーモンを召喚した!", "You summon Cyberdemons!"));
794 if (max_cyber > 4) max_cyber = 4;
795 for (k = 0;k < max_cyber; k++)
796 summon_specific(-1, target_row, target_col, plev, SUMMON_CYBER, mode);
802 if (!target_set(TARGET_KILL)) return FALSE;
803 msg_print(_("仲間を召喚した。", "You summon help."));
804 for (k = 0;k < 1; k++)
805 summon_specific(-1, target_row, target_col, plev, 0, (mode | u_mode));
811 if (!target_set(TARGET_KILL)) return FALSE;
812 msg_print(_("モンスターを召喚した!", "You summon monsters!"));
813 for (k = 0;k < 6; k++)
814 summon_specific(-1, target_row, target_col, plev, 0, (mode | u_mode));
820 if (!target_set(TARGET_KILL)) return FALSE;
821 msg_print(_("アリを召喚した。", "You summon ants."));
822 for (k = 0;k < 6; k++)
823 summon_specific(-1, target_row, target_col, plev, SUMMON_ANT, mode);
829 if (!target_set(TARGET_KILL)) return FALSE;
830 msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
831 for (k = 0;k < 6; k++)
832 summon_specific(-1, target_row, target_col, plev, SUMMON_SPIDER, mode);
838 if (!target_set(TARGET_KILL)) return FALSE;
839 msg_print(_("ハウンドを召喚した。", "You summon hounds."));
840 for (k = 0;k < 4; k++)
841 summon_specific(-1, target_row, target_col, plev, SUMMON_HOUND, mode);
847 if (!target_set(TARGET_KILL)) return FALSE;
848 msg_print(_("ヒドラを召喚した。", "You summon hydras."));
849 for (k = 0;k < 4; k++)
850 summon_specific(-1, target_row, target_col, plev, SUMMON_HYDRA, mode);
856 if (!target_set(TARGET_KILL)) return FALSE;
857 msg_print(_("天使を召喚した!", "You summon angel!"));
858 for (k = 0;k < 1; k++)
859 summon_specific(-1, target_row, target_col, plev, SUMMON_ANGEL, mode);
865 if (!target_set(TARGET_KILL)) return FALSE;
866 msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
867 for (k = 0;k < 1; k++)
868 summon_specific(-1, target_row, target_col, plev, SUMMON_DEMON, (mode | u_mode));
874 if (!target_set(TARGET_KILL)) return FALSE;
875 msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
876 for (k = 0;k < 1; k++)
877 summon_specific(-1, target_row, target_col, plev, SUMMON_UNDEAD, (mode | u_mode));
883 if (!target_set(TARGET_KILL)) return FALSE;
884 msg_print(_("ドラゴンを召喚した!", "You summon dragon!"));
885 for (k = 0;k < 1; k++)
886 summon_specific(-1, target_row, target_col, plev, SUMMON_DRAGON, (mode | u_mode));
892 if (!target_set(TARGET_KILL)) return FALSE;
893 msg_print(_("強力なアンデッドを召喚した!", "You summon greater undead!"));
894 for (k = 0;k < 6; k++)
895 summon_specific(-1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
901 if (!target_set(TARGET_KILL)) return FALSE;
902 msg_print(_("古代ドラゴンを召喚した!", "You summon ancient dragons!"));
903 for (k = 0;k < 4; k++)
904 summon_specific(-1, target_row, target_col, plev, SUMMON_HI_DRAGON, (mode | u_mode));
910 if (!target_set(TARGET_KILL)) return FALSE;
911 msg_print(_("アンバーの王族を召喚した!", "You summon Lords of Amber!"));
912 for (k = 0;k < 4; k++)
913 summon_specific(-1, target_row, target_col, plev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
919 if (!target_set(TARGET_KILL)) return FALSE;
920 msg_print(_("特別な強敵を召喚した!", "You summon special opponents!"));
921 for (k = 0;k < 4; k++)
922 if (summon_specific(-1, target_row, target_col, plev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE))) count++;
923 for (k = count;k < 4; k++)
924 summon_specific(-1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
936 * @brief ものまねコマンドのメインルーチン /
937 * do_cmd_cast calls this function if the player's class is 'imitator'.
938 * @param baigaesi TRUEならば倍返し上の処理として行う
939 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
941 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
942 * If the user hits escape, returns FALSE, and set '*sn' to -1
943 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
945 * The "prompt" should be "cast", "recite", or "study"
946 * The "known" should be TRUE for cast/pray, FALSE for study
948 * nb: This function has a (trivial) display bug which will be obvious
949 * when you run it. It's probably easy to fix but I haven't tried,
952 bool do_cmd_mane(bool baigaesi)
957 PLAYER_LEVEL plev = p_ptr->lev;
962 /* not if confused */
965 msg_print(_("混乱していて集中できない!", "You are too confused!"));
969 if (!p_ptr->mane_num)
971 msg_print(_("まねられるものが何もない!", "You don't remember any action!"));
976 if (!get_mane_power(&n, baigaesi)) return FALSE;
978 spell = monster_powers[p_ptr->mane_spell[n]];
980 /* Spell failure chance */
981 chance = spell.manefail;
983 /* Reduce failure rate by "effective" level adjustment */
984 if (plev > spell.level) chance -= 3 * (plev - spell.level);
986 /* Reduce failure rate by 1 stat and DEX adjustment */
987 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[p_ptr->stat_ind[A_DEX]] - 2) / 2;
989 if (spell.manedam) chance = chance * damage / spell.manedam;
991 chance += p_ptr->to_m_chance;
993 /* Extract the minimum failure rate */
994 minfail = adj_mag_fail[p_ptr->stat_ind[spell.use_stat]];
996 /* Minimum failure rate */
997 if (chance < minfail) chance = minfail;
999 /* Stunning makes spells harder */
1000 if (p_ptr->stun > 50) chance += 25;
1001 else if (p_ptr->stun) chance += 15;
1003 /* Always a 5 percent chance of working */
1004 if (chance > 95) chance = 95;
1007 if (randint0(100) < chance)
1009 if (flush_failure) flush();
1010 msg_print(_("ものまねに失敗した!", "You failed to concentrate hard enough!"));
1017 /* Cast the spell */
1018 cast = use_mane(p_ptr->mane_spell[n]);
1020 if (!cast) return FALSE;
1024 for (j = n; j < p_ptr->mane_num;j++)
1026 p_ptr->mane_spell[j] = p_ptr->mane_spell[j+1];
1027 p_ptr->mane_dam[j] = p_ptr->mane_dam[j+1];
1030 p_ptr->energy_use = 100;
1032 p_ptr->redraw |= (PR_IMITATION);
1033 p_ptr->window |= (PW_PLAYER);
1034 p_ptr->window |= (PW_SPELL);