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 "action/action-limited.h"
13 #include "cmd-action/cmd-spell.h"
14 #include "core/asking-player.h"
15 #include "core/player-redraw-types.h"
16 #include "core/stuff-handler.h"
17 #include "core/window-redrawer.h"
18 #include "floor/cave.h"
19 #include "floor/floor-object.h"
20 #include "game-option/disturbance-options.h"
21 #include "game-option/text-display-options.h"
22 #include "grid/grid.h"
23 #include "hpmp/hp-mp-processor.h"
24 #include "main/sound-definitions-table.h"
25 #include "main/sound-of-music.h"
26 #include "mind/mind-mage.h"
27 #include "monster-floor/monster-summon.h"
28 #include "monster-floor/place-monster-types.h"
29 #include "monster-race/monster-race.h"
30 #include "monster-race/race-ability-flags.h"
31 #include "monster-race/race-flags-resistance.h"
32 #include "monster-race/race-flags1.h"
33 #include "monster/monster-describer.h"
34 #include "monster/monster-info.h"
35 #include "monster/monster-processor.h"
36 #include "monster/monster-status.h"
37 #include "mspell/monster-power-table.h"
38 #include "player/player-status-table.h"
39 #include "player/player-status.h"
40 #include "spell-kind/spells-launcher.h"
41 #include "spell-kind/spells-lite.h"
42 #include "spell-kind/spells-neighbor.h"
43 #include "spell-kind/spells-sight.h"
44 #include "spell-kind/spells-teleport.h"
45 #include "spell-kind/spells-world.h"
46 #include "spell/spell-types.h"
47 #include "spell/spells-status.h"
48 #include "spell/spells-summon.h"
49 #include "spell/summon-types.h"
50 #include "status/bad-status-setter.h"
51 #include "status/body-improvement.h"
52 #include "status/buff-setter.h"
53 #include "system/floor-type-definition.h"
54 #include "system/monster-race-definition.h"
55 #include "system/monster-type-definition.h"
56 #include "system/player-type-definition.h"
57 #include "target/projection-path-calculator.h"
58 #include "target/target-checker.h"
59 #include "target/target-getter.h"
60 #include "target/target-setter.h"
61 #include "target/target-types.h"
62 #include "term/screen-processor.h"
63 #include "util/int-char-converter.h"
64 #include "view/display-messages.h"
69 * @brief 受け取ったパラメータに応じてものまねの効果情報をまとめたフォーマットを返す
70 * @param p 情報を返す文字列参照ポインタ
71 * @param power ものまねの効力の種類
75 static void mane_info(player_type *caster_ptr, char *p, RF_ABILITY power, HIT_POINT dam)
77 PLAYER_LEVEL plev = caster_ptr->lev;
81 const auto power_int = static_cast<int>(power);
83 if ((power_int > 2 && power_int < 41) || (power_int > 41 && power_int < 59) || (power == RF_ABILITY::PSY_SPEAR))
84 sprintf(p, " %s%d", KWD_DAM, (int)dam);
87 case RF_ABILITY::DRAIN_MANA:
88 sprintf(p, " %sd%d+%d", KWD_HEAL, plev * 3, plev);
90 case RF_ABILITY::HASTE:
91 sprintf(p, " %sd%d+%d", KWD_DURATION, 20 + plev, plev);
93 case RF_ABILITY::HEAL:
94 sprintf(p, " %s%d", KWD_HEAL, plev * 6);
96 case RF_ABILITY::INVULNER:
97 sprintf(p, " %sd7+7", KWD_DURATION);
99 case RF_ABILITY::BLINK:
100 sprintf(p, " %s10", KWD_SPHERE);
102 case RF_ABILITY::TPORT:
103 sprintf(p, " %s%d", KWD_SPHERE, plev * 5);
105 case RF_ABILITY::RAISE_DEAD:
106 sprintf(p, " %s5", KWD_SPHERE);
115 * @brief どのものまねを発動するか選択する処理 /
116 * Allow user to choose a imitation.
117 * @param sn 実行したものまねのIDを返す参照ポインタ(キャンセルなどの場合-1を返す)
118 * @param baigaesi TRUEならば倍返し上の処理として行う
119 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
121 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
122 * If the user hits escape, returns FALSE, and set '*sn' to -1
123 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
125 * The "prompt" should be "cast", "recite", or "study"
126 * The "known" should be TRUE for cast/pray, FALSE for study
128 * nb: This function has a (trivial) display bug which will be obvious
129 * when you run it. It's probably easy to fix but I haven't tried,
132 static int get_mane_power(player_type *caster_ptr, int *sn, bool baigaesi)
138 PERCENTAGE minfail = 0;
139 PLAYER_LEVEL plev = caster_ptr->lev;
140 PERCENTAGE chance = 0;
143 char out_val[MAX_MONSTER_NAME];
145 concptr p = _("能力", "power");
150 /* Assume cancelled */
156 num = caster_ptr->mane_num;
158 /* Build a prompt (accept all spells) */
159 (void)strnfmt(out_val, 78, _("(%c-%c, '*'で一覧, ESC) どの%sをまねますか?", "(%c-%c, *=List, ESC=exit) Use which %s? "), I2A(0), I2A(num - 1), p);
161 choice = always_show_list ? ESCAPE : 1;
163 if (choice == ESCAPE)
165 else if (!get_com(out_val, &choice, TRUE))
169 if ((choice == ' ') || (choice == '*') || (choice == '?')) {
176 /* Display a list of spells */
178 put_str(_("名前", "Name"), y, x + 5);
179 put_str(_("失率 効果", "Fail Info"), y, x + 36);
181 /* Dump the spells */
182 for (i = 0; i < num; i++) {
183 /* Access the spell */
184 spell = monster_powers[static_cast<size_t>(caster_ptr->mane_spell[i])];
186 chance = spell.manefail;
188 /* Reduce failure rate by "effective" level adjustment */
189 if (plev > spell.level)
190 chance -= 3 * (plev - spell.level);
192 /* Reduce failure rate by INT/WIS adjustment */
193 chance -= 3 * (adj_mag_stat[caster_ptr->stat_index[spell.use_stat]] + adj_mag_stat[caster_ptr->stat_index[A_DEX]] - 2) / 2;
196 chance = chance * (baigaesi ? caster_ptr->mane_dam[i] * 2 : caster_ptr->mane_dam[i]) / spell.manedam;
198 chance += caster_ptr->to_m_chance;
200 /* Extract the minimum failure rate */
201 minfail = adj_mag_fail[caster_ptr->stat_index[spell.use_stat]];
203 /* Minimum failure rate */
204 if (chance < minfail)
207 /* Stunning makes spells harder */
208 if (caster_ptr->stun > 50)
210 else if (caster_ptr->stun)
213 /* Always a 5 percent chance of working */
218 mane_info(caster_ptr, comment, caster_ptr->mane_spell[i], (baigaesi ? caster_ptr->mane_dam[i] * 2 : caster_ptr->mane_dam[i]));
220 /* Dump the spell --(-- */
221 sprintf(psi_desc, " %c) %-30s %3d%%%s", I2A(i), spell.name, chance, comment);
222 prt(psi_desc, y + i + 1, x);
225 /* Clear the bottom line */
226 prt("", y + i + 1, x);
241 ask = isupper(choice);
245 choice = (char)tolower(choice);
247 /* Extract request */
248 i = (islower(choice) ? A2I(choice) : -1);
250 /* Totally Illegal */
251 if ((i < 0) || (i >= num)) {
256 /* Save the spell index */
257 spell = monster_powers[static_cast<int>(caster_ptr->mane_spell[i])];
264 (void)strnfmt(tmp_val, 78, _("%sをまねますか?", "Use %s? "), spell.name);
266 /* Belay that order */
267 if (!get_check(tmp_val))
277 caster_ptr->window_flags |= (PW_SPELL);
278 handle_stuff(caster_ptr);
280 /* Abort if needed */
284 /* Save the choice */
287 damage = (baigaesi ? caster_ptr->mane_dam[i] * 2 : caster_ptr->mane_dam[i]);
295 * do_cmd_cast calls this function if the player's class is 'imitator'.
296 * @param caster_ptr プレーヤーへの参照ポインタ
297 * @param spell 発動するモンスター攻撃のID
298 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
300 static bool use_mane(player_type *caster_ptr, RF_ABILITY spell)
303 PLAYER_LEVEL plev = caster_ptr->lev;
304 BIT_FLAGS mode = (PM_ALLOW_GROUP | PM_FORCE_PET);
305 BIT_FLAGS u_mode = 0L;
307 if (randint1(50 + plev) < plev / 10)
308 u_mode = PM_ALLOW_UNIQUE;
312 case RF_ABILITY::SHRIEK:
313 msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
314 aggravate_monsters(caster_ptr, 0);
317 case RF_ABILITY::XXX1:
320 case RF_ABILITY::DISPEL: {
323 if (!target_set(caster_ptr, TARGET_KILL))
325 m_idx = caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
328 if (!player_has_los_bold(caster_ptr, target_row, target_col))
330 if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col))
332 dispel_monster_status(caster_ptr, m_idx);
336 case RF_ABILITY::ROCKET:
337 if (!get_aim_dir(caster_ptr, &dir))
340 msg_print(_("ロケットを発射した。", "You fire a rocket."));
341 fire_rocket(caster_ptr, GF_ROCKET, dir, damage, 2);
344 case RF_ABILITY::SHOOT:
345 if (!get_aim_dir(caster_ptr, &dir))
348 msg_print(_("矢を放った。", "You fire an arrow."));
349 fire_bolt(caster_ptr, GF_ARROW, dir, damage);
352 case RF_ABILITY::XXX2:
355 case RF_ABILITY::XXX3:
358 case RF_ABILITY::XXX4:
361 case RF_ABILITY::BR_ACID:
362 if (!get_aim_dir(caster_ptr, &dir))
365 msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
366 fire_breath(caster_ptr, GF_ACID, dir, damage, (plev > 35 ? 3 : 2));
369 case RF_ABILITY::BR_ELEC:
370 if (!get_aim_dir(caster_ptr, &dir))
373 msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
374 fire_breath(caster_ptr, GF_ELEC, dir, damage, (plev > 35 ? 3 : 2));
377 case RF_ABILITY::BR_FIRE:
378 if (!get_aim_dir(caster_ptr, &dir))
381 msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
382 fire_breath(caster_ptr, GF_FIRE, dir, damage, (plev > 35 ? 3 : 2));
385 case RF_ABILITY::BR_COLD:
386 if (!get_aim_dir(caster_ptr, &dir))
389 msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
390 fire_breath(caster_ptr, GF_COLD, dir, damage, (plev > 35 ? 3 : 2));
393 case RF_ABILITY::BR_POIS:
394 if (!get_aim_dir(caster_ptr, &dir))
397 msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
398 fire_breath(caster_ptr, GF_POIS, dir, damage, (plev > 35 ? 3 : 2));
401 case RF_ABILITY::BR_NETH:
402 if (!get_aim_dir(caster_ptr, &dir))
405 msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
406 fire_breath(caster_ptr, GF_NETHER, dir, damage, (plev > 35 ? 3 : 2));
409 case RF_ABILITY::BR_LITE:
410 if (!get_aim_dir(caster_ptr, &dir))
413 msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
414 fire_breath(caster_ptr, GF_LITE, dir, damage, (plev > 35 ? 3 : 2));
417 case RF_ABILITY::BR_DARK:
418 if (!get_aim_dir(caster_ptr, &dir))
421 msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
422 fire_breath(caster_ptr, GF_DARK, dir, damage, (plev > 35 ? 3 : 2));
425 case RF_ABILITY::BR_CONF:
426 if (!get_aim_dir(caster_ptr, &dir))
429 msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
430 fire_breath(caster_ptr, GF_CONFUSION, dir, damage, (plev > 35 ? 3 : 2));
433 case RF_ABILITY::BR_SOUN:
434 if (!get_aim_dir(caster_ptr, &dir))
437 msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
438 fire_breath(caster_ptr, GF_SOUND, dir, damage, (plev > 35 ? 3 : 2));
441 case RF_ABILITY::BR_CHAO:
442 if (!get_aim_dir(caster_ptr, &dir))
445 msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
446 fire_breath(caster_ptr, GF_CHAOS, dir, damage, (plev > 35 ? 3 : 2));
449 case RF_ABILITY::BR_DISE:
450 if (!get_aim_dir(caster_ptr, &dir))
453 msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
454 fire_breath(caster_ptr, GF_DISENCHANT, dir, damage, (plev > 35 ? 3 : 2));
457 case RF_ABILITY::BR_NEXU:
458 if (!get_aim_dir(caster_ptr, &dir))
461 msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
462 fire_breath(caster_ptr, GF_NEXUS, dir, damage, (plev > 35 ? 3 : 2));
465 case RF_ABILITY::BR_TIME:
466 if (!get_aim_dir(caster_ptr, &dir))
469 msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
470 fire_breath(caster_ptr, GF_TIME, dir, damage, (plev > 35 ? 3 : 2));
473 case RF_ABILITY::BR_INER:
474 if (!get_aim_dir(caster_ptr, &dir))
477 msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
478 fire_breath(caster_ptr, GF_INERTIAL, dir, damage, (plev > 35 ? 3 : 2));
481 case RF_ABILITY::BR_GRAV:
482 if (!get_aim_dir(caster_ptr, &dir))
485 msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
486 fire_breath(caster_ptr, GF_GRAVITY, dir, damage, (plev > 35 ? 3 : 2));
489 case RF_ABILITY::BR_SHAR:
490 if (!get_aim_dir(caster_ptr, &dir))
493 msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
494 fire_breath(caster_ptr, GF_SHARDS, dir, damage, (plev > 35 ? 3 : 2));
497 case RF_ABILITY::BR_PLAS:
498 if (!get_aim_dir(caster_ptr, &dir))
501 msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
503 fire_breath(caster_ptr, GF_PLASMA, dir, damage, (plev > 35 ? 3 : 2));
506 case RF_ABILITY::BR_FORC:
507 if (!get_aim_dir(caster_ptr, &dir))
510 msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
512 fire_breath(caster_ptr, GF_FORCE, dir, damage, (plev > 35 ? 3 : 2));
515 case RF_ABILITY::BR_MANA:
516 if (!get_aim_dir(caster_ptr, &dir))
519 msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
521 fire_breath(caster_ptr, GF_MANA, dir, damage, (plev > 35 ? 3 : 2));
524 case RF_ABILITY::BA_NUKE:
525 if (!get_aim_dir(caster_ptr, &dir))
528 msg_print(_("放射能球を放った。", "You cast a ball of radiation."));
530 fire_ball(caster_ptr, GF_NUKE, dir, damage, 2);
533 case RF_ABILITY::BR_NUKE:
534 if (!get_aim_dir(caster_ptr, &dir))
537 msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
539 fire_breath(caster_ptr, GF_NUKE, dir, damage, (plev > 35 ? 3 : 2));
542 case RF_ABILITY::BA_CHAO:
543 if (!get_aim_dir(caster_ptr, &dir))
546 msg_print(_("純ログルスを放った。", "You invoke a raw Logrus."));
548 fire_ball(caster_ptr, GF_CHAOS, dir, damage, 4);
550 case RF_ABILITY::BR_DISI:
551 if (!get_aim_dir(caster_ptr, &dir))
554 msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
556 fire_breath(caster_ptr, GF_DISINTEGRATE, dir, damage, (plev > 35 ? 3 : 2));
558 case RF_ABILITY::BA_ACID:
559 if (!get_aim_dir(caster_ptr, &dir))
562 msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball."));
564 fire_ball(caster_ptr, GF_ACID, dir, damage, 2);
566 case RF_ABILITY::BA_ELEC:
567 if (!get_aim_dir(caster_ptr, &dir))
570 msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball."));
572 fire_ball(caster_ptr, GF_ELEC, dir, damage, 2);
574 case RF_ABILITY::BA_FIRE:
575 if (!get_aim_dir(caster_ptr, &dir))
578 msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball."));
580 fire_ball(caster_ptr, GF_FIRE, dir, damage, 2);
582 case RF_ABILITY::BA_COLD:
583 if (!get_aim_dir(caster_ptr, &dir))
586 msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball."));
588 fire_ball(caster_ptr, GF_COLD, dir, damage, 2);
590 case RF_ABILITY::BA_POIS:
591 if (!get_aim_dir(caster_ptr, &dir))
594 msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud."));
596 fire_ball(caster_ptr, GF_POIS, dir, damage, 2);
598 case RF_ABILITY::BA_NETH:
599 if (!get_aim_dir(caster_ptr, &dir))
602 msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball."));
604 fire_ball(caster_ptr, GF_NETHER, dir, damage, 2);
606 case RF_ABILITY::BA_WATE:
607 if (!get_aim_dir(caster_ptr, &dir))
610 msg_print(_("流れるような身振りをした。", "You gesture fluidly."));
612 fire_ball(caster_ptr, GF_WATER, dir, damage, 4);
614 case RF_ABILITY::BA_MANA:
615 if (!get_aim_dir(caster_ptr, &dir))
618 msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm."));
620 fire_ball(caster_ptr, GF_MANA, dir, damage, 4);
622 case RF_ABILITY::BA_DARK:
623 if (!get_aim_dir(caster_ptr, &dir))
626 msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm."));
628 fire_ball(caster_ptr, GF_DARK, dir, damage, 4);
630 case RF_ABILITY::DRAIN_MANA:
631 if (!get_aim_dir(caster_ptr, &dir))
633 fire_ball_hide(caster_ptr, GF_DRAIN_MANA, dir, randint1(plev * 3) + plev, 0);
635 case RF_ABILITY::MIND_BLAST:
636 if (!get_aim_dir(caster_ptr, &dir))
638 fire_ball_hide(caster_ptr, GF_MIND_BLAST, dir, damage, 0);
640 case RF_ABILITY::BRAIN_SMASH:
641 if (!get_aim_dir(caster_ptr, &dir))
643 fire_ball_hide(caster_ptr, GF_BRAIN_SMASH, dir, damage, 0);
645 case RF_ABILITY::CAUSE_1:
646 if (!get_aim_dir(caster_ptr, &dir))
648 fire_ball_hide(caster_ptr, GF_CAUSE_1, dir, damage, 0);
650 case RF_ABILITY::CAUSE_2:
651 if (!get_aim_dir(caster_ptr, &dir))
653 fire_ball_hide(caster_ptr, GF_CAUSE_2, dir, damage, 0);
655 case RF_ABILITY::CAUSE_3:
656 if (!get_aim_dir(caster_ptr, &dir))
658 fire_ball_hide(caster_ptr, GF_CAUSE_3, dir, damage, 0);
660 case RF_ABILITY::CAUSE_4:
661 if (!get_aim_dir(caster_ptr, &dir))
663 fire_ball_hide(caster_ptr, GF_CAUSE_4, dir, damage, 0);
665 case RF_ABILITY::BO_ACID:
666 if (!get_aim_dir(caster_ptr, &dir))
669 msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt."));
671 fire_bolt(caster_ptr, GF_ACID, dir, damage);
673 case RF_ABILITY::BO_ELEC:
674 if (!get_aim_dir(caster_ptr, &dir))
677 msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt."));
679 fire_bolt(caster_ptr, GF_ELEC, dir, damage);
681 case RF_ABILITY::BO_FIRE:
682 if (!get_aim_dir(caster_ptr, &dir))
685 msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt."));
687 fire_bolt(caster_ptr, GF_FIRE, dir, damage);
689 case RF_ABILITY::BO_COLD:
690 if (!get_aim_dir(caster_ptr, &dir))
693 msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt."));
695 fire_bolt(caster_ptr, GF_COLD, dir, damage);
697 case RF_ABILITY::BA_LITE:
698 if (!get_aim_dir(caster_ptr, &dir))
701 msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst."));
703 fire_ball(caster_ptr, GF_LITE, dir, damage, 4);
705 case RF_ABILITY::BO_NETH:
706 if (!get_aim_dir(caster_ptr, &dir))
709 msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt."));
711 fire_bolt(caster_ptr, GF_NETHER, dir, damage);
713 case RF_ABILITY::BO_WATE:
714 if (!get_aim_dir(caster_ptr, &dir))
717 msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt."));
719 fire_bolt(caster_ptr, GF_WATER, dir, damage);
721 case RF_ABILITY::BO_MANA:
722 if (!get_aim_dir(caster_ptr, &dir))
725 msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt."));
727 fire_bolt(caster_ptr, GF_MANA, dir, damage);
729 case RF_ABILITY::BO_PLAS:
730 if (!get_aim_dir(caster_ptr, &dir))
733 msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt."));
735 fire_bolt(caster_ptr, GF_PLASMA, dir, damage);
737 case RF_ABILITY::BO_ICEE:
738 if (!get_aim_dir(caster_ptr, &dir))
741 msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt."));
743 fire_bolt(caster_ptr, GF_ICE, dir, damage);
745 case RF_ABILITY::MISSILE:
746 if (!get_aim_dir(caster_ptr, &dir))
749 msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile."));
751 fire_bolt(caster_ptr, GF_MISSILE, dir, damage);
753 case RF_ABILITY::SCARE:
754 if (!get_aim_dir(caster_ptr, &dir))
757 msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion."));
759 fear_monster(caster_ptr, dir, plev + 10);
761 case RF_ABILITY::BLIND:
762 if (!get_aim_dir(caster_ptr, &dir))
764 confuse_monster(caster_ptr, dir, plev * 2);
766 case RF_ABILITY::CONF:
767 if (!get_aim_dir(caster_ptr, &dir))
770 msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion."));
772 confuse_monster(caster_ptr, dir, plev * 2);
774 case RF_ABILITY::SLOW:
775 if (!get_aim_dir(caster_ptr, &dir))
777 slow_monster(caster_ptr, dir, plev);
779 case RF_ABILITY::HOLD:
780 if (!get_aim_dir(caster_ptr, &dir))
782 sleep_monster(caster_ptr, dir, plev);
784 case RF_ABILITY::HASTE:
785 (void)set_fast(caster_ptr, randint1(20 + plev) + plev, FALSE);
787 case RF_ABILITY::HAND_DOOM: {
788 if (!get_aim_dir(caster_ptr, &dir))
791 msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
793 fire_ball_hide(caster_ptr, GF_HAND_DOOM, dir, 200, 0);
796 case RF_ABILITY::HEAL:
797 msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
798 (void)hp_player(caster_ptr, plev * 6);
799 (void)set_stun(caster_ptr, 0);
800 (void)set_cut(caster_ptr, 0);
802 case RF_ABILITY::INVULNER:
803 msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
804 (void)set_invuln(caster_ptr, randint1(7) + 7, FALSE);
806 case RF_ABILITY::BLINK:
807 teleport_player(caster_ptr, 10, TELEPORT_SPONTANEOUS);
809 case RF_ABILITY::TPORT:
810 teleport_player(caster_ptr, plev * 5, TELEPORT_SPONTANEOUS);
812 case RF_ABILITY::WORLD:
813 (void)time_walk(caster_ptr);
815 case RF_ABILITY::SPECIAL:
817 case RF_ABILITY::TELE_TO: {
820 GAME_TEXT m_name[MAX_NLEN];
822 if (!target_set(caster_ptr, TARGET_KILL))
824 if (!caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx)
826 if (!player_has_los_bold(caster_ptr, target_row, target_col))
828 if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col))
830 m_ptr = &caster_ptr->current_floor_ptr->m_list[caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx];
831 r_ptr = &r_info[m_ptr->r_idx];
832 monster_desc(caster_ptr, m_name, m_ptr, 0);
833 if (r_ptr->flagsr & RFR_RES_TELE) {
834 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL)) {
835 if (is_original_ap_and_seen(caster_ptr, m_ptr))
836 r_ptr->r_flagsr |= RFR_RES_TELE;
837 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
840 } else if (r_ptr->level > randint1(100)) {
841 if (is_original_ap_and_seen(caster_ptr, m_ptr))
842 r_ptr->r_flagsr |= RFR_RES_TELE;
843 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
848 msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
851 caster_ptr, caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx, caster_ptr->y, caster_ptr->x, 100, TELEPORT_PASSIVE);
854 case RF_ABILITY::TELE_AWAY:
855 if (!get_aim_dir(caster_ptr, &dir))
858 (void)fire_beam(caster_ptr, GF_AWAY_ALL, dir, plev);
861 case RF_ABILITY::TELE_LEVEL:
862 return teleport_level_other(caster_ptr);
865 case RF_ABILITY::PSY_SPEAR:
866 if (!get_aim_dir(caster_ptr, &dir))
869 msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
870 (void)fire_beam(caster_ptr, GF_PSY_SPEAR, dir, damage);
873 case RF_ABILITY::DARKNESS:
874 msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
875 (void)unlite_area(caster_ptr, 10, 3);
878 case RF_ABILITY::TRAPS:
879 if (!target_set(caster_ptr, TARGET_KILL))
881 msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackle evilly."));
882 trap_creation(caster_ptr, target_row, target_col);
884 case RF_ABILITY::FORGET:
885 msg_print(_("しかし何も起きなかった。", "Nothing happens."));
887 case RF_ABILITY::RAISE_DEAD:
888 msg_print(_("死者復活の呪文を唱えた。", "You animate the dead."));
889 (void)animate_dead(caster_ptr, 0, caster_ptr->y, caster_ptr->x);
891 case RF_ABILITY::S_KIN: {
893 if (!target_set(caster_ptr, TARGET_KILL))
896 msg_print(_("援軍を召喚した。", "You summon minions."));
897 for (k = 0; k < 4; k++) {
898 (void)summon_kin_player(caster_ptr, plev, target_row, target_col, (PM_FORCE_PET | PM_ALLOW_GROUP));
902 case RF_ABILITY::S_CYBER: {
904 int max_cyber = (caster_ptr->current_floor_ptr->dun_level / 50) + randint1(3);
905 if (!target_set(caster_ptr, TARGET_KILL))
907 msg_print(_("サイバーデーモンを召喚した!", "You summon Cyberdemons!"));
910 for (k = 0; k < max_cyber; k++)
911 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_CYBER, mode);
914 case RF_ABILITY::S_MONSTER: {
916 if (!target_set(caster_ptr, TARGET_KILL))
918 msg_print(_("仲間を召喚した。", "You summon help."));
919 for (k = 0; k < 1; k++)
920 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_NONE, (mode | u_mode));
923 case RF_ABILITY::S_MONSTERS: {
925 if (!target_set(caster_ptr, TARGET_KILL))
927 msg_print(_("モンスターを召喚した!", "You summon monsters!"));
928 for (k = 0; k < 6; k++)
929 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_NONE, (mode | u_mode));
932 case RF_ABILITY::S_ANT: {
934 if (!target_set(caster_ptr, TARGET_KILL))
936 msg_print(_("アリを召喚した。", "You summon ants."));
937 for (k = 0; k < 6; k++)
938 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_ANT, mode);
941 case RF_ABILITY::S_SPIDER: {
943 if (!target_set(caster_ptr, TARGET_KILL))
945 msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
946 for (k = 0; k < 6; k++)
947 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_SPIDER, mode);
950 case RF_ABILITY::S_HOUND: {
952 if (!target_set(caster_ptr, TARGET_KILL))
954 msg_print(_("ハウンドを召喚した。", "You summon hounds."));
955 for (k = 0; k < 4; k++)
956 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HOUND, mode);
959 case RF_ABILITY::S_HYDRA: {
961 if (!target_set(caster_ptr, TARGET_KILL))
963 msg_print(_("ヒドラを召喚した。", "You summon hydras."));
964 for (k = 0; k < 4; k++)
965 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HYDRA, mode);
968 case RF_ABILITY::S_ANGEL: {
970 if (!target_set(caster_ptr, TARGET_KILL))
972 msg_print(_("天使を召喚した!", "You summon an angel!"));
973 for (k = 0; k < 1; k++)
974 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_ANGEL, mode);
977 case RF_ABILITY::S_DEMON: {
979 if (!target_set(caster_ptr, TARGET_KILL))
981 msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
982 for (k = 0; k < 1; k++)
983 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_DEMON, (mode | u_mode));
986 case RF_ABILITY::S_UNDEAD: {
988 if (!target_set(caster_ptr, TARGET_KILL))
990 msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
991 for (k = 0; k < 1; k++)
992 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_UNDEAD, (mode | u_mode));
995 case RF_ABILITY::S_DRAGON: {
997 if (!target_set(caster_ptr, TARGET_KILL))
999 msg_print(_("ドラゴンを召喚した!", "You summon a dragon!"));
1000 for (k = 0; k < 1; k++)
1001 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_DRAGON, (mode | u_mode));
1004 case RF_ABILITY::S_HI_UNDEAD: {
1006 if (!target_set(caster_ptr, TARGET_KILL))
1008 msg_print(_("強力なアンデッドを召喚した!", "You summon greater undead!"));
1009 for (k = 0; k < 6; k++)
1010 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
1013 case RF_ABILITY::S_HI_DRAGON: {
1015 if (!target_set(caster_ptr, TARGET_KILL))
1017 msg_print(_("古代ドラゴンを召喚した!", "You summon ancient dragons!"));
1018 for (k = 0; k < 4; k++)
1019 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_DRAGON, (mode | u_mode));
1022 case RF_ABILITY::S_AMBERITES: {
1024 if (!target_set(caster_ptr, TARGET_KILL))
1026 msg_print(_("アンバーの王族を召喚した!", "You summon Lords of Amber!"));
1027 for (k = 0; k < 4; k++)
1028 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
1031 case RF_ABILITY::S_UNIQUE: {
1033 if (!target_set(caster_ptr, TARGET_KILL))
1035 msg_print(_("特別な強敵を召喚した!", "You summon special opponents!"));
1036 for (k = 0; k < 4; k++)
1037 if (summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE)))
1039 for (k = count; k < 4; k++)
1040 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
1051 * @brief ものまねコマンドのメインルーチン /
1052 * do_cmd_cast calls this function if the player's class is 'imitator'.
1053 * @param baigaesi TRUEならば倍返し上の処理として行う
1054 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
1056 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
1057 * If the user hits escape, returns FALSE, and set '*sn' to -1
1058 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
1060 * The "prompt" should be "cast", "recite", or "study"
1061 * The "known" should be TRUE for cast/pray, FALSE for study
1063 * nb: This function has a (trivial) display bug which will be obvious
1064 * when you run it. It's probably easy to fix but I haven't tried,
1067 bool do_cmd_mane(player_type *creature_ptr, bool baigaesi)
1071 PERCENTAGE minfail = 0;
1072 PLAYER_LEVEL plev = creature_ptr->lev;
1073 monster_power spell;
1076 if (cmd_limit_confused(creature_ptr))
1079 if (!creature_ptr->mane_num) {
1080 msg_print(_("まねられるものが何もない!", "You don't remember any action!"));
1084 if (!get_mane_power(creature_ptr, &n, baigaesi))
1087 spell = monster_powers[static_cast<int>(creature_ptr->mane_spell[n])];
1089 /* Spell failure chance */
1090 chance = spell.manefail;
1092 /* Reduce failure rate by "effective" level adjustment */
1093 if (plev > spell.level)
1094 chance -= 3 * (plev - spell.level);
1096 /* Reduce failure rate by 1 stat and DEX adjustment */
1097 chance -= 3 * (adj_mag_stat[creature_ptr->stat_index[spell.use_stat]] + adj_mag_stat[creature_ptr->stat_index[A_DEX]] - 2) / 2;
1100 chance = chance * damage / spell.manedam;
1102 chance += creature_ptr->to_m_chance;
1104 /* Extract the minimum failure rate */
1105 minfail = adj_mag_fail[creature_ptr->stat_index[spell.use_stat]];
1107 /* Minimum failure rate */
1108 if (chance < minfail)
1111 /* Stunning makes spells harder */
1112 if (creature_ptr->stun > 50)
1114 else if (creature_ptr->stun)
1117 /* Always a 5 percent chance of working */
1122 if (randint0(100) < chance) {
1125 msg_print(_("ものまねに失敗した!", "You failed to concentrate hard enough!"));
1129 cast = use_mane(creature_ptr, creature_ptr->mane_spell[n]);
1134 creature_ptr->mane_num--;
1135 for (j = n; j < creature_ptr->mane_num; j++) {
1136 creature_ptr->mane_spell[j] = creature_ptr->mane_spell[j + 1];
1137 creature_ptr->mane_dam[j] = creature_ptr->mane_dam[j + 1];
1140 take_turn(creature_ptr, 100);
1142 creature_ptr->redraw |= (PR_IMITATION);
1143 creature_ptr->window_flags |= (PW_PLAYER);
1144 creature_ptr->window_flags |= (PW_SPELL);