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
20 #include "spells-summon.h"
21 #include "spells-status.h"
22 #include "monster-status.h"
23 #include "monster-spell.h"
24 #include "monster-process.h"
25 #include "cmd-spell.h"
26 #include "player-status.h"
27 #include "player-effects.h"
28 #include "cmd-basic.h"
29 #include "targeting.h"
30 #include "view-mainwindow.h"
35 * @brief 受け取ったパラメータに応じてものまねの効果情報をまとめたフォーマットを返す
36 * @param p 情報を返す文字列参照ポインタ
37 * @param power ものまねの効力の種類
41 static void mane_info(char *p, int power, HIT_POINT dam)
43 PLAYER_LEVEL plev = p_ptr->lev;
47 if ((power > 2 && power < 41) || (power > 41 && power < 59) || (power == 75))
48 sprintf(p, " %s%d", KWD_DAM, (int)dam);
54 sprintf(p, " %sd%d+%d", KWD_HEAL, plev * 3, plev);
57 sprintf(p, " %sd%d+%d", KWD_DURATION, 20+plev, plev);
60 sprintf(p, " %s%d", KWD_HEAL, plev*6);
63 sprintf(p, " %sd7+7", KWD_DURATION);
66 sprintf(p, " %s10", KWD_SPHERE);
69 sprintf(p, " %s%d", KWD_SPHERE, plev * 5);
72 sprintf(p, " %s5", KWD_SPHERE);
82 * @brief どのものまねを発動するか選択する処理 /
83 * Allow user to choose a imitation.
84 * @param sn 実行したものまねのIDを返す参照ポインタ(キャンセルなどの場合-1を返す)
85 * @param baigaesi TRUEならば倍返し上の処理として行う
86 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
88 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
89 * If the user hits escape, returns FALSE, and set '*sn' to -1
90 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
92 * The "prompt" should be "cast", "recite", or "study"
93 * The "known" should be TRUE for cast/pray, FALSE for study
95 * nb: This function has a (trivial) display bug which will be obvious
96 * when you run it. It's probably easy to fix but I haven't tried,
99 static int get_mane_power(player_type *caster_ptr, int *sn, bool baigaesi)
105 PERCENTAGE minfail = 0;
106 PLAYER_LEVEL plev = caster_ptr->lev;
107 PERCENTAGE chance = 0;
112 concptr p = _("能力", "power");
117 /* Assume cancelled */
123 num = caster_ptr->mane_num;
125 /* Build a prompt (accept all spells) */
126 (void)strnfmt(out_val, 78,
127 _("(%c-%c, '*'で一覧, ESC) どの%sをまねますか?", "(%c-%c, *=List, ESC=exit) Use which %s? "),
128 I2A(0), I2A(num - 1), p);
130 choice= always_show_list ? ESCAPE:1 ;
133 if(choice==ESCAPE) choice = ' ';
134 else if( !get_com(out_val, &choice, TRUE) )break;
137 if ((choice == ' ') || (choice == '*') || (choice == '?'))
146 /* Display a list of spells */
148 put_str(_("名前", "Name"), y, x + 5);
149 put_str(_("失率 効果", "Fail Info"), y, x + 36);
152 /* Dump the spells */
153 for (i = 0; i < num; i++)
155 /* Access the spell */
156 spell = monster_powers[caster_ptr->mane_spell[i]];
158 chance = spell.manefail;
160 /* Reduce failure rate by "effective" level adjustment */
161 if (plev > spell.level) chance -= 3 * (plev - spell.level);
163 /* Reduce failure rate by INT/WIS adjustment */
164 chance -= 3 * (adj_mag_stat[caster_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[caster_ptr->stat_ind[A_DEX]] - 2) / 2;
166 if (spell.manedam) chance = chance * (baigaesi ? caster_ptr->mane_dam[i] * 2 : caster_ptr->mane_dam[i]) / spell.manedam;
168 chance += caster_ptr->to_m_chance;
170 /* Extract the minimum failure rate */
171 minfail = adj_mag_fail[caster_ptr->stat_ind[spell.use_stat]];
173 /* Minimum failure rate */
174 if (chance < minfail) chance = minfail;
176 /* Stunning makes spells harder */
177 if (caster_ptr->stun > 50) chance += 25;
178 else if (caster_ptr->stun) chance += 15;
180 /* Always a 5 percent chance of working */
181 if (chance > 95) chance = 95;
184 mane_info(comment, caster_ptr->mane_spell[i], (baigaesi ? caster_ptr->mane_dam[i]*2 : caster_ptr->mane_dam[i]));
186 /* Dump the spell --(-- */
187 sprintf(psi_desc, " %c) %-30s %3d%%%s",
190 prt(psi_desc, y + i + 1, x);
193 /* Clear the bottom line */
194 prt("", y + i + 1, x);
210 ask = isupper(choice);
213 if (ask) choice = (char)tolower(choice);
215 /* Extract request */
216 i = (islower(choice) ? A2I(choice) : -1);
218 /* Totally Illegal */
219 if ((i < 0) || (i >= num))
225 /* Save the spell index */
226 spell = monster_powers[caster_ptr->mane_spell[i]];
234 (void) strnfmt(tmp_val, 78, _("%sをまねますか?", "Use %s? "), monster_powers[caster_ptr->mane_spell[i]].name);
236 /* Belay that order */
237 if (!get_check(tmp_val)) continue;
243 if (redraw) screen_load();
245 caster_ptr->window |= (PW_SPELL);
248 /* Abort if needed */
249 if (!flag) return (FALSE);
251 /* Save the choice */
254 damage = (baigaesi ? caster_ptr->mane_dam[i]*2 : caster_ptr->mane_dam[i]);
263 * do_cmd_cast calls this function if the player's class is 'imitator'.
264 * @param spell 発動するモンスター攻撃のID
265 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
267 static bool use_mane(player_type *caster_ptr, int spell)
270 PLAYER_LEVEL plev = caster_ptr->lev;
271 BIT_FLAGS mode = (PM_ALLOW_GROUP | PM_FORCE_PET);
272 BIT_FLAGS u_mode = 0L;
274 if (randint1(50+plev) < plev/10) u_mode = PM_ALLOW_UNIQUE;
282 msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
283 aggravate_monsters(0);
293 if (!target_set(TARGET_KILL)) return FALSE;
294 m_idx = caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
296 if (!player_has_los_bold(target_row, target_col)) break;
297 if (!projectable(caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
298 dispel_monster_status(m_idx);
303 if (!get_aim_dir(&dir)) return FALSE;
304 else msg_print(_("ロケットを発射した。", "You fire a rocket."));
305 fire_rocket(GF_ROCKET, dir, damage, 2);
309 if (!get_aim_dir(&dir)) return FALSE;
310 else msg_print(_("矢を放った。", "You fire an arrow."));
311 fire_bolt(GF_ARROW, dir, damage);
324 if (!get_aim_dir(&dir)) return FALSE;
325 else msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
326 fire_breath(GF_ACID, dir, damage, (plev > 35 ? 3 : 2));
330 if (!get_aim_dir(&dir)) return FALSE;
331 else msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
332 fire_breath(GF_ELEC, dir, damage, (plev > 35 ? 3 : 2));
336 if (!get_aim_dir(&dir)) return FALSE;
337 else msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
338 fire_breath(GF_FIRE, dir, damage, (plev > 35 ? 3 : 2));
342 if (!get_aim_dir(&dir)) return FALSE;
343 else msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
344 fire_breath(GF_COLD, dir, damage, (plev > 35 ? 3 : 2));
348 if (!get_aim_dir(&dir)) return FALSE;
349 else msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
350 fire_breath(GF_POIS, dir, damage, (plev > 35 ? 3 : 2));
354 if (!get_aim_dir(&dir)) return FALSE;
355 else msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
356 fire_breath(GF_NETHER, dir, damage, (plev > 35 ? 3 : 2));
360 if (!get_aim_dir(&dir)) return FALSE;
361 else msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
362 fire_breath(GF_LITE, dir, damage, (plev > 35 ? 3 : 2));
366 if (!get_aim_dir(&dir)) return FALSE;
367 else msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
368 fire_breath(GF_DARK, dir, damage, (plev > 35 ? 3 : 2));
372 if (!get_aim_dir(&dir)) return FALSE;
373 else msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
374 fire_breath(GF_CONFUSION, dir, damage, (plev > 35 ? 3 : 2));
378 if (!get_aim_dir(&dir)) return FALSE;
379 else msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
380 fire_breath(GF_SOUND, dir, damage, (plev > 35 ? 3 : 2));
384 if (!get_aim_dir(&dir)) return FALSE;
385 else msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
386 fire_breath(GF_CHAOS, dir, damage, (plev > 35 ? 3 : 2));
390 if (!get_aim_dir(&dir)) return FALSE;
391 else msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
392 fire_breath(GF_DISENCHANT, dir, damage, (plev > 35 ? 3 : 2));
396 if (!get_aim_dir(&dir)) return FALSE;
397 else msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
398 fire_breath(GF_NEXUS, dir, damage, (plev > 35 ? 3 : 2));
402 if (!get_aim_dir(&dir)) return FALSE;
403 else msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
404 fire_breath(GF_TIME, dir, damage, (plev > 35 ? 3 : 2));
408 if (!get_aim_dir(&dir)) return FALSE;
409 else msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
410 fire_breath(GF_INERTIAL, dir, damage, (plev > 35 ? 3 : 2));
414 if (!get_aim_dir(&dir)) return FALSE;
415 else msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
416 fire_breath(GF_GRAVITY, dir, damage, (plev > 35 ? 3 : 2));
420 if (!get_aim_dir(&dir)) return FALSE;
421 else msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
422 fire_breath(GF_SHARDS, dir, damage, (plev > 35 ? 3 : 2));
426 if (!get_aim_dir(&dir)) return FALSE;
427 else msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
429 fire_breath(GF_PLASMA, dir, damage, (plev > 35 ? 3 : 2));
433 if (!get_aim_dir(&dir)) return FALSE;
434 else msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
436 fire_breath(GF_FORCE, dir, damage, (plev > 35 ? 3 : 2));
440 if (!get_aim_dir(&dir)) return FALSE;
441 else msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
443 fire_breath(GF_MANA, dir, damage, (plev > 35 ? 3 : 2));
447 if (!get_aim_dir(&dir)) return FALSE;
448 else msg_print(_("放射能球を放った。", "You cast a ball of radiation."));
450 fire_ball(GF_NUKE, dir, damage, 2);
454 if (!get_aim_dir(&dir)) return FALSE;
455 else msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
457 fire_breath(GF_NUKE, dir, damage, (plev > 35 ? 3 : 2));
461 if (!get_aim_dir(&dir)) return FALSE;
462 else msg_print(_("純ログルスを放った。", "You invoke a raw Logrus."));
464 fire_ball(GF_CHAOS, dir, damage, 4);
467 if (!get_aim_dir(&dir)) return FALSE;
468 else msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
470 fire_breath(GF_DISINTEGRATE, dir, damage, (plev > 35 ? 3 : 2));
473 if (!get_aim_dir(&dir)) return FALSE;
474 else msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball."));
476 fire_ball(GF_ACID, dir, damage, 2);
479 if (!get_aim_dir(&dir)) return FALSE;
480 else msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball."));
482 fire_ball(GF_ELEC, dir, damage, 2);
485 if (!get_aim_dir(&dir)) return FALSE;
486 else msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball."));
488 fire_ball(GF_FIRE, dir, damage, 2);
491 if (!get_aim_dir(&dir)) return FALSE;
492 else msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball."));
494 fire_ball(GF_COLD, dir, damage, 2);
497 if (!get_aim_dir(&dir)) return FALSE;
498 else msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud."));
500 fire_ball(GF_POIS, dir, damage, 2);
503 if (!get_aim_dir(&dir)) return FALSE;
504 else msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball."));
506 fire_ball(GF_NETHER, dir, damage, 2);
509 if (!get_aim_dir(&dir)) return FALSE;
510 else msg_print(_("流れるような身振りをした。", "You gesture fluidly."));
512 fire_ball(GF_WATER, dir, damage, 4);
515 if (!get_aim_dir(&dir)) return FALSE;
516 else msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm."));
518 fire_ball(GF_MANA, dir, damage, 4);
521 if (!get_aim_dir(&dir)) return FALSE;
522 else msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm."));
524 fire_ball(GF_DARK, dir, damage, 4);
527 if (!get_aim_dir(&dir)) return FALSE;
528 fire_ball_hide(GF_DRAIN_MANA, dir, randint1(plev*3)+plev, 0);
531 if (!get_aim_dir(&dir)) return FALSE;
532 fire_ball_hide(GF_MIND_BLAST, dir, damage, 0);
535 if (!get_aim_dir(&dir)) return FALSE;
536 fire_ball_hide(GF_BRAIN_SMASH, dir, damage, 0);
539 if (!get_aim_dir(&dir)) return FALSE;
540 fire_ball_hide(GF_CAUSE_1, dir, damage, 0);
543 if (!get_aim_dir(&dir)) return FALSE;
544 fire_ball_hide(GF_CAUSE_2, dir, damage, 0);
547 if (!get_aim_dir(&dir)) return FALSE;
548 fire_ball_hide(GF_CAUSE_3, dir, damage, 0);
551 if (!get_aim_dir(&dir)) return FALSE;
552 fire_ball_hide(GF_CAUSE_4, dir, damage, 0);
555 if (!get_aim_dir(&dir)) return FALSE;
556 else msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt."));
558 fire_bolt(GF_ACID, dir, damage);
561 if (!get_aim_dir(&dir)) return FALSE;
562 else msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt."));
564 fire_bolt(GF_ELEC, dir, damage);
567 if (!get_aim_dir(&dir)) return FALSE;
568 else msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt."));
570 fire_bolt(GF_FIRE, dir, damage);
573 if (!get_aim_dir(&dir)) return FALSE;
574 else msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt."));
576 fire_bolt(GF_COLD, dir, damage);
579 if (!get_aim_dir(&dir)) return FALSE;
580 else msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst."));
582 fire_ball(GF_LITE, dir, damage, 4);
585 if (!get_aim_dir(&dir)) return FALSE;
586 else msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt."));
588 fire_bolt(GF_NETHER, dir, damage);
591 if (!get_aim_dir(&dir)) return FALSE;
592 else msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt."));
594 fire_bolt(GF_WATER, dir, damage);
597 if (!get_aim_dir(&dir)) return FALSE;
598 else msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt."));
600 fire_bolt(GF_MANA, dir, damage);
603 if (!get_aim_dir(&dir)) return FALSE;
604 else msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt."));
606 fire_bolt(GF_PLASMA, dir, damage);
609 if (!get_aim_dir(&dir)) return FALSE;
610 else msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt."));
612 fire_bolt(GF_ICE, dir, damage);
614 case MS_MAGIC_MISSILE:
615 if (!get_aim_dir(&dir)) return FALSE;
616 else msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile."));
618 fire_bolt(GF_MISSILE, dir, damage);
621 if (!get_aim_dir(&dir)) return FALSE;
622 else msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion."));
624 fear_monster(dir, plev+10);
627 if (!get_aim_dir(&dir)) return FALSE;
628 confuse_monster(dir, plev * 2);
631 if (!get_aim_dir(&dir)) return FALSE;
632 else msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion."));
634 confuse_monster(dir, plev * 2);
637 if (!get_aim_dir(&dir)) return FALSE;
638 slow_monster(dir, plev);
641 if (!get_aim_dir(&dir)) return FALSE;
642 sleep_monster(dir, plev);
645 (void)set_fast(caster_ptr, randint1(20 + plev) + plev, FALSE);
649 if (!get_aim_dir(&dir)) return FALSE;
650 else msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
652 fire_ball_hide(GF_HAND_DOOM, dir, 200, 0);
656 msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
657 (void)hp_player(caster_ptr, plev*6);
658 (void)set_stun(caster_ptr, 0);
659 (void)set_cut(caster_ptr,0);
662 msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
663 (void)set_invuln(caster_ptr, randint1(7) + 7, FALSE);
666 teleport_player(10, 0L);
669 teleport_player(plev * 5, 0L);
672 (void)time_walk(caster_ptr);
680 GAME_TEXT m_name[MAX_NLEN];
682 if (!target_set(TARGET_KILL)) return FALSE;
683 if (!caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx) break;
684 if (!player_has_los_bold(target_row, target_col)) break;
685 if (!projectable(caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
686 m_ptr = &caster_ptr->current_floor_ptr->m_list[caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx];
687 r_ptr = &r_info[m_ptr->r_idx];
688 monster_desc(m_name, m_ptr, 0);
689 if (r_ptr->flagsr & RFR_RES_TELE)
691 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
693 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
694 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
698 else if (r_ptr->level > randint1(100))
700 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
701 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
706 msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
708 teleport_monster_to(caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx, caster_ptr->y, caster_ptr->x, 100, TELEPORT_PASSIVE);
712 if (!get_aim_dir(&dir)) return FALSE;
714 (void)fire_beam(GF_AWAY_ALL, dir, plev);
718 return teleport_level_other(caster_ptr);
722 if (!get_aim_dir(&dir)) return FALSE;
723 else msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
724 (void)fire_beam(GF_PSY_SPEAR, dir, damage);
728 msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
729 (void)unlite_area(10, 3);
733 if (!target_set(TARGET_KILL)) return FALSE;
734 msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackles evilly."));
735 trap_creation(target_row, target_col);
738 msg_print(_("しかし何も起きなかった。", "Nothing happen."));
741 msg_print(_("死者復活の呪文を唱えた。", "You cast a animate dead."));
742 (void)animate_dead(0, caster_ptr->y, caster_ptr->x);
747 if (!target_set(TARGET_KILL)) return FALSE;
749 msg_print(_("援軍を召喚した。", "You summon minions."));
750 for (k = 0;k < 4; k++)
752 (void)summon_kin_player(plev, target_row, target_col, (PM_FORCE_PET | PM_ALLOW_GROUP));
759 int max_cyber = (caster_ptr->current_floor_ptr->dun_level / 50) + randint1(3);
760 if (!target_set(TARGET_KILL)) return FALSE;
761 msg_print(_("サイバーデーモンを召喚した!", "You summon Cyberdemons!"));
762 if (max_cyber > 4) max_cyber = 4;
763 for (k = 0;k < max_cyber; k++)
764 summon_specific(-1, target_row, target_col, plev, SUMMON_CYBER, mode);
770 if (!target_set(TARGET_KILL)) return FALSE;
771 msg_print(_("仲間を召喚した。", "You summon help."));
772 for (k = 0;k < 1; k++)
773 summon_specific(-1, target_row, target_col, plev, 0, (mode | u_mode));
779 if (!target_set(TARGET_KILL)) return FALSE;
780 msg_print(_("モンスターを召喚した!", "You summon monsters!"));
781 for (k = 0; k < 6; k++)
782 summon_specific(-1, target_row, target_col, plev, 0, (mode | u_mode));
788 if (!target_set(TARGET_KILL)) return FALSE;
789 msg_print(_("アリを召喚した。", "You summon ants."));
790 for (k = 0; k < 6; k++)
791 summon_specific(-1, target_row, target_col, plev, SUMMON_ANT, mode);
797 if (!target_set(TARGET_KILL)) return FALSE;
798 msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
799 for (k = 0; k < 6; k++)
800 summon_specific(-1, target_row, target_col, plev, SUMMON_SPIDER, mode);
806 if (!target_set(TARGET_KILL)) return FALSE;
807 msg_print(_("ハウンドを召喚した。", "You summon hounds."));
808 for (k = 0; k < 4; k++)
809 summon_specific(-1, target_row, target_col, plev, SUMMON_HOUND, mode);
815 if (!target_set(TARGET_KILL)) return FALSE;
816 msg_print(_("ヒドラを召喚した。", "You summon hydras."));
817 for (k = 0; k < 4; k++)
818 summon_specific(-1, target_row, target_col, plev, SUMMON_HYDRA, mode);
824 if (!target_set(TARGET_KILL)) return FALSE;
825 msg_print(_("天使を召喚した!", "You summon angel!"));
826 for (k = 0; k < 1; k++)
827 summon_specific(-1, target_row, target_col, plev, SUMMON_ANGEL, mode);
833 if (!target_set(TARGET_KILL)) return FALSE;
834 msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
835 for (k = 0; k < 1; k++)
836 summon_specific(-1, target_row, target_col, plev, SUMMON_DEMON, (mode | u_mode));
842 if (!target_set(TARGET_KILL)) return FALSE;
843 msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
844 for (k = 0; k < 1; k++)
845 summon_specific(-1, target_row, target_col, plev, SUMMON_UNDEAD, (mode | u_mode));
851 if (!target_set(TARGET_KILL)) return FALSE;
852 msg_print(_("ドラゴンを召喚した!", "You summon dragon!"));
853 for (k = 0; k < 1; k++)
854 summon_specific(-1, target_row, target_col, plev, SUMMON_DRAGON, (mode | u_mode));
860 if (!target_set(TARGET_KILL)) return FALSE;
861 msg_print(_("強力なアンデッドを召喚した!", "You summon greater undead!"));
862 for (k = 0; k < 6; k++)
863 summon_specific(-1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
869 if (!target_set(TARGET_KILL)) return FALSE;
870 msg_print(_("古代ドラゴンを召喚した!", "You summon ancient dragons!"));
871 for (k = 0; k < 4; k++)
872 summon_specific(-1, target_row, target_col, plev, SUMMON_HI_DRAGON, (mode | u_mode));
878 if (!target_set(TARGET_KILL)) return FALSE;
879 msg_print(_("アンバーの王族を召喚した!", "You summon Lords of Amber!"));
880 for (k = 0; k < 4; k++)
881 summon_specific(-1, target_row, target_col, plev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
887 if (!target_set(TARGET_KILL)) return FALSE;
888 msg_print(_("特別な強敵を召喚した!", "You summon special opponents!"));
889 for (k = 0;k < 4; k++)
890 if (summon_specific(-1, target_row, target_col, plev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE))) count++;
891 for (k = count;k < 4; k++)
892 summon_specific(-1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
904 * @brief ものまねコマンドのメインルーチン /
905 * do_cmd_cast calls this function if the player's class is 'imitator'.
906 * @param baigaesi TRUEならば倍返し上の処理として行う
907 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
909 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
910 * If the user hits escape, returns FALSE, and set '*sn' to -1
911 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
913 * The "prompt" should be "cast", "recite", or "study"
914 * The "known" should be TRUE for cast/pray, FALSE for study
916 * nb: This function has a (trivial) display bug which will be obvious
917 * when you run it. It's probably easy to fix but I haven't tried,
920 bool do_cmd_mane(player_type *creature_ptr, bool baigaesi)
924 PERCENTAGE minfail = 0;
925 PLAYER_LEVEL plev = creature_ptr->lev;
929 if (cmd_limit_confused(creature_ptr)) return FALSE;
931 if (!creature_ptr->mane_num)
933 msg_print(_("まねられるものが何もない!", "You don't remember any action!"));
937 if (!get_mane_power(creature_ptr, &n, baigaesi)) return FALSE;
939 spell = monster_powers[creature_ptr->mane_spell[n]];
941 /* Spell failure chance */
942 chance = spell.manefail;
944 /* Reduce failure rate by "effective" level adjustment */
945 if (plev > spell.level) chance -= 3 * (plev - spell.level);
947 /* Reduce failure rate by 1 stat and DEX adjustment */
948 chance -= 3 * (adj_mag_stat[creature_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[creature_ptr->stat_ind[A_DEX]] - 2) / 2;
950 if (spell.manedam) chance = chance * damage / spell.manedam;
952 chance += creature_ptr->to_m_chance;
954 /* Extract the minimum failure rate */
955 minfail = adj_mag_fail[creature_ptr->stat_ind[spell.use_stat]];
957 /* Minimum failure rate */
958 if (chance < minfail) chance = minfail;
960 /* Stunning makes spells harder */
961 if (creature_ptr->stun > 50) chance += 25;
962 else if (creature_ptr->stun) chance += 15;
964 /* Always a 5 percent chance of working */
965 if (chance > 95) chance = 95;
968 if (randint0(100) < chance)
970 if (flush_failure) flush();
971 msg_print(_("ものまねに失敗した!", "You failed to concentrate hard enough!"));
977 cast = use_mane(creature_ptr, creature_ptr->mane_spell[n]);
978 if (!cast) return FALSE;
981 creature_ptr->mane_num--;
982 for (j = n; j < creature_ptr->mane_num;j++)
984 creature_ptr->mane_spell[j] = creature_ptr->mane_spell[j+1];
985 creature_ptr->mane_dam[j] = creature_ptr->mane_dam[j+1];
988 take_turn(creature_ptr, 100);
990 creature_ptr->redraw |= (PR_IMITATION);
991 creature_ptr->window |= (PW_PLAYER);
992 creature_ptr->window |= (PW_SPELL);