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-mane.h"
13 #include "action/action-limited.h"
14 #include "artifact/fixed-art-types.h"
15 #include "cmd-action/cmd-spell.h"
16 #include "core/asking-player.h"
17 #include "core/player-redraw-types.h"
18 #include "core/stuff-handler.h"
19 #include "core/window-redrawer.h"
20 #include "floor/cave.h"
21 #include "floor/floor-object.h"
22 #include "game-option/disturbance-options.h"
23 #include "game-option/text-display-options.h"
24 #include "hpmp/hp-mp-processor.h"
25 #include "inventory/inventory-slot-types.h"
26 #include "main/sound-definitions-table.h"
27 #include "main/sound-of-music.h"
28 #include "mind/mind-mage.h"
29 #include "monster-floor/monster-summon.h"
30 #include "monster-floor/place-monster-types.h"
31 #include "monster-race/monster-race.h"
32 #include "monster-race/race-ability-flags.h"
33 #include "monster-race/race-flags-resistance.h"
34 #include "monster-race/race-flags1.h"
35 #include "monster/monster-describer.h"
36 #include "monster/monster-info.h"
37 #include "monster/monster-processor.h"
38 #include "monster/monster-status.h"
39 #include "mspell/monster-power-table.h"
40 #include "player-base/player-class.h"
41 #include "player-info/mane-data-type.h"
42 #include "player-status/player-energy.h"
43 #include "player/player-status-table.h"
44 #include "spell-kind/spells-launcher.h"
45 #include "spell-kind/spells-lite.h"
46 #include "spell-kind/spells-neighbor.h"
47 #include "spell-kind/spells-sight.h"
48 #include "spell-kind/spells-teleport.h"
49 #include "spell-kind/spells-world.h"
50 #include "spell/spells-status.h"
51 #include "spell/spells-summon.h"
52 #include "spell/summon-types.h"
53 #include "status/bad-status-setter.h"
54 #include "status/body-improvement.h"
55 #include "status/buff-setter.h"
56 #include "system/floor-type-definition.h"
57 #include "system/grid-type-definition.h"
58 #include "system/monster-race-definition.h"
59 #include "system/monster-type-definition.h"
60 #include "system/object-type-definition.h"
61 #include "system/player-type-definition.h"
62 #include "target/projection-path-calculator.h"
63 #include "target/target-checker.h"
64 #include "target/target-getter.h"
65 #include "target/target-setter.h"
66 #include "target/target-types.h"
67 #include "term/screen-processor.h"
68 #include "timed-effect/player-stun.h"
69 #include "timed-effect/timed-effects.h"
70 #include "util/enum-converter.h"
71 #include "util/int-char-converter.h"
72 #include "view/display-messages.h"
79 * @brief 受け取ったパラメータに応じてものまねの効果情報をまとめたフォーマットを返す
80 * @param p 情報を返す文字列参照ポインタ
81 * @param power ものまねの効力の種類
84 static void mane_info(PlayerType *player_ptr, char *p, MonsterAbilityType power, HIT_POINT dam)
86 PLAYER_LEVEL plev = player_ptr->lev;
90 const auto power_int = enum2i(power);
92 if ((power_int > 2 && power_int < 41) || (power_int > 41 && power_int < 59) || (power == MonsterAbilityType::PSY_SPEAR) || (power == MonsterAbilityType::BO_VOID) || (power == MonsterAbilityType::BO_ABYSS) || (power == MonsterAbilityType::BA_VOID) || (power == MonsterAbilityType::BA_ABYSS) || (power == MonsterAbilityType::BR_VOID) || (power == MonsterAbilityType::BR_ABYSS)) {
93 sprintf(p, " %s%d", KWD_DAM, (int)dam);
96 case MonsterAbilityType::DRAIN_MANA:
97 sprintf(p, " %sd%d+%d", KWD_HEAL, plev * 3, plev);
99 case MonsterAbilityType::HASTE:
100 sprintf(p, " %sd%d+%d", KWD_DURATION, 20 + plev, plev);
102 case MonsterAbilityType::HEAL:
103 sprintf(p, " %s%d", KWD_HEAL, plev * 6);
105 case MonsterAbilityType::INVULNER:
106 sprintf(p, " %sd7+7", KWD_DURATION);
108 case MonsterAbilityType::BLINK:
109 sprintf(p, " %s10", KWD_SPHERE);
111 case MonsterAbilityType::TPORT:
112 sprintf(p, " %s%d", KWD_SPHERE, plev * 5);
114 case MonsterAbilityType::RAISE_DEAD:
115 sprintf(p, " %s5", KWD_SPHERE);
124 * @brief どのものまねを発動するか選択する処理 /
125 * Allow user to choose a imitation.
126 * @param sn 実行したものまねのIDを返す参照ポインタ(キャンセルなどの場合-1を返す)
127 * @param baigaesi TRUEならば倍返し上の処理として行う
128 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
130 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
131 * If the user hits escape, returns FALSE, and set '*sn' to -1
132 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
134 * The "prompt" should be "cast", "recite", or "study"
135 * The "known" should be TRUE for cast/pray, FALSE for study
137 * nb: This function has a (trivial) display bug which will be obvious
138 * when you run it. It's probably easy to fix but I haven't tried,
141 static int get_mane_power(PlayerType *player_ptr, int *sn, bool baigaesi)
147 PERCENTAGE minfail = 0;
148 PLAYER_LEVEL plev = player_ptr->lev;
149 PERCENTAGE chance = 0;
152 char out_val[MAX_MONSTER_NAME];
154 concptr p = _("能力", "power");
159 /* Assume cancelled */
165 auto mane_data = PlayerClass(player_ptr).get_specific_data<mane_data_type>();
167 num = mane_data->mane_list.size();
169 /* Build a prompt (accept all spells) */
170 (void)strnfmt(out_val, 78, _("(%c-%c, '*'で一覧, ESC) どの%sをまねますか?", "(%c-%c, *=List, ESC=exit) Use which %s? "), I2A(0), I2A(num - 1), p);
172 choice = always_show_list ? ESCAPE : 1;
174 if (choice == ESCAPE) {
176 } else if (!get_com(out_val, &choice, true)) {
181 if ((choice == ' ') || (choice == '*') || (choice == '?')) {
188 /* Display a list of spells */
190 put_str(_("名前", "Name"), y, x + 5);
191 put_str(_("失率 効果", "Fail Info"), y, x + 36);
193 /* Dump the spells */
194 for (i = 0; i < num; i++) {
195 const auto &mane = mane_data->mane_list[i];
196 /* Access the spell */
197 spell = monster_powers.at(mane.spell);
199 chance = spell.manefail;
201 /* Reduce failure rate by "effective" level adjustment */
202 if (plev > spell.level) {
203 chance -= 3 * (plev - spell.level);
206 /* Reduce failure rate by INT/WIS adjustment */
207 chance -= 3 * (adj_mag_stat[player_ptr->stat_index[spell.use_stat]] + adj_mag_stat[player_ptr->stat_index[A_DEX]] - 2) / 2;
210 chance = chance * (baigaesi ? mane.damage * 2 : mane.damage) / spell.manedam;
213 chance += player_ptr->to_m_chance;
215 if (player_ptr->inventory_list[INVEN_NECK].name1 == ART_GOGO_PENDANT) {
219 /* Extract the minimum failure rate */
220 minfail = adj_mag_fail[player_ptr->stat_index[spell.use_stat]];
222 /* Minimum failure rate */
223 if (chance < minfail)
226 auto player_stun = player_ptr->effects()->stun();
227 chance += player_stun->get_magic_chance_penalty();
233 mane_info(player_ptr, comment, mane.spell, (baigaesi ? mane.damage * 2 : mane.damage));
235 /* Dump the spell --(-- */
236 sprintf(psi_desc, " %c) %-30s %3d%%%s", I2A(i), spell.name, chance, comment);
237 prt(psi_desc, y + i + 1, x);
240 /* Clear the bottom line */
241 prt("", y + i + 1, x);
256 ask = isupper(choice);
260 choice = (char)tolower(choice);
263 /* Extract request */
264 i = (islower(choice) ? A2I(choice) : -1);
266 /* Totally Illegal */
267 if ((i < 0) || (i >= num)) {
272 /* Save the spell index */
273 spell = monster_powers.at(mane_data->mane_list[i].spell);
280 (void)strnfmt(tmp_val, 78, _("%sをまねますか?", "Use %s? "), spell.name);
282 /* Belay that order */
283 if (!get_check(tmp_val)) {
295 player_ptr->window_flags |= (PW_SPELL);
296 handle_stuff(player_ptr);
298 /* Abort if needed */
303 /* Save the choice */
306 damage = (baigaesi ? mane_data->mane_list[i].damage * 2 : mane_data->mane_list[i].damage);
314 * do_cmd_cast calls this function if the player's class is 'imitator'.
315 * @param player_ptr プレイヤーへの参照ポインタ
316 * @param spell 発動するモンスター攻撃のID
317 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
319 static bool use_mane(PlayerType *player_ptr, MonsterAbilityType spell)
322 PLAYER_LEVEL plev = player_ptr->lev;
323 BIT_FLAGS mode = (PM_ALLOW_GROUP | PM_FORCE_PET);
324 BIT_FLAGS u_mode = 0L;
326 if (randint1(50 + plev) < plev / 10) {
327 u_mode = PM_ALLOW_UNIQUE;
332 case MonsterAbilityType::SHRIEK:
333 msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
334 aggravate_monsters(player_ptr, 0);
337 case MonsterAbilityType::XXX1:
340 case MonsterAbilityType::DISPEL: {
343 if (!target_set(player_ptr, TARGET_KILL)) {
346 m_idx = player_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
350 if (!player_has_los_bold(player_ptr, target_row, target_col)) {
353 if (!projectable(player_ptr, player_ptr->y, player_ptr->x, target_row, target_col)) {
356 dispel_monster_status(player_ptr, m_idx);
360 case MonsterAbilityType::ROCKET:
361 if (!get_aim_dir(player_ptr, &dir)) {
364 msg_print(_("ロケットを発射した。", "You fire a rocket."));
366 fire_rocket(player_ptr, AttributeType::ROCKET, dir, damage, 2);
369 case MonsterAbilityType::SHOOT:
370 if (!get_aim_dir(player_ptr, &dir)) {
373 msg_print(_("矢を放った。", "You fire an arrow."));
375 fire_bolt(player_ptr, AttributeType::MONSTER_SHOOT, dir, damage);
378 case MonsterAbilityType::XXX2:
381 case MonsterAbilityType::XXX3:
384 case MonsterAbilityType::XXX4:
387 case MonsterAbilityType::BR_ACID:
388 if (!get_aim_dir(player_ptr, &dir)) {
391 msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
393 fire_breath(player_ptr, AttributeType::ACID, dir, damage, (plev > 35 ? 3 : 2));
396 case MonsterAbilityType::BR_ELEC:
397 if (!get_aim_dir(player_ptr, &dir)) {
400 msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
402 fire_breath(player_ptr, AttributeType::ELEC, dir, damage, (plev > 35 ? 3 : 2));
405 case MonsterAbilityType::BR_FIRE:
406 if (!get_aim_dir(player_ptr, &dir)) {
409 msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
411 fire_breath(player_ptr, AttributeType::FIRE, dir, damage, (plev > 35 ? 3 : 2));
414 case MonsterAbilityType::BR_COLD:
415 if (!get_aim_dir(player_ptr, &dir)) {
418 msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
420 fire_breath(player_ptr, AttributeType::COLD, dir, damage, (plev > 35 ? 3 : 2));
423 case MonsterAbilityType::BR_POIS:
424 if (!get_aim_dir(player_ptr, &dir)) {
427 msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
429 fire_breath(player_ptr, AttributeType::POIS, dir, damage, (plev > 35 ? 3 : 2));
432 case MonsterAbilityType::BR_NETH:
433 if (!get_aim_dir(player_ptr, &dir)) {
436 msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
438 fire_breath(player_ptr, AttributeType::NETHER, dir, damage, (plev > 35 ? 3 : 2));
441 case MonsterAbilityType::BR_LITE:
442 if (!get_aim_dir(player_ptr, &dir)) {
445 msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
447 fire_breath(player_ptr, AttributeType::LITE, dir, damage, (plev > 35 ? 3 : 2));
450 case MonsterAbilityType::BR_DARK:
451 if (!get_aim_dir(player_ptr, &dir)) {
454 msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
456 fire_breath(player_ptr, AttributeType::DARK, dir, damage, (plev > 35 ? 3 : 2));
459 case MonsterAbilityType::BR_CONF:
460 if (!get_aim_dir(player_ptr, &dir)) {
463 msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
465 fire_breath(player_ptr, AttributeType::CONFUSION, dir, damage, (plev > 35 ? 3 : 2));
468 case MonsterAbilityType::BR_SOUN:
469 if (!get_aim_dir(player_ptr, &dir)) {
472 msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
474 fire_breath(player_ptr, AttributeType::SOUND, dir, damage, (plev > 35 ? 3 : 2));
477 case MonsterAbilityType::BR_CHAO:
478 if (!get_aim_dir(player_ptr, &dir)) {
481 msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
483 fire_breath(player_ptr, AttributeType::CHAOS, dir, damage, (plev > 35 ? 3 : 2));
486 case MonsterAbilityType::BR_DISE:
487 if (!get_aim_dir(player_ptr, &dir)) {
490 msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
492 fire_breath(player_ptr, AttributeType::DISENCHANT, dir, damage, (plev > 35 ? 3 : 2));
495 case MonsterAbilityType::BR_NEXU:
496 if (!get_aim_dir(player_ptr, &dir)) {
499 msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
501 fire_breath(player_ptr, AttributeType::NEXUS, dir, damage, (plev > 35 ? 3 : 2));
504 case MonsterAbilityType::BR_TIME:
505 if (!get_aim_dir(player_ptr, &dir)) {
508 msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
510 fire_breath(player_ptr, AttributeType::TIME, dir, damage, (plev > 35 ? 3 : 2));
513 case MonsterAbilityType::BR_INER:
514 if (!get_aim_dir(player_ptr, &dir)) {
517 msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
519 fire_breath(player_ptr, AttributeType::INERTIAL, dir, damage, (plev > 35 ? 3 : 2));
522 case MonsterAbilityType::BR_GRAV:
523 if (!get_aim_dir(player_ptr, &dir)) {
526 msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
528 fire_breath(player_ptr, AttributeType::GRAVITY, dir, damage, (plev > 35 ? 3 : 2));
531 case MonsterAbilityType::BR_SHAR:
532 if (!get_aim_dir(player_ptr, &dir)) {
535 msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
537 fire_breath(player_ptr, AttributeType::SHARDS, dir, damage, (plev > 35 ? 3 : 2));
540 case MonsterAbilityType::BR_PLAS:
541 if (!get_aim_dir(player_ptr, &dir)) {
544 msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
546 fire_breath(player_ptr, AttributeType::PLASMA, dir, damage, (plev > 35 ? 3 : 2));
549 case MonsterAbilityType::BR_FORC:
550 if (!get_aim_dir(player_ptr, &dir)) {
553 msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
555 fire_breath(player_ptr, AttributeType::FORCE, dir, damage, (plev > 35 ? 3 : 2));
558 case MonsterAbilityType::BR_MANA:
559 if (!get_aim_dir(player_ptr, &dir)) {
562 msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
564 fire_breath(player_ptr, AttributeType::MANA, dir, damage, (plev > 35 ? 3 : 2));
567 case MonsterAbilityType::BA_NUKE:
568 if (!get_aim_dir(player_ptr, &dir)) {
571 msg_print(_("放射能球を放った。", "You cast a ball of radiation."));
573 fire_ball(player_ptr, AttributeType::NUKE, dir, damage, 2);
576 case MonsterAbilityType::BR_NUKE:
577 if (!get_aim_dir(player_ptr, &dir)) {
580 msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
583 fire_breath(player_ptr, AttributeType::NUKE, dir, damage, (plev > 35 ? 3 : 2));
586 case MonsterAbilityType::BA_CHAO:
587 if (!get_aim_dir(player_ptr, &dir)) {
590 msg_print(_("純ログルスを放った。", "You invoke a raw Logrus."));
593 fire_ball(player_ptr, AttributeType::CHAOS, dir, damage, 4);
595 case MonsterAbilityType::BR_DISI:
596 if (!get_aim_dir(player_ptr, &dir)) {
599 msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
602 fire_breath(player_ptr, AttributeType::DISINTEGRATE, dir, damage, (plev > 35 ? 3 : 2));
604 case MonsterAbilityType::BR_VOID:
605 if (!get_aim_dir(player_ptr, &dir)) {
608 msg_print(_("虚無のブレスを吐いた。", "You breathe void."));
611 fire_breath(player_ptr, AttributeType::VOID_MAGIC, dir, damage, (plev > 35 ? 3 : 2));
614 case MonsterAbilityType::BR_ABYSS:
615 if (!get_aim_dir(player_ptr, &dir)) {
618 msg_print(_("深淵のブレスを吐いた。", "You breathe abyss."));
621 fire_breath(player_ptr, AttributeType::ABYSS, dir, damage, (plev > 35 ? 3 : 2));
624 case MonsterAbilityType::BA_ACID:
625 if (!get_aim_dir(player_ptr, &dir)) {
628 msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball."));
631 fire_ball(player_ptr, AttributeType::ACID, dir, damage, 2);
633 case MonsterAbilityType::BA_ELEC:
634 if (!get_aim_dir(player_ptr, &dir)) {
637 msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball."));
640 fire_ball(player_ptr, AttributeType::ELEC, dir, damage, 2);
642 case MonsterAbilityType::BA_FIRE:
643 if (!get_aim_dir(player_ptr, &dir)) {
646 msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball."));
649 fire_ball(player_ptr, AttributeType::FIRE, dir, damage, 2);
651 case MonsterAbilityType::BA_COLD:
652 if (!get_aim_dir(player_ptr, &dir)) {
655 msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball."));
658 fire_ball(player_ptr, AttributeType::COLD, dir, damage, 2);
660 case MonsterAbilityType::BA_POIS:
661 if (!get_aim_dir(player_ptr, &dir)) {
664 msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud."));
667 fire_ball(player_ptr, AttributeType::POIS, dir, damage, 2);
669 case MonsterAbilityType::BA_NETH:
670 if (!get_aim_dir(player_ptr, &dir)) {
673 msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball."));
676 fire_ball(player_ptr, AttributeType::NETHER, dir, damage, 2);
678 case MonsterAbilityType::BA_WATE:
679 if (!get_aim_dir(player_ptr, &dir)) {
682 msg_print(_("流れるような身振りをした。", "You gesture fluidly."));
685 fire_ball(player_ptr, AttributeType::WATER, dir, damage, 4);
687 case MonsterAbilityType::BA_MANA:
688 if (!get_aim_dir(player_ptr, &dir)) {
691 msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm."));
694 fire_ball(player_ptr, AttributeType::MANA, dir, damage, 4);
696 case MonsterAbilityType::BA_DARK:
697 if (!get_aim_dir(player_ptr, &dir)) {
700 msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm."));
703 fire_ball(player_ptr, AttributeType::DARK, dir, damage, 4);
705 case MonsterAbilityType::BA_VOID:
706 if (!get_aim_dir(player_ptr, &dir)) {
709 msg_print(_("虚無の嵐の呪文を念じた。", "You cast a void ball."));
712 fire_ball(player_ptr, AttributeType::VOID_MAGIC, dir, damage, 4);
714 case MonsterAbilityType::BA_ABYSS:
715 if (!get_aim_dir(player_ptr, &dir)) {
718 msg_print(_("深淵の嵐の呪文を念じた。", "You cast a abyss ball."));
721 fire_ball(player_ptr, AttributeType::ABYSS, dir, damage, 4);
723 case MonsterAbilityType::DRAIN_MANA:
724 if (!get_aim_dir(player_ptr, &dir)) {
727 fire_ball_hide(player_ptr, AttributeType::DRAIN_MANA, dir, randint1(plev * 3) + plev, 0);
729 case MonsterAbilityType::MIND_BLAST:
730 if (!get_aim_dir(player_ptr, &dir)) {
733 fire_ball_hide(player_ptr, AttributeType::MIND_BLAST, dir, damage, 0);
735 case MonsterAbilityType::BRAIN_SMASH:
736 if (!get_aim_dir(player_ptr, &dir)) {
739 fire_ball_hide(player_ptr, AttributeType::BRAIN_SMASH, dir, damage, 0);
741 case MonsterAbilityType::CAUSE_1:
742 if (!get_aim_dir(player_ptr, &dir)) {
745 fire_ball_hide(player_ptr, AttributeType::CAUSE_1, dir, damage, 0);
747 case MonsterAbilityType::CAUSE_2:
748 if (!get_aim_dir(player_ptr, &dir)) {
751 fire_ball_hide(player_ptr, AttributeType::CAUSE_2, dir, damage, 0);
753 case MonsterAbilityType::CAUSE_3:
754 if (!get_aim_dir(player_ptr, &dir)) {
757 fire_ball_hide(player_ptr, AttributeType::CAUSE_3, dir, damage, 0);
759 case MonsterAbilityType::CAUSE_4:
760 if (!get_aim_dir(player_ptr, &dir)) {
763 fire_ball_hide(player_ptr, AttributeType::CAUSE_4, dir, damage, 0);
765 case MonsterAbilityType::BO_ACID:
766 if (!get_aim_dir(player_ptr, &dir)) {
769 msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt."));
772 fire_bolt(player_ptr, AttributeType::ACID, dir, damage);
774 case MonsterAbilityType::BO_ELEC:
775 if (!get_aim_dir(player_ptr, &dir)) {
778 msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt."));
781 fire_bolt(player_ptr, AttributeType::ELEC, dir, damage);
783 case MonsterAbilityType::BO_FIRE:
784 if (!get_aim_dir(player_ptr, &dir)) {
787 msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt."));
790 fire_bolt(player_ptr, AttributeType::FIRE, dir, damage);
792 case MonsterAbilityType::BO_COLD:
793 if (!get_aim_dir(player_ptr, &dir)) {
796 msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt."));
799 fire_bolt(player_ptr, AttributeType::COLD, dir, damage);
801 case MonsterAbilityType::BA_LITE:
802 if (!get_aim_dir(player_ptr, &dir)) {
805 msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst."));
808 fire_ball(player_ptr, AttributeType::LITE, dir, damage, 4);
810 case MonsterAbilityType::BO_NETH:
811 if (!get_aim_dir(player_ptr, &dir)) {
814 msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt."));
817 fire_bolt(player_ptr, AttributeType::NETHER, dir, damage);
819 case MonsterAbilityType::BO_WATE:
820 if (!get_aim_dir(player_ptr, &dir)) {
823 msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt."));
826 fire_bolt(player_ptr, AttributeType::WATER, dir, damage);
828 case MonsterAbilityType::BO_MANA:
829 if (!get_aim_dir(player_ptr, &dir)) {
832 msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt."));
835 fire_bolt(player_ptr, AttributeType::MANA, dir, damage);
837 case MonsterAbilityType::BO_PLAS:
838 if (!get_aim_dir(player_ptr, &dir)) {
841 msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt."));
844 fire_bolt(player_ptr, AttributeType::PLASMA, dir, damage);
846 case MonsterAbilityType::BO_ICEE:
847 if (!get_aim_dir(player_ptr, &dir)) {
850 msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt."));
853 fire_bolt(player_ptr, AttributeType::ICE, dir, damage);
855 case MonsterAbilityType::BO_VOID:
856 if (!get_aim_dir(player_ptr, &dir)) {
859 msg_print(_("虚無の矢の呪文を唱えた。", "You cast a void bolt."));
862 fire_bolt(player_ptr, AttributeType::VOID_MAGIC, dir, damage);
864 case MonsterAbilityType::BO_ABYSS:
865 if (!get_aim_dir(player_ptr, &dir)) {
868 msg_print(_("深淵の矢の呪文を唱えた。", "You cast a abyss bolt."));
871 fire_bolt(player_ptr, AttributeType::ABYSS, dir, damage);
873 case MonsterAbilityType::MISSILE:
874 if (!get_aim_dir(player_ptr, &dir)) {
877 msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile."));
880 fire_bolt(player_ptr, AttributeType::MISSILE, dir, damage);
882 case MonsterAbilityType::SCARE:
883 if (!get_aim_dir(player_ptr, &dir)) {
886 msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion."));
889 fear_monster(player_ptr, dir, plev + 10);
891 case MonsterAbilityType::BLIND:
892 if (!get_aim_dir(player_ptr, &dir)) {
895 confuse_monster(player_ptr, dir, plev * 2);
897 case MonsterAbilityType::CONF:
898 if (!get_aim_dir(player_ptr, &dir)) {
901 msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion."));
904 confuse_monster(player_ptr, dir, plev * 2);
906 case MonsterAbilityType::SLOW:
907 if (!get_aim_dir(player_ptr, &dir)) {
910 slow_monster(player_ptr, dir, plev);
912 case MonsterAbilityType::HOLD:
913 if (!get_aim_dir(player_ptr, &dir)) {
916 sleep_monster(player_ptr, dir, plev);
918 case MonsterAbilityType::HASTE:
919 (void)set_fast(player_ptr, randint1(20 + plev) + plev, false);
921 case MonsterAbilityType::HAND_DOOM: {
922 if (!get_aim_dir(player_ptr, &dir)) {
925 msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
928 fire_ball_hide(player_ptr, AttributeType::HAND_DOOM, dir, 200, 0);
931 case MonsterAbilityType::HEAL: {
932 msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
933 (void)hp_player(player_ptr, plev * 6);
934 BadStatusSetter bss(player_ptr);
939 case MonsterAbilityType::INVULNER:
940 msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
941 (void)set_invuln(player_ptr, randint1(7) + 7, false);
943 case MonsterAbilityType::BLINK:
944 teleport_player(player_ptr, 10, TELEPORT_SPONTANEOUS);
946 case MonsterAbilityType::TPORT:
947 teleport_player(player_ptr, plev * 5, TELEPORT_SPONTANEOUS);
949 case MonsterAbilityType::WORLD:
950 (void)time_walk(player_ptr);
952 case MonsterAbilityType::SPECIAL:
954 case MonsterAbilityType::TELE_TO: {
957 GAME_TEXT m_name[MAX_NLEN];
959 if (!target_set(player_ptr, TARGET_KILL)) {
962 if (!player_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx) {
965 if (!player_has_los_bold(player_ptr, target_row, target_col)) {
968 if (!projectable(player_ptr, player_ptr->y, player_ptr->x, target_row, target_col)) {
971 m_ptr = &player_ptr->current_floor_ptr->m_list[player_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx];
972 r_ptr = &r_info[m_ptr->r_idx];
973 monster_desc(player_ptr, m_name, m_ptr, 0);
974 if (r_ptr->flagsr & RFR_RES_TELE) {
975 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL)) {
976 if (is_original_ap_and_seen(player_ptr, m_ptr)) {
977 r_ptr->r_flagsr |= RFR_RES_TELE;
979 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
982 } else if (r_ptr->level > randint1(100)) {
983 if (is_original_ap_and_seen(player_ptr, m_ptr)) {
984 r_ptr->r_flagsr |= RFR_RES_TELE;
986 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
991 msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
994 player_ptr, player_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx, player_ptr->y, player_ptr->x, 100, TELEPORT_PASSIVE);
997 case MonsterAbilityType::TELE_AWAY:
998 if (!get_aim_dir(player_ptr, &dir)) {
1002 (void)fire_beam(player_ptr, AttributeType::AWAY_ALL, dir, plev);
1005 case MonsterAbilityType::TELE_LEVEL:
1006 return teleport_level_other(player_ptr);
1009 case MonsterAbilityType::PSY_SPEAR:
1010 if (!get_aim_dir(player_ptr, &dir)) {
1013 msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
1015 (void)fire_beam(player_ptr, AttributeType::PSY_SPEAR, dir, damage);
1018 case MonsterAbilityType::DARKNESS:
1019 msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
1020 (void)unlite_area(player_ptr, 10, 3);
1023 case MonsterAbilityType::TRAPS:
1024 if (!target_set(player_ptr, TARGET_KILL)) {
1027 msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackle evilly."));
1028 trap_creation(player_ptr, target_row, target_col);
1030 case MonsterAbilityType::FORGET:
1031 msg_print(_("しかし何も起きなかった。", "Nothing happens."));
1033 case MonsterAbilityType::RAISE_DEAD:
1034 msg_print(_("死者復活の呪文を唱えた。", "You animate the dead."));
1035 (void)animate_dead(player_ptr, 0, player_ptr->y, player_ptr->x);
1037 case MonsterAbilityType::S_KIN: {
1039 if (!target_set(player_ptr, TARGET_KILL)) {
1043 msg_print(_("援軍を召喚した。", "You summon minions."));
1044 for (k = 0; k < 4; k++) {
1045 (void)summon_kin_player(player_ptr, plev, target_row, target_col, (PM_FORCE_PET | PM_ALLOW_GROUP));
1049 case MonsterAbilityType::S_CYBER: {
1051 int max_cyber = (player_ptr->current_floor_ptr->dun_level / 50) + randint1(3);
1052 if (!target_set(player_ptr, TARGET_KILL)) {
1055 msg_print(_("サイバーデーモンを召喚した!", "You summon Cyberdemons!"));
1056 if (max_cyber > 4) {
1059 for (k = 0; k < max_cyber; k++) {
1060 summon_specific(player_ptr, -1, target_row, target_col, plev, SUMMON_CYBER, mode);
1064 case MonsterAbilityType::S_MONSTER: {
1066 if (!target_set(player_ptr, TARGET_KILL)) {
1069 msg_print(_("仲間を召喚した。", "You summon help."));
1070 for (k = 0; k < 1; k++) {
1071 summon_specific(player_ptr, -1, target_row, target_col, plev, SUMMON_NONE, (mode | u_mode));
1075 case MonsterAbilityType::S_MONSTERS: {
1077 if (!target_set(player_ptr, TARGET_KILL)) {
1080 msg_print(_("モンスターを召喚した!", "You summon monsters!"));
1081 for (k = 0; k < 6; k++) {
1082 summon_specific(player_ptr, -1, target_row, target_col, plev, SUMMON_NONE, (mode | u_mode));
1086 case MonsterAbilityType::S_ANT: {
1088 if (!target_set(player_ptr, TARGET_KILL)) {
1091 msg_print(_("アリを召喚した。", "You summon ants."));
1092 for (k = 0; k < 6; k++) {
1093 summon_specific(player_ptr, -1, target_row, target_col, plev, SUMMON_ANT, mode);
1097 case MonsterAbilityType::S_SPIDER: {
1099 if (!target_set(player_ptr, TARGET_KILL)) {
1102 msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
1103 for (k = 0; k < 6; k++) {
1104 summon_specific(player_ptr, -1, target_row, target_col, plev, SUMMON_SPIDER, mode);
1108 case MonsterAbilityType::S_HOUND: {
1110 if (!target_set(player_ptr, TARGET_KILL)) {
1113 msg_print(_("ハウンドを召喚した。", "You summon hounds."));
1114 for (k = 0; k < 4; k++) {
1115 summon_specific(player_ptr, -1, target_row, target_col, plev, SUMMON_HOUND, mode);
1119 case MonsterAbilityType::S_HYDRA: {
1121 if (!target_set(player_ptr, TARGET_KILL)) {
1124 msg_print(_("ヒドラを召喚した。", "You summon hydras."));
1125 for (k = 0; k < 4; k++) {
1126 summon_specific(player_ptr, -1, target_row, target_col, plev, SUMMON_HYDRA, mode);
1130 case MonsterAbilityType::S_ANGEL: {
1132 if (!target_set(player_ptr, TARGET_KILL)) {
1135 msg_print(_("天使を召喚した!", "You summon an angel!"));
1136 for (k = 0; k < 1; k++) {
1137 summon_specific(player_ptr, -1, target_row, target_col, plev, SUMMON_ANGEL, mode);
1141 case MonsterAbilityType::S_DEMON: {
1143 if (!target_set(player_ptr, TARGET_KILL)) {
1146 msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
1147 for (k = 0; k < 1; k++) {
1148 summon_specific(player_ptr, -1, target_row, target_col, plev, SUMMON_DEMON, (mode | u_mode));
1152 case MonsterAbilityType::S_UNDEAD: {
1154 if (!target_set(player_ptr, TARGET_KILL)) {
1157 msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
1158 for (k = 0; k < 1; k++) {
1159 summon_specific(player_ptr, -1, target_row, target_col, plev, SUMMON_UNDEAD, (mode | u_mode));
1163 case MonsterAbilityType::S_DRAGON: {
1165 if (!target_set(player_ptr, TARGET_KILL)) {
1168 msg_print(_("ドラゴンを召喚した!", "You summon a dragon!"));
1169 for (k = 0; k < 1; k++) {
1170 summon_specific(player_ptr, -1, target_row, target_col, plev, SUMMON_DRAGON, (mode | u_mode));
1174 case MonsterAbilityType::S_HI_UNDEAD: {
1176 if (!target_set(player_ptr, TARGET_KILL)) {
1179 msg_print(_("強力なアンデッドを召喚した!", "You summon greater undead!"));
1180 for (k = 0; k < 6; k++) {
1181 summon_specific(player_ptr, -1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
1185 case MonsterAbilityType::S_HI_DRAGON: {
1187 if (!target_set(player_ptr, TARGET_KILL)) {
1190 msg_print(_("古代ドラゴンを召喚した!", "You summon ancient dragons!"));
1191 for (k = 0; k < 4; k++) {
1192 summon_specific(player_ptr, -1, target_row, target_col, plev, SUMMON_HI_DRAGON, (mode | u_mode));
1196 case MonsterAbilityType::S_AMBERITES: {
1198 if (!target_set(player_ptr, TARGET_KILL)) {
1201 msg_print(_("アンバーの王族を召喚した!", "You summon Lords of Amber!"));
1202 for (k = 0; k < 4; k++) {
1203 summon_specific(player_ptr, -1, target_row, target_col, plev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
1207 case MonsterAbilityType::S_UNIQUE: {
1209 if (!target_set(player_ptr, TARGET_KILL)) {
1212 msg_print(_("特別な強敵を召喚した!", "You summon special opponents!"));
1213 for (k = 0; k < 4; k++) {
1214 if (summon_specific(player_ptr, -1, target_row, target_col, plev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE))) {
1218 for (k = count; k < 4; k++) {
1219 summon_specific(player_ptr, -1, target_row, target_col, plev, SUMMON_HI_UNDEAD, (mode | u_mode));
1231 * @brief ものまねコマンドのメインルーチン /
1232 * do_cmd_cast calls this function if the player's class is 'imitator'.
1233 * @param baigaesi TRUEならば倍返し上の処理として行う
1234 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
1236 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
1237 * If the user hits escape, returns FALSE, and set '*sn' to -1
1238 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
1240 * The "prompt" should be "cast", "recite", or "study"
1241 * The "known" should be TRUE for cast/pray, FALSE for study
1243 * nb: This function has a (trivial) display bug which will be obvious
1244 * when you run it. It's probably easy to fix but I haven't tried,
1247 bool do_cmd_mane(PlayerType *player_ptr, bool baigaesi)
1251 PERCENTAGE minfail = 0;
1252 PLAYER_LEVEL plev = player_ptr->lev;
1253 monster_power spell;
1256 if (cmd_limit_confused(player_ptr)) {
1260 auto mane_data = PlayerClass(player_ptr).get_specific_data<mane_data_type>();
1262 if (mane_data->mane_list.empty()) {
1263 msg_print(_("まねられるものが何もない!", "You don't remember any action!"));
1267 if (!get_mane_power(player_ptr, &n, baigaesi)) {
1271 spell = monster_powers.at(mane_data->mane_list[n].spell);
1273 /* Spell failure chance */
1274 chance = spell.manefail;
1276 /* Reduce failure rate by "effective" level adjustment */
1277 if (plev > spell.level) {
1278 chance -= 3 * (plev - spell.level);
1281 /* Reduce failure rate by 1 stat and DEX adjustment */
1282 chance -= 3 * (adj_mag_stat[player_ptr->stat_index[spell.use_stat]] + adj_mag_stat[player_ptr->stat_index[A_DEX]] - 2) / 2;
1284 if (spell.manedam) {
1285 chance = chance * damage / spell.manedam;
1288 chance += player_ptr->to_m_chance;
1290 /* Extract the minimum failure rate */
1291 minfail = adj_mag_fail[player_ptr->stat_index[spell.use_stat]];
1293 /* Minimum failure rate */
1294 if (chance < minfail) {
1298 auto player_stun = player_ptr->effects()->stun();
1299 chance += player_stun->get_magic_chance_penalty();
1305 if (randint0(100) < chance) {
1306 if (flush_failure) {
1309 msg_print(_("ものまねに失敗した!", "You failed to concentrate hard enough!"));
1313 cast = use_mane(player_ptr, mane_data->mane_list[n].spell);
1319 mane_data->mane_list.erase(std::next(mane_data->mane_list.begin(), n));
1321 PlayerEnergy(player_ptr).set_player_turn_energy(100);
1323 player_ptr->redraw |= (PR_IMITATION);
1324 player_ptr->window_flags |= (PW_PLAYER);
1325 player_ptr->window_flags |= (PW_SPELL);