1 #include "realm/realm-arcane.h"
2 #include "avatar/avatar.h"
3 #include "cmd-action/cmd-spell.h"
4 #include "core/asking-player.h"
5 #include "monster-floor/monster-summon.h"
6 #include "monster-floor/place-monster-types.h"
7 #include "player/digestion-processor.h"
8 #include "spell-kind/spells-beam.h"
9 #include "spell-kind/spells-detection.h"
10 #include "spell-kind/spells-floor.h"
11 #include "spell-kind/spells-launcher.h"
12 #include "spell-kind/spells-lite.h"
13 #include "spell-kind/spells-perception.h"
14 #include "spell-kind/spells-teleport.h"
15 #include "spell-kind/spells-world.h"
16 #include "spell-realm/spells-arcane.h"
17 #include "effect/attribute-types.h"
18 #include "spell/spells-diceroll.h"
19 #include "spell/spells-status.h"
20 #include "spell/summon-types.h"
21 #include "status/bad-status-setter.h"
22 #include "status/element-resistance.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時はnullptr文字列を返す。
35 concptr do_arcane_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 _("電撃", "Zap");
50 return _("電撃のボルトもしくはビームを放つ。", "Fires a bolt or beam of lightning.");
53 DICE_NUMBER dice = 3 + (plev - 1) / 5;
57 return info_damage(dice, sides, 0);
60 if (!get_aim_dir(player_ptr, &dir))
63 fire_bolt_or_beam(player_ptr, beam_chance(player_ptr) - 10, AttributeType::ELEC, dir, damroll(dice, sides));
70 return _("魔法の施錠", "Wizard Lock");
72 return _("扉に鍵をかける。", "Locks a door.");
76 if (!get_aim_dir(player_ptr, &dir))
79 wizard_lock(player_ptr, dir);
86 return _("透明体感知", "Detect Invisibility");
88 return _("近くの透明なモンスターを感知する。", "Detects all invisible monsters in your vicinity.");
91 POSITION rad = DETECT_RAD_DEFAULT;
94 return info_radius(rad);
97 detect_monsters_invis(player_ptr, rad);
104 return _("モンスター感知", "Detect Monsters");
106 return _("近くの全ての見えるモンスターを感知する。", "Detects all monsters in your vicinity unless invisible.");
109 POSITION rad = DETECT_RAD_DEFAULT;
112 return info_radius(rad);
115 detect_monsters_normal(player_ptr, rad);
122 return _("ショート・テレポート", "Blink");
124 return _("近距離のテレポートをする。", "Teleports you a short distance.");
130 return info_range(range);
133 teleport_player(player_ptr, range, TELEPORT_SPONTANEOUS);
140 return _("ライト・エリア", "Light Area");
142 return _("光源が照らしている範囲か部屋全体を永久に明るくする。", "Lights up nearby area and the inside of a room permanently.");
145 DICE_NUMBER dice = 2;
146 DICE_SID sides = plev / 2;
147 POSITION rad = plev / 10 + 1;
150 return info_damage(dice, sides, 0);
153 lite_area(player_ptr, damroll(dice, sides), rad);
160 return _("罠と扉 破壊", "Trap & Door Destruction");
162 return _("一直線上の全ての罠と扉を破壊する。", "Fires a beam which destroy traps and doors.");
166 if (!get_aim_dir(player_ptr, &dir))
169 destroy_door(player_ptr, dir);
176 return _("軽傷の治癒", "Cure Light Wounds");
178 return _("怪我と体力を少し回復させる。", "Heals cuts and HP a little.");
181 DICE_NUMBER dice = 2;
185 return info_heal(dice, sides, 0);
187 (void)cure_light_wounds(player_ptr, dice, sides);
193 return _("罠と扉 感知", "Detect Doors & Traps");
195 return _("近くの全ての罠と扉と階段を感知する。", "Detects traps, doors, and stairs in your vicinity.");
198 POSITION rad = DETECT_RAD_DEFAULT;
201 return info_radius(rad);
204 detect_traps(player_ptr, rad, true);
205 detect_doors(player_ptr, rad);
206 detect_stairs(player_ptr, rad);
213 return _("燃素", "Phlogiston");
215 return _("光源に燃料を補給する。", "Adds more turns of light to a lantern or torch.");
219 phlogiston(player_ptr);
226 return _("財宝感知", "Detect Treasure");
228 return _("近くの財宝を感知する。", "Detects all treasures in your vicinity.");
231 POSITION rad = DETECT_RAD_DEFAULT;
234 return info_radius(rad);
237 detect_treasure(player_ptr, rad);
238 detect_objects_gold(player_ptr, rad);
245 return _("魔法 感知", "Detect Enchantment");
247 return _("近くの魔法がかかったアイテムを感知する。", "Detects all magical items in your vicinity.");
250 POSITION rad = DETECT_RAD_DEFAULT;
253 return info_radius(rad);
256 detect_objects_magic(player_ptr, rad);
263 return _("アイテム感知", "Detect Objects");
265 return _("近くの全てのアイテムを感知する。", "Detects all items in your vicinity.");
268 POSITION rad = DETECT_RAD_DEFAULT;
271 return info_radius(rad);
274 detect_objects_normal(player_ptr, rad);
281 return _("解毒", "Cure Poison");
285 return _("毒を体内から完全に取り除く。", "Cures yourself of any poisons.");
289 (void)BadStatusSetter(player_ptr).poison(0);
296 return _("耐冷", "Resist Cold");
298 return _("一定時間、冷気への耐性を得る。装備による耐性に累積する。",
299 "Gives resistance to cold. This resistance can be added to that from equipment for more powerful resistance.");
305 return info_duration(base, base);
308 set_oppose_cold(player_ptr, randint1(base) + base, false);
315 return _("耐火", "Resist Fire");
317 return _("一定時間、炎への耐性を得る。装備による耐性に累積する。",
318 "Gives resistance to fire. This resistance can be added to that from equipment for more powerful resistance.");
324 return info_duration(base, base);
327 set_oppose_fire(player_ptr, randint1(base) + base, false);
334 return _("耐電", "Resist Lightning");
336 return _("一定時間、電撃への耐性を得る。装備による耐性に累積する。",
337 "Gives resistance to electricity. This resistance can be added to that from equipment for more powerful resistance.");
343 return info_duration(base, base);
346 set_oppose_elec(player_ptr, randint1(base) + base, false);
353 return _("耐酸", "Resist Acid");
355 return _("一定時間、酸への耐性を得る。装備による耐性に累積する。",
356 "Gives resistance to acid. This resistance can be added to that from equipment for more powerful resistance.");
362 return info_duration(base, base);
365 set_oppose_acid(player_ptr, randint1(base) + base, false);
372 return _("重傷の治癒", "Cure Medium Wounds");
374 return _("怪我と体力を中程度回復させる。", "Heals cuts and HP.");
377 DICE_NUMBER dice = 4;
381 return info_heal(dice, sides, 0);
383 (void)cure_serious_wounds(player_ptr, 4, 8);
389 return _("テレポート", "Teleport");
391 return _("遠距離のテレポートをする。", "Teleports you a long distance.");
394 POSITION range = plev * 5;
397 return info_range(range);
400 teleport_player(player_ptr, range, TELEPORT_SPONTANEOUS);
407 return _("鑑定", "Identify");
409 return _("アイテムを識別する。", "Identifies an item.");
413 if (!ident_spell(player_ptr, false))
421 return _("岩石溶解", "Stone to Mud");
423 return _("壁を溶かして床にする。", "Turns one rock square to mud.");
426 DICE_NUMBER dice = 1;
431 return info_damage(dice, sides, base);
434 if (!get_aim_dir(player_ptr, &dir))
437 wall_to_mud(player_ptr, dir, 20 + randint1(30));
444 return _("閃光", "Ray of Light");
446 return _("光線を放つ。光りを嫌うモンスターに効果がある。", "Fires a beam of light which damages to light-sensitive monsters.");
449 DICE_NUMBER dice = 6;
453 return info_damage(dice, sides, 0);
456 if (!get_aim_dir(player_ptr, &dir))
459 msg_print(_("光線が放たれた。", "A line of light appears."));
460 lite_line(player_ptr, dir, damroll(6, 8));
467 return _("空腹充足", "Satisfy Hunger");
469 return _("満腹にする。", "Satisfies hunger.");
473 set_food(player_ptr, PY_FOOD_MAX - 1);
480 return _("透明視認", "See Invisible");
482 return _("一定時間、透明なものが見えるようになる。", "Gives see invisible for a while.");
488 return info_duration(base, base);
491 set_tim_invis(player_ptr, randint1(base) + base, false);
498 return _("エレメンタル召喚", "Conjure Elemental");
500 return _("1体のエレメンタルを召喚する。", "Summons an elemental.");
503 if (!summon_specific(player_ptr, -1, player_ptr->y, player_ptr->x, plev, SUMMON_ELEMENTAL, (PM_ALLOW_GROUP | PM_FORCE_PET))) {
504 msg_print(_("エレメンタルは現れなかった。", "No elementals arrive."));
512 return _("テレポート・レベル", "Teleport Level");
514 return _("瞬時に上か下の階にテレポートする。", "Instantly teleports you up or down a level.");
518 if (!get_check(_("本当に他の階にテレポートしますか?", "Are you sure? (Teleport Level)")))
520 teleport_level(player_ptr, 0);
527 return _("テレポート・モンスター", "Teleport Away");
529 return _("モンスターをテレポートさせるビームを放つ。抵抗されると無効。", "Teleports all monsters on the line away unless resisted.");
535 return info_power(power);
538 if (!get_aim_dir(player_ptr, &dir))
541 fire_beam(player_ptr, AttributeType::AWAY_ALL, dir, power);
548 return _("元素の球", "Elemental Ball");
550 return _("炎、電撃、冷気、酸のどれかの球を放つ。", "Fires a ball of some elements.");
557 return info_damage(0, 0, dam);
562 if (!get_aim_dir(player_ptr, &dir))
565 switch (randint1(4)) {
567 type = AttributeType::FIRE;
570 type = AttributeType::ELEC;
573 type = AttributeType::COLD;
576 type = AttributeType::ACID;
580 fire_ball(player_ptr, type, dir, dam, rad);
587 return _("全感知", "Detection");
589 return _("近くの全てのモンスター、罠、扉、階段、財宝、そしてアイテムを感知する。",
590 "Detects all monsters, traps, doors, stairs, treasures and items in your vicinity.");
593 POSITION rad = DETECT_RAD_DEFAULT;
596 return info_radius(rad);
599 detect_all(player_ptr, rad);
606 return _("帰還の呪文", "Word of Recall");
608 return _("地上にいるときはダンジョンの最深階へ、ダンジョンにいるときは地上へと移動する。",
609 "Recalls player from dungeon to town or from town to the deepest level of dungeon.");
616 return info_delay(base, sides);
619 if (!recall_player(player_ptr, randint0(21) + 15))
627 return _("千里眼", "Clairvoyance");
629 return _("その階全体を永久に照らし、ダンジョン内すべてのアイテムを感知する。さらに、一定時間テレパシー能力を得る。",
630 "Maps and lights whole dungeon level. Reveals locations of all objects. Gives telepathy for a while.");
637 return info_duration(base, sides);
640 chg_virtue(player_ptr, V_KNOWLEDGE, 1);
641 chg_virtue(player_ptr, V_ENLIGHTEN, 1);
643 wiz_lite(player_ptr, false);
645 if (!player_ptr->telepathy) {
646 set_tim_esp(player_ptr, randint1(sides) + base, false);