1 #include "realm/realm-sorcery.h"
2 #include "avatar/avatar.h"
3 #include "cmd-action/cmd-spell.h"
4 #include "core/asking-player.h"
5 #include "effect/attribute-types.h"
6 #include "player-info/self-info.h"
7 #include "spell-kind/magic-item-recharger.h"
8 #include "spell-kind/spells-charm.h"
9 #include "spell-kind/spells-detection.h"
10 #include "spell-kind/spells-fetcher.h"
11 #include "spell-kind/spells-floor.h"
12 #include "spell-kind/spells-grid.h"
13 #include "spell-kind/spells-launcher.h"
14 #include "spell-kind/spells-lite.h"
15 #include "spell-kind/spells-perception.h"
16 #include "spell-kind/spells-sight.h"
17 #include "spell-kind/spells-teleport.h"
18 #include "spell-kind/spells-world.h"
19 #include "spell-realm/spells-sorcery.h"
20 #include "spell/spells-status.h"
21 #include "status/body-improvement.h"
22 #include "status/buff-setter.h"
23 #include "status/sight-setter.h"
24 #include "system/player-type-definition.h"
25 #include "target/target-getter.h"
26 #include "view/display-messages.h"
29 * @brief 仙術領域魔法の各処理を行う
30 * @param player_ptr プレイヤーへの参照ポインタ
32 * @param mode 処理内容 (SpellProcessType::NAME / SPELL_DESC / SpellProcessType::INFO / SpellProcessType::CAST)
33 * @return SpellProcessType::NAME / SPELL_DESC / SpellProcessType::INFO 時には文字列を返す。SpellProcessType::CAST時は std::nullopt を返す。
35 std::optional<std::string> do_sorcery_spell(PlayerType *player_ptr, SPELL_IDX spell, SpellProcessType mode)
37 bool name = mode == SpellProcessType::NAME;
38 bool desc = mode == SpellProcessType::DESCRIPTION;
39 bool info = mode == SpellProcessType::INFO;
40 bool cast = mode == SpellProcessType::CAST;
43 PLAYER_LEVEL plev = player_ptr->lev;
48 return _("モンスター感知", "Detect Monsters");
51 return _("近くの全ての見えるモンスターを感知する。", "Detects all monsters in your vicinity unless invisible.");
55 POSITION rad = DETECT_RAD_DEFAULT;
58 return info_radius(rad);
62 detect_monsters_normal(player_ptr, rad);
69 return _("ショート・テレポート", "Phase Door");
72 return _("近距離のテレポートをする。", "Teleports you a short distance.");
79 return info_range(range);
83 teleport_player(player_ptr, range, TELEPORT_SPONTANEOUS);
90 return _("罠と扉感知", "Detect Doors and Traps");
93 return _("近くの全ての扉と罠を感知する。", "Detects traps, doors, and stairs in your vicinity.");
97 POSITION rad = DETECT_RAD_DEFAULT;
100 return info_radius(rad);
104 detect_traps(player_ptr, rad, true);
105 detect_doors(player_ptr, rad);
106 detect_stairs(player_ptr, rad);
113 return _("ライト・エリア", "Light Area");
116 return _("光源が照らしている範囲か部屋全体を永久に明るくする。", "Lights up nearby area and the inside of a room permanently.");
120 DICE_NUMBER dice = 2;
121 DICE_SID sides = plev / 2;
122 POSITION rad = plev / 10 + 1;
125 return info_damage(dice, sides, 0);
129 lite_area(player_ptr, damroll(dice, sides), rad);
136 return _("パニック・モンスター", "Confuse Monster");
139 return _("モンスター1体を混乱させる。抵抗されると無効。", "Attempts to confuse a monster.");
143 PLAYER_LEVEL power = (plev * 3) / 2;
146 return info_power(power);
150 if (!get_aim_dir(player_ptr, &dir)) {
154 confuse_monster(player_ptr, dir, power);
161 return _("テレポート", "Teleport");
164 return _("遠距離のテレポートをする。", "Teleports you a long distance.");
168 POSITION range = plev * 5;
171 return info_range(range);
175 teleport_player(player_ptr, range, TELEPORT_SPONTANEOUS);
182 return _("スリープ・モンスター", "Sleep Monster");
185 return _("モンスター1体を眠らせる。抵抗されると無効。", "Attempts to put a monster to sleep.");
192 return info_power(power);
196 if (!get_aim_dir(player_ptr, &dir)) {
200 sleep_monster(player_ptr, dir, plev);
207 return _("魔力充填", "Recharging");
210 return _("杖/魔法棒の充填回数を増やすか、充填中のロッドの充填時間を減らす。", "Recharges staffs, wands or rods.");
214 int power = plev * 4;
217 return info_power(power);
221 if (!recharge(player_ptr, power)) {
230 return _("魔法の地図", "Magic Mapping");
233 return _("周辺の地形を感知する。", "Maps nearby area.");
237 POSITION rad = DETECT_RAD_MAP;
240 return info_radius(rad);
244 map_area(player_ptr, rad);
251 return _("鑑定", "Identify");
254 return _("アイテムを識別する。", "Identifies an item.");
259 if (!ident_spell(player_ptr, false)) {
268 return _("スロウ・モンスター", "Slow Monster");
271 return _("モンスター1体を減速させる。抵抗されると無効。", "Attempts to slow a monster.");
278 return info_power(power);
282 if (!get_aim_dir(player_ptr, &dir)) {
286 slow_monster(player_ptr, dir, plev);
293 return _("周辺スリープ", "Mass Sleep");
296 return _("視界内の全てのモンスターを眠らせる。抵抗されると無効。", "Attempts to put all monsters in sight to sleep.");
303 return info_power(power);
307 sleep_monsters(player_ptr, plev);
314 return _("テレポート・モンスター", "Teleport Away");
317 return _("モンスターをテレポートさせるビームを放つ。抵抗されると無効。", "Teleports all monsters on the line away unless resisted.");
324 return info_power(power);
328 if (!get_aim_dir(player_ptr, &dir)) {
332 fire_beam(player_ptr, AttributeType::AWAY_ALL, dir, power);
339 return _("スピード", "Haste Self");
342 return _("一定時間、加速する。", "Hastes you for a while.");
347 DICE_SID sides = 20 + plev;
350 return info_duration(base, sides);
354 set_acceleration(player_ptr, randint1(sides) + base, false);
361 return _("真・感知", "Detection True");
364 return _("近くの全てのモンスター、罠、扉、階段、財宝、そしてアイテムを感知する。",
365 "Detects all monsters, traps, doors, stairs, treasures and items in your vicinity.");
369 POSITION rad = DETECT_RAD_DEFAULT;
372 return info_radius(rad);
376 detect_all(player_ptr, rad);
383 return _("真・鑑定", "Identify True");
386 return _("アイテムの持つ能力を完全に知る。", "*Identifies* an item.");
391 if (!identify_fully(player_ptr, false)) {
400 return _("物体と財宝感知", "Detect items and Treasure");
403 return _("近くの全てのアイテムと財宝を感知する。", "Detects all treasures and items in your vicinity.");
407 POSITION rad = DETECT_RAD_DEFAULT;
410 return info_radius(rad);
414 detect_objects_normal(player_ptr, rad);
415 detect_treasure(player_ptr, rad);
416 detect_objects_gold(player_ptr, rad);
423 return _("チャーム・モンスター", "Charm Monster");
426 return _("モンスター1体を魅了する。抵抗されると無効。", "Attempts to charm a monster.");
433 return info_power(power);
437 if (!get_aim_dir(player_ptr, &dir)) {
441 charm_monster(player_ptr, dir, plev);
448 return _("精神感知", "Sense Minds");
451 return _("一定時間、テレパシー能力を得る。", "Gives telepathy for a while.");
459 return info_duration(base, sides);
463 set_tim_esp(player_ptr, randint1(sides) + base, false);
470 return _("街移動", "Teleport to town");
473 return _("街へ移動する。地上にいるときしか使えない。", "Instantly teleports you to a town which you choose. Can only be used outdoors.");
478 if (!tele_town(player_ptr)) {
487 return _("自己分析", "Self Knowledge");
490 return _("現在の自分の状態を完全に知る。",
491 "Gives you useful info regarding your current resistances, the powers of your weapon and maximum limits of your stats.");
496 self_knowledge(player_ptr);
503 return _("テレポート・レベル", "Teleport Level");
506 return _("瞬時に上か下の階にテレポートする。", "Instantly teleports you up or down a level.");
511 if (!input_check(_("本当に他の階にテレポートしますか?", "Are you sure? (Teleport Level)"))) {
514 teleport_level(player_ptr, 0);
521 return _("帰還の呪文", "Word of Recall");
524 return _("地上にいるときはダンジョンの最深階へ、ダンジョンにいるときは地上へと移動する。",
525 "Recalls player from dungeon to town or from town to the deepest level of dungeon.");
533 return info_delay(base, sides);
537 if (!recall_player(player_ptr, randint0(21) + 15)) {
546 return _("次元の扉", "Dimension Door");
549 return _("短距離内の指定した場所にテレポートする。", "Teleports you to a given location.");
553 POSITION range = plev / 2 + 10;
556 return info_range(range);
560 msg_print(_("次元の扉が開いた。目的地を選んで下さい。", "You open a dimensional gate. Choose a destination."));
561 if (!dimension_door(player_ptr)) {
570 return _("調査", "Probing");
573 return _("モンスターの属性、残り体力、最大体力、スピード、正体を知る。", "Probes all monsters' alignment, HP, speed and their true character.");
585 return _("爆発のルーン", "Explosive Rune");
588 return _("自分のいる床の上に、モンスターが通ると爆発してダメージを与えるルーンを描く。",
589 "Sets a rune under you. The rune will explode when a monster moves on it.");
593 DICE_NUMBER dice = 7;
598 return info_damage(dice, sides, base);
602 create_rune_explosion(player_ptr, player_ptr->y, player_ptr->x);
609 return _("念動力", "Telekinesis");
612 return _("アイテムを自分の足元へ移動させる。", "Pulls a distant item close to you.");
616 WEIGHT weight = plev * 15;
619 return info_weight(weight);
623 if (!get_aim_dir(player_ptr, &dir)) {
627 fetch_item(player_ptr, dir, weight, false);
634 return _("千里眼", "Clairvoyance");
637 return _("その階全体を永久に照らし、ダンジョン内すべてのアイテムを感知する。さらに、一定時間テレパシー能力を得る。",
638 "Maps and lights whole dungeon level. Knows all objects location. And gives telepathy for a while.");
646 return info_duration(base, sides);
650 chg_virtue(player_ptr, Virtue::KNOWLEDGE, 1);
651 chg_virtue(player_ptr, Virtue::ENLIGHTEN, 1);
653 wiz_lite(player_ptr, false);
655 if (!player_ptr->telepathy) {
656 set_tim_esp(player_ptr, randint1(sides) + base, false);
664 return _("魅了の視線", "Charm monsters");
667 return _("視界内の全てのモンスターを魅了する。抵抗されると無効。", "Attempts to charm all monsters in sight.");
671 int power = plev * 2;
674 return info_power(power);
678 charm_monsters(player_ptr, power);
685 return _("錬金術", "Alchemy");
688 return _("アイテム1つをお金に変える。", "Turns an item into 1/3 of its value in gold.");
693 if (!alchemy(player_ptr)) {
702 return _("怪物追放", "Banishment");
705 return _("視界内の全てのモンスターをテレポートさせる。抵抗されると無効。", "Teleports all monsters in sight away unless resisted.");
709 int power = plev * 4;
712 return info_power(power);
716 banish_monsters(player_ptr, power);
723 return _("無傷の球", "Globe of Invulnerability");
726 return _("一定時間、ダメージを受けなくなるバリアを張る。切れた瞬間に少しターンを消費するので注意。",
727 "Generates a barrier which completely protects you from almost all damage. Takes a few of your turns when the barrier breaks or duration time "
735 return info_duration(base, base);
739 set_invuln(player_ptr, randint1(base) + base, false);