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/hp-mp-processor.h"
16 #include "core/player-redraw-types.h"
17 #include "core/stuff-handler.h"
18 #include "core/window-redrawer.h"
19 #include "floor/cave.h"
20 #include "floor/floor-object.h"
21 #include "game-option/disturbance-options.h"
22 #include "game-option/text-display-options.h"
23 #include "grid/grid.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-flags-resistance.h"
31 #include "monster-race/race-flags1.h"
32 #include "monster/monster-describer.h"
33 #include "monster/monster-info.h"
34 #include "monster/monster-processor.h"
35 #include "monster/monster-status.h"
36 #include "mspell/monster-power-table.h"
37 #include "player/player-status-table.h"
38 #include "player/player-status.h"
39 #include "spell-kind/spells-launcher.h"
40 #include "spell-kind/spells-lite.h"
41 #include "spell-kind/spells-neighbor.h"
42 #include "spell-kind/spells-sight.h"
43 #include "spell-kind/spells-teleport.h"
44 #include "spell-kind/spells-world.h"
45 #include "spell/spell-types.h"
46 #include "spell/spells-status.h"
47 #include "spell/spells-summon.h"
48 #include "spell/summon-types.h"
49 #include "status/bad-status-setter.h"
50 #include "status/body-improvement.h"
51 #include "status/buff-setter.h"
52 #include "system/floor-type-definition.h"
53 #include "target/projection-path-calculator.h"
54 #include "target/target-checker.h"
55 #include "target/target-getter.h"
56 #include "target/target-setter.h"
57 #include "target/target-types.h"
58 #include "term/screen-processor.h"
59 #include "util/int-char-converter.h"
60 #include "view/display-messages.h"
65 * @brief 受け取ったパラメータに応じてものまねの効果情報をまとめたフォーマットを返す
66 * @param p 情報を返す文字列参照ポインタ
67 * @param power ものまねの効力の種類
71 static void mane_info(player_type *caster_ptr, char *p, RF_ABILITY power, HIT_POINT dam)
73 PLAYER_LEVEL plev = caster_ptr->lev;
77 const auto power_int = static_cast<int>(power);
79 if ((power_int > 2 && power_int < 41) || (power_int > 41 && power_int < 59) || (power == RF_ABILITY::PSY_SPEAR))
80 sprintf(p, " %s%d", KWD_DAM, (int)dam);
83 case RF_ABILITY::DRAIN_MANA:
84 sprintf(p, " %sd%d+%d", KWD_HEAL, plev * 3, plev);
86 case RF_ABILITY::HASTE:
87 sprintf(p, " %sd%d+%d", KWD_DURATION, 20 + plev, plev);
89 case RF_ABILITY::HEAL:
90 sprintf(p, " %s%d", KWD_HEAL, plev * 6);
92 case RF_ABILITY::INVULNER:
93 sprintf(p, " %sd7+7", KWD_DURATION);
95 case RF_ABILITY::BLINK:
96 sprintf(p, " %s10", KWD_SPHERE);
98 case RF_ABILITY::TPORT:
99 sprintf(p, " %s%d", KWD_SPHERE, plev * 5);
101 case RF_ABILITY::RAISE_DEAD:
102 sprintf(p, " %s5", KWD_SPHERE);
111 * @brief どのものまねを発動するか選択する処理 /
112 * Allow user to choose a imitation.
113 * @param sn 実行したものまねのIDを返す参照ポインタ(キャンセルなどの場合-1を返す)
114 * @param baigaesi TRUEならば倍返し上の処理として行う
115 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
117 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
118 * If the user hits escape, returns FALSE, and set '*sn' to -1
119 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
121 * The "prompt" should be "cast", "recite", or "study"
122 * The "known" should be TRUE for cast/pray, FALSE for study
124 * nb: This function has a (trivial) display bug which will be obvious
125 * when you run it. It's probably easy to fix but I haven't tried,
128 static int get_mane_power(player_type *caster_ptr, int *sn, bool baigaesi)
134 PERCENTAGE minfail = 0;
135 PLAYER_LEVEL plev = caster_ptr->lev;
136 PERCENTAGE chance = 0;
139 char out_val[MAX_MONSTER_NAME];
141 concptr p = _("能力", "power");
146 /* Assume cancelled */
152 num = caster_ptr->mane_num;
154 /* Build a prompt (accept all spells) */
155 (void)strnfmt(out_val, 78, _("(%c-%c, '*'で一覧, ESC) どの%sをまねますか?", "(%c-%c, *=List, ESC=exit) Use which %s? "), I2A(0), I2A(num - 1), p);
157 choice = always_show_list ? ESCAPE : 1;
159 if (choice == ESCAPE)
161 else if (!get_com(out_val, &choice, TRUE))
165 if ((choice == ' ') || (choice == '*') || (choice == '?')) {
172 /* Display a list of spells */
174 put_str(_("名前", "Name"), y, x + 5);
175 put_str(_("失率 効果", "Fail Info"), y, x + 36);
177 /* Dump the spells */
178 for (i = 0; i < num; i++) {
179 /* Access the spell */
180 spell = monster_powers[static_cast<size_t>(caster_ptr->mane_spell[i])];
182 chance = spell.manefail;
184 /* Reduce failure rate by "effective" level adjustment */
185 if (plev > spell.level)
186 chance -= 3 * (plev - spell.level);
188 /* Reduce failure rate by INT/WIS adjustment */
189 chance -= 3 * (adj_mag_stat[caster_ptr->stat_index[spell.use_stat]] + adj_mag_stat[caster_ptr->stat_index[A_DEX]] - 2) / 2;
192 chance = chance * (baigaesi ? caster_ptr->mane_dam[i] * 2 : caster_ptr->mane_dam[i]) / spell.manedam;
194 chance += caster_ptr->to_m_chance;
196 /* Extract the minimum failure rate */
197 minfail = adj_mag_fail[caster_ptr->stat_index[spell.use_stat]];
199 /* Minimum failure rate */
200 if (chance < minfail)
203 /* Stunning makes spells harder */
204 if (caster_ptr->stun > 50)
206 else if (caster_ptr->stun)
209 /* Always a 5 percent chance of working */
214 mane_info(caster_ptr, comment, caster_ptr->mane_spell[i], (baigaesi ? caster_ptr->mane_dam[i] * 2 : caster_ptr->mane_dam[i]));
216 /* Dump the spell --(-- */
217 sprintf(psi_desc, " %c) %-30s %3d%%%s", I2A(i), spell.name, chance, comment);
218 prt(psi_desc, y + i + 1, x);
221 /* Clear the bottom line */
222 prt("", y + i + 1, x);
237 ask = isupper(choice);
241 choice = (char)tolower(choice);
243 /* Extract request */
244 i = (islower(choice) ? A2I(choice) : -1);
246 /* Totally Illegal */
247 if ((i < 0) || (i >= num)) {
252 /* Save the spell index */
253 spell = monster_powers[static_cast<int>(caster_ptr->mane_spell[i])];
260 (void)strnfmt(tmp_val, 78, _("%sをまねますか?", "Use %s? "), spell.name);
262 /* Belay that order */
263 if (!get_check(tmp_val))
273 caster_ptr->window_flags |= (PW_SPELL);
274 handle_stuff(caster_ptr);
276 /* Abort if needed */
280 /* Save the choice */
283 damage = (baigaesi ? caster_ptr->mane_dam[i] * 2 : caster_ptr->mane_dam[i]);
291 * do_cmd_cast calls this function if the player's class is 'imitator'.
292 * @param caster_ptr プレーヤーへの参照ポインタ
293 * @param spell 発動するモンスター攻撃のID
294 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
296 static bool use_mane(player_type *caster_ptr, RF_ABILITY spell)
299 PLAYER_LEVEL plev = caster_ptr->lev;
300 BIT_FLAGS mode = (PM_ALLOW_GROUP | PM_FORCE_PET);
301 BIT_FLAGS u_mode = 0L;
303 if (randint1(50 + plev) < plev / 10)
304 u_mode = PM_ALLOW_UNIQUE;
308 case RF_ABILITY::SHRIEK:
309 msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
310 aggravate_monsters(caster_ptr, 0);
313 case RF_ABILITY::XXX1:
316 case RF_ABILITY::DISPEL: {
319 if (!target_set(caster_ptr, TARGET_KILL))
321 m_idx = caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
324 if (!player_has_los_bold(caster_ptr, target_row, target_col))
326 if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col))
328 dispel_monster_status(caster_ptr, m_idx);
332 case RF_ABILITY::ROCKET:
333 if (!get_aim_dir(caster_ptr, &dir))
336 msg_print(_("ロケットを発射した。", "You fire a rocket."));
337 fire_rocket(caster_ptr, GF_ROCKET, dir, damage, 2);
340 case RF_ABILITY::SHOOT:
341 if (!get_aim_dir(caster_ptr, &dir))
344 msg_print(_("矢を放った。", "You fire an arrow."));
345 fire_bolt(caster_ptr, GF_ARROW, dir, damage);
348 case RF_ABILITY::XXX2:
351 case RF_ABILITY::XXX3:
354 case RF_ABILITY::XXX4:
357 case RF_ABILITY::BR_ACID:
358 if (!get_aim_dir(caster_ptr, &dir))
361 msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
362 fire_breath(caster_ptr, GF_ACID, dir, damage, (plev > 35 ? 3 : 2));
365 case RF_ABILITY::BR_ELEC:
366 if (!get_aim_dir(caster_ptr, &dir))
369 msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
370 fire_breath(caster_ptr, GF_ELEC, dir, damage, (plev > 35 ? 3 : 2));
373 case RF_ABILITY::BR_FIRE:
374 if (!get_aim_dir(caster_ptr, &dir))
377 msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
378 fire_breath(caster_ptr, GF_FIRE, dir, damage, (plev > 35 ? 3 : 2));
381 case RF_ABILITY::BR_COLD:
382 if (!get_aim_dir(caster_ptr, &dir))
385 msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
386 fire_breath(caster_ptr, GF_COLD, dir, damage, (plev > 35 ? 3 : 2));
389 case RF_ABILITY::BR_POIS:
390 if (!get_aim_dir(caster_ptr, &dir))
393 msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
394 fire_breath(caster_ptr, GF_POIS, dir, damage, (plev > 35 ? 3 : 2));
397 case RF_ABILITY::BR_NETH:
398 if (!get_aim_dir(caster_ptr, &dir))
401 msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
402 fire_breath(caster_ptr, GF_NETHER, dir, damage, (plev > 35 ? 3 : 2));
405 case RF_ABILITY::BR_LITE:
406 if (!get_aim_dir(caster_ptr, &dir))
409 msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
410 fire_breath(caster_ptr, GF_LITE, dir, damage, (plev > 35 ? 3 : 2));
413 case RF_ABILITY::BR_DARK:
414 if (!get_aim_dir(caster_ptr, &dir))
417 msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
418 fire_breath(caster_ptr, GF_DARK, dir, damage, (plev > 35 ? 3 : 2));
421 case RF_ABILITY::BR_CONF:
422 if (!get_aim_dir(caster_ptr, &dir))
425 msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
426 fire_breath(caster_ptr, GF_CONFUSION, dir, damage, (plev > 35 ? 3 : 2));
429 case RF_ABILITY::BR_SOUN:
430 if (!get_aim_dir(caster_ptr, &dir))
433 msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
434 fire_breath(caster_ptr, GF_SOUND, dir, damage, (plev > 35 ? 3 : 2));
437 case RF_ABILITY::BR_CHAO:
438 if (!get_aim_dir(caster_ptr, &dir))
441 msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
442 fire_breath(caster_ptr, GF_CHAOS, dir, damage, (plev > 35 ? 3 : 2));
445 case RF_ABILITY::BR_DISE:
446 if (!get_aim_dir(caster_ptr, &dir))
449 msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
450 fire_breath(caster_ptr, GF_DISENCHANT, dir, damage, (plev > 35 ? 3 : 2));
453 case RF_ABILITY::BR_NEXU:
454 if (!get_aim_dir(caster_ptr, &dir))
457 msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
458 fire_breath(caster_ptr, GF_NEXUS, dir, damage, (plev > 35 ? 3 : 2));
461 case RF_ABILITY::BR_TIME:
462 if (!get_aim_dir(caster_ptr, &dir))
465 msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
466 fire_breath(caster_ptr, GF_TIME, dir, damage, (plev > 35 ? 3 : 2));
469 case RF_ABILITY::BR_INER:
470 if (!get_aim_dir(caster_ptr, &dir))
473 msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
474 fire_breath(caster_ptr, GF_INERTIAL, dir, damage, (plev > 35 ? 3 : 2));
477 case RF_ABILITY::BR_GRAV:
478 if (!get_aim_dir(caster_ptr, &dir))
481 msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
482 fire_breath(caster_ptr, GF_GRAVITY, dir, damage, (plev > 35 ? 3 : 2));
485 case RF_ABILITY::BR_SHAR:
486 if (!get_aim_dir(caster_ptr, &dir))
489 msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
490 fire_breath(caster_ptr, GF_SHARDS, dir, damage, (plev > 35 ? 3 : 2));
493 case RF_ABILITY::BR_PLAS:
494 if (!get_aim_dir(caster_ptr, &dir))
497 msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
499 fire_breath(caster_ptr, GF_PLASMA, dir, damage, (plev > 35 ? 3 : 2));
502 case RF_ABILITY::BR_FORC:
503 if (!get_aim_dir(caster_ptr, &dir))
506 msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
508 fire_breath(caster_ptr, GF_FORCE, dir, damage, (plev > 35 ? 3 : 2));
511 case RF_ABILITY::BR_MANA:
512 if (!get_aim_dir(caster_ptr, &dir))
515 msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
517 fire_breath(caster_ptr, GF_MANA, dir, damage, (plev > 35 ? 3 : 2));
520 case RF_ABILITY::BA_NUKE:
521 if (!get_aim_dir(caster_ptr, &dir))
524 msg_print(_("放射能球を放った。", "You cast a ball of radiation."));
526 fire_ball(caster_ptr, GF_NUKE, dir, damage, 2);
529 case RF_ABILITY::BR_NUKE:
530 if (!get_aim_dir(caster_ptr, &dir))
533 msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
535 fire_breath(caster_ptr, GF_NUKE, dir, damage, (plev > 35 ? 3 : 2));
538 case RF_ABILITY::BA_CHAO:
539 if (!get_aim_dir(caster_ptr, &dir))
542 msg_print(_("純ログルスを放った。", "You invoke a raw Logrus."));
544 fire_ball(caster_ptr, GF_CHAOS, dir, damage, 4);
546 case RF_ABILITY::BR_DISI:
547 if (!get_aim_dir(caster_ptr, &dir))
550 msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
552 fire_breath(caster_ptr, GF_DISINTEGRATE, dir, damage, (plev > 35 ? 3 : 2));
554 case RF_ABILITY::BA_ACID:
555 if (!get_aim_dir(caster_ptr, &dir))
558 msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball."));
560 fire_ball(caster_ptr, GF_ACID, dir, damage, 2);
562 case RF_ABILITY::BA_ELEC:
563 if (!get_aim_dir(caster_ptr, &dir))
566 msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball."));
568 fire_ball(caster_ptr, GF_ELEC, dir, damage, 2);
570 case RF_ABILITY::BA_FIRE:
571 if (!get_aim_dir(caster_ptr, &dir))
574 msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball."));
576 fire_ball(caster_ptr, GF_FIRE, dir, damage, 2);
578 case RF_ABILITY::BA_COLD:
579 if (!get_aim_dir(caster_ptr, &dir))
582 msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball."));
584 fire_ball(caster_ptr, GF_COLD, dir, damage, 2);
586 case RF_ABILITY::BA_POIS:
587 if (!get_aim_dir(caster_ptr, &dir))
590 msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud."));
592 fire_ball(caster_ptr, GF_POIS, dir, damage, 2);
594 case RF_ABILITY::BA_NETH:
595 if (!get_aim_dir(caster_ptr, &dir))
598 msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball."));
600 fire_ball(caster_ptr, GF_NETHER, dir, damage, 2);
602 case RF_ABILITY::BA_WATE:
603 if (!get_aim_dir(caster_ptr, &dir))
606 msg_print(_("流れるような身振りをした。", "You gesture fluidly."));
608 fire_ball(caster_ptr, GF_WATER, dir, damage, 4);
610 case RF_ABILITY::BA_MANA:
611 if (!get_aim_dir(caster_ptr, &dir))
614 msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm."));
616 fire_ball(caster_ptr, GF_MANA, dir, damage, 4);
618 case RF_ABILITY::BA_DARK:
619 if (!get_aim_dir(caster_ptr, &dir))
622 msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm."));
624 fire_ball(caster_ptr, GF_DARK, dir, damage, 4);
626 case RF_ABILITY::DRAIN_MANA:
627 if (!get_aim_dir(caster_ptr, &dir))
629 fire_ball_hide(caster_ptr, GF_DRAIN_MANA, dir, randint1(plev * 3) + plev, 0);
631 case RF_ABILITY::MIND_BLAST:
632 if (!get_aim_dir(caster_ptr, &dir))
634 fire_ball_hide(caster_ptr, GF_MIND_BLAST, dir, damage, 0);
636 case RF_ABILITY::BRAIN_SMASH:
637 if (!get_aim_dir(caster_ptr, &dir))
639 fire_ball_hide(caster_ptr, GF_BRAIN_SMASH, dir, damage, 0);
641 case RF_ABILITY::CAUSE_1:
642 if (!get_aim_dir(caster_ptr, &dir))
644 fire_ball_hide(caster_ptr, GF_CAUSE_1, dir, damage, 0);
646 case RF_ABILITY::CAUSE_2:
647 if (!get_aim_dir(caster_ptr, &dir))
649 fire_ball_hide(caster_ptr, GF_CAUSE_2, dir, damage, 0);
651 case RF_ABILITY::CAUSE_3:
652 if (!get_aim_dir(caster_ptr, &dir))
654 fire_ball_hide(caster_ptr, GF_CAUSE_3, dir, damage, 0);
656 case RF_ABILITY::CAUSE_4:
657 if (!get_aim_dir(caster_ptr, &dir))
659 fire_ball_hide(caster_ptr, GF_CAUSE_4, dir, damage, 0);
661 case RF_ABILITY::BO_ACID:
662 if (!get_aim_dir(caster_ptr, &dir))
665 msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt."));
667 fire_bolt(caster_ptr, GF_ACID, dir, damage);
669 case RF_ABILITY::BO_ELEC:
670 if (!get_aim_dir(caster_ptr, &dir))
673 msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt."));
675 fire_bolt(caster_ptr, GF_ELEC, dir, damage);
677 case RF_ABILITY::BO_FIRE:
678 if (!get_aim_dir(caster_ptr, &dir))
681 msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt."));
683 fire_bolt(caster_ptr, GF_FIRE, dir, damage);
685 case RF_ABILITY::BO_COLD:
686 if (!get_aim_dir(caster_ptr, &dir))
689 msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt."));
691 fire_bolt(caster_ptr, GF_COLD, dir, damage);
693 case RF_ABILITY::BA_LITE:
694 if (!get_aim_dir(caster_ptr, &dir))
697 msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst."));
699 fire_ball(caster_ptr, GF_LITE, dir, damage, 4);
701 case RF_ABILITY::BO_NETH:
702 if (!get_aim_dir(caster_ptr, &dir))
705 msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt."));
707 fire_bolt(caster_ptr, GF_NETHER, dir, damage);
709 case RF_ABILITY::BO_WATE:
710 if (!get_aim_dir(caster_ptr, &dir))
713 msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt."));
715 fire_bolt(caster_ptr, GF_WATER, dir, damage);
717 case RF_ABILITY::BO_MANA:
718 if (!get_aim_dir(caster_ptr, &dir))
721 msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt."));
723 fire_bolt(caster_ptr, GF_MANA, dir, damage);
725 case RF_ABILITY::BO_PLAS:
726 if (!get_aim_dir(caster_ptr, &dir))
729 msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt."));
731 fire_bolt(caster_ptr, GF_PLASMA, dir, damage);
733 case RF_ABILITY::BO_ICEE:
734 if (!get_aim_dir(caster_ptr, &dir))
737 msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt."));
739 fire_bolt(caster_ptr, GF_ICE, dir, damage);
741 case RF_ABILITY::MISSILE:
742 if (!get_aim_dir(caster_ptr, &dir))
745 msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile."));
747 fire_bolt(caster_ptr, GF_MISSILE, dir, damage);
749 case RF_ABILITY::SCARE:
750 if (!get_aim_dir(caster_ptr, &dir))
753 msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion."));
755 fear_monster(caster_ptr, dir, plev + 10);
757 case RF_ABILITY::BLIND:
758 if (!get_aim_dir(caster_ptr, &dir))
760 confuse_monster(caster_ptr, dir, plev * 2);
762 case RF_ABILITY::CONF:
763 if (!get_aim_dir(caster_ptr, &dir))
766 msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion."));
768 confuse_monster(caster_ptr, dir, plev * 2);
770 case RF_ABILITY::SLOW:
771 if (!get_aim_dir(caster_ptr, &dir))
773 slow_monster(caster_ptr, dir, plev);
775 case RF_ABILITY::HOLD:
776 if (!get_aim_dir(caster_ptr, &dir))
778 sleep_monster(caster_ptr, dir, plev);
780 case RF_ABILITY::HASTE:
781 (void)set_fast(caster_ptr, randint1(20 + plev) + plev, FALSE);
783 case RF_ABILITY::HAND_DOOM: {
784 if (!get_aim_dir(caster_ptr, &dir))
787 msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
789 fire_ball_hide(caster_ptr, GF_HAND_DOOM, dir, 200, 0);
792 case RF_ABILITY::HEAL:
793 msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
794 (void)hp_player(caster_ptr, plev * 6);
795 (void)set_stun(caster_ptr, 0);
796 (void)set_cut(caster_ptr, 0);
798 case RF_ABILITY::INVULNER:
799 msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
800 (void)set_invuln(caster_ptr, randint1(7) + 7, FALSE);
802 case RF_ABILITY::BLINK:
803 teleport_player(caster_ptr, 10, TELEPORT_SPONTANEOUS);
805 case RF_ABILITY::TPORT:
806 teleport_player(caster_ptr, plev * 5, TELEPORT_SPONTANEOUS);
808 case RF_ABILITY::WORLD:
809 (void)time_walk(caster_ptr);
811 case RF_ABILITY::SPECIAL:
813 case RF_ABILITY::TELE_TO: {
816 GAME_TEXT m_name[MAX_NLEN];
818 if (!target_set(caster_ptr, TARGET_KILL))
820 if (!caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx)
822 if (!player_has_los_bold(caster_ptr, target_row, target_col))
824 if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col))
826 m_ptr = &caster_ptr->current_floor_ptr->m_list[caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx];
827 r_ptr = &r_info[m_ptr->r_idx];
828 monster_desc(caster_ptr, m_name, m_ptr, 0);
829 if (r_ptr->flagsr & RFR_RES_TELE) {
830 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL)) {
831 if (is_original_ap_and_seen(caster_ptr, m_ptr))
832 r_ptr->r_flagsr |= RFR_RES_TELE;
833 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
836 } else if (r_ptr->level > randint1(100)) {
837 if (is_original_ap_and_seen(caster_ptr, m_ptr))
838 r_ptr->r_flagsr |= RFR_RES_TELE;
839 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
844 msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
847 caster_ptr, caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx, caster_ptr->y, caster_ptr->x, 100, TELEPORT_PASSIVE);
850 case RF_ABILITY::TELE_AWAY:
851 if (!get_aim_dir(caster_ptr, &dir))
854 (void)fire_beam(caster_ptr, GF_AWAY_ALL, dir, plev);
857 case RF_ABILITY::TELE_LEVEL:
858 return teleport_level_other(caster_ptr);
861 case RF_ABILITY::PSY_SPEAR:
862 if (!get_aim_dir(caster_ptr, &dir))
865 msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
866 (void)fire_beam(caster_ptr, GF_PSY_SPEAR, dir, damage);
869 case RF_ABILITY::DARKNESS:
870 msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
871 (void)unlite_area(caster_ptr, 10, 3);
874 case RF_ABILITY::TRAPS:
875 if (!target_set(caster_ptr, TARGET_KILL))
877 msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackle evilly."));
878 trap_creation(caster_ptr, target_row, target_col);
880 case RF_ABILITY::FORGET:
881 msg_print(_("しかし何も起きなかった。", "Nothing happens."));
883 case RF_ABILITY::RAISE_DEAD:
884 msg_print(_("死者復活の呪文を唱えた。", "You animate the dead."));
885 (void)animate_dead(caster_ptr, 0, caster_ptr->y, caster_ptr->x);
887 case RF_ABILITY::S_KIN: {
889 if (!target_set(caster_ptr, TARGET_KILL))
892 msg_print(_("援軍を召喚した。", "You summon minions."));
893 for (k = 0; k < 4; k++) {
894 (void)summon_kin_player(caster_ptr, plev, target_row, target_col, (PM_FORCE_PET | PM_ALLOW_GROUP));
898 case RF_ABILITY::S_CYBER: {
900 int max_cyber = (caster_ptr->current_floor_ptr->dun_level / 50) + randint1(3);
901 if (!target_set(caster_ptr, TARGET_KILL))
903 msg_print(_("サイバーデーモンを召喚した!", "You summon Cyberdemons!"));
906 for (k = 0; k < max_cyber; k++)
907 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_CYBER, mode);
910 case RF_ABILITY::S_MONSTER: {
912 if (!target_set(caster_ptr, TARGET_KILL))
914 msg_print(_("仲間を召喚した。", "You summon help."));
915 for (k = 0; k < 1; k++)
916 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_NONE, (mode | u_mode));
919 case RF_ABILITY::S_MONSTERS: {
921 if (!target_set(caster_ptr, TARGET_KILL))
923 msg_print(_("モンスターを召喚した!", "You summon monsters!"));
924 for (k = 0; k < 6; k++)
925 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_NONE, (mode | u_mode));
928 case RF_ABILITY::S_ANT: {
930 if (!target_set(caster_ptr, TARGET_KILL))
932 msg_print(_("アリを召喚した。", "You summon ants."));
933 for (k = 0; k < 6; k++)
934 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_ANT, mode);
937 case RF_ABILITY::S_SPIDER: {
939 if (!target_set(caster_ptr, TARGET_KILL))
941 msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
942 for (k = 0; k < 6; k++)
943 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_SPIDER, mode);
946 case RF_ABILITY::S_HOUND: {
948 if (!target_set(caster_ptr, TARGET_KILL))
950 msg_print(_("ハウンドを召喚した。", "You summon hounds."));
951 for (k = 0; k < 4; k++)
952 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HOUND, mode);
955 case RF_ABILITY::S_HYDRA: {
957 if (!target_set(caster_ptr, TARGET_KILL))
959 msg_print(_("ヒドラを召喚した。", "You summon hydras."));
960 for (k = 0; k < 4; k++)
961 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HYDRA, mode);
964 case RF_ABILITY::S_ANGEL: {
966 if (!target_set(caster_ptr, TARGET_KILL))
968 msg_print(_("天使を召喚した!", "You summon an angel!"));
969 for (k = 0; k < 1; k++)
970 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_ANGEL, mode);
973 case RF_ABILITY::S_DEMON: {
975 if (!target_set(caster_ptr, TARGET_KILL))
977 msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
978 for (k = 0; k < 1; k++)
979 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_DEMON, (mode | u_mode));
982 case RF_ABILITY::S_UNDEAD: {
984 if (!target_set(caster_ptr, TARGET_KILL))
986 msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
987 for (k = 0; k < 1; k++)
988 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_UNDEAD, (mode | u_mode));
991 case RF_ABILITY::S_DRAGON: {
993 if (!target_set(caster_ptr, TARGET_KILL))
995 msg_print(_("ドラゴンを召喚した!", "You summon a dragon!"));
996 for (k = 0; k < 1; k++)
997 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_DRAGON, (mode | u_mode));
1000 case RF_ABILITY::S_HI_UNDEAD: {
1002 if (!target_set(caster_ptr, TARGET_KILL))
1004 msg_print(_("強力なアンデッドを召喚した!", "You summon greater undead!"));
1005 for (k = 0; k < 6; k++)
1006 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
1009 case RF_ABILITY::S_HI_DRAGON: {
1011 if (!target_set(caster_ptr, TARGET_KILL))
1013 msg_print(_("古代ドラゴンを召喚した!", "You summon ancient dragons!"));
1014 for (k = 0; k < 4; k++)
1015 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_DRAGON, (mode | u_mode));
1018 case RF_ABILITY::S_AMBERITES: {
1020 if (!target_set(caster_ptr, TARGET_KILL))
1022 msg_print(_("アンバーの王族を召喚した!", "You summon Lords of Amber!"));
1023 for (k = 0; k < 4; k++)
1024 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
1027 case RF_ABILITY::S_UNIQUE: {
1029 if (!target_set(caster_ptr, TARGET_KILL))
1031 msg_print(_("特別な強敵を召喚した!", "You summon special opponents!"));
1032 for (k = 0; k < 4; k++)
1033 if (summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE)))
1035 for (k = count; k < 4; k++)
1036 summon_specific(caster_ptr, -1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
1047 * @brief ものまねコマンドのメインルーチン /
1048 * do_cmd_cast calls this function if the player's class is 'imitator'.
1049 * @param baigaesi TRUEならば倍返し上の処理として行う
1050 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
1052 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
1053 * If the user hits escape, returns FALSE, and set '*sn' to -1
1054 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
1056 * The "prompt" should be "cast", "recite", or "study"
1057 * The "known" should be TRUE for cast/pray, FALSE for study
1059 * nb: This function has a (trivial) display bug which will be obvious
1060 * when you run it. It's probably easy to fix but I haven't tried,
1063 bool do_cmd_mane(player_type *creature_ptr, bool baigaesi)
1067 PERCENTAGE minfail = 0;
1068 PLAYER_LEVEL plev = creature_ptr->lev;
1069 monster_power spell;
1072 if (cmd_limit_confused(creature_ptr))
1075 if (!creature_ptr->mane_num) {
1076 msg_print(_("まねられるものが何もない!", "You don't remember any action!"));
1080 if (!get_mane_power(creature_ptr, &n, baigaesi))
1083 spell = monster_powers[static_cast<int>(creature_ptr->mane_spell[n])];
1085 /* Spell failure chance */
1086 chance = spell.manefail;
1088 /* Reduce failure rate by "effective" level adjustment */
1089 if (plev > spell.level)
1090 chance -= 3 * (plev - spell.level);
1092 /* Reduce failure rate by 1 stat and DEX adjustment */
1093 chance -= 3 * (adj_mag_stat[creature_ptr->stat_index[spell.use_stat]] + adj_mag_stat[creature_ptr->stat_index[A_DEX]] - 2) / 2;
1096 chance = chance * damage / spell.manedam;
1098 chance += creature_ptr->to_m_chance;
1100 /* Extract the minimum failure rate */
1101 minfail = adj_mag_fail[creature_ptr->stat_index[spell.use_stat]];
1103 /* Minimum failure rate */
1104 if (chance < minfail)
1107 /* Stunning makes spells harder */
1108 if (creature_ptr->stun > 50)
1110 else if (creature_ptr->stun)
1113 /* Always a 5 percent chance of working */
1118 if (randint0(100) < chance) {
1121 msg_print(_("ものまねに失敗した!", "You failed to concentrate hard enough!"));
1125 cast = use_mane(creature_ptr, creature_ptr->mane_spell[n]);
1130 creature_ptr->mane_num--;
1131 for (j = n; j < creature_ptr->mane_num; j++) {
1132 creature_ptr->mane_spell[j] = creature_ptr->mane_spell[j + 1];
1133 creature_ptr->mane_dam[j] = creature_ptr->mane_dam[j + 1];
1136 take_turn(creature_ptr, 100);
1138 creature_ptr->redraw |= (PR_IMITATION);
1139 creature_ptr->window_flags |= (PW_PLAYER);
1140 creature_ptr->window_flags |= (PW_SPELL);