2 * @brief ものまねの処理実装 / Imitation code
5 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
6 * This software may be copied and distributed for educational, research,\n
7 * and not for profit purposes provided that this copyright and statement\n
8 * are included in all such copies. Other copyrights may also apply.\n
9 * 2014 Deskull rearranged comment for Doxygen.\n
12 #include "cmd-action/cmd-spell.h"
13 #include "cmd/cmd-basic.h"
14 #include "core/asking-player.h"
15 #include "core/stuff-handler.h"
16 #include "floor/floor.h"
17 #include "game-option/disturbance-options.h"
18 #include "game-option/text-display-options.h"
19 #include "grid/grid.h"
20 #include "io/targeting.h"
21 #include "main/sound-definitions-table.h"
22 #include "main/sound-of-music.h"
23 #include "monster-race/monster-race.h"
24 #include "monster-race/race-flags1.h"
25 #include "monster-race/race-flags-resistance.h"
26 #include "monster/monster-describer.h"
27 #include "monster-floor/monster-summon.h"
28 #include "monster-floor/place-monster-types.h"
29 #include "monster/monster-info.h"
30 #include "monster/monster-processor.h"
31 #include "monster/monster-status.h"
32 #include "mspell/monster-power-table.h"
33 #include "mspell/mspell-type.h"
34 #include "player/bad-status-setter.h"
35 #include "player/player-effects.h"
36 #include "player/player-status.h"
37 #include "spell-kind/spells-launcher.h"
38 #include "spell-kind/spells-lite.h"
39 #include "spell-kind/spells-neighbor.h"
40 #include "spell-kind/spells-sight.h"
41 #include "spell/spells-status.h"
42 #include "spell/spells-summon.h"
43 #include "spell-kind/spells-teleport.h"
44 #include "spell/spell-types.h"
45 #include "term/screen-processor.h"
46 #include "util/int-char-converter.h"
47 #include "view/display-messages.h"
52 * @brief 受け取ったパラメータに応じてものまねの効果情報をまとめたフォーマットを返す
53 * @param p 情報を返す文字列参照ポインタ
54 * @param power ものまねの効力の種類
58 static void mane_info(player_type *caster_ptr, char *p, int power, HIT_POINT dam)
60 PLAYER_LEVEL plev = caster_ptr->lev;
64 if ((power > 2 && power < 41) || (power > 41 && power < 59) || (power == 75))
65 sprintf(p, " %s%d", KWD_DAM, (int)dam);
71 sprintf(p, " %sd%d+%d", KWD_HEAL, plev * 3, plev);
74 sprintf(p, " %sd%d+%d", KWD_DURATION, 20+plev, plev);
77 sprintf(p, " %s%d", KWD_HEAL, plev*6);
80 sprintf(p, " %sd7+7", KWD_DURATION);
83 sprintf(p, " %s10", KWD_SPHERE);
86 sprintf(p, " %s%d", KWD_SPHERE, plev * 5);
89 sprintf(p, " %s5", KWD_SPHERE);
99 * @brief どのものまねを発動するか選択する処理 /
100 * Allow user to choose a imitation.
101 * @param sn 実行したものまねのIDを返す参照ポインタ(キャンセルなどの場合-1を返す)
102 * @param baigaesi TRUEならば倍返し上の処理として行う
103 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
105 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
106 * If the user hits escape, returns FALSE, and set '*sn' to -1
107 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
109 * The "prompt" should be "cast", "recite", or "study"
110 * The "known" should be TRUE for cast/pray, FALSE for study
112 * nb: This function has a (trivial) display bug which will be obvious
113 * when you run it. It's probably easy to fix but I haven't tried,
116 static int get_mane_power(player_type *caster_ptr, int *sn, bool baigaesi)
122 PERCENTAGE minfail = 0;
123 PLAYER_LEVEL plev = caster_ptr->lev;
124 PERCENTAGE chance = 0;
129 concptr p = _("能力", "power");
134 /* Assume cancelled */
140 num = caster_ptr->mane_num;
142 /* Build a prompt (accept all spells) */
143 (void)strnfmt(out_val, 78,
144 _("(%c-%c, '*'で一覧, ESC) どの%sをまねますか?", "(%c-%c, *=List, ESC=exit) Use which %s? "),
145 I2A(0), I2A(num - 1), p);
147 choice= always_show_list ? ESCAPE:1 ;
150 if(choice==ESCAPE) choice = ' ';
151 else if( !get_com(out_val, &choice, TRUE) )break;
154 if ((choice == ' ') || (choice == '*') || (choice == '?'))
163 /* Display a list of spells */
165 put_str(_("名前", "Name"), y, x + 5);
166 put_str(_("失率 効果", "Fail Info"), y, x + 36);
169 /* Dump the spells */
170 for (i = 0; i < num; i++)
172 /* Access the spell */
173 spell = monster_powers[caster_ptr->mane_spell[i]];
175 chance = spell.manefail;
177 /* Reduce failure rate by "effective" level adjustment */
178 if (plev > spell.level) chance -= 3 * (plev - spell.level);
180 /* Reduce failure rate by INT/WIS adjustment */
181 chance -= 3 * (adj_mag_stat[caster_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[caster_ptr->stat_ind[A_DEX]] - 2) / 2;
183 if (spell.manedam) chance = chance * (baigaesi ? caster_ptr->mane_dam[i] * 2 : caster_ptr->mane_dam[i]) / spell.manedam;
185 chance += caster_ptr->to_m_chance;
187 /* Extract the minimum failure rate */
188 minfail = adj_mag_fail[caster_ptr->stat_ind[spell.use_stat]];
190 /* Minimum failure rate */
191 if (chance < minfail) chance = minfail;
193 /* Stunning makes spells harder */
194 if (caster_ptr->stun > 50) chance += 25;
195 else if (caster_ptr->stun) chance += 15;
197 /* Always a 5 percent chance of working */
198 if (chance > 95) chance = 95;
201 mane_info(caster_ptr, comment, caster_ptr->mane_spell[i], (baigaesi ? caster_ptr->mane_dam[i]*2 : caster_ptr->mane_dam[i]));
203 /* Dump the spell --(-- */
204 sprintf(psi_desc, " %c) %-30s %3d%%%s",
207 prt(psi_desc, y + i + 1, x);
210 /* Clear the bottom line */
211 prt("", y + i + 1, x);
227 ask = isupper(choice);
230 if (ask) choice = (char)tolower(choice);
232 /* Extract request */
233 i = (islower(choice) ? A2I(choice) : -1);
235 /* Totally Illegal */
236 if ((i < 0) || (i >= num))
242 /* Save the spell index */
243 spell = monster_powers[caster_ptr->mane_spell[i]];
251 (void) strnfmt(tmp_val, 78, _("%sをまねますか?", "Use %s? "), monster_powers[caster_ptr->mane_spell[i]].name);
253 /* Belay that order */
254 if (!get_check(tmp_val)) continue;
260 if (redraw) screen_load();
262 caster_ptr->window |= (PW_SPELL);
263 handle_stuff(caster_ptr);
265 /* Abort if needed */
266 if (!flag) return FALSE;
268 /* Save the choice */
271 damage = (baigaesi ? caster_ptr->mane_dam[i]*2 : caster_ptr->mane_dam[i]);
280 * do_cmd_cast calls this function if the player's class is 'imitator'.
281 * @param caster_ptr プレーヤーへの参照ポインタ
282 * @param spell 発動するモンスター攻撃のID
283 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
285 static bool use_mane(player_type *caster_ptr, int spell)
288 PLAYER_LEVEL plev = caster_ptr->lev;
289 BIT_FLAGS mode = (PM_ALLOW_GROUP | PM_FORCE_PET);
290 BIT_FLAGS u_mode = 0L;
292 if (randint1(50+plev) < plev/10) u_mode = PM_ALLOW_UNIQUE;
300 msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
301 aggravate_monsters(caster_ptr, 0);
311 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
312 m_idx = caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
314 if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
315 if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
316 dispel_monster_status(caster_ptr, m_idx);
321 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
322 else msg_print(_("ロケットを発射した。", "You fire a rocket."));
323 fire_rocket(caster_ptr, GF_ROCKET, dir, damage, 2);
327 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
328 else msg_print(_("矢を放った。", "You fire an arrow."));
329 fire_bolt(caster_ptr, GF_ARROW, dir, damage);
342 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
343 else msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
344 fire_breath(caster_ptr, GF_ACID, dir, damage, (plev > 35 ? 3 : 2));
348 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
349 else msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
350 fire_breath(caster_ptr, GF_ELEC, dir, damage, (plev > 35 ? 3 : 2));
354 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
355 else msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
356 fire_breath(caster_ptr, GF_FIRE, dir, damage, (plev > 35 ? 3 : 2));
360 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
361 else msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
362 fire_breath(caster_ptr, GF_COLD, dir, damage, (plev > 35 ? 3 : 2));
366 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
367 else msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
368 fire_breath(caster_ptr, GF_POIS, dir, damage, (plev > 35 ? 3 : 2));
372 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
373 else msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
374 fire_breath(caster_ptr, GF_NETHER, dir, damage, (plev > 35 ? 3 : 2));
378 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
379 else msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
380 fire_breath(caster_ptr, GF_LITE, dir, damage, (plev > 35 ? 3 : 2));
384 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
385 else msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
386 fire_breath(caster_ptr, GF_DARK, dir, damage, (plev > 35 ? 3 : 2));
390 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
391 else msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
392 fire_breath(caster_ptr, GF_CONFUSION, dir, damage, (plev > 35 ? 3 : 2));
396 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
397 else msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
398 fire_breath(caster_ptr, GF_SOUND, dir, damage, (plev > 35 ? 3 : 2));
402 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
403 else msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
404 fire_breath(caster_ptr, GF_CHAOS, dir, damage, (plev > 35 ? 3 : 2));
408 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
409 else msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
410 fire_breath(caster_ptr, GF_DISENCHANT, dir, damage, (plev > 35 ? 3 : 2));
414 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
415 else msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
416 fire_breath(caster_ptr, GF_NEXUS, dir, damage, (plev > 35 ? 3 : 2));
420 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
421 else msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
422 fire_breath(caster_ptr, GF_TIME, dir, damage, (plev > 35 ? 3 : 2));
426 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
427 else msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
428 fire_breath(caster_ptr, GF_INERTIAL, dir, damage, (plev > 35 ? 3 : 2));
432 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
433 else msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
434 fire_breath(caster_ptr, GF_GRAVITY, dir, damage, (plev > 35 ? 3 : 2));
438 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
439 else msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
440 fire_breath(caster_ptr, GF_SHARDS, dir, damage, (plev > 35 ? 3 : 2));
444 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
445 else msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
447 fire_breath(caster_ptr, GF_PLASMA, dir, damage, (plev > 35 ? 3 : 2));
451 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
452 else msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
454 fire_breath(caster_ptr, GF_FORCE, dir, damage, (plev > 35 ? 3 : 2));
458 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
459 else msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
461 fire_breath(caster_ptr, GF_MANA, dir, damage, (plev > 35 ? 3 : 2));
465 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
466 else msg_print(_("放射能球を放った。", "You cast a ball of radiation."));
468 fire_ball(caster_ptr, GF_NUKE, dir, damage, 2);
472 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
473 else msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
475 fire_breath(caster_ptr, GF_NUKE, dir, damage, (plev > 35 ? 3 : 2));
479 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
480 else msg_print(_("純ログルスを放った。", "You invoke a raw Logrus."));
482 fire_ball(caster_ptr, GF_CHAOS, dir, damage, 4);
485 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
486 else msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
488 fire_breath(caster_ptr, GF_DISINTEGRATE, dir, damage, (plev > 35 ? 3 : 2));
491 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
492 else msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball."));
494 fire_ball(caster_ptr, GF_ACID, dir, damage, 2);
497 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
498 else msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball."));
500 fire_ball(caster_ptr, GF_ELEC, dir, damage, 2);
503 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
504 else msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball."));
506 fire_ball(caster_ptr, GF_FIRE, dir, damage, 2);
509 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
510 else msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball."));
512 fire_ball(caster_ptr, GF_COLD, dir, damage, 2);
515 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
516 else msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud."));
518 fire_ball(caster_ptr, GF_POIS, dir, damage, 2);
521 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
522 else msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball."));
524 fire_ball(caster_ptr, GF_NETHER, dir, damage, 2);
527 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
528 else msg_print(_("流れるような身振りをした。", "You gesture fluidly."));
530 fire_ball(caster_ptr, GF_WATER, dir, damage, 4);
533 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
534 else msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm."));
536 fire_ball(caster_ptr, GF_MANA, dir, damage, 4);
539 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
540 else msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm."));
542 fire_ball(caster_ptr, GF_DARK, dir, damage, 4);
545 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
546 fire_ball_hide(caster_ptr, GF_DRAIN_MANA, dir, randint1(plev*3)+plev, 0);
549 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
550 fire_ball_hide(caster_ptr, GF_MIND_BLAST, dir, damage, 0);
553 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
554 fire_ball_hide(caster_ptr, GF_BRAIN_SMASH, dir, damage, 0);
557 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
558 fire_ball_hide(caster_ptr, GF_CAUSE_1, dir, damage, 0);
561 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
562 fire_ball_hide(caster_ptr, GF_CAUSE_2, dir, damage, 0);
565 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
566 fire_ball_hide(caster_ptr, GF_CAUSE_3, dir, damage, 0);
569 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
570 fire_ball_hide(caster_ptr, GF_CAUSE_4, dir, damage, 0);
573 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
574 else msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt."));
576 fire_bolt(caster_ptr, GF_ACID, dir, damage);
579 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
580 else msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt."));
582 fire_bolt(caster_ptr, GF_ELEC, dir, damage);
585 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
586 else msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt."));
588 fire_bolt(caster_ptr, GF_FIRE, dir, damage);
591 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
592 else msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt."));
594 fire_bolt(caster_ptr, GF_COLD, dir, damage);
597 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
598 else msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst."));
600 fire_ball(caster_ptr, GF_LITE, dir, damage, 4);
603 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
604 else msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt."));
606 fire_bolt(caster_ptr, GF_NETHER, dir, damage);
609 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
610 else msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt."));
612 fire_bolt(caster_ptr, GF_WATER, dir, damage);
615 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
616 else msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt."));
618 fire_bolt(caster_ptr, GF_MANA, dir, damage);
621 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
622 else msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt."));
624 fire_bolt(caster_ptr, GF_PLASMA, dir, damage);
627 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
628 else msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt."));
630 fire_bolt(caster_ptr, GF_ICE, dir, damage);
632 case MS_MAGIC_MISSILE:
633 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
634 else msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile."));
636 fire_bolt(caster_ptr, GF_MISSILE, dir, damage);
639 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
640 else msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion."));
642 fear_monster(caster_ptr, dir, plev+10);
645 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
646 confuse_monster(caster_ptr, dir, plev * 2);
649 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
650 else msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion."));
652 confuse_monster(caster_ptr, dir, plev * 2);
655 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
656 slow_monster(caster_ptr, dir, plev);
659 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
660 sleep_monster(caster_ptr, dir, plev);
663 (void)set_fast(caster_ptr, randint1(20 + plev) + plev, FALSE);
667 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
668 else msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
670 fire_ball_hide(caster_ptr, GF_HAND_DOOM, dir, 200, 0);
674 msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
675 (void)hp_player(caster_ptr, plev*6);
676 (void)set_stun(caster_ptr, 0);
677 (void)set_cut(caster_ptr,0);
680 msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
681 (void)set_invuln(caster_ptr, randint1(7) + 7, FALSE);
684 teleport_player(caster_ptr, 10, TELEPORT_SPONTANEOUS);
687 teleport_player(caster_ptr, plev * 5, TELEPORT_SPONTANEOUS);
690 (void)time_walk(caster_ptr);
698 GAME_TEXT m_name[MAX_NLEN];
700 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
701 if (!caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx) break;
702 if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
703 if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
704 m_ptr = &caster_ptr->current_floor_ptr->m_list[caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx];
705 r_ptr = &r_info[m_ptr->r_idx];
706 monster_desc(caster_ptr, m_name, m_ptr, 0);
707 if (r_ptr->flagsr & RFR_RES_TELE)
709 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
711 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
712 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
716 else if (r_ptr->level > randint1(100))
718 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
719 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
724 msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
726 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);
730 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
732 (void)fire_beam(caster_ptr, GF_AWAY_ALL, dir, plev);
736 return teleport_level_other(caster_ptr);
740 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
741 else msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
742 (void)fire_beam(caster_ptr, GF_PSY_SPEAR, dir, damage);
746 msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
747 (void)unlite_area(caster_ptr, 10, 3);
751 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
752 msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackle evilly."));
753 trap_creation(caster_ptr, target_row, target_col);
756 msg_print(_("しかし何も起きなかった。", "Nothing happen."));
759 msg_print(_("死者復活の呪文を唱えた。", "You animate the dead."));
760 (void)animate_dead(caster_ptr, 0, caster_ptr->y, caster_ptr->x);
765 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
767 msg_print(_("援軍を召喚した。", "You summon minions."));
768 for (k = 0;k < 4; k++)
770 (void)summon_kin_player(caster_ptr, plev, target_row, target_col, (PM_FORCE_PET | PM_ALLOW_GROUP));
777 int max_cyber = (caster_ptr->current_floor_ptr->dun_level / 50) + randint1(3);
778 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
779 msg_print(_("サイバーデーモンを召喚した!", "You summon Cyberdemons!"));
780 if (max_cyber > 4) max_cyber = 4;
781 for (k = 0;k < max_cyber; k++)
782 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_CYBER, mode);
788 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
789 msg_print(_("仲間を召喚した。", "You summon help."));
790 for (k = 0;k < 1; k++)
791 summon_specific(caster_ptr, -1, target_row, target_col, plev, 0, (mode | u_mode));
797 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
798 msg_print(_("モンスターを召喚した!", "You summon monsters!"));
799 for (k = 0; k < 6; k++)
800 summon_specific(caster_ptr, -1, target_row, target_col, plev, 0, (mode | u_mode));
806 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
807 msg_print(_("アリを召喚した。", "You summon ants."));
808 for (k = 0; k < 6; k++)
809 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_ANT, mode);
815 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
816 msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
817 for (k = 0; k < 6; k++)
818 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_SPIDER, mode);
824 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
825 msg_print(_("ハウンドを召喚した。", "You summon hounds."));
826 for (k = 0; k < 4; k++)
827 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HOUND, mode);
833 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
834 msg_print(_("ヒドラを召喚した。", "You summon hydras."));
835 for (k = 0; k < 4; k++)
836 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HYDRA, mode);
842 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
843 msg_print(_("天使を召喚した!", "You summon an angel!"));
844 for (k = 0; k < 1; k++)
845 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_ANGEL, mode);
851 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
852 msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
853 for (k = 0; k < 1; k++)
854 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_DEMON, (mode | u_mode));
860 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
861 msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
862 for (k = 0; k < 1; k++)
863 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_UNDEAD, (mode | u_mode));
869 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
870 msg_print(_("ドラゴンを召喚した!", "You summon a dragon!"));
871 for (k = 0; k < 1; k++)
872 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_DRAGON, (mode | u_mode));
878 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
879 msg_print(_("強力なアンデッドを召喚した!", "You summon greater undead!"));
880 for (k = 0; k < 6; k++)
881 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
887 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
888 msg_print(_("古代ドラゴンを召喚した!", "You summon ancient dragons!"));
889 for (k = 0; k < 4; k++)
890 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_DRAGON, (mode | u_mode));
896 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
897 msg_print(_("アンバーの王族を召喚した!", "You summon Lords of Amber!"));
898 for (k = 0; k < 4; k++)
899 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
905 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
906 msg_print(_("特別な強敵を召喚した!", "You summon special opponents!"));
907 for (k = 0;k < 4; k++)
908 if (summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE))) count++;
909 for (k = count;k < 4; k++)
910 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
922 * @brief ものまねコマンドのメインルーチン /
923 * do_cmd_cast calls this function if the player's class is 'imitator'.
924 * @param baigaesi TRUEならば倍返し上の処理として行う
925 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
927 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
928 * If the user hits escape, returns FALSE, and set '*sn' to -1
929 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
931 * The "prompt" should be "cast", "recite", or "study"
932 * The "known" should be TRUE for cast/pray, FALSE for study
934 * nb: This function has a (trivial) display bug which will be obvious
935 * when you run it. It's probably easy to fix but I haven't tried,
938 bool do_cmd_mane(player_type *creature_ptr, bool baigaesi)
942 PERCENTAGE minfail = 0;
943 PLAYER_LEVEL plev = creature_ptr->lev;
947 if (cmd_limit_confused(creature_ptr)) return FALSE;
949 if (!creature_ptr->mane_num)
951 msg_print(_("まねられるものが何もない!", "You don't remember any action!"));
955 if (!get_mane_power(creature_ptr, &n, baigaesi)) return FALSE;
957 spell = monster_powers[creature_ptr->mane_spell[n]];
959 /* Spell failure chance */
960 chance = spell.manefail;
962 /* Reduce failure rate by "effective" level adjustment */
963 if (plev > spell.level) chance -= 3 * (plev - spell.level);
965 /* Reduce failure rate by 1 stat and DEX adjustment */
966 chance -= 3 * (adj_mag_stat[creature_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[creature_ptr->stat_ind[A_DEX]] - 2) / 2;
968 if (spell.manedam) chance = chance * damage / spell.manedam;
970 chance += creature_ptr->to_m_chance;
972 /* Extract the minimum failure rate */
973 minfail = adj_mag_fail[creature_ptr->stat_ind[spell.use_stat]];
975 /* Minimum failure rate */
976 if (chance < minfail) chance = minfail;
978 /* Stunning makes spells harder */
979 if (creature_ptr->stun > 50) chance += 25;
980 else if (creature_ptr->stun) chance += 15;
982 /* Always a 5 percent chance of working */
983 if (chance > 95) chance = 95;
986 if (randint0(100) < chance)
988 if (flush_failure) flush();
989 msg_print(_("ものまねに失敗した!", "You failed to concentrate hard enough!"));
995 cast = use_mane(creature_ptr, creature_ptr->mane_spell[n]);
996 if (!cast) return FALSE;
999 creature_ptr->mane_num--;
1000 for (j = n; j < creature_ptr->mane_num;j++)
1002 creature_ptr->mane_spell[j] = creature_ptr->mane_spell[j+1];
1003 creature_ptr->mane_dam[j] = creature_ptr->mane_dam[j+1];
1006 take_turn(creature_ptr, 100);
1008 creature_ptr->redraw |= (PR_IMITATION);
1009 creature_ptr->window |= (PW_PLAYER);
1010 creature_ptr->window |= (PW_SPELL);