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-sight.h"
28 #include "spell/spells-status.h"
29 #include "spell/spells-summon.h"
30 #include "spell/spells-teleport.h"
31 #include "spell/spells-type.h"
32 #include "spell/spells2.h"
33 #include "util/util.h"
34 #include "view/display-main-window.h"
39 * @brief 受け取ったパラメータに応じてものまねの効果情報をまとめたフォーマットを返す
40 * @param p 情報を返す文字列参照ポインタ
41 * @param power ものまねの効力の種類
45 static void mane_info(player_type *caster_ptr, char *p, int power, HIT_POINT dam)
47 PLAYER_LEVEL plev = caster_ptr->lev;
51 if ((power > 2 && power < 41) || (power > 41 && power < 59) || (power == 75))
52 sprintf(p, " %s%d", KWD_DAM, (int)dam);
58 sprintf(p, " %sd%d+%d", KWD_HEAL, plev * 3, plev);
61 sprintf(p, " %sd%d+%d", KWD_DURATION, 20+plev, plev);
64 sprintf(p, " %s%d", KWD_HEAL, plev*6);
67 sprintf(p, " %sd7+7", KWD_DURATION);
70 sprintf(p, " %s10", KWD_SPHERE);
73 sprintf(p, " %s%d", KWD_SPHERE, plev * 5);
76 sprintf(p, " %s5", KWD_SPHERE);
86 * @brief どのものまねを発動するか選択する処理 /
87 * Allow user to choose a imitation.
88 * @param sn 実行したものまねのIDを返す参照ポインタ(キャンセルなどの場合-1を返す)
89 * @param baigaesi TRUEならば倍返し上の処理として行う
90 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
92 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
93 * If the user hits escape, returns FALSE, and set '*sn' to -1
94 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
96 * The "prompt" should be "cast", "recite", or "study"
97 * The "known" should be TRUE for cast/pray, FALSE for study
99 * nb: This function has a (trivial) display bug which will be obvious
100 * when you run it. It's probably easy to fix but I haven't tried,
103 static int get_mane_power(player_type *caster_ptr, int *sn, bool baigaesi)
109 PERCENTAGE minfail = 0;
110 PLAYER_LEVEL plev = caster_ptr->lev;
111 PERCENTAGE chance = 0;
116 concptr p = _("能力", "power");
121 /* Assume cancelled */
127 num = caster_ptr->mane_num;
129 /* Build a prompt (accept all spells) */
130 (void)strnfmt(out_val, 78,
131 _("(%c-%c, '*'で一覧, ESC) どの%sをまねますか?", "(%c-%c, *=List, ESC=exit) Use which %s? "),
132 I2A(0), I2A(num - 1), p);
134 choice= always_show_list ? ESCAPE:1 ;
137 if(choice==ESCAPE) choice = ' ';
138 else if( !get_com(out_val, &choice, TRUE) )break;
141 if ((choice == ' ') || (choice == '*') || (choice == '?'))
150 /* Display a list of spells */
152 put_str(_("名前", "Name"), y, x + 5);
153 put_str(_("失率 効果", "Fail Info"), y, x + 36);
156 /* Dump the spells */
157 for (i = 0; i < num; i++)
159 /* Access the spell */
160 spell = monster_powers[caster_ptr->mane_spell[i]];
162 chance = spell.manefail;
164 /* Reduce failure rate by "effective" level adjustment */
165 if (plev > spell.level) chance -= 3 * (plev - spell.level);
167 /* Reduce failure rate by INT/WIS adjustment */
168 chance -= 3 * (adj_mag_stat[caster_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[caster_ptr->stat_ind[A_DEX]] - 2) / 2;
170 if (spell.manedam) chance = chance * (baigaesi ? caster_ptr->mane_dam[i] * 2 : caster_ptr->mane_dam[i]) / spell.manedam;
172 chance += caster_ptr->to_m_chance;
174 /* Extract the minimum failure rate */
175 minfail = adj_mag_fail[caster_ptr->stat_ind[spell.use_stat]];
177 /* Minimum failure rate */
178 if (chance < minfail) chance = minfail;
180 /* Stunning makes spells harder */
181 if (caster_ptr->stun > 50) chance += 25;
182 else if (caster_ptr->stun) chance += 15;
184 /* Always a 5 percent chance of working */
185 if (chance > 95) chance = 95;
188 mane_info(caster_ptr, comment, caster_ptr->mane_spell[i], (baigaesi ? caster_ptr->mane_dam[i]*2 : caster_ptr->mane_dam[i]));
190 /* Dump the spell --(-- */
191 sprintf(psi_desc, " %c) %-30s %3d%%%s",
194 prt(psi_desc, y + i + 1, x);
197 /* Clear the bottom line */
198 prt("", y + i + 1, x);
214 ask = isupper(choice);
217 if (ask) choice = (char)tolower(choice);
219 /* Extract request */
220 i = (islower(choice) ? A2I(choice) : -1);
222 /* Totally Illegal */
223 if ((i < 0) || (i >= num))
229 /* Save the spell index */
230 spell = monster_powers[caster_ptr->mane_spell[i]];
238 (void) strnfmt(tmp_val, 78, _("%sをまねますか?", "Use %s? "), monster_powers[caster_ptr->mane_spell[i]].name);
240 /* Belay that order */
241 if (!get_check(tmp_val)) continue;
247 if (redraw) screen_load();
249 caster_ptr->window |= (PW_SPELL);
250 handle_stuff(caster_ptr);
252 /* Abort if needed */
253 if (!flag) return FALSE;
255 /* Save the choice */
258 damage = (baigaesi ? caster_ptr->mane_dam[i]*2 : caster_ptr->mane_dam[i]);
267 * do_cmd_cast calls this function if the player's class is 'imitator'.
268 * @param caster_ptr プレーヤーへの参照ポインタ
269 * @param spell 発動するモンスター攻撃のID
270 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
272 static bool use_mane(player_type *caster_ptr, int spell)
275 PLAYER_LEVEL plev = caster_ptr->lev;
276 BIT_FLAGS mode = (PM_ALLOW_GROUP | PM_FORCE_PET);
277 BIT_FLAGS u_mode = 0L;
279 if (randint1(50+plev) < plev/10) u_mode = PM_ALLOW_UNIQUE;
287 msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
288 aggravate_monsters(caster_ptr, 0);
298 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
299 m_idx = caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
301 if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
302 if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
303 dispel_monster_status(caster_ptr, m_idx);
308 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
309 else msg_print(_("ロケットを発射した。", "You fire a rocket."));
310 fire_rocket(caster_ptr, GF_ROCKET, dir, damage, 2);
314 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
315 else msg_print(_("矢を放った。", "You fire an arrow."));
316 fire_bolt(caster_ptr, GF_ARROW, dir, damage);
329 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
330 else msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
331 fire_breath(caster_ptr, GF_ACID, dir, damage, (plev > 35 ? 3 : 2));
335 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
336 else msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
337 fire_breath(caster_ptr, GF_ELEC, dir, damage, (plev > 35 ? 3 : 2));
341 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
342 else msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
343 fire_breath(caster_ptr, GF_FIRE, dir, damage, (plev > 35 ? 3 : 2));
347 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
348 else msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
349 fire_breath(caster_ptr, GF_COLD, dir, damage, (plev > 35 ? 3 : 2));
353 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
354 else msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
355 fire_breath(caster_ptr, GF_POIS, dir, damage, (plev > 35 ? 3 : 2));
359 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
360 else msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
361 fire_breath(caster_ptr, GF_NETHER, dir, damage, (plev > 35 ? 3 : 2));
365 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
366 else msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
367 fire_breath(caster_ptr, GF_LITE, dir, damage, (plev > 35 ? 3 : 2));
371 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
372 else msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
373 fire_breath(caster_ptr, GF_DARK, dir, damage, (plev > 35 ? 3 : 2));
377 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
378 else msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
379 fire_breath(caster_ptr, GF_CONFUSION, dir, damage, (plev > 35 ? 3 : 2));
383 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
384 else msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
385 fire_breath(caster_ptr, GF_SOUND, dir, damage, (plev > 35 ? 3 : 2));
389 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
390 else msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
391 fire_breath(caster_ptr, GF_CHAOS, dir, damage, (plev > 35 ? 3 : 2));
395 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
396 else msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
397 fire_breath(caster_ptr, GF_DISENCHANT, dir, damage, (plev > 35 ? 3 : 2));
401 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
402 else msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
403 fire_breath(caster_ptr, GF_NEXUS, dir, damage, (plev > 35 ? 3 : 2));
407 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
408 else msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
409 fire_breath(caster_ptr, GF_TIME, dir, damage, (plev > 35 ? 3 : 2));
413 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
414 else msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
415 fire_breath(caster_ptr, GF_INERTIAL, dir, damage, (plev > 35 ? 3 : 2));
419 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
420 else msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
421 fire_breath(caster_ptr, GF_GRAVITY, dir, damage, (plev > 35 ? 3 : 2));
425 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
426 else msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
427 fire_breath(caster_ptr, GF_SHARDS, dir, damage, (plev > 35 ? 3 : 2));
431 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
432 else msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
434 fire_breath(caster_ptr, GF_PLASMA, dir, damage, (plev > 35 ? 3 : 2));
438 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
439 else msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
441 fire_breath(caster_ptr, GF_FORCE, dir, damage, (plev > 35 ? 3 : 2));
445 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
446 else msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
448 fire_breath(caster_ptr, GF_MANA, dir, damage, (plev > 35 ? 3 : 2));
452 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
453 else msg_print(_("放射能球を放った。", "You cast a ball of radiation."));
455 fire_ball(caster_ptr, GF_NUKE, dir, damage, 2);
459 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
460 else msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
462 fire_breath(caster_ptr, GF_NUKE, dir, damage, (plev > 35 ? 3 : 2));
466 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
467 else msg_print(_("純ログルスを放った。", "You invoke a raw Logrus."));
469 fire_ball(caster_ptr, GF_CHAOS, dir, damage, 4);
472 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
473 else msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
475 fire_breath(caster_ptr, GF_DISINTEGRATE, dir, damage, (plev > 35 ? 3 : 2));
478 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
479 else msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball."));
481 fire_ball(caster_ptr, GF_ACID, dir, damage, 2);
484 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
485 else msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball."));
487 fire_ball(caster_ptr, GF_ELEC, dir, damage, 2);
490 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
491 else msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball."));
493 fire_ball(caster_ptr, GF_FIRE, dir, damage, 2);
496 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
497 else msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball."));
499 fire_ball(caster_ptr, GF_COLD, dir, damage, 2);
502 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
503 else msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud."));
505 fire_ball(caster_ptr, GF_POIS, dir, damage, 2);
508 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
509 else msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball."));
511 fire_ball(caster_ptr, GF_NETHER, dir, damage, 2);
514 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
515 else msg_print(_("流れるような身振りをした。", "You gesture fluidly."));
517 fire_ball(caster_ptr, GF_WATER, dir, damage, 4);
520 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
521 else msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm."));
523 fire_ball(caster_ptr, GF_MANA, dir, damage, 4);
526 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
527 else msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm."));
529 fire_ball(caster_ptr, GF_DARK, dir, damage, 4);
532 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
533 fire_ball_hide(caster_ptr, GF_DRAIN_MANA, dir, randint1(plev*3)+plev, 0);
536 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
537 fire_ball_hide(caster_ptr, GF_MIND_BLAST, dir, damage, 0);
540 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
541 fire_ball_hide(caster_ptr, GF_BRAIN_SMASH, dir, damage, 0);
544 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
545 fire_ball_hide(caster_ptr, GF_CAUSE_1, dir, damage, 0);
548 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
549 fire_ball_hide(caster_ptr, GF_CAUSE_2, dir, damage, 0);
552 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
553 fire_ball_hide(caster_ptr, GF_CAUSE_3, dir, damage, 0);
556 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
557 fire_ball_hide(caster_ptr, GF_CAUSE_4, dir, damage, 0);
560 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
561 else msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt."));
563 fire_bolt(caster_ptr, GF_ACID, dir, damage);
566 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
567 else msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt."));
569 fire_bolt(caster_ptr, GF_ELEC, dir, damage);
572 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
573 else msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt."));
575 fire_bolt(caster_ptr, GF_FIRE, dir, damage);
578 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
579 else msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt."));
581 fire_bolt(caster_ptr, GF_COLD, dir, damage);
584 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
585 else msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst."));
587 fire_ball(caster_ptr, GF_LITE, dir, damage, 4);
590 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
591 else msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt."));
593 fire_bolt(caster_ptr, GF_NETHER, dir, damage);
596 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
597 else msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt."));
599 fire_bolt(caster_ptr, GF_WATER, dir, damage);
602 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
603 else msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt."));
605 fire_bolt(caster_ptr, GF_MANA, dir, damage);
608 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
609 else msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt."));
611 fire_bolt(caster_ptr, GF_PLASMA, dir, damage);
614 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
615 else msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt."));
617 fire_bolt(caster_ptr, GF_ICE, dir, damage);
619 case MS_MAGIC_MISSILE:
620 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
621 else msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile."));
623 fire_bolt(caster_ptr, GF_MISSILE, dir, damage);
626 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
627 else msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion."));
629 fear_monster(caster_ptr, dir, plev+10);
632 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
633 confuse_monster(caster_ptr, dir, plev * 2);
636 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
637 else msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion."));
639 confuse_monster(caster_ptr, dir, plev * 2);
642 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
643 slow_monster(caster_ptr, dir, plev);
646 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
647 sleep_monster(caster_ptr, dir, plev);
650 (void)set_fast(caster_ptr, randint1(20 + plev) + plev, FALSE);
654 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
655 else msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
657 fire_ball_hide(caster_ptr, GF_HAND_DOOM, dir, 200, 0);
661 msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
662 (void)hp_player(caster_ptr, plev*6);
663 (void)set_stun(caster_ptr, 0);
664 (void)set_cut(caster_ptr,0);
667 msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
668 (void)set_invuln(caster_ptr, randint1(7) + 7, FALSE);
671 teleport_player(caster_ptr, 10, TELEPORT_SPONTANEOUS);
674 teleport_player(caster_ptr, plev * 5, TELEPORT_SPONTANEOUS);
677 (void)time_walk(caster_ptr);
685 GAME_TEXT m_name[MAX_NLEN];
687 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
688 if (!caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx) break;
689 if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
690 if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
691 m_ptr = &caster_ptr->current_floor_ptr->m_list[caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx];
692 r_ptr = &r_info[m_ptr->r_idx];
693 monster_desc(caster_ptr, m_name, m_ptr, 0);
694 if (r_ptr->flagsr & RFR_RES_TELE)
696 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
698 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
699 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
703 else if (r_ptr->level > randint1(100))
705 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
706 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
711 msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
713 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);
717 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
719 (void)fire_beam(caster_ptr, GF_AWAY_ALL, dir, plev);
723 return teleport_level_other(caster_ptr);
727 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
728 else msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
729 (void)fire_beam(caster_ptr, GF_PSY_SPEAR, dir, damage);
733 msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
734 (void)unlite_area(caster_ptr, 10, 3);
738 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
739 msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackle evilly."));
740 trap_creation(caster_ptr, target_row, target_col);
743 msg_print(_("しかし何も起きなかった。", "Nothing happen."));
746 msg_print(_("死者復活の呪文を唱えた。", "You animate the dead."));
747 (void)animate_dead(caster_ptr, 0, caster_ptr->y, caster_ptr->x);
752 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
754 msg_print(_("援軍を召喚した。", "You summon minions."));
755 for (k = 0;k < 4; k++)
757 (void)summon_kin_player(caster_ptr, plev, target_row, target_col, (PM_FORCE_PET | PM_ALLOW_GROUP));
764 int max_cyber = (caster_ptr->current_floor_ptr->dun_level / 50) + randint1(3);
765 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
766 msg_print(_("サイバーデーモンを召喚した!", "You summon Cyberdemons!"));
767 if (max_cyber > 4) max_cyber = 4;
768 for (k = 0;k < max_cyber; k++)
769 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_CYBER, mode);
775 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
776 msg_print(_("仲間を召喚した。", "You summon help."));
777 for (k = 0;k < 1; k++)
778 summon_specific(caster_ptr, -1, target_row, target_col, plev, 0, (mode | u_mode));
784 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
785 msg_print(_("モンスターを召喚した!", "You summon monsters!"));
786 for (k = 0; k < 6; k++)
787 summon_specific(caster_ptr, -1, target_row, target_col, plev, 0, (mode | u_mode));
793 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
794 msg_print(_("アリを召喚した。", "You summon ants."));
795 for (k = 0; k < 6; k++)
796 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_ANT, mode);
802 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
803 msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
804 for (k = 0; k < 6; k++)
805 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_SPIDER, mode);
811 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
812 msg_print(_("ハウンドを召喚した。", "You summon hounds."));
813 for (k = 0; k < 4; k++)
814 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HOUND, mode);
820 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
821 msg_print(_("ヒドラを召喚した。", "You summon hydras."));
822 for (k = 0; k < 4; k++)
823 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HYDRA, mode);
829 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
830 msg_print(_("天使を召喚した!", "You summon an angel!"));
831 for (k = 0; k < 1; k++)
832 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_ANGEL, mode);
838 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
839 msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
840 for (k = 0; k < 1; k++)
841 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_DEMON, (mode | u_mode));
847 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
848 msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
849 for (k = 0; k < 1; k++)
850 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_UNDEAD, (mode | u_mode));
856 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
857 msg_print(_("ドラゴンを召喚した!", "You summon a dragon!"));
858 for (k = 0; k < 1; k++)
859 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_DRAGON, (mode | u_mode));
865 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
866 msg_print(_("強力なアンデッドを召喚した!", "You summon greater undead!"));
867 for (k = 0; k < 6; k++)
868 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
874 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
875 msg_print(_("古代ドラゴンを召喚した!", "You summon ancient dragons!"));
876 for (k = 0; k < 4; k++)
877 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_DRAGON, (mode | u_mode));
883 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
884 msg_print(_("アンバーの王族を召喚した!", "You summon Lords of Amber!"));
885 for (k = 0; k < 4; k++)
886 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
892 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
893 msg_print(_("特別な強敵を召喚した!", "You summon special opponents!"));
894 for (k = 0;k < 4; k++)
895 if (summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE))) count++;
896 for (k = count;k < 4; k++)
897 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
909 * @brief ものまねコマンドのメインルーチン /
910 * do_cmd_cast calls this function if the player's class is 'imitator'.
911 * @param baigaesi TRUEならば倍返し上の処理として行う
912 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
914 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
915 * If the user hits escape, returns FALSE, and set '*sn' to -1
916 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
918 * The "prompt" should be "cast", "recite", or "study"
919 * The "known" should be TRUE for cast/pray, FALSE for study
921 * nb: This function has a (trivial) display bug which will be obvious
922 * when you run it. It's probably easy to fix but I haven't tried,
925 bool do_cmd_mane(player_type *creature_ptr, bool baigaesi)
929 PERCENTAGE minfail = 0;
930 PLAYER_LEVEL plev = creature_ptr->lev;
934 if (cmd_limit_confused(creature_ptr)) return FALSE;
936 if (!creature_ptr->mane_num)
938 msg_print(_("まねられるものが何もない!", "You don't remember any action!"));
942 if (!get_mane_power(creature_ptr, &n, baigaesi)) return FALSE;
944 spell = monster_powers[creature_ptr->mane_spell[n]];
946 /* Spell failure chance */
947 chance = spell.manefail;
949 /* Reduce failure rate by "effective" level adjustment */
950 if (plev > spell.level) chance -= 3 * (plev - spell.level);
952 /* Reduce failure rate by 1 stat and DEX adjustment */
953 chance -= 3 * (adj_mag_stat[creature_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[creature_ptr->stat_ind[A_DEX]] - 2) / 2;
955 if (spell.manedam) chance = chance * damage / spell.manedam;
957 chance += creature_ptr->to_m_chance;
959 /* Extract the minimum failure rate */
960 minfail = adj_mag_fail[creature_ptr->stat_ind[spell.use_stat]];
962 /* Minimum failure rate */
963 if (chance < minfail) chance = minfail;
965 /* Stunning makes spells harder */
966 if (creature_ptr->stun > 50) chance += 25;
967 else if (creature_ptr->stun) chance += 15;
969 /* Always a 5 percent chance of working */
970 if (chance > 95) chance = 95;
973 if (randint0(100) < chance)
975 if (flush_failure) flush();
976 msg_print(_("ものまねに失敗した!", "You failed to concentrate hard enough!"));
982 cast = use_mane(creature_ptr, creature_ptr->mane_spell[n]);
983 if (!cast) return FALSE;
986 creature_ptr->mane_num--;
987 for (j = n; j < creature_ptr->mane_num;j++)
989 creature_ptr->mane_spell[j] = creature_ptr->mane_spell[j+1];
990 creature_ptr->mane_dam[j] = creature_ptr->mane_dam[j+1];
993 take_turn(creature_ptr, 100);
995 creature_ptr->redraw |= (PR_IMITATION);
996 creature_ptr->window |= (PW_PLAYER);
997 creature_ptr->window |= (PW_SPELL);