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);
197 /* Restore the screen */
206 ask = isupper(choice);
209 if (ask) choice = (char)tolower(choice);
211 /* Extract request */
212 i = (islower(choice) ? A2I(choice) : -1);
214 /* Totally Illegal */
215 if ((i < 0) || (i >= num))
221 /* Save the spell index */
222 spell = monster_powers[p_ptr->mane_spell[i]];
230 (void) strnfmt(tmp_val, 78, _("%sをまねますか?", "Use %s? "), monster_powers[p_ptr->mane_spell[i]].name);
232 /* Belay that order */
233 if (!get_check(tmp_val)) continue;
240 /* Restore the screen */
241 if (redraw) screen_load();
243 p_ptr->window |= (PW_SPELL);
246 /* Abort if needed */
247 if (!flag) return (FALSE);
249 /* Save the choice */
252 damage = (baigaesi ? p_ptr->mane_dam[i]*2 : p_ptr->mane_dam[i]);
261 * do_cmd_cast calls this function if the player's class is 'imitator'.
262 * @param spell 発動するモンスター攻撃のID
263 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
265 static bool use_mane(int spell)
268 PLAYER_LEVEL plev = p_ptr->lev;
269 BIT_FLAGS mode = (PM_ALLOW_GROUP | PM_FORCE_PET);
270 BIT_FLAGS u_mode = 0L;
272 if (randint1(50+plev) < plev/10) u_mode = PM_ALLOW_UNIQUE;
280 msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
281 aggravate_monsters(0);
291 if (!target_set(TARGET_KILL)) return FALSE;
292 m_idx = cave[target_row][target_col].m_idx;
294 if (!player_has_los_bold(target_row, target_col)) break;
295 if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
296 dispel_monster_status(m_idx);
301 if (!get_aim_dir(&dir)) return FALSE;
302 else msg_print(_("ロケットを発射した。", "You fire a rocket."));
303 fire_rocket(GF_ROCKET, dir, damage, 2);
307 if (!get_aim_dir(&dir)) return FALSE;
308 else msg_print(_("矢を放った。", "You fire an arrow."));
309 fire_bolt(GF_ARROW, dir, damage);
322 if (!get_aim_dir(&dir)) return FALSE;
323 else msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
324 fire_breath(GF_ACID, dir, damage, (plev > 35 ? 3 : 2));
328 if (!get_aim_dir(&dir)) return FALSE;
329 else msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
330 fire_breath(GF_ELEC, dir, damage, (plev > 35 ? 3 : 2));
334 if (!get_aim_dir(&dir)) return FALSE;
335 else msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
336 fire_breath(GF_FIRE, dir, damage, (plev > 35 ? 3 : 2));
340 if (!get_aim_dir(&dir)) return FALSE;
341 else msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
342 fire_breath(GF_COLD, dir, damage, (plev > 35 ? 3 : 2));
346 if (!get_aim_dir(&dir)) return FALSE;
347 else msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
348 fire_breath(GF_POIS, dir, damage, (plev > 35 ? 3 : 2));
352 if (!get_aim_dir(&dir)) return FALSE;
353 else msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
354 fire_breath(GF_NETHER, dir, damage, (plev > 35 ? 3 : 2));
358 if (!get_aim_dir(&dir)) return FALSE;
359 else msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
360 fire_breath(GF_LITE, dir, damage, (plev > 35 ? 3 : 2));
364 if (!get_aim_dir(&dir)) return FALSE;
365 else msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
366 fire_breath(GF_DARK, dir, damage, (plev > 35 ? 3 : 2));
370 if (!get_aim_dir(&dir)) return FALSE;
371 else msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
372 fire_breath(GF_CONFUSION, dir, damage, (plev > 35 ? 3 : 2));
376 if (!get_aim_dir(&dir)) return FALSE;
377 else msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
378 fire_breath(GF_SOUND, dir, damage, (plev > 35 ? 3 : 2));
382 if (!get_aim_dir(&dir)) return FALSE;
383 else msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
384 fire_breath(GF_CHAOS, dir, damage, (plev > 35 ? 3 : 2));
388 if (!get_aim_dir(&dir)) return FALSE;
389 else msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
390 fire_breath(GF_DISENCHANT, dir, damage, (plev > 35 ? 3 : 2));
394 if (!get_aim_dir(&dir)) return FALSE;
395 else msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
396 fire_breath(GF_NEXUS, dir, damage, (plev > 35 ? 3 : 2));
400 if (!get_aim_dir(&dir)) return FALSE;
401 else msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
402 fire_breath(GF_TIME, dir, damage, (plev > 35 ? 3 : 2));
406 if (!get_aim_dir(&dir)) return FALSE;
407 else msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
408 fire_breath(GF_INERTIAL, dir, damage, (plev > 35 ? 3 : 2));
412 if (!get_aim_dir(&dir)) return FALSE;
413 else msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
414 fire_breath(GF_GRAVITY, dir, damage, (plev > 35 ? 3 : 2));
418 if (!get_aim_dir(&dir)) return FALSE;
419 else msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
420 fire_breath(GF_SHARDS, dir, damage, (plev > 35 ? 3 : 2));
424 if (!get_aim_dir(&dir)) return FALSE;
425 else msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
427 fire_breath(GF_PLASMA, dir, damage, (plev > 35 ? 3 : 2));
431 if (!get_aim_dir(&dir)) return FALSE;
432 else msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
434 fire_breath(GF_FORCE, dir, damage, (plev > 35 ? 3 : 2));
438 if (!get_aim_dir(&dir)) return FALSE;
439 else msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
441 fire_breath(GF_MANA, dir, damage, (plev > 35 ? 3 : 2));
445 if (!get_aim_dir(&dir)) return FALSE;
446 else msg_print(_("放射能球を放った。", "You cast a ball of radiation."));
448 fire_ball(GF_NUKE, dir, damage, 2);
452 if (!get_aim_dir(&dir)) return FALSE;
453 else msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
455 fire_breath(GF_NUKE, dir, damage, (plev > 35 ? 3 : 2));
459 if (!get_aim_dir(&dir)) return FALSE;
460 else msg_print(_("純ログルスを放った。", "You invoke a raw Logrus."));
462 fire_ball(GF_CHAOS, dir, damage, 4);
465 if (!get_aim_dir(&dir)) return FALSE;
466 else msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
468 fire_breath(GF_DISINTEGRATE, dir, damage, (plev > 35 ? 3 : 2));
471 if (!get_aim_dir(&dir)) return FALSE;
472 else msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball."));
474 fire_ball(GF_ACID, dir, damage, 2);
477 if (!get_aim_dir(&dir)) return FALSE;
478 else msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball."));
480 fire_ball(GF_ELEC, dir, damage, 2);
483 if (!get_aim_dir(&dir)) return FALSE;
484 else msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball."));
486 fire_ball(GF_FIRE, dir, damage, 2);
489 if (!get_aim_dir(&dir)) return FALSE;
490 else msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball."));
492 fire_ball(GF_COLD, dir, damage, 2);
495 if (!get_aim_dir(&dir)) return FALSE;
496 else msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud."));
498 fire_ball(GF_POIS, dir, damage, 2);
501 if (!get_aim_dir(&dir)) return FALSE;
502 else msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball."));
504 fire_ball(GF_NETHER, dir, damage, 2);
507 if (!get_aim_dir(&dir)) return FALSE;
508 else msg_print(_("流れるような身振りをした。", "You gesture fluidly."));
510 fire_ball(GF_WATER, dir, damage, 4);
513 if (!get_aim_dir(&dir)) return FALSE;
514 else msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm."));
516 fire_ball(GF_MANA, dir, damage, 4);
519 if (!get_aim_dir(&dir)) return FALSE;
520 else msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm."));
522 fire_ball(GF_DARK, dir, damage, 4);
525 if (!get_aim_dir(&dir)) return FALSE;
526 fire_ball_hide(GF_DRAIN_MANA, dir, randint1(plev*3)+plev, 0);
529 if (!get_aim_dir(&dir)) return FALSE;
530 fire_ball_hide(GF_MIND_BLAST, dir, damage, 0);
533 if (!get_aim_dir(&dir)) return FALSE;
534 fire_ball_hide(GF_BRAIN_SMASH, dir, damage, 0);
537 if (!get_aim_dir(&dir)) return FALSE;
538 fire_ball_hide(GF_CAUSE_1, dir, damage, 0);
541 if (!get_aim_dir(&dir)) return FALSE;
542 fire_ball_hide(GF_CAUSE_2, dir, damage, 0);
545 if (!get_aim_dir(&dir)) return FALSE;
546 fire_ball_hide(GF_CAUSE_3, dir, damage, 0);
549 if (!get_aim_dir(&dir)) return FALSE;
550 fire_ball_hide(GF_CAUSE_4, dir, damage, 0);
553 if (!get_aim_dir(&dir)) return FALSE;
554 else msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt."));
556 fire_bolt(GF_ACID, dir, damage);
559 if (!get_aim_dir(&dir)) return FALSE;
560 else msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt."));
562 fire_bolt(GF_ELEC, dir, damage);
565 if (!get_aim_dir(&dir)) return FALSE;
566 else msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt."));
568 fire_bolt(GF_FIRE, dir, damage);
571 if (!get_aim_dir(&dir)) return FALSE;
572 else msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt."));
574 fire_bolt(GF_COLD, dir, damage);
577 if (!get_aim_dir(&dir)) return FALSE;
578 else msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst."));
580 fire_ball(GF_LITE, dir, damage, 4);
583 if (!get_aim_dir(&dir)) return FALSE;
584 else msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt."));
586 fire_bolt(GF_NETHER, dir, damage);
589 if (!get_aim_dir(&dir)) return FALSE;
590 else msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt."));
592 fire_bolt(GF_WATER, dir, damage);
595 if (!get_aim_dir(&dir)) return FALSE;
596 else msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt."));
598 fire_bolt(GF_MANA, dir, damage);
601 if (!get_aim_dir(&dir)) return FALSE;
602 else msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt."));
604 fire_bolt(GF_PLASMA, dir, damage);
607 if (!get_aim_dir(&dir)) return FALSE;
608 else msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt."));
610 fire_bolt(GF_ICE, dir, damage);
612 case MS_MAGIC_MISSILE:
613 if (!get_aim_dir(&dir)) return FALSE;
614 else msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile."));
616 fire_bolt(GF_MISSILE, dir, damage);
619 if (!get_aim_dir(&dir)) return FALSE;
620 else msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion."));
622 fear_monster(dir, plev+10);
625 if (!get_aim_dir(&dir)) return FALSE;
626 confuse_monster(dir, plev * 2);
629 if (!get_aim_dir(&dir)) return FALSE;
630 else msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion."));
632 confuse_monster(dir, plev * 2);
635 if (!get_aim_dir(&dir)) return FALSE;
636 slow_monster(dir, plev);
639 if (!get_aim_dir(&dir)) return FALSE;
640 sleep_monster(dir, plev);
643 (void)set_fast(randint1(20 + plev) + plev, FALSE);
647 if (!get_aim_dir(&dir)) return FALSE;
648 else msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
650 fire_ball_hide(GF_HAND_DOOM, dir, 200, 0);
654 msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
655 (void)hp_player(plev*6);
660 msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
661 (void)set_invuln(randint1(7) + 7, FALSE);
664 teleport_player(10, 0L);
667 teleport_player(plev * 5, 0L);
671 if (damage == 1 || damage == 2)
672 msg_print(_("「『ザ・ワールド』!時は止まった!」", "You yell 'The World! Time has stopped!'"));
673 else if (damage == 3 || damage == 6)
674 msg_print(_("「時よ!」", "You yell 'Time!'"));
680 p_ptr->energy_need -= 1000 + (100 + randint1(200)+200)*TURNS_PER_TICK/10;
682 p_ptr->redraw |= (PR_MAP);
683 p_ptr->update |= (PU_MONSTERS);
685 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
697 if (!target_set(TARGET_KILL)) return FALSE;
698 if (!cave[target_row][target_col].m_idx) break;
699 if (!player_has_los_bold(target_row, target_col)) break;
700 if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
701 m_ptr = &m_list[cave[target_row][target_col].m_idx];
702 r_ptr = &r_info[m_ptr->r_idx];
703 monster_desc(m_name, m_ptr, 0);
704 if (r_ptr->flagsr & RFR_RES_TELE)
706 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
708 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
709 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
713 else if (r_ptr->level > randint1(100))
715 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
716 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
721 msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
723 teleport_monster_to(cave[target_row][target_col].m_idx, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE);
727 if (!get_aim_dir(&dir)) return FALSE;
729 (void)fire_beam(GF_AWAY_ALL, dir, plev);
738 if (!target_set(TARGET_KILL)) return FALSE;
739 target_m_idx = cave[target_row][target_col].m_idx;
740 if (!target_m_idx) break;
741 if (!player_has_los_bold(target_row, target_col)) break;
742 if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
743 m_ptr = &m_list[target_m_idx];
744 r_ptr = &r_info[m_ptr->r_idx];
745 monster_desc(m_name, m_ptr, 0);
746 msg_format(_("%^sの足を指さした。", "You gesture at %^s's feet."), m_name);
748 if ((r_ptr->flagsr & (RFR_EFF_RES_NEXU_MASK | RFR_RES_TELE)) ||
749 (r_ptr->flags1 & RF1_QUESTOR) || (r_ptr->level + randint1(50) > plev + randint1(60)))
751 msg_print(_("しかし効果がなかった!", "%^s is unaffected!"));
753 else teleport_level(target_m_idx);
758 if (!get_aim_dir(&dir)) return FALSE;
759 else msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
760 (void)fire_beam(GF_PSY_SPEAR, dir, damage);
764 msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
765 (void)unlite_area(10, 3);
769 if (!target_set(TARGET_KILL)) return FALSE;
770 msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackles evilly."));
771 trap_creation(target_row, target_col);
774 msg_print(_("しかし何も起きなかった。", "Nothing happen."));
777 msg_print(_("死者復活の呪文を唱えた。", "You cast a animate dead."));
778 (void)animate_dead(0, p_ptr->y, p_ptr->x);
783 if (!target_set(TARGET_KILL)) return FALSE;
785 msg_print(_("援軍を召喚した。", "You summon minions."));
786 for (k = 0;k < 4; k++)
788 (void)summon_kin_player(plev, target_row, target_col, (PM_FORCE_PET | PM_ALLOW_GROUP));
795 int max_cyber = (dun_level / 50) + randint1(3);
796 if (!target_set(TARGET_KILL)) return FALSE;
797 msg_print(_("サイバーデーモンを召喚した!", "You summon Cyberdemons!"));
798 if (max_cyber > 4) max_cyber = 4;
799 for (k = 0;k < max_cyber; k++)
800 summon_specific(-1, target_row, target_col, plev, SUMMON_CYBER, mode);
806 if (!target_set(TARGET_KILL)) return FALSE;
807 msg_print(_("仲間を召喚した。", "You summon help."));
808 for (k = 0;k < 1; k++)
809 summon_specific(-1, target_row, target_col, plev, 0, (mode | u_mode));
815 if (!target_set(TARGET_KILL)) return FALSE;
816 msg_print(_("モンスターを召喚した!", "You summon monsters!"));
817 for (k = 0;k < 6; k++)
818 summon_specific(-1, target_row, target_col, plev, 0, (mode | u_mode));
824 if (!target_set(TARGET_KILL)) return FALSE;
825 msg_print(_("アリを召喚した。", "You summon ants."));
826 for (k = 0;k < 6; k++)
827 summon_specific(-1, target_row, target_col, plev, SUMMON_ANT, mode);
833 if (!target_set(TARGET_KILL)) return FALSE;
834 msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
835 for (k = 0;k < 6; k++)
836 summon_specific(-1, target_row, target_col, plev, SUMMON_SPIDER, mode);
842 if (!target_set(TARGET_KILL)) return FALSE;
843 msg_print(_("ハウンドを召喚した。", "You summon hounds."));
844 for (k = 0;k < 4; k++)
845 summon_specific(-1, target_row, target_col, plev, SUMMON_HOUND, mode);
851 if (!target_set(TARGET_KILL)) return FALSE;
852 msg_print(_("ヒドラを召喚した。", "You summon hydras."));
853 for (k = 0;k < 4; k++)
854 summon_specific(-1, target_row, target_col, plev, SUMMON_HYDRA, mode);
860 if (!target_set(TARGET_KILL)) return FALSE;
861 msg_print(_("天使を召喚した!", "You summon angel!"));
862 for (k = 0;k < 1; k++)
863 summon_specific(-1, target_row, target_col, plev, SUMMON_ANGEL, mode);
869 if (!target_set(TARGET_KILL)) return FALSE;
870 msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
871 for (k = 0;k < 1; k++)
872 summon_specific(-1, target_row, target_col, plev, SUMMON_DEMON, (mode | u_mode));
878 if (!target_set(TARGET_KILL)) return FALSE;
879 msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
880 for (k = 0;k < 1; k++)
881 summon_specific(-1, target_row, target_col, plev, SUMMON_UNDEAD, (mode | u_mode));
887 if (!target_set(TARGET_KILL)) return FALSE;
888 msg_print(_("ドラゴンを召喚した!", "You summon dragon!"));
889 for (k = 0;k < 1; k++)
890 summon_specific(-1, target_row, target_col, plev, SUMMON_DRAGON, (mode | u_mode));
896 if (!target_set(TARGET_KILL)) return FALSE;
897 msg_print(_("強力なアンデッドを召喚した!", "You summon greater undead!"));
898 for (k = 0;k < 6; k++)
899 summon_specific(-1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
905 if (!target_set(TARGET_KILL)) return FALSE;
906 msg_print(_("古代ドラゴンを召喚した!", "You summon ancient dragons!"));
907 for (k = 0;k < 4; k++)
908 summon_specific(-1, target_row, target_col, plev, SUMMON_HI_DRAGON, (mode | u_mode));
914 if (!target_set(TARGET_KILL)) return FALSE;
915 msg_print(_("アンバーの王族を召喚した!", "You summon Lords of Amber!"));
916 for (k = 0;k < 4; k++)
917 summon_specific(-1, target_row, target_col, plev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
923 if (!target_set(TARGET_KILL)) return FALSE;
924 msg_print(_("特別な強敵を召喚した!", "You summon special opponents!"));
925 for (k = 0;k < 4; k++)
926 if (summon_specific(-1, target_row, target_col, plev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE))) count++;
927 for (k = count;k < 4; k++)
928 summon_specific(-1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
940 * @brief ものまねコマンドのメインルーチン /
941 * do_cmd_cast calls this function if the player's class is 'imitator'.
942 * @param baigaesi TRUEならば倍返し上の処理として行う
943 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
945 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
946 * If the user hits escape, returns FALSE, and set '*sn' to -1
947 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
949 * The "prompt" should be "cast", "recite", or "study"
950 * The "known" should be TRUE for cast/pray, FALSE for study
952 * nb: This function has a (trivial) display bug which will be obvious
953 * when you run it. It's probably easy to fix but I haven't tried,
956 bool do_cmd_mane(bool baigaesi)
961 PLAYER_LEVEL plev = p_ptr->lev;
966 /* not if confused */
969 msg_print(_("混乱していて集中できない!", "You are too confused!"));
973 if (!p_ptr->mane_num)
975 msg_print(_("まねられるものが何もない!", "You don't remember any action!"));
980 if (!get_mane_power(&n, baigaesi)) return FALSE;
982 spell = monster_powers[p_ptr->mane_spell[n]];
984 /* Spell failure chance */
985 chance = spell.manefail;
987 /* Reduce failure rate by "effective" level adjustment */
988 if (plev > spell.level) chance -= 3 * (plev - spell.level);
990 /* Reduce failure rate by 1 stat and DEX adjustment */
991 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[p_ptr->stat_ind[A_DEX]] - 2) / 2;
993 if (spell.manedam) chance = chance * damage / spell.manedam;
995 chance += p_ptr->to_m_chance;
997 /* Extract the minimum failure rate */
998 minfail = adj_mag_fail[p_ptr->stat_ind[spell.use_stat]];
1000 /* Minimum failure rate */
1001 if (chance < minfail) chance = minfail;
1003 /* Stunning makes spells harder */
1004 if (p_ptr->stun > 50) chance += 25;
1005 else if (p_ptr->stun) chance += 15;
1007 /* Always a 5 percent chance of working */
1008 if (chance > 95) chance = 95;
1011 if (randint0(100) < chance)
1013 if (flush_failure) flush();
1014 msg_print(_("ものまねに失敗した!", "You failed to concentrate hard enough!"));
1021 /* Cast the spell */
1022 cast = use_mane(p_ptr->mane_spell[n]);
1024 if (!cast) return FALSE;
1028 for (j = n; j < p_ptr->mane_num;j++)
1030 p_ptr->mane_spell[j] = p_ptr->mane_spell[j+1];
1031 p_ptr->mane_dam[j] = p_ptr->mane_dam[j+1];
1034 p_ptr->energy_use = 100;
1036 p_ptr->redraw |= (PR_IMITATION);
1037 p_ptr->window |= (PW_PLAYER);
1038 p_ptr->window |= (PW_SPELL);