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
13 #include "cmd-action/cmd-spell.h"
14 #include "cmd/cmd-basic.h"
15 #include "core/stuff-handler.h"
16 #include "floor/floor.h"
17 #include "grid/grid.h"
18 #include "io/targeting.h"
19 #include "main/sound-definitions-table.h"
20 #include "monster/monster-process.h"
21 #include "monster/monster-status.h"
22 #include "monster/place-monster-types.h"
23 #include "mspell/monster-spell.h"
24 #include "mspell/mspell-type.h"
25 #include "player/player-effects.h"
26 #include "player/player-status.h"
27 #include "spell-kind/spells-launcher.h"
28 #include "spell-kind/spells-lite.h"
29 #include "spell-kind/spells-neighbor.h"
30 #include "spell-kind/spells-sight.h"
31 #include "spell/spells-status.h"
32 #include "spell/spells-summon.h"
33 #include "spell-kind/spells-teleport.h"
34 #include "spell/spells-type.h"
35 #include "util/util.h"
36 #include "view/display-main-window.h"
41 * @brief 受け取ったパラメータに応じてものまねの効果情報をまとめたフォーマットを返す
42 * @param p 情報を返す文字列参照ポインタ
43 * @param power ものまねの効力の種類
47 static void mane_info(player_type *caster_ptr, char *p, int power, HIT_POINT dam)
49 PLAYER_LEVEL plev = caster_ptr->lev;
53 if ((power > 2 && power < 41) || (power > 41 && power < 59) || (power == 75))
54 sprintf(p, " %s%d", KWD_DAM, (int)dam);
60 sprintf(p, " %sd%d+%d", KWD_HEAL, plev * 3, plev);
63 sprintf(p, " %sd%d+%d", KWD_DURATION, 20+plev, plev);
66 sprintf(p, " %s%d", KWD_HEAL, plev*6);
69 sprintf(p, " %sd7+7", KWD_DURATION);
72 sprintf(p, " %s10", KWD_SPHERE);
75 sprintf(p, " %s%d", KWD_SPHERE, plev * 5);
78 sprintf(p, " %s5", KWD_SPHERE);
88 * @brief どのものまねを発動するか選択する処理 /
89 * Allow user to choose a imitation.
90 * @param sn 実行したものまねのIDを返す参照ポインタ(キャンセルなどの場合-1を返す)
91 * @param baigaesi TRUEならば倍返し上の処理として行う
92 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
94 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
95 * If the user hits escape, returns FALSE, and set '*sn' to -1
96 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
98 * The "prompt" should be "cast", "recite", or "study"
99 * The "known" should be TRUE for cast/pray, FALSE for study
101 * nb: This function has a (trivial) display bug which will be obvious
102 * when you run it. It's probably easy to fix but I haven't tried,
105 static int get_mane_power(player_type *caster_ptr, int *sn, bool baigaesi)
111 PERCENTAGE minfail = 0;
112 PLAYER_LEVEL plev = caster_ptr->lev;
113 PERCENTAGE chance = 0;
118 concptr p = _("能力", "power");
123 /* Assume cancelled */
129 num = caster_ptr->mane_num;
131 /* Build a prompt (accept all spells) */
132 (void)strnfmt(out_val, 78,
133 _("(%c-%c, '*'で一覧, ESC) どの%sをまねますか?", "(%c-%c, *=List, ESC=exit) Use which %s? "),
134 I2A(0), I2A(num - 1), p);
136 choice= always_show_list ? ESCAPE:1 ;
139 if(choice==ESCAPE) choice = ' ';
140 else if( !get_com(out_val, &choice, TRUE) )break;
143 if ((choice == ' ') || (choice == '*') || (choice == '?'))
152 /* Display a list of spells */
154 put_str(_("名前", "Name"), y, x + 5);
155 put_str(_("失率 効果", "Fail Info"), y, x + 36);
158 /* Dump the spells */
159 for (i = 0; i < num; i++)
161 /* Access the spell */
162 spell = monster_powers[caster_ptr->mane_spell[i]];
164 chance = spell.manefail;
166 /* Reduce failure rate by "effective" level adjustment */
167 if (plev > spell.level) chance -= 3 * (plev - spell.level);
169 /* Reduce failure rate by INT/WIS adjustment */
170 chance -= 3 * (adj_mag_stat[caster_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[caster_ptr->stat_ind[A_DEX]] - 2) / 2;
172 if (spell.manedam) chance = chance * (baigaesi ? caster_ptr->mane_dam[i] * 2 : caster_ptr->mane_dam[i]) / spell.manedam;
174 chance += caster_ptr->to_m_chance;
176 /* Extract the minimum failure rate */
177 minfail = adj_mag_fail[caster_ptr->stat_ind[spell.use_stat]];
179 /* Minimum failure rate */
180 if (chance < minfail) chance = minfail;
182 /* Stunning makes spells harder */
183 if (caster_ptr->stun > 50) chance += 25;
184 else if (caster_ptr->stun) chance += 15;
186 /* Always a 5 percent chance of working */
187 if (chance > 95) chance = 95;
190 mane_info(caster_ptr, comment, caster_ptr->mane_spell[i], (baigaesi ? caster_ptr->mane_dam[i]*2 : caster_ptr->mane_dam[i]));
192 /* Dump the spell --(-- */
193 sprintf(psi_desc, " %c) %-30s %3d%%%s",
196 prt(psi_desc, y + i + 1, x);
199 /* Clear the bottom line */
200 prt("", y + i + 1, x);
216 ask = isupper(choice);
219 if (ask) choice = (char)tolower(choice);
221 /* Extract request */
222 i = (islower(choice) ? A2I(choice) : -1);
224 /* Totally Illegal */
225 if ((i < 0) || (i >= num))
231 /* Save the spell index */
232 spell = monster_powers[caster_ptr->mane_spell[i]];
240 (void) strnfmt(tmp_val, 78, _("%sをまねますか?", "Use %s? "), monster_powers[caster_ptr->mane_spell[i]].name);
242 /* Belay that order */
243 if (!get_check(tmp_val)) continue;
249 if (redraw) screen_load();
251 caster_ptr->window |= (PW_SPELL);
252 handle_stuff(caster_ptr);
254 /* Abort if needed */
255 if (!flag) return FALSE;
257 /* Save the choice */
260 damage = (baigaesi ? caster_ptr->mane_dam[i]*2 : caster_ptr->mane_dam[i]);
269 * do_cmd_cast calls this function if the player's class is 'imitator'.
270 * @param caster_ptr プレーヤーへの参照ポインタ
271 * @param spell 発動するモンスター攻撃のID
272 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
274 static bool use_mane(player_type *caster_ptr, int spell)
277 PLAYER_LEVEL plev = caster_ptr->lev;
278 BIT_FLAGS mode = (PM_ALLOW_GROUP | PM_FORCE_PET);
279 BIT_FLAGS u_mode = 0L;
281 if (randint1(50+plev) < plev/10) u_mode = PM_ALLOW_UNIQUE;
289 msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
290 aggravate_monsters(caster_ptr, 0);
300 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
301 m_idx = caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
303 if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
304 if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
305 dispel_monster_status(caster_ptr, m_idx);
310 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
311 else msg_print(_("ロケットを発射した。", "You fire a rocket."));
312 fire_rocket(caster_ptr, GF_ROCKET, dir, damage, 2);
316 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
317 else msg_print(_("矢を放った。", "You fire an arrow."));
318 fire_bolt(caster_ptr, GF_ARROW, dir, damage);
331 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
332 else msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
333 fire_breath(caster_ptr, GF_ACID, dir, damage, (plev > 35 ? 3 : 2));
337 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
338 else msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
339 fire_breath(caster_ptr, GF_ELEC, dir, damage, (plev > 35 ? 3 : 2));
343 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
344 else msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
345 fire_breath(caster_ptr, GF_FIRE, dir, damage, (plev > 35 ? 3 : 2));
349 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
350 else msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
351 fire_breath(caster_ptr, GF_COLD, dir, damage, (plev > 35 ? 3 : 2));
355 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
356 else msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
357 fire_breath(caster_ptr, GF_POIS, dir, damage, (plev > 35 ? 3 : 2));
361 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
362 else msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
363 fire_breath(caster_ptr, GF_NETHER, dir, damage, (plev > 35 ? 3 : 2));
367 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
368 else msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
369 fire_breath(caster_ptr, GF_LITE, dir, damage, (plev > 35 ? 3 : 2));
373 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
374 else msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
375 fire_breath(caster_ptr, GF_DARK, dir, damage, (plev > 35 ? 3 : 2));
379 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
380 else msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
381 fire_breath(caster_ptr, GF_CONFUSION, dir, damage, (plev > 35 ? 3 : 2));
385 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
386 else msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
387 fire_breath(caster_ptr, GF_SOUND, dir, damage, (plev > 35 ? 3 : 2));
391 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
392 else msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
393 fire_breath(caster_ptr, GF_CHAOS, dir, damage, (plev > 35 ? 3 : 2));
397 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
398 else msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
399 fire_breath(caster_ptr, GF_DISENCHANT, dir, damage, (plev > 35 ? 3 : 2));
403 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
404 else msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
405 fire_breath(caster_ptr, GF_NEXUS, dir, damage, (plev > 35 ? 3 : 2));
409 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
410 else msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
411 fire_breath(caster_ptr, GF_TIME, dir, damage, (plev > 35 ? 3 : 2));
415 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
416 else msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
417 fire_breath(caster_ptr, GF_INERTIAL, dir, damage, (plev > 35 ? 3 : 2));
421 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
422 else msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
423 fire_breath(caster_ptr, GF_GRAVITY, dir, damage, (plev > 35 ? 3 : 2));
427 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
428 else msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
429 fire_breath(caster_ptr, GF_SHARDS, dir, damage, (plev > 35 ? 3 : 2));
433 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
434 else msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
436 fire_breath(caster_ptr, GF_PLASMA, dir, damage, (plev > 35 ? 3 : 2));
440 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
441 else msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
443 fire_breath(caster_ptr, GF_FORCE, dir, damage, (plev > 35 ? 3 : 2));
447 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
448 else msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
450 fire_breath(caster_ptr, GF_MANA, dir, damage, (plev > 35 ? 3 : 2));
454 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
455 else msg_print(_("放射能球を放った。", "You cast a ball of radiation."));
457 fire_ball(caster_ptr, GF_NUKE, dir, damage, 2);
461 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
462 else msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
464 fire_breath(caster_ptr, GF_NUKE, dir, damage, (plev > 35 ? 3 : 2));
468 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
469 else msg_print(_("純ログルスを放った。", "You invoke a raw Logrus."));
471 fire_ball(caster_ptr, GF_CHAOS, dir, damage, 4);
474 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
475 else msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
477 fire_breath(caster_ptr, GF_DISINTEGRATE, dir, damage, (plev > 35 ? 3 : 2));
480 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
481 else msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball."));
483 fire_ball(caster_ptr, GF_ACID, dir, damage, 2);
486 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
487 else msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball."));
489 fire_ball(caster_ptr, GF_ELEC, dir, damage, 2);
492 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
493 else msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball."));
495 fire_ball(caster_ptr, GF_FIRE, dir, damage, 2);
498 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
499 else msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball."));
501 fire_ball(caster_ptr, GF_COLD, dir, damage, 2);
504 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
505 else msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud."));
507 fire_ball(caster_ptr, GF_POIS, dir, damage, 2);
510 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
511 else msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball."));
513 fire_ball(caster_ptr, GF_NETHER, dir, damage, 2);
516 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
517 else msg_print(_("流れるような身振りをした。", "You gesture fluidly."));
519 fire_ball(caster_ptr, GF_WATER, dir, damage, 4);
522 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
523 else msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm."));
525 fire_ball(caster_ptr, GF_MANA, dir, damage, 4);
528 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
529 else msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm."));
531 fire_ball(caster_ptr, GF_DARK, dir, damage, 4);
534 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
535 fire_ball_hide(caster_ptr, GF_DRAIN_MANA, dir, randint1(plev*3)+plev, 0);
538 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
539 fire_ball_hide(caster_ptr, GF_MIND_BLAST, dir, damage, 0);
542 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
543 fire_ball_hide(caster_ptr, GF_BRAIN_SMASH, dir, damage, 0);
546 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
547 fire_ball_hide(caster_ptr, GF_CAUSE_1, dir, damage, 0);
550 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
551 fire_ball_hide(caster_ptr, GF_CAUSE_2, dir, damage, 0);
554 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
555 fire_ball_hide(caster_ptr, GF_CAUSE_3, dir, damage, 0);
558 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
559 fire_ball_hide(caster_ptr, GF_CAUSE_4, dir, damage, 0);
562 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
563 else msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt."));
565 fire_bolt(caster_ptr, GF_ACID, dir, damage);
568 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
569 else msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt."));
571 fire_bolt(caster_ptr, GF_ELEC, dir, damage);
574 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
575 else msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt."));
577 fire_bolt(caster_ptr, GF_FIRE, dir, damage);
580 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
581 else msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt."));
583 fire_bolt(caster_ptr, GF_COLD, dir, damage);
586 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
587 else msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst."));
589 fire_ball(caster_ptr, GF_LITE, dir, damage, 4);
592 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
593 else msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt."));
595 fire_bolt(caster_ptr, GF_NETHER, dir, damage);
598 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
599 else msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt."));
601 fire_bolt(caster_ptr, GF_WATER, dir, damage);
604 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
605 else msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt."));
607 fire_bolt(caster_ptr, GF_MANA, dir, damage);
610 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
611 else msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt."));
613 fire_bolt(caster_ptr, GF_PLASMA, dir, damage);
616 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
617 else msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt."));
619 fire_bolt(caster_ptr, GF_ICE, dir, damage);
621 case MS_MAGIC_MISSILE:
622 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
623 else msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile."));
625 fire_bolt(caster_ptr, GF_MISSILE, dir, damage);
628 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
629 else msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion."));
631 fear_monster(caster_ptr, dir, plev+10);
634 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
635 confuse_monster(caster_ptr, dir, plev * 2);
638 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
639 else msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion."));
641 confuse_monster(caster_ptr, dir, plev * 2);
644 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
645 slow_monster(caster_ptr, dir, plev);
648 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
649 sleep_monster(caster_ptr, dir, plev);
652 (void)set_fast(caster_ptr, randint1(20 + plev) + plev, FALSE);
656 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
657 else msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
659 fire_ball_hide(caster_ptr, GF_HAND_DOOM, dir, 200, 0);
663 msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
664 (void)hp_player(caster_ptr, plev*6);
665 (void)set_stun(caster_ptr, 0);
666 (void)set_cut(caster_ptr,0);
669 msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
670 (void)set_invuln(caster_ptr, randint1(7) + 7, FALSE);
673 teleport_player(caster_ptr, 10, TELEPORT_SPONTANEOUS);
676 teleport_player(caster_ptr, plev * 5, TELEPORT_SPONTANEOUS);
679 (void)time_walk(caster_ptr);
687 GAME_TEXT m_name[MAX_NLEN];
689 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
690 if (!caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx) break;
691 if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
692 if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
693 m_ptr = &caster_ptr->current_floor_ptr->m_list[caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx];
694 r_ptr = &r_info[m_ptr->r_idx];
695 monster_desc(caster_ptr, m_name, m_ptr, 0);
696 if (r_ptr->flagsr & RFR_RES_TELE)
698 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
700 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
701 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
705 else if (r_ptr->level > randint1(100))
707 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
708 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
713 msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
715 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);
719 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
721 (void)fire_beam(caster_ptr, GF_AWAY_ALL, dir, plev);
725 return teleport_level_other(caster_ptr);
729 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
730 else msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
731 (void)fire_beam(caster_ptr, GF_PSY_SPEAR, dir, damage);
735 msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
736 (void)unlite_area(caster_ptr, 10, 3);
740 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
741 msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackle evilly."));
742 trap_creation(caster_ptr, target_row, target_col);
745 msg_print(_("しかし何も起きなかった。", "Nothing happen."));
748 msg_print(_("死者復活の呪文を唱えた。", "You animate the dead."));
749 (void)animate_dead(caster_ptr, 0, caster_ptr->y, caster_ptr->x);
754 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
756 msg_print(_("援軍を召喚した。", "You summon minions."));
757 for (k = 0;k < 4; k++)
759 (void)summon_kin_player(caster_ptr, plev, target_row, target_col, (PM_FORCE_PET | PM_ALLOW_GROUP));
766 int max_cyber = (caster_ptr->current_floor_ptr->dun_level / 50) + randint1(3);
767 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
768 msg_print(_("サイバーデーモンを召喚した!", "You summon Cyberdemons!"));
769 if (max_cyber > 4) max_cyber = 4;
770 for (k = 0;k < max_cyber; k++)
771 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_CYBER, mode);
777 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
778 msg_print(_("仲間を召喚した。", "You summon help."));
779 for (k = 0;k < 1; k++)
780 summon_specific(caster_ptr, -1, target_row, target_col, plev, 0, (mode | u_mode));
786 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
787 msg_print(_("モンスターを召喚した!", "You summon monsters!"));
788 for (k = 0; k < 6; k++)
789 summon_specific(caster_ptr, -1, target_row, target_col, plev, 0, (mode | u_mode));
795 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
796 msg_print(_("アリを召喚した。", "You summon ants."));
797 for (k = 0; k < 6; k++)
798 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_ANT, mode);
804 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
805 msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
806 for (k = 0; k < 6; k++)
807 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_SPIDER, mode);
813 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
814 msg_print(_("ハウンドを召喚した。", "You summon hounds."));
815 for (k = 0; k < 4; k++)
816 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HOUND, mode);
822 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
823 msg_print(_("ヒドラを召喚した。", "You summon hydras."));
824 for (k = 0; k < 4; k++)
825 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HYDRA, mode);
831 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
832 msg_print(_("天使を召喚した!", "You summon an angel!"));
833 for (k = 0; k < 1; k++)
834 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_ANGEL, mode);
840 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
841 msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
842 for (k = 0; k < 1; k++)
843 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_DEMON, (mode | u_mode));
849 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
850 msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
851 for (k = 0; k < 1; k++)
852 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_UNDEAD, (mode | u_mode));
858 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
859 msg_print(_("ドラゴンを召喚した!", "You summon a dragon!"));
860 for (k = 0; k < 1; k++)
861 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_DRAGON, (mode | u_mode));
867 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
868 msg_print(_("強力なアンデッドを召喚した!", "You summon greater undead!"));
869 for (k = 0; k < 6; k++)
870 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
876 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
877 msg_print(_("古代ドラゴンを召喚した!", "You summon ancient dragons!"));
878 for (k = 0; k < 4; k++)
879 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_DRAGON, (mode | u_mode));
885 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
886 msg_print(_("アンバーの王族を召喚した!", "You summon Lords of Amber!"));
887 for (k = 0; k < 4; k++)
888 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
894 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
895 msg_print(_("特別な強敵を召喚した!", "You summon special opponents!"));
896 for (k = 0;k < 4; k++)
897 if (summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE))) count++;
898 for (k = count;k < 4; k++)
899 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
911 * @brief ものまねコマンドのメインルーチン /
912 * do_cmd_cast calls this function if the player's class is 'imitator'.
913 * @param baigaesi TRUEならば倍返し上の処理として行う
914 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
916 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
917 * If the user hits escape, returns FALSE, and set '*sn' to -1
918 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
920 * The "prompt" should be "cast", "recite", or "study"
921 * The "known" should be TRUE for cast/pray, FALSE for study
923 * nb: This function has a (trivial) display bug which will be obvious
924 * when you run it. It's probably easy to fix but I haven't tried,
927 bool do_cmd_mane(player_type *creature_ptr, bool baigaesi)
931 PERCENTAGE minfail = 0;
932 PLAYER_LEVEL plev = creature_ptr->lev;
936 if (cmd_limit_confused(creature_ptr)) return FALSE;
938 if (!creature_ptr->mane_num)
940 msg_print(_("まねられるものが何もない!", "You don't remember any action!"));
944 if (!get_mane_power(creature_ptr, &n, baigaesi)) return FALSE;
946 spell = monster_powers[creature_ptr->mane_spell[n]];
948 /* Spell failure chance */
949 chance = spell.manefail;
951 /* Reduce failure rate by "effective" level adjustment */
952 if (plev > spell.level) chance -= 3 * (plev - spell.level);
954 /* Reduce failure rate by 1 stat and DEX adjustment */
955 chance -= 3 * (adj_mag_stat[creature_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[creature_ptr->stat_ind[A_DEX]] - 2) / 2;
957 if (spell.manedam) chance = chance * damage / spell.manedam;
959 chance += creature_ptr->to_m_chance;
961 /* Extract the minimum failure rate */
962 minfail = adj_mag_fail[creature_ptr->stat_ind[spell.use_stat]];
964 /* Minimum failure rate */
965 if (chance < minfail) chance = minfail;
967 /* Stunning makes spells harder */
968 if (creature_ptr->stun > 50) chance += 25;
969 else if (creature_ptr->stun) chance += 15;
971 /* Always a 5 percent chance of working */
972 if (chance > 95) chance = 95;
975 if (randint0(100) < chance)
977 if (flush_failure) flush();
978 msg_print(_("ものまねに失敗した!", "You failed to concentrate hard enough!"));
984 cast = use_mane(creature_ptr, creature_ptr->mane_spell[n]);
985 if (!cast) return FALSE;
988 creature_ptr->mane_num--;
989 for (j = n; j < creature_ptr->mane_num;j++)
991 creature_ptr->mane_spell[j] = creature_ptr->mane_spell[j+1];
992 creature_ptr->mane_dam[j] = creature_ptr->mane_dam[j+1];
995 take_turn(creature_ptr, 100);
997 creature_ptr->redraw |= (PR_IMITATION);
998 creature_ptr->window |= (PW_PLAYER);
999 creature_ptr->window |= (PW_SPELL);