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-race/race-flags1.h"
21 #include "monster-race/race-flags-resistance.h"
22 #include "monster/monster-processor.h"
23 #include "monster/monster-status.h"
24 #include "monster/monster-info.h"
25 #include "monster/monster2.h"
26 #include "monster/place-monster-types.h"
27 #include "mspell/monster-spell.h"
28 #include "mspell/mspell-type.h"
29 #include "player/player-effects.h"
30 #include "player/player-status.h"
31 #include "spell-kind/spells-launcher.h"
32 #include "spell-kind/spells-lite.h"
33 #include "spell-kind/spells-neighbor.h"
34 #include "spell-kind/spells-sight.h"
35 #include "spell/spells-status.h"
36 #include "spell/spells-summon.h"
37 #include "spell-kind/spells-teleport.h"
38 #include "spell/spells-type.h"
39 #include "util/util.h"
40 #include "view/display-main-window.h"
45 * @brief 受け取ったパラメータに応じてものまねの効果情報をまとめたフォーマットを返す
46 * @param p 情報を返す文字列参照ポインタ
47 * @param power ものまねの効力の種類
51 static void mane_info(player_type *caster_ptr, char *p, int power, HIT_POINT dam)
53 PLAYER_LEVEL plev = caster_ptr->lev;
57 if ((power > 2 && power < 41) || (power > 41 && power < 59) || (power == 75))
58 sprintf(p, " %s%d", KWD_DAM, (int)dam);
64 sprintf(p, " %sd%d+%d", KWD_HEAL, plev * 3, plev);
67 sprintf(p, " %sd%d+%d", KWD_DURATION, 20+plev, plev);
70 sprintf(p, " %s%d", KWD_HEAL, plev*6);
73 sprintf(p, " %sd7+7", KWD_DURATION);
76 sprintf(p, " %s10", KWD_SPHERE);
79 sprintf(p, " %s%d", KWD_SPHERE, plev * 5);
82 sprintf(p, " %s5", KWD_SPHERE);
92 * @brief どのものまねを発動するか選択する処理 /
93 * Allow user to choose a imitation.
94 * @param sn 実行したものまねのIDを返す参照ポインタ(キャンセルなどの場合-1を返す)
95 * @param baigaesi TRUEならば倍返し上の処理として行う
96 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
98 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
99 * If the user hits escape, returns FALSE, and set '*sn' to -1
100 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
102 * The "prompt" should be "cast", "recite", or "study"
103 * The "known" should be TRUE for cast/pray, FALSE for study
105 * nb: This function has a (trivial) display bug which will be obvious
106 * when you run it. It's probably easy to fix but I haven't tried,
109 static int get_mane_power(player_type *caster_ptr, int *sn, bool baigaesi)
115 PERCENTAGE minfail = 0;
116 PLAYER_LEVEL plev = caster_ptr->lev;
117 PERCENTAGE chance = 0;
122 concptr p = _("能力", "power");
127 /* Assume cancelled */
133 num = caster_ptr->mane_num;
135 /* Build a prompt (accept all spells) */
136 (void)strnfmt(out_val, 78,
137 _("(%c-%c, '*'で一覧, ESC) どの%sをまねますか?", "(%c-%c, *=List, ESC=exit) Use which %s? "),
138 I2A(0), I2A(num - 1), p);
140 choice= always_show_list ? ESCAPE:1 ;
143 if(choice==ESCAPE) choice = ' ';
144 else if( !get_com(out_val, &choice, TRUE) )break;
147 if ((choice == ' ') || (choice == '*') || (choice == '?'))
156 /* Display a list of spells */
158 put_str(_("名前", "Name"), y, x + 5);
159 put_str(_("失率 効果", "Fail Info"), y, x + 36);
162 /* Dump the spells */
163 for (i = 0; i < num; i++)
165 /* Access the spell */
166 spell = monster_powers[caster_ptr->mane_spell[i]];
168 chance = spell.manefail;
170 /* Reduce failure rate by "effective" level adjustment */
171 if (plev > spell.level) chance -= 3 * (plev - spell.level);
173 /* Reduce failure rate by INT/WIS adjustment */
174 chance -= 3 * (adj_mag_stat[caster_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[caster_ptr->stat_ind[A_DEX]] - 2) / 2;
176 if (spell.manedam) chance = chance * (baigaesi ? caster_ptr->mane_dam[i] * 2 : caster_ptr->mane_dam[i]) / spell.manedam;
178 chance += caster_ptr->to_m_chance;
180 /* Extract the minimum failure rate */
181 minfail = adj_mag_fail[caster_ptr->stat_ind[spell.use_stat]];
183 /* Minimum failure rate */
184 if (chance < minfail) chance = minfail;
186 /* Stunning makes spells harder */
187 if (caster_ptr->stun > 50) chance += 25;
188 else if (caster_ptr->stun) chance += 15;
190 /* Always a 5 percent chance of working */
191 if (chance > 95) chance = 95;
194 mane_info(caster_ptr, comment, caster_ptr->mane_spell[i], (baigaesi ? caster_ptr->mane_dam[i]*2 : caster_ptr->mane_dam[i]));
196 /* Dump the spell --(-- */
197 sprintf(psi_desc, " %c) %-30s %3d%%%s",
200 prt(psi_desc, y + i + 1, x);
203 /* Clear the bottom line */
204 prt("", y + i + 1, x);
220 ask = isupper(choice);
223 if (ask) choice = (char)tolower(choice);
225 /* Extract request */
226 i = (islower(choice) ? A2I(choice) : -1);
228 /* Totally Illegal */
229 if ((i < 0) || (i >= num))
235 /* Save the spell index */
236 spell = monster_powers[caster_ptr->mane_spell[i]];
244 (void) strnfmt(tmp_val, 78, _("%sをまねますか?", "Use %s? "), monster_powers[caster_ptr->mane_spell[i]].name);
246 /* Belay that order */
247 if (!get_check(tmp_val)) continue;
253 if (redraw) screen_load();
255 caster_ptr->window |= (PW_SPELL);
256 handle_stuff(caster_ptr);
258 /* Abort if needed */
259 if (!flag) return FALSE;
261 /* Save the choice */
264 damage = (baigaesi ? caster_ptr->mane_dam[i]*2 : caster_ptr->mane_dam[i]);
273 * do_cmd_cast calls this function if the player's class is 'imitator'.
274 * @param caster_ptr プレーヤーへの参照ポインタ
275 * @param spell 発動するモンスター攻撃のID
276 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
278 static bool use_mane(player_type *caster_ptr, int spell)
281 PLAYER_LEVEL plev = caster_ptr->lev;
282 BIT_FLAGS mode = (PM_ALLOW_GROUP | PM_FORCE_PET);
283 BIT_FLAGS u_mode = 0L;
285 if (randint1(50+plev) < plev/10) u_mode = PM_ALLOW_UNIQUE;
293 msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
294 aggravate_monsters(caster_ptr, 0);
304 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
305 m_idx = caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
307 if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
308 if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
309 dispel_monster_status(caster_ptr, m_idx);
314 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
315 else msg_print(_("ロケットを発射した。", "You fire a rocket."));
316 fire_rocket(caster_ptr, GF_ROCKET, dir, damage, 2);
320 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
321 else msg_print(_("矢を放った。", "You fire an arrow."));
322 fire_bolt(caster_ptr, GF_ARROW, dir, damage);
335 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
336 else msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
337 fire_breath(caster_ptr, GF_ACID, dir, damage, (plev > 35 ? 3 : 2));
341 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
342 else msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
343 fire_breath(caster_ptr, GF_ELEC, dir, damage, (plev > 35 ? 3 : 2));
347 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
348 else msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
349 fire_breath(caster_ptr, GF_FIRE, dir, damage, (plev > 35 ? 3 : 2));
353 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
354 else msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
355 fire_breath(caster_ptr, GF_COLD, dir, damage, (plev > 35 ? 3 : 2));
359 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
360 else msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
361 fire_breath(caster_ptr, GF_POIS, dir, damage, (plev > 35 ? 3 : 2));
365 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
366 else msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
367 fire_breath(caster_ptr, GF_NETHER, dir, damage, (plev > 35 ? 3 : 2));
371 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
372 else msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
373 fire_breath(caster_ptr, GF_LITE, dir, damage, (plev > 35 ? 3 : 2));
377 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
378 else msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
379 fire_breath(caster_ptr, GF_DARK, dir, damage, (plev > 35 ? 3 : 2));
383 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
384 else msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
385 fire_breath(caster_ptr, GF_CONFUSION, dir, damage, (plev > 35 ? 3 : 2));
389 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
390 else msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
391 fire_breath(caster_ptr, GF_SOUND, dir, damage, (plev > 35 ? 3 : 2));
395 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
396 else msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
397 fire_breath(caster_ptr, GF_CHAOS, dir, damage, (plev > 35 ? 3 : 2));
401 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
402 else msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
403 fire_breath(caster_ptr, GF_DISENCHANT, dir, damage, (plev > 35 ? 3 : 2));
407 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
408 else msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
409 fire_breath(caster_ptr, GF_NEXUS, dir, damage, (plev > 35 ? 3 : 2));
413 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
414 else msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
415 fire_breath(caster_ptr, GF_TIME, dir, damage, (plev > 35 ? 3 : 2));
419 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
420 else msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
421 fire_breath(caster_ptr, GF_INERTIAL, dir, damage, (plev > 35 ? 3 : 2));
425 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
426 else msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
427 fire_breath(caster_ptr, GF_GRAVITY, dir, damage, (plev > 35 ? 3 : 2));
431 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
432 else msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
433 fire_breath(caster_ptr, GF_SHARDS, dir, damage, (plev > 35 ? 3 : 2));
437 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
438 else msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
440 fire_breath(caster_ptr, GF_PLASMA, dir, damage, (plev > 35 ? 3 : 2));
444 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
445 else msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
447 fire_breath(caster_ptr, GF_FORCE, dir, damage, (plev > 35 ? 3 : 2));
451 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
452 else msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
454 fire_breath(caster_ptr, GF_MANA, dir, damage, (plev > 35 ? 3 : 2));
458 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
459 else msg_print(_("放射能球を放った。", "You cast a ball of radiation."));
461 fire_ball(caster_ptr, GF_NUKE, dir, damage, 2);
465 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
466 else msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
468 fire_breath(caster_ptr, GF_NUKE, dir, damage, (plev > 35 ? 3 : 2));
472 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
473 else msg_print(_("純ログルスを放った。", "You invoke a raw Logrus."));
475 fire_ball(caster_ptr, GF_CHAOS, dir, damage, 4);
478 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
479 else msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
481 fire_breath(caster_ptr, GF_DISINTEGRATE, dir, damage, (plev > 35 ? 3 : 2));
484 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
485 else msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball."));
487 fire_ball(caster_ptr, GF_ACID, dir, damage, 2);
490 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
491 else msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball."));
493 fire_ball(caster_ptr, GF_ELEC, dir, damage, 2);
496 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
497 else msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball."));
499 fire_ball(caster_ptr, GF_FIRE, dir, damage, 2);
502 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
503 else msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball."));
505 fire_ball(caster_ptr, GF_COLD, dir, damage, 2);
508 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
509 else msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud."));
511 fire_ball(caster_ptr, GF_POIS, dir, damage, 2);
514 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
515 else msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball."));
517 fire_ball(caster_ptr, GF_NETHER, dir, damage, 2);
520 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
521 else msg_print(_("流れるような身振りをした。", "You gesture fluidly."));
523 fire_ball(caster_ptr, GF_WATER, dir, damage, 4);
526 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
527 else msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm."));
529 fire_ball(caster_ptr, GF_MANA, dir, damage, 4);
532 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
533 else msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm."));
535 fire_ball(caster_ptr, GF_DARK, dir, damage, 4);
538 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
539 fire_ball_hide(caster_ptr, GF_DRAIN_MANA, dir, randint1(plev*3)+plev, 0);
542 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
543 fire_ball_hide(caster_ptr, GF_MIND_BLAST, dir, damage, 0);
546 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
547 fire_ball_hide(caster_ptr, GF_BRAIN_SMASH, dir, damage, 0);
550 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
551 fire_ball_hide(caster_ptr, GF_CAUSE_1, dir, damage, 0);
554 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
555 fire_ball_hide(caster_ptr, GF_CAUSE_2, dir, damage, 0);
558 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
559 fire_ball_hide(caster_ptr, GF_CAUSE_3, dir, damage, 0);
562 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
563 fire_ball_hide(caster_ptr, GF_CAUSE_4, dir, damage, 0);
566 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
567 else msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt."));
569 fire_bolt(caster_ptr, GF_ACID, dir, damage);
572 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
573 else msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt."));
575 fire_bolt(caster_ptr, GF_ELEC, dir, damage);
578 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
579 else msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt."));
581 fire_bolt(caster_ptr, GF_FIRE, dir, damage);
584 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
585 else msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt."));
587 fire_bolt(caster_ptr, GF_COLD, dir, damage);
590 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
591 else msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst."));
593 fire_ball(caster_ptr, GF_LITE, dir, damage, 4);
596 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
597 else msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt."));
599 fire_bolt(caster_ptr, GF_NETHER, dir, damage);
602 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
603 else msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt."));
605 fire_bolt(caster_ptr, GF_WATER, dir, damage);
608 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
609 else msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt."));
611 fire_bolt(caster_ptr, GF_MANA, dir, damage);
614 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
615 else msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt."));
617 fire_bolt(caster_ptr, GF_PLASMA, dir, damage);
620 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
621 else msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt."));
623 fire_bolt(caster_ptr, GF_ICE, dir, damage);
625 case MS_MAGIC_MISSILE:
626 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
627 else msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile."));
629 fire_bolt(caster_ptr, GF_MISSILE, dir, damage);
632 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
633 else msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion."));
635 fear_monster(caster_ptr, dir, plev+10);
638 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
639 confuse_monster(caster_ptr, dir, plev * 2);
642 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
643 else msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion."));
645 confuse_monster(caster_ptr, dir, plev * 2);
648 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
649 slow_monster(caster_ptr, dir, plev);
652 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
653 sleep_monster(caster_ptr, dir, plev);
656 (void)set_fast(caster_ptr, randint1(20 + plev) + plev, FALSE);
660 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
661 else msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
663 fire_ball_hide(caster_ptr, GF_HAND_DOOM, dir, 200, 0);
667 msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
668 (void)hp_player(caster_ptr, plev*6);
669 (void)set_stun(caster_ptr, 0);
670 (void)set_cut(caster_ptr,0);
673 msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
674 (void)set_invuln(caster_ptr, randint1(7) + 7, FALSE);
677 teleport_player(caster_ptr, 10, TELEPORT_SPONTANEOUS);
680 teleport_player(caster_ptr, plev * 5, TELEPORT_SPONTANEOUS);
683 (void)time_walk(caster_ptr);
691 GAME_TEXT m_name[MAX_NLEN];
693 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
694 if (!caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx) break;
695 if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
696 if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
697 m_ptr = &caster_ptr->current_floor_ptr->m_list[caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx];
698 r_ptr = &r_info[m_ptr->r_idx];
699 monster_desc(caster_ptr, m_name, m_ptr, 0);
700 if (r_ptr->flagsr & RFR_RES_TELE)
702 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
704 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
705 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
709 else if (r_ptr->level > randint1(100))
711 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
712 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
717 msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
719 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);
723 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
725 (void)fire_beam(caster_ptr, GF_AWAY_ALL, dir, plev);
729 return teleport_level_other(caster_ptr);
733 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
734 else msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
735 (void)fire_beam(caster_ptr, GF_PSY_SPEAR, dir, damage);
739 msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
740 (void)unlite_area(caster_ptr, 10, 3);
744 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
745 msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackle evilly."));
746 trap_creation(caster_ptr, target_row, target_col);
749 msg_print(_("しかし何も起きなかった。", "Nothing happen."));
752 msg_print(_("死者復活の呪文を唱えた。", "You animate the dead."));
753 (void)animate_dead(caster_ptr, 0, caster_ptr->y, caster_ptr->x);
758 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
760 msg_print(_("援軍を召喚した。", "You summon minions."));
761 for (k = 0;k < 4; k++)
763 (void)summon_kin_player(caster_ptr, plev, target_row, target_col, (PM_FORCE_PET | PM_ALLOW_GROUP));
770 int max_cyber = (caster_ptr->current_floor_ptr->dun_level / 50) + randint1(3);
771 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
772 msg_print(_("サイバーデーモンを召喚した!", "You summon Cyberdemons!"));
773 if (max_cyber > 4) max_cyber = 4;
774 for (k = 0;k < max_cyber; k++)
775 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_CYBER, mode);
781 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
782 msg_print(_("仲間を召喚した。", "You summon help."));
783 for (k = 0;k < 1; k++)
784 summon_specific(caster_ptr, -1, target_row, target_col, plev, 0, (mode | u_mode));
790 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
791 msg_print(_("モンスターを召喚した!", "You summon monsters!"));
792 for (k = 0; k < 6; k++)
793 summon_specific(caster_ptr, -1, target_row, target_col, plev, 0, (mode | u_mode));
799 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
800 msg_print(_("アリを召喚した。", "You summon ants."));
801 for (k = 0; k < 6; k++)
802 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_ANT, mode);
808 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
809 msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
810 for (k = 0; k < 6; k++)
811 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_SPIDER, mode);
817 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
818 msg_print(_("ハウンドを召喚した。", "You summon hounds."));
819 for (k = 0; k < 4; k++)
820 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HOUND, mode);
826 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
827 msg_print(_("ヒドラを召喚した。", "You summon hydras."));
828 for (k = 0; k < 4; k++)
829 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HYDRA, mode);
835 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
836 msg_print(_("天使を召喚した!", "You summon an angel!"));
837 for (k = 0; k < 1; k++)
838 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_ANGEL, mode);
844 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
845 msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
846 for (k = 0; k < 1; k++)
847 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_DEMON, (mode | u_mode));
853 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
854 msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
855 for (k = 0; k < 1; k++)
856 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_UNDEAD, (mode | u_mode));
862 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
863 msg_print(_("ドラゴンを召喚した!", "You summon a dragon!"));
864 for (k = 0; k < 1; k++)
865 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_DRAGON, (mode | u_mode));
871 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
872 msg_print(_("強力なアンデッドを召喚した!", "You summon greater undead!"));
873 for (k = 0; k < 6; k++)
874 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
880 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
881 msg_print(_("古代ドラゴンを召喚した!", "You summon ancient dragons!"));
882 for (k = 0; k < 4; k++)
883 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_DRAGON, (mode | u_mode));
889 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
890 msg_print(_("アンバーの王族を召喚した!", "You summon Lords of Amber!"));
891 for (k = 0; k < 4; k++)
892 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
898 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
899 msg_print(_("特別な強敵を召喚した!", "You summon special opponents!"));
900 for (k = 0;k < 4; k++)
901 if (summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE))) count++;
902 for (k = count;k < 4; k++)
903 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
915 * @brief ものまねコマンドのメインルーチン /
916 * do_cmd_cast calls this function if the player's class is 'imitator'.
917 * @param baigaesi TRUEならば倍返し上の処理として行う
918 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
920 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
921 * If the user hits escape, returns FALSE, and set '*sn' to -1
922 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
924 * The "prompt" should be "cast", "recite", or "study"
925 * The "known" should be TRUE for cast/pray, FALSE for study
927 * nb: This function has a (trivial) display bug which will be obvious
928 * when you run it. It's probably easy to fix but I haven't tried,
931 bool do_cmd_mane(player_type *creature_ptr, bool baigaesi)
935 PERCENTAGE minfail = 0;
936 PLAYER_LEVEL plev = creature_ptr->lev;
940 if (cmd_limit_confused(creature_ptr)) return FALSE;
942 if (!creature_ptr->mane_num)
944 msg_print(_("まねられるものが何もない!", "You don't remember any action!"));
948 if (!get_mane_power(creature_ptr, &n, baigaesi)) return FALSE;
950 spell = monster_powers[creature_ptr->mane_spell[n]];
952 /* Spell failure chance */
953 chance = spell.manefail;
955 /* Reduce failure rate by "effective" level adjustment */
956 if (plev > spell.level) chance -= 3 * (plev - spell.level);
958 /* Reduce failure rate by 1 stat and DEX adjustment */
959 chance -= 3 * (adj_mag_stat[creature_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[creature_ptr->stat_ind[A_DEX]] - 2) / 2;
961 if (spell.manedam) chance = chance * damage / spell.manedam;
963 chance += creature_ptr->to_m_chance;
965 /* Extract the minimum failure rate */
966 minfail = adj_mag_fail[creature_ptr->stat_ind[spell.use_stat]];
968 /* Minimum failure rate */
969 if (chance < minfail) chance = minfail;
971 /* Stunning makes spells harder */
972 if (creature_ptr->stun > 50) chance += 25;
973 else if (creature_ptr->stun) chance += 15;
975 /* Always a 5 percent chance of working */
976 if (chance > 95) chance = 95;
979 if (randint0(100) < chance)
981 if (flush_failure) flush();
982 msg_print(_("ものまねに失敗した!", "You failed to concentrate hard enough!"));
988 cast = use_mane(creature_ptr, creature_ptr->mane_spell[n]);
989 if (!cast) return FALSE;
992 creature_ptr->mane_num--;
993 for (j = n; j < creature_ptr->mane_num;j++)
995 creature_ptr->mane_spell[j] = creature_ptr->mane_spell[j+1];
996 creature_ptr->mane_dam[j] = creature_ptr->mane_dam[j+1];
999 take_turn(creature_ptr, 100);
1001 creature_ptr->redraw |= (PR_IMITATION);
1002 creature_ptr->window |= (PW_PLAYER);
1003 creature_ptr->window |= (PW_SPELL);