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 "mspell/monster-spell.h"
23 #include "mspell/mspell-type.h"
24 #include "player/player-effects.h"
25 #include "player/player-status.h"
26 #include "spell/spells-launcher.h"
27 #include "spell/spells-lite.h"
28 #include "spell/spells-sight.h"
29 #include "spell/spells-status.h"
30 #include "spell/spells-summon.h"
31 #include "spell/spells-teleport.h"
32 #include "spell/spells-type.h"
33 #include "spell/spells2.h"
34 #include "util/util.h"
35 #include "view/display-main-window.h"
40 * @brief 受け取ったパラメータに応じてものまねの効果情報をまとめたフォーマットを返す
41 * @param p 情報を返す文字列参照ポインタ
42 * @param power ものまねの効力の種類
46 static void mane_info(player_type *caster_ptr, char *p, int power, HIT_POINT dam)
48 PLAYER_LEVEL plev = caster_ptr->lev;
52 if ((power > 2 && power < 41) || (power > 41 && power < 59) || (power == 75))
53 sprintf(p, " %s%d", KWD_DAM, (int)dam);
59 sprintf(p, " %sd%d+%d", KWD_HEAL, plev * 3, plev);
62 sprintf(p, " %sd%d+%d", KWD_DURATION, 20+plev, plev);
65 sprintf(p, " %s%d", KWD_HEAL, plev*6);
68 sprintf(p, " %sd7+7", KWD_DURATION);
71 sprintf(p, " %s10", KWD_SPHERE);
74 sprintf(p, " %s%d", KWD_SPHERE, plev * 5);
77 sprintf(p, " %s5", KWD_SPHERE);
87 * @brief どのものまねを発動するか選択する処理 /
88 * Allow user to choose a imitation.
89 * @param sn 実行したものまねのIDを返す参照ポインタ(キャンセルなどの場合-1を返す)
90 * @param baigaesi TRUEならば倍返し上の処理として行う
91 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
93 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
94 * If the user hits escape, returns FALSE, and set '*sn' to -1
95 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
97 * The "prompt" should be "cast", "recite", or "study"
98 * The "known" should be TRUE for cast/pray, FALSE for study
100 * nb: This function has a (trivial) display bug which will be obvious
101 * when you run it. It's probably easy to fix but I haven't tried,
104 static int get_mane_power(player_type *caster_ptr, int *sn, bool baigaesi)
110 PERCENTAGE minfail = 0;
111 PLAYER_LEVEL plev = caster_ptr->lev;
112 PERCENTAGE chance = 0;
117 concptr p = _("能力", "power");
122 /* Assume cancelled */
128 num = caster_ptr->mane_num;
130 /* Build a prompt (accept all spells) */
131 (void)strnfmt(out_val, 78,
132 _("(%c-%c, '*'で一覧, ESC) どの%sをまねますか?", "(%c-%c, *=List, ESC=exit) Use which %s? "),
133 I2A(0), I2A(num - 1), p);
135 choice= always_show_list ? ESCAPE:1 ;
138 if(choice==ESCAPE) choice = ' ';
139 else if( !get_com(out_val, &choice, TRUE) )break;
142 if ((choice == ' ') || (choice == '*') || (choice == '?'))
151 /* Display a list of spells */
153 put_str(_("名前", "Name"), y, x + 5);
154 put_str(_("失率 効果", "Fail Info"), y, x + 36);
157 /* Dump the spells */
158 for (i = 0; i < num; i++)
160 /* Access the spell */
161 spell = monster_powers[caster_ptr->mane_spell[i]];
163 chance = spell.manefail;
165 /* Reduce failure rate by "effective" level adjustment */
166 if (plev > spell.level) chance -= 3 * (plev - spell.level);
168 /* Reduce failure rate by INT/WIS adjustment */
169 chance -= 3 * (adj_mag_stat[caster_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[caster_ptr->stat_ind[A_DEX]] - 2) / 2;
171 if (spell.manedam) chance = chance * (baigaesi ? caster_ptr->mane_dam[i] * 2 : caster_ptr->mane_dam[i]) / spell.manedam;
173 chance += caster_ptr->to_m_chance;
175 /* Extract the minimum failure rate */
176 minfail = adj_mag_fail[caster_ptr->stat_ind[spell.use_stat]];
178 /* Minimum failure rate */
179 if (chance < minfail) chance = minfail;
181 /* Stunning makes spells harder */
182 if (caster_ptr->stun > 50) chance += 25;
183 else if (caster_ptr->stun) chance += 15;
185 /* Always a 5 percent chance of working */
186 if (chance > 95) chance = 95;
189 mane_info(caster_ptr, comment, caster_ptr->mane_spell[i], (baigaesi ? caster_ptr->mane_dam[i]*2 : caster_ptr->mane_dam[i]));
191 /* Dump the spell --(-- */
192 sprintf(psi_desc, " %c) %-30s %3d%%%s",
195 prt(psi_desc, y + i + 1, x);
198 /* Clear the bottom line */
199 prt("", y + i + 1, x);
215 ask = isupper(choice);
218 if (ask) choice = (char)tolower(choice);
220 /* Extract request */
221 i = (islower(choice) ? A2I(choice) : -1);
223 /* Totally Illegal */
224 if ((i < 0) || (i >= num))
230 /* Save the spell index */
231 spell = monster_powers[caster_ptr->mane_spell[i]];
239 (void) strnfmt(tmp_val, 78, _("%sをまねますか?", "Use %s? "), monster_powers[caster_ptr->mane_spell[i]].name);
241 /* Belay that order */
242 if (!get_check(tmp_val)) continue;
248 if (redraw) screen_load();
250 caster_ptr->window |= (PW_SPELL);
251 handle_stuff(caster_ptr);
253 /* Abort if needed */
254 if (!flag) return FALSE;
256 /* Save the choice */
259 damage = (baigaesi ? caster_ptr->mane_dam[i]*2 : caster_ptr->mane_dam[i]);
268 * do_cmd_cast calls this function if the player's class is 'imitator'.
269 * @param caster_ptr プレーヤーへの参照ポインタ
270 * @param spell 発動するモンスター攻撃のID
271 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
273 static bool use_mane(player_type *caster_ptr, int spell)
276 PLAYER_LEVEL plev = caster_ptr->lev;
277 BIT_FLAGS mode = (PM_ALLOW_GROUP | PM_FORCE_PET);
278 BIT_FLAGS u_mode = 0L;
280 if (randint1(50+plev) < plev/10) u_mode = PM_ALLOW_UNIQUE;
288 msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
289 aggravate_monsters(caster_ptr, 0);
299 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
300 m_idx = caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
302 if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
303 if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
304 dispel_monster_status(caster_ptr, m_idx);
309 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
310 else msg_print(_("ロケットを発射した。", "You fire a rocket."));
311 fire_rocket(caster_ptr, GF_ROCKET, dir, damage, 2);
315 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
316 else msg_print(_("矢を放った。", "You fire an arrow."));
317 fire_bolt(caster_ptr, GF_ARROW, dir, damage);
330 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
331 else msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
332 fire_breath(caster_ptr, GF_ACID, dir, damage, (plev > 35 ? 3 : 2));
336 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
337 else msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
338 fire_breath(caster_ptr, GF_ELEC, dir, damage, (plev > 35 ? 3 : 2));
342 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
343 else msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
344 fire_breath(caster_ptr, GF_FIRE, dir, damage, (plev > 35 ? 3 : 2));
348 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
349 else msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
350 fire_breath(caster_ptr, GF_COLD, dir, damage, (plev > 35 ? 3 : 2));
354 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
355 else msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
356 fire_breath(caster_ptr, GF_POIS, dir, damage, (plev > 35 ? 3 : 2));
360 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
361 else msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
362 fire_breath(caster_ptr, GF_NETHER, dir, damage, (plev > 35 ? 3 : 2));
366 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
367 else msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
368 fire_breath(caster_ptr, GF_LITE, dir, damage, (plev > 35 ? 3 : 2));
372 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
373 else msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
374 fire_breath(caster_ptr, GF_DARK, dir, damage, (plev > 35 ? 3 : 2));
378 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
379 else msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
380 fire_breath(caster_ptr, GF_CONFUSION, dir, damage, (plev > 35 ? 3 : 2));
384 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
385 else msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
386 fire_breath(caster_ptr, GF_SOUND, dir, damage, (plev > 35 ? 3 : 2));
390 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
391 else msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
392 fire_breath(caster_ptr, GF_CHAOS, dir, damage, (plev > 35 ? 3 : 2));
396 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
397 else msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
398 fire_breath(caster_ptr, GF_DISENCHANT, dir, damage, (plev > 35 ? 3 : 2));
402 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
403 else msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
404 fire_breath(caster_ptr, GF_NEXUS, dir, damage, (plev > 35 ? 3 : 2));
408 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
409 else msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
410 fire_breath(caster_ptr, GF_TIME, dir, damage, (plev > 35 ? 3 : 2));
414 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
415 else msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
416 fire_breath(caster_ptr, GF_INERTIAL, dir, damage, (plev > 35 ? 3 : 2));
420 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
421 else msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
422 fire_breath(caster_ptr, GF_GRAVITY, dir, damage, (plev > 35 ? 3 : 2));
426 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
427 else msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
428 fire_breath(caster_ptr, GF_SHARDS, dir, damage, (plev > 35 ? 3 : 2));
432 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
433 else msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
435 fire_breath(caster_ptr, GF_PLASMA, dir, damage, (plev > 35 ? 3 : 2));
439 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
440 else msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
442 fire_breath(caster_ptr, GF_FORCE, dir, damage, (plev > 35 ? 3 : 2));
446 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
447 else msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
449 fire_breath(caster_ptr, GF_MANA, dir, damage, (plev > 35 ? 3 : 2));
453 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
454 else msg_print(_("放射能球を放った。", "You cast a ball of radiation."));
456 fire_ball(caster_ptr, GF_NUKE, dir, damage, 2);
460 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
461 else msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
463 fire_breath(caster_ptr, GF_NUKE, dir, damage, (plev > 35 ? 3 : 2));
467 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
468 else msg_print(_("純ログルスを放った。", "You invoke a raw Logrus."));
470 fire_ball(caster_ptr, GF_CHAOS, dir, damage, 4);
473 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
474 else msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
476 fire_breath(caster_ptr, GF_DISINTEGRATE, dir, damage, (plev > 35 ? 3 : 2));
479 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
480 else msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball."));
482 fire_ball(caster_ptr, GF_ACID, dir, damage, 2);
485 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
486 else msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball."));
488 fire_ball(caster_ptr, GF_ELEC, dir, damage, 2);
491 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
492 else msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball."));
494 fire_ball(caster_ptr, GF_FIRE, dir, damage, 2);
497 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
498 else msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball."));
500 fire_ball(caster_ptr, GF_COLD, dir, damage, 2);
503 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
504 else msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud."));
506 fire_ball(caster_ptr, GF_POIS, dir, damage, 2);
509 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
510 else msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball."));
512 fire_ball(caster_ptr, GF_NETHER, dir, damage, 2);
515 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
516 else msg_print(_("流れるような身振りをした。", "You gesture fluidly."));
518 fire_ball(caster_ptr, GF_WATER, dir, damage, 4);
521 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
522 else msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm."));
524 fire_ball(caster_ptr, GF_MANA, dir, damage, 4);
527 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
528 else msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm."));
530 fire_ball(caster_ptr, GF_DARK, dir, damage, 4);
533 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
534 fire_ball_hide(caster_ptr, GF_DRAIN_MANA, dir, randint1(plev*3)+plev, 0);
537 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
538 fire_ball_hide(caster_ptr, GF_MIND_BLAST, dir, damage, 0);
541 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
542 fire_ball_hide(caster_ptr, GF_BRAIN_SMASH, dir, damage, 0);
545 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
546 fire_ball_hide(caster_ptr, GF_CAUSE_1, dir, damage, 0);
549 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
550 fire_ball_hide(caster_ptr, GF_CAUSE_2, dir, damage, 0);
553 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
554 fire_ball_hide(caster_ptr, GF_CAUSE_3, dir, damage, 0);
557 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
558 fire_ball_hide(caster_ptr, GF_CAUSE_4, dir, damage, 0);
561 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
562 else msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt."));
564 fire_bolt(caster_ptr, GF_ACID, dir, damage);
567 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
568 else msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt."));
570 fire_bolt(caster_ptr, GF_ELEC, dir, damage);
573 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
574 else msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt."));
576 fire_bolt(caster_ptr, GF_FIRE, dir, damage);
579 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
580 else msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt."));
582 fire_bolt(caster_ptr, GF_COLD, dir, damage);
585 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
586 else msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst."));
588 fire_ball(caster_ptr, GF_LITE, dir, damage, 4);
591 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
592 else msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt."));
594 fire_bolt(caster_ptr, GF_NETHER, dir, damage);
597 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
598 else msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt."));
600 fire_bolt(caster_ptr, GF_WATER, dir, damage);
603 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
604 else msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt."));
606 fire_bolt(caster_ptr, GF_MANA, dir, damage);
609 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
610 else msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt."));
612 fire_bolt(caster_ptr, GF_PLASMA, dir, damage);
615 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
616 else msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt."));
618 fire_bolt(caster_ptr, GF_ICE, dir, damage);
620 case MS_MAGIC_MISSILE:
621 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
622 else msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile."));
624 fire_bolt(caster_ptr, GF_MISSILE, dir, damage);
627 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
628 else msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion."));
630 fear_monster(caster_ptr, dir, plev+10);
633 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
634 confuse_monster(caster_ptr, dir, plev * 2);
637 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
638 else msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion."));
640 confuse_monster(caster_ptr, dir, plev * 2);
643 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
644 slow_monster(caster_ptr, dir, plev);
647 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
648 sleep_monster(caster_ptr, dir, plev);
651 (void)set_fast(caster_ptr, randint1(20 + plev) + plev, FALSE);
655 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
656 else msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
658 fire_ball_hide(caster_ptr, GF_HAND_DOOM, dir, 200, 0);
662 msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
663 (void)hp_player(caster_ptr, plev*6);
664 (void)set_stun(caster_ptr, 0);
665 (void)set_cut(caster_ptr,0);
668 msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
669 (void)set_invuln(caster_ptr, randint1(7) + 7, FALSE);
672 teleport_player(caster_ptr, 10, TELEPORT_SPONTANEOUS);
675 teleport_player(caster_ptr, plev * 5, TELEPORT_SPONTANEOUS);
678 (void)time_walk(caster_ptr);
686 GAME_TEXT m_name[MAX_NLEN];
688 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
689 if (!caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx) break;
690 if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
691 if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
692 m_ptr = &caster_ptr->current_floor_ptr->m_list[caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx];
693 r_ptr = &r_info[m_ptr->r_idx];
694 monster_desc(caster_ptr, m_name, m_ptr, 0);
695 if (r_ptr->flagsr & RFR_RES_TELE)
697 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
699 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
700 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
704 else if (r_ptr->level > randint1(100))
706 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
707 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
712 msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
714 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);
718 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
720 (void)fire_beam(caster_ptr, GF_AWAY_ALL, dir, plev);
724 return teleport_level_other(caster_ptr);
728 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
729 else msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
730 (void)fire_beam(caster_ptr, GF_PSY_SPEAR, dir, damage);
734 msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
735 (void)unlite_area(caster_ptr, 10, 3);
739 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
740 msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackle evilly."));
741 trap_creation(caster_ptr, target_row, target_col);
744 msg_print(_("しかし何も起きなかった。", "Nothing happen."));
747 msg_print(_("死者復活の呪文を唱えた。", "You animate the dead."));
748 (void)animate_dead(caster_ptr, 0, caster_ptr->y, caster_ptr->x);
753 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
755 msg_print(_("援軍を召喚した。", "You summon minions."));
756 for (k = 0;k < 4; k++)
758 (void)summon_kin_player(caster_ptr, plev, target_row, target_col, (PM_FORCE_PET | PM_ALLOW_GROUP));
765 int max_cyber = (caster_ptr->current_floor_ptr->dun_level / 50) + randint1(3);
766 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
767 msg_print(_("サイバーデーモンを召喚した!", "You summon Cyberdemons!"));
768 if (max_cyber > 4) max_cyber = 4;
769 for (k = 0;k < max_cyber; k++)
770 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_CYBER, mode);
776 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
777 msg_print(_("仲間を召喚した。", "You summon help."));
778 for (k = 0;k < 1; k++)
779 summon_specific(caster_ptr, -1, target_row, target_col, plev, 0, (mode | u_mode));
785 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
786 msg_print(_("モンスターを召喚した!", "You summon monsters!"));
787 for (k = 0; k < 6; k++)
788 summon_specific(caster_ptr, -1, target_row, target_col, plev, 0, (mode | u_mode));
794 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
795 msg_print(_("アリを召喚した。", "You summon ants."));
796 for (k = 0; k < 6; k++)
797 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_ANT, mode);
803 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
804 msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
805 for (k = 0; k < 6; k++)
806 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_SPIDER, mode);
812 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
813 msg_print(_("ハウンドを召喚した。", "You summon hounds."));
814 for (k = 0; k < 4; k++)
815 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HOUND, mode);
821 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
822 msg_print(_("ヒドラを召喚した。", "You summon hydras."));
823 for (k = 0; k < 4; k++)
824 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HYDRA, mode);
830 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
831 msg_print(_("天使を召喚した!", "You summon an angel!"));
832 for (k = 0; k < 1; k++)
833 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_ANGEL, mode);
839 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
840 msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
841 for (k = 0; k < 1; k++)
842 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_DEMON, (mode | u_mode));
848 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
849 msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
850 for (k = 0; k < 1; k++)
851 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_UNDEAD, (mode | u_mode));
857 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
858 msg_print(_("ドラゴンを召喚した!", "You summon a dragon!"));
859 for (k = 0; k < 1; k++)
860 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_DRAGON, (mode | u_mode));
866 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
867 msg_print(_("強力なアンデッドを召喚した!", "You summon greater undead!"));
868 for (k = 0; k < 6; k++)
869 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
875 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
876 msg_print(_("古代ドラゴンを召喚した!", "You summon ancient dragons!"));
877 for (k = 0; k < 4; k++)
878 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_DRAGON, (mode | u_mode));
884 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
885 msg_print(_("アンバーの王族を召喚した!", "You summon Lords of Amber!"));
886 for (k = 0; k < 4; k++)
887 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
893 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
894 msg_print(_("特別な強敵を召喚した!", "You summon special opponents!"));
895 for (k = 0;k < 4; k++)
896 if (summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE))) count++;
897 for (k = count;k < 4; k++)
898 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
910 * @brief ものまねコマンドのメインルーチン /
911 * do_cmd_cast calls this function if the player's class is 'imitator'.
912 * @param baigaesi TRUEならば倍返し上の処理として行う
913 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
915 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
916 * If the user hits escape, returns FALSE, and set '*sn' to -1
917 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
919 * The "prompt" should be "cast", "recite", or "study"
920 * The "known" should be TRUE for cast/pray, FALSE for study
922 * nb: This function has a (trivial) display bug which will be obvious
923 * when you run it. It's probably easy to fix but I haven't tried,
926 bool do_cmd_mane(player_type *creature_ptr, bool baigaesi)
930 PERCENTAGE minfail = 0;
931 PLAYER_LEVEL plev = creature_ptr->lev;
935 if (cmd_limit_confused(creature_ptr)) return FALSE;
937 if (!creature_ptr->mane_num)
939 msg_print(_("まねられるものが何もない!", "You don't remember any action!"));
943 if (!get_mane_power(creature_ptr, &n, baigaesi)) return FALSE;
945 spell = monster_powers[creature_ptr->mane_spell[n]];
947 /* Spell failure chance */
948 chance = spell.manefail;
950 /* Reduce failure rate by "effective" level adjustment */
951 if (plev > spell.level) chance -= 3 * (plev - spell.level);
953 /* Reduce failure rate by 1 stat and DEX adjustment */
954 chance -= 3 * (adj_mag_stat[creature_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[creature_ptr->stat_ind[A_DEX]] - 2) / 2;
956 if (spell.manedam) chance = chance * damage / spell.manedam;
958 chance += creature_ptr->to_m_chance;
960 /* Extract the minimum failure rate */
961 minfail = adj_mag_fail[creature_ptr->stat_ind[spell.use_stat]];
963 /* Minimum failure rate */
964 if (chance < minfail) chance = minfail;
966 /* Stunning makes spells harder */
967 if (creature_ptr->stun > 50) chance += 25;
968 else if (creature_ptr->stun) chance += 15;
970 /* Always a 5 percent chance of working */
971 if (chance > 95) chance = 95;
974 if (randint0(100) < chance)
976 if (flush_failure) flush();
977 msg_print(_("ものまねに失敗した!", "You failed to concentrate hard enough!"));
983 cast = use_mane(creature_ptr, creature_ptr->mane_spell[n]);
984 if (!cast) return FALSE;
987 creature_ptr->mane_num--;
988 for (j = n; j < creature_ptr->mane_num;j++)
990 creature_ptr->mane_spell[j] = creature_ptr->mane_spell[j+1];
991 creature_ptr->mane_dam[j] = creature_ptr->mane_dam[j+1];
994 take_turn(creature_ptr, 100);
996 creature_ptr->redraw |= (PR_IMITATION);
997 creature_ptr->window |= (PW_PLAYER);
998 creature_ptr->window |= (PW_SPELL);