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(player_type *caster_ptr, char *p, int power, HIT_POINT dam)
43 PLAYER_LEVEL plev = caster_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(caster_ptr, 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);
246 handle_stuff(caster_ptr);
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 caster_ptr プレーヤーへの参照ポインタ
265 * @param spell 発動するモンスター攻撃のID
266 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
268 static bool use_mane(player_type *caster_ptr, int spell)
271 PLAYER_LEVEL plev = caster_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(caster_ptr, 0);
294 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
295 m_idx = caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
297 if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
298 if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
299 dispel_monster_status(caster_ptr, m_idx);
304 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
305 else msg_print(_("ロケットを発射した。", "You fire a rocket."));
306 fire_rocket(caster_ptr, GF_ROCKET, dir, damage, 2);
310 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
311 else msg_print(_("矢を放った。", "You fire an arrow."));
312 fire_bolt(caster_ptr, GF_ARROW, dir, damage);
325 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
326 else msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
327 fire_breath(caster_ptr, GF_ACID, dir, damage, (plev > 35 ? 3 : 2));
331 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
332 else msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
333 fire_breath(caster_ptr, GF_ELEC, dir, damage, (plev > 35 ? 3 : 2));
337 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
338 else msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
339 fire_breath(caster_ptr, GF_FIRE, dir, damage, (plev > 35 ? 3 : 2));
343 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
344 else msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
345 fire_breath(caster_ptr, GF_COLD, dir, damage, (plev > 35 ? 3 : 2));
349 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
350 else msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
351 fire_breath(caster_ptr, GF_POIS, dir, damage, (plev > 35 ? 3 : 2));
355 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
356 else msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
357 fire_breath(caster_ptr, GF_NETHER, dir, damage, (plev > 35 ? 3 : 2));
361 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
362 else msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
363 fire_breath(caster_ptr, GF_LITE, dir, damage, (plev > 35 ? 3 : 2));
367 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
368 else msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
369 fire_breath(caster_ptr, GF_DARK, dir, damage, (plev > 35 ? 3 : 2));
373 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
374 else msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
375 fire_breath(caster_ptr, GF_CONFUSION, dir, damage, (plev > 35 ? 3 : 2));
379 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
380 else msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
381 fire_breath(caster_ptr, GF_SOUND, dir, damage, (plev > 35 ? 3 : 2));
385 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
386 else msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
387 fire_breath(caster_ptr, GF_CHAOS, dir, damage, (plev > 35 ? 3 : 2));
391 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
392 else msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
393 fire_breath(caster_ptr, GF_DISENCHANT, dir, damage, (plev > 35 ? 3 : 2));
397 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
398 else msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
399 fire_breath(caster_ptr, GF_NEXUS, dir, damage, (plev > 35 ? 3 : 2));
403 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
404 else msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
405 fire_breath(caster_ptr, GF_TIME, dir, damage, (plev > 35 ? 3 : 2));
409 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
410 else msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
411 fire_breath(caster_ptr, GF_INERTIAL, dir, damage, (plev > 35 ? 3 : 2));
415 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
416 else msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
417 fire_breath(caster_ptr, GF_GRAVITY, dir, damage, (plev > 35 ? 3 : 2));
421 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
422 else msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
423 fire_breath(caster_ptr, GF_SHARDS, dir, damage, (plev > 35 ? 3 : 2));
427 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
428 else msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
430 fire_breath(caster_ptr, GF_PLASMA, dir, damage, (plev > 35 ? 3 : 2));
434 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
435 else msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
437 fire_breath(caster_ptr, GF_FORCE, dir, damage, (plev > 35 ? 3 : 2));
441 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
442 else msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
444 fire_breath(caster_ptr, GF_MANA, dir, damage, (plev > 35 ? 3 : 2));
448 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
449 else msg_print(_("放射能球を放った。", "You cast a ball of radiation."));
451 fire_ball(caster_ptr, GF_NUKE, dir, damage, 2);
455 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
456 else msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
458 fire_breath(caster_ptr, GF_NUKE, dir, damage, (plev > 35 ? 3 : 2));
462 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
463 else msg_print(_("純ログルスを放った。", "You invoke a raw Logrus."));
465 fire_ball(caster_ptr, GF_CHAOS, dir, damage, 4);
468 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
469 else msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
471 fire_breath(caster_ptr, GF_DISINTEGRATE, dir, damage, (plev > 35 ? 3 : 2));
474 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
475 else msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball."));
477 fire_ball(caster_ptr, GF_ACID, dir, damage, 2);
480 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
481 else msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball."));
483 fire_ball(caster_ptr, GF_ELEC, dir, damage, 2);
486 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
487 else msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball."));
489 fire_ball(caster_ptr, GF_FIRE, dir, damage, 2);
492 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
493 else msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball."));
495 fire_ball(caster_ptr, GF_COLD, dir, damage, 2);
498 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
499 else msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud."));
501 fire_ball(caster_ptr, GF_POIS, dir, damage, 2);
504 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
505 else msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball."));
507 fire_ball(caster_ptr, GF_NETHER, dir, damage, 2);
510 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
511 else msg_print(_("流れるような身振りをした。", "You gesture fluidly."));
513 fire_ball(caster_ptr, GF_WATER, dir, damage, 4);
516 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
517 else msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm."));
519 fire_ball(caster_ptr, GF_MANA, dir, damage, 4);
522 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
523 else msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm."));
525 fire_ball(caster_ptr, GF_DARK, dir, damage, 4);
528 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
529 fire_ball_hide(caster_ptr, GF_DRAIN_MANA, dir, randint1(plev*3)+plev, 0);
532 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
533 fire_ball_hide(caster_ptr, GF_MIND_BLAST, dir, damage, 0);
536 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
537 fire_ball_hide(caster_ptr, GF_BRAIN_SMASH, dir, damage, 0);
540 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
541 fire_ball_hide(caster_ptr, GF_CAUSE_1, dir, damage, 0);
544 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
545 fire_ball_hide(caster_ptr, GF_CAUSE_2, dir, damage, 0);
548 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
549 fire_ball_hide(caster_ptr, GF_CAUSE_3, dir, damage, 0);
552 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
553 fire_ball_hide(caster_ptr, GF_CAUSE_4, dir, damage, 0);
556 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
557 else msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt."));
559 fire_bolt(caster_ptr, GF_ACID, dir, damage);
562 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
563 else msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt."));
565 fire_bolt(caster_ptr, GF_ELEC, dir, damage);
568 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
569 else msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt."));
571 fire_bolt(caster_ptr, GF_FIRE, dir, damage);
574 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
575 else msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt."));
577 fire_bolt(caster_ptr, GF_COLD, dir, damage);
580 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
581 else msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst."));
583 fire_ball(caster_ptr, GF_LITE, dir, damage, 4);
586 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
587 else msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt."));
589 fire_bolt(caster_ptr, GF_NETHER, dir, damage);
592 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
593 else msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt."));
595 fire_bolt(caster_ptr, GF_WATER, dir, damage);
598 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
599 else msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt."));
601 fire_bolt(caster_ptr, GF_MANA, dir, damage);
604 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
605 else msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt."));
607 fire_bolt(caster_ptr, GF_PLASMA, dir, damage);
610 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
611 else msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt."));
613 fire_bolt(caster_ptr, GF_ICE, dir, damage);
615 case MS_MAGIC_MISSILE:
616 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
617 else msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile."));
619 fire_bolt(caster_ptr, GF_MISSILE, dir, damage);
622 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
623 else msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion."));
625 fear_monster(caster_ptr, dir, plev+10);
628 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
629 confuse_monster(caster_ptr, dir, plev * 2);
632 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
633 else msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion."));
635 confuse_monster(caster_ptr, dir, plev * 2);
638 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
639 slow_monster(caster_ptr, dir, plev);
642 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
643 sleep_monster(caster_ptr, dir, plev);
646 (void)set_fast(caster_ptr, randint1(20 + plev) + plev, FALSE);
650 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
651 else msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
653 fire_ball_hide(caster_ptr, GF_HAND_DOOM, dir, 200, 0);
657 msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
658 (void)hp_player(caster_ptr, plev*6);
659 (void)set_stun(caster_ptr, 0);
660 (void)set_cut(caster_ptr,0);
663 msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
664 (void)set_invuln(caster_ptr, randint1(7) + 7, FALSE);
667 teleport_player(caster_ptr, 10, 0L);
670 teleport_player(caster_ptr, plev * 5, 0L);
673 (void)time_walk(caster_ptr);
681 GAME_TEXT m_name[MAX_NLEN];
683 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
684 if (!caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx) break;
685 if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
686 if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
687 m_ptr = &caster_ptr->current_floor_ptr->m_list[caster_ptr->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(caster_ptr, caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx, caster_ptr->y, caster_ptr->x, 100, TELEPORT_PASSIVE);
713 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
715 (void)fire_beam(caster_ptr, GF_AWAY_ALL, dir, plev);
719 return teleport_level_other(caster_ptr);
723 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
724 else msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
725 (void)fire_beam(caster_ptr, GF_PSY_SPEAR, dir, damage);
729 msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
730 (void)unlite_area(caster_ptr, 10, 3);
734 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
735 msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackles evilly."));
736 trap_creation(caster_ptr, target_row, target_col);
739 msg_print(_("しかし何も起きなかった。", "Nothing happen."));
742 msg_print(_("死者復活の呪文を唱えた。", "You cast a animate dead."));
743 (void)animate_dead(caster_ptr, 0, caster_ptr->y, caster_ptr->x);
748 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
750 msg_print(_("援軍を召喚した。", "You summon minions."));
751 for (k = 0;k < 4; k++)
753 (void)summon_kin_player(caster_ptr, plev, target_row, target_col, (PM_FORCE_PET | PM_ALLOW_GROUP));
760 int max_cyber = (caster_ptr->current_floor_ptr->dun_level / 50) + randint1(3);
761 if (!target_set(caster_ptr, 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(caster_ptr, -1, target_row, target_col, plev, SUMMON_CYBER, mode);
771 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
772 msg_print(_("仲間を召喚した。", "You summon help."));
773 for (k = 0;k < 1; k++)
774 summon_specific(caster_ptr, -1, target_row, target_col, plev, 0, (mode | u_mode));
780 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
781 msg_print(_("モンスターを召喚した!", "You summon monsters!"));
782 for (k = 0; k < 6; k++)
783 summon_specific(caster_ptr, -1, target_row, target_col, plev, 0, (mode | u_mode));
789 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
790 msg_print(_("アリを召喚した。", "You summon ants."));
791 for (k = 0; k < 6; k++)
792 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_ANT, mode);
798 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
799 msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
800 for (k = 0; k < 6; k++)
801 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_SPIDER, mode);
807 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
808 msg_print(_("ハウンドを召喚した。", "You summon hounds."));
809 for (k = 0; k < 4; k++)
810 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HOUND, mode);
816 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
817 msg_print(_("ヒドラを召喚した。", "You summon hydras."));
818 for (k = 0; k < 4; k++)
819 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HYDRA, mode);
825 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
826 msg_print(_("天使を召喚した!", "You summon angel!"));
827 for (k = 0; k < 1; k++)
828 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_ANGEL, mode);
834 if (!target_set(caster_ptr, 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(caster_ptr, -1, target_row, target_col, plev, SUMMON_DEMON, (mode | u_mode));
843 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
844 msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
845 for (k = 0; k < 1; k++)
846 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_UNDEAD, (mode | u_mode));
852 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
853 msg_print(_("ドラゴンを召喚した!", "You summon dragon!"));
854 for (k = 0; k < 1; k++)
855 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_DRAGON, (mode | u_mode));
861 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
862 msg_print(_("強力なアンデッドを召喚した!", "You summon greater undead!"));
863 for (k = 0; k < 6; k++)
864 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
870 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
871 msg_print(_("古代ドラゴンを召喚した!", "You summon ancient dragons!"));
872 for (k = 0; k < 4; k++)
873 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_DRAGON, (mode | u_mode));
879 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
880 msg_print(_("アンバーの王族を召喚した!", "You summon Lords of Amber!"));
881 for (k = 0; k < 4; k++)
882 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
888 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
889 msg_print(_("特別な強敵を召喚した!", "You summon special opponents!"));
890 for (k = 0;k < 4; k++)
891 if (summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE))) count++;
892 for (k = count;k < 4; k++)
893 summon_specific(caster_ptr, -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(player_type *creature_ptr, bool baigaesi)
925 PERCENTAGE minfail = 0;
926 PLAYER_LEVEL plev = creature_ptr->lev;
930 if (cmd_limit_confused(creature_ptr)) return FALSE;
932 if (!creature_ptr->mane_num)
934 msg_print(_("まねられるものが何もない!", "You don't remember any action!"));
938 if (!get_mane_power(creature_ptr, &n, baigaesi)) return FALSE;
940 spell = monster_powers[creature_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[creature_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[creature_ptr->stat_ind[A_DEX]] - 2) / 2;
951 if (spell.manedam) chance = chance * damage / spell.manedam;
953 chance += creature_ptr->to_m_chance;
955 /* Extract the minimum failure rate */
956 minfail = adj_mag_fail[creature_ptr->stat_ind[spell.use_stat]];
958 /* Minimum failure rate */
959 if (chance < minfail) chance = minfail;
961 /* Stunning makes spells harder */
962 if (creature_ptr->stun > 50) chance += 25;
963 else if (creature_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(creature_ptr, creature_ptr->mane_spell[n]);
979 if (!cast) return FALSE;
982 creature_ptr->mane_num--;
983 for (j = n; j < creature_ptr->mane_num;j++)
985 creature_ptr->mane_spell[j] = creature_ptr->mane_spell[j+1];
986 creature_ptr->mane_dam[j] = creature_ptr->mane_dam[j+1];
989 take_turn(creature_ptr, 100);
991 creature_ptr->redraw |= (PR_IMITATION);
992 creature_ptr->window |= (PW_PLAYER);
993 creature_ptr->window |= (PW_SPELL);