1 #include "realm/realm-nature.h"
2 #include "avatar/avatar.h"
3 #include "cmd-action/cmd-spell.h"
4 #include "effect/effect-characteristics.h"
5 #include "effect/effect-processor.h"
6 #include "effect/spells-effect-util.h"
7 #include "floor/floor-object.h"
8 #include "hpmp/hp-mp-processor.h"
9 #include "monster-floor/monster-summon.h"
10 #include "monster-floor/place-monster-types.h"
11 #include "object/object-kind-hook.h"
12 #include "player-attack/player-attack.h"
13 #include "player-base/player-race.h"
14 #include "player-info/race-info.h"
15 #include "player-info/race-types.h"
16 #include "player/player-damage.h"
17 #include "player/player-status-flags.h"
18 #include "spell-kind/earthquake.h"
19 #include "spell-kind/spells-beam.h"
20 #include "spell-kind/spells-charm.h"
21 #include "spell-kind/spells-detection.h"
22 #include "spell-kind/spells-floor.h"
23 #include "spell-kind/spells-grid.h"
24 #include "spell-kind/spells-launcher.h"
25 #include "spell-kind/spells-lite.h"
26 #include "spell-kind/spells-neighbor.h"
27 #include "spell-kind/spells-perception.h"
28 #include "spell-kind/spells-sight.h"
29 #include "spell-realm/spells-nature.h"
30 #include "effect/attribute-types.h"
31 #include "spell/spells-diceroll.h"
32 #include "spell/spells-object.h"
33 #include "spell/spells-status.h"
34 #include "spell/summon-types.h"
35 #include "status/bad-status-setter.h"
36 #include "status/buff-setter.h"
37 #include "status/element-resistance.h"
38 #include "sv-definition/sv-food-types.h"
39 #include "system/object-type-definition.h"
40 #include "system/player-type-definition.h"
41 #include "target/target-getter.h"
42 #include "view/display-messages.h"
45 * @brief 自然領域魔法の各処理を行う
46 * @param player_ptr プレイヤーへの参照ポインタ
48 * @param mode 処理内容 (SpellProcessType::NAME / SPELL_DESC / SpellProcessType::INFO / SpellProcessType::CAST)
49 * @return SpellProcessType::NAME / SPELL_DESC / SpellProcessType::INFO 時には文字列ポインタを返す。SpellProcessType::CAST時はnullptr文字列を返す。
51 concptr do_nature_spell(PlayerType *player_ptr, SPELL_IDX spell, SpellProcessType mode)
53 bool name = mode == SpellProcessType::NAME;
54 bool desc = mode == SpellProcessType::DESCRIPTION;
55 bool info = mode == SpellProcessType::INFO;
56 bool cast = mode == SpellProcessType::CAST;
59 PLAYER_LEVEL plev = player_ptr->lev;
64 return _("モンスター感知", "Detect Creatures");
66 return _("近くの全ての見えるモンスターを感知する。", "Detects all monsters in your vicinity unless invisible.");
69 POSITION rad = DETECT_RAD_DEFAULT;
72 return info_radius(rad);
75 detect_monsters_normal(player_ptr, rad);
82 return _("稲妻", "Lightning");
84 return _("電撃の短いビームを放つ。", "Fires a short beam of lightning.");
87 DICE_NUMBER dice = 3 + (plev - 1) / 5;
89 POSITION range = plev / 6 + 2;
92 return format("%s%dd%d %s%d", KWD_DAM, dice, sides, KWD_RANGE, range);
95 project_length = range;
97 if (!get_aim_dir(player_ptr, &dir))
100 fire_beam(player_ptr, AttributeType::ELEC, dir, damroll(dice, sides));
107 return _("罠と扉感知", "Detect Doors and Traps");
109 return _("近くの全ての罠と扉を感知する。", "Detects traps, doors, and stairs in your vicinity.");
112 POSITION rad = DETECT_RAD_DEFAULT;
115 return info_radius(rad);
118 detect_traps(player_ptr, rad, true);
119 detect_doors(player_ptr, rad);
120 detect_stairs(player_ptr, rad);
127 return _("食糧生成", "Produce Food");
129 return _("食料を一つ作り出す。", "Produces a Ration of Food.");
133 ObjectType forge, *q_ptr = &forge;
134 msg_print(_("食料を生成した。", "A food ration is produced."));
136 /* Create the food ration */
137 q_ptr->prep(lookup_kind(ItemKindType::FOOD, SV_FOOD_RATION));
139 /* Drop the object from heaven */
140 (void)drop_near(player_ptr, q_ptr, -1, player_ptr->y, player_ptr->x);
147 return _("日の光", "Daylight");
149 return _("光源が照らしている範囲か部屋全体を永久に明るくする。", "Lights up nearby area and the inside of a room permanently.");
152 DICE_NUMBER dice = 2;
153 DICE_SID sides = plev / 2;
154 POSITION rad = (plev / 10) + 1;
157 return info_damage(dice, sides, 0);
160 lite_area(player_ptr, damroll(dice, sides), rad);
162 PlayerRace race(player_ptr);
163 if (race.life() == PlayerRaceLifeType::UNDEAD && race.tr_flags().has(TR_VUL_LITE) && !has_resist_lite(player_ptr)) {
164 msg_print(_("日の光があなたの肉体を焦がした!", "The daylight scorches your flesh!"));
165 take_hit(player_ptr, DAMAGE_NOESCAPE, damroll(2, 2), _("日の光", "daylight"));
173 return _("動物習し", "Animal Taming");
175 return _("動物1体を魅了する。抵抗されると無効。", "Attempts to charm an animal.");
181 return info_power(power);
184 if (!get_aim_dir(player_ptr, &dir))
187 charm_animal(player_ptr, dir, plev);
194 return _("環境への耐性", "Resist Environment");
196 return _("一定時間、冷気、炎、電撃に対する耐性を得る。装備による耐性に累積する。",
197 "Gives resistance to fire, cold and electricity for a while. These resistances can be added to those from equipment for more powerful "
204 return info_duration(base, base);
207 set_oppose_cold(player_ptr, randint1(base) + base, false);
208 set_oppose_fire(player_ptr, randint1(base) + base, false);
209 set_oppose_elec(player_ptr, randint1(base) + base, false);
216 return _("傷と毒治療", "Cure Wounds & Poison");
218 return _("怪我を全快させ、毒を体から完全に取り除き、体力を少し回復させる。", "Heals all cuts and poisons. Heals HP a little.");
221 DICE_NUMBER dice = 2;
225 return info_heal(dice, sides, 0);
228 BadStatusSetter bss(player_ptr);
229 hp_player(player_ptr, damroll(dice, sides));
238 return _("岩石溶解", "Stone to Mud");
240 return _("壁を溶かして床にする。", "Turns one rock square to mud.");
243 DICE_NUMBER dice = 1;
248 return info_damage(dice, sides, base);
251 if (!get_aim_dir(player_ptr, &dir))
254 wall_to_mud(player_ptr, dir, 20 + randint1(30));
261 return _("アイス・ボルト", "Frost Bolt");
263 return _("冷気のボルトもしくはビームを放つ。", "Fires a bolt or beam of cold.");
266 DICE_NUMBER dice = 3 + (plev - 5) / 4;
270 return info_damage(dice, sides, 0);
273 if (!get_aim_dir(player_ptr, &dir))
275 fire_bolt_or_beam(player_ptr, beam_chance(player_ptr) - 10, AttributeType::COLD, dir, damroll(dice, sides));
282 return _("自然の覚醒", "Nature Awareness");
285 "周辺の地形を感知し、近くの罠、扉、階段、全てのモンスターを感知する。", "Maps nearby area. Detects all monsters, traps, doors and stairs.");
288 int rad1 = DETECT_RAD_MAP;
289 int rad2 = DETECT_RAD_DEFAULT;
292 return info_radius(std::max(rad1, rad2));
295 map_area(player_ptr, rad1);
296 detect_traps(player_ptr, rad2, true);
297 detect_doors(player_ptr, rad2);
298 detect_stairs(player_ptr, rad2);
299 detect_monsters_normal(player_ptr, rad2);
306 return _("ファイア・ボルト", "Fire Bolt");
308 return _("火炎のボルトもしくはビームを放つ。", "Fires a bolt or beam of fire.");
311 DICE_NUMBER dice = 5 + (plev - 5) / 4;
315 return info_damage(dice, sides, 0);
318 if (!get_aim_dir(player_ptr, &dir))
320 fire_bolt_or_beam(player_ptr, beam_chance(player_ptr) - 10, AttributeType::FIRE, dir, damroll(dice, sides));
327 return _("太陽光線", "Ray of Sunlight");
329 return _("光線を放つ。光りを嫌うモンスターに効果がある。", "Fires a beam of light which damages light-sensitive monsters.");
332 DICE_NUMBER dice = 6;
336 return info_damage(dice, sides, 0);
339 if (!get_aim_dir(player_ptr, &dir))
341 msg_print(_("太陽光線が現れた。", "A line of sunlight appears."));
342 lite_line(player_ptr, dir, damroll(6, 8));
349 return _("足かせ", "Entangle");
351 return _("視界内の全てのモンスターを減速させる。抵抗されると無効。", "Attempts to slow all monsters in sight.");
355 return info_power(power);
357 slow_monsters(player_ptr, plev);
363 return _("動物召喚", "Summon Animal");
365 return _("動物を1体召喚する。", "Summons an animal.");
369 if (!(summon_specific(player_ptr, -1, player_ptr->y, player_ptr->x, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET)))) {
370 msg_print(_("動物は現れなかった。", "No animals arrive."));
379 return _("薬草治療", "Herbal Healing");
381 return _("体力を大幅に回復させ、負傷、朦朧状態、毒から全快する。", "Heals HP greatly. Completely cures cuts, poisons and being stunned.");
385 return info_heal(0, 0, heal);
387 (void)cure_critical_wounds(player_ptr, heal);
393 return _("階段生成", "Stair Building");
395 return _("自分のいる位置に階段を作る。", "Creates a staircase which goes down or up.");
399 stair_creation(player_ptr);
406 return _("肌石化", "Stone Skin");
408 return _("一定時間、ACを上昇させる。", "Gives a bonus to AC for a while.");
415 return info_duration(base, sides);
418 set_shield(player_ptr, randint1(sides) + base, false);
425 return _("真・耐性", "Resistance True");
427 return _("一定時間、酸、電撃、炎、冷気、毒に対する耐性を得る。装備による耐性に累積する。",
428 "Gives resistance to fire, cold, electricity, acid and poison for a while. These resistances can be added to those from equipment for more "
429 "powerful resistances.");
435 return info_duration(base, base);
438 set_oppose_acid(player_ptr, randint1(base) + base, false);
439 set_oppose_elec(player_ptr, randint1(base) + base, false);
440 set_oppose_fire(player_ptr, randint1(base) + base, false);
441 set_oppose_cold(player_ptr, randint1(base) + base, false);
442 set_oppose_pois(player_ptr, randint1(base) + base, false);
449 return _("森林創造", "Forest Creation");
451 return _("周囲に木を作り出す。", "Creates trees in all adjacent squares.");
455 tree_creation(player_ptr, player_ptr->y, player_ptr->x);
462 return _("動物友和", "Animal Friendship");
464 return _("視界内の全ての動物を魅了する。抵抗されると無効。", "Attempts to charm all animals in sight.");
467 int power = plev * 2;
469 return info_power(power);
471 charm_animals(player_ptr, power);
477 return _("試金石", "Stone Tell");
479 return _("アイテムの持つ能力を完全に知る。", "*Identifies* an item.");
483 if (!identify_fully(player_ptr, false))
491 return _("石の壁", "Wall of Stone");
493 return _("自分の周囲に花崗岩の壁を作る。", "Creates granite walls in all adjacent squares.");
497 wall_stone(player_ptr);
504 return _("腐食防止", "Protect from Corrosion");
506 return _("アイテムを酸で傷つかないよう加工する。", "Makes a piece of equipment acid-proof.");
510 if (!rustproof(player_ptr))
518 return _("地震", "Earthquake");
521 "周囲のダンジョンを揺らし、壁と床をランダムに入れ変える。", "Shakes dungeon structure, and results in random swapping of floors and walls.");
527 return info_radius(rad);
530 earthquake(player_ptr, player_ptr->y, player_ptr->x, rad, 0);
537 return _("カマイタチ", "Whirlwind");
539 return _("全方向に向かって攻撃する。", "Attacks all adjacent monsters.");
541 massacre(player_ptr);
546 return _("ブリザード", "Blizzard");
548 return _("巨大な冷気の球を放つ。", "Fires a huge ball of cold.");
551 HIT_POINT dam = 70 + plev * 3 / 2;
552 POSITION rad = plev / 12 + 1;
555 return info_damage(0, 0, dam);
558 if (!get_aim_dir(player_ptr, &dir))
561 fire_ball(player_ptr, AttributeType::COLD, dir, dam, rad);
568 return _("稲妻嵐", "Lightning Storm");
570 return _("巨大な電撃の球を放つ。", "Fires a huge electric ball.");
573 HIT_POINT dam = 90 + plev * 3 / 2;
574 POSITION rad = plev / 12 + 1;
577 return info_damage(0, 0, dam);
580 if (!get_aim_dir(player_ptr, &dir))
582 fire_ball(player_ptr, AttributeType::ELEC, dir, dam, rad);
590 return _("渦潮", "Whirlpool");
592 return _("巨大な水の球を放つ。", "Fires a huge ball of water.");
595 HIT_POINT dam = 100 + plev * 3 / 2;
596 POSITION rad = plev / 12 + 1;
599 return info_damage(0, 0, dam);
602 if (!get_aim_dir(player_ptr, &dir))
604 fire_ball(player_ptr, AttributeType::WATER, dir, dam, rad);
611 return _("陽光召喚", "Call Sunlight");
613 return _("自分を中心とした光の球を発生させる。さらに、その階全体を永久に照らし、ダンジョン内すべてのアイテムを感知する。",
614 "Generates ball of light centered on you. Maps and lights whole dungeon level. Knows all objects location.");
621 return info_damage(0, 0, dam / 2);
624 fire_ball(player_ptr, AttributeType::LITE, 0, dam, rad);
625 chg_virtue(player_ptr, V_KNOWLEDGE, 1);
626 chg_virtue(player_ptr, V_ENLIGHTEN, 1);
627 wiz_lite(player_ptr, false);
629 PlayerRace race(player_ptr);
630 if (race.life() == PlayerRaceLifeType::UNDEAD && race.tr_flags().has(TR_VUL_LITE) && !has_resist_lite(player_ptr)) {
631 msg_print(_("日光があなたの肉体を焦がした!", "The sunlight scorches your flesh!"));
632 take_hit(player_ptr, DAMAGE_NOESCAPE, 50, _("日光", "sunlight"));
640 return _("精霊の刃", "Elemental Branding");
642 return _("武器に炎か冷気の属性をつける。", "Brands current weapon with fire or frost.");
646 brand_weapon(player_ptr, randint0(2));
653 return _("自然の脅威", "Nature's Wrath");
655 return _("近くの全てのモンスターにダメージを与え、地震を起こし、自分を中心とした分解の球を発生させる。",
656 "Damages all monsters in sight. Makes quake. Generates disintegration ball centered on you.");
659 int d_dam = 4 * plev;
660 int b_dam = (100 + plev) * 2;
661 POSITION b_rad = 1 + plev / 12;
662 POSITION q_rad = 20 + plev / 2;
665 return format("%s%d+%d", KWD_DAM, d_dam, b_dam / 2);
668 dispel_monsters(player_ptr, d_dam);
669 earthquake(player_ptr, player_ptr->y, player_ptr->x, q_rad, 0);
670 project(player_ptr, 0, b_rad, player_ptr->y, player_ptr->x, b_dam, AttributeType::DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM);