1 #include "realm/realm-nature.h"
2 #include "cmd-action/cmd-spell.h"
3 #include "effect/effect-characteristics.h"
4 #include "effect/spells-effect-util.h"
5 #include "floor/floor-object.h"
6 #include "io/targeting.h"
7 #include "monster-floor/monster-summon.h"
8 #include "monster-floor/place-monster-types.h"
9 #include "object/object-generator.h"
10 #include "object/object-kind-hook.h"
11 #include "player/avatar.h"
12 #include "player/bad-status-setter.h"
13 #include "player/player-damage.h"
14 #include "player/player-effects.h"
15 #include "player/player-race-types.h"
16 #include "player/player-race.h"
17 #include "spell-kind/earthquake.h"
18 #include "spell-kind/spells-beam.h"
19 #include "spell-kind/spells-charm.h"
20 #include "spell-kind/spells-detection.h"
21 #include "spell-kind/spells-floor.h"
22 #include "spell-kind/spells-grid.h"
23 #include "spell-kind/spells-launcher.h"
24 #include "spell-kind/spells-lite.h"
25 #include "spell-kind/spells-neighbor.h"
26 #include "spell-kind/spells-sight.h"
27 #include "spell/process-effect.h"
28 #include "spell/spells-diceroll.h"
29 #include "spell/spells-object.h"
30 #include "spell/spells-status.h"
31 #include "spell/spells-summon.h"
32 #include "spell/spell-types.h"
33 #include "spell/spells3.h"
34 #include "sv-definition/sv-food-types.h"
35 #include "view/display-messages.h"
38 * @brief 自然領域魔法の各処理を行う
39 * @param caster_ptr プレーヤーへの参照ポインタ
41 * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
42 * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
44 concptr do_nature_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode)
46 bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
47 bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
48 bool info = (mode == SPELL_INFO) ? TRUE : FALSE;
49 bool cast = (mode == SPELL_CAST) ? TRUE : FALSE;
52 PLAYER_LEVEL plev = caster_ptr->lev;
57 if (name) return _("モンスター感知", "Detect Creatures");
58 if (desc) return _("近くの全ての見えるモンスターを感知する。", "Detects all monsters in your vicinity unless invisible.");
61 POSITION rad = DETECT_RAD_DEFAULT;
63 if (info) return info_radius(rad);
67 detect_monsters_normal(caster_ptr, rad);
73 if (name) return _("稲妻", "Lightning");
74 if (desc) return _("電撃の短いビームを放つ。", "Fires a short beam of lightning.");
77 DICE_NUMBER dice = 3 + (plev - 1) / 5;
79 POSITION range = plev / 6 + 2;
81 if (info) return format("%s%dd%d %s%d", KWD_DAM, dice, sides, KWD_RANGE, range);
85 project_length = range;
87 if (!get_aim_dir(caster_ptr, &dir)) return NULL;
89 fire_beam(caster_ptr, GF_ELEC, dir, damroll(dice, sides));
95 if (name) return _("罠と扉感知", "Detect Doors and Traps");
96 if (desc) return _("近くの全ての罠と扉を感知する。", "Detects traps, doors, and stairs in your vicinity.");
99 POSITION rad = DETECT_RAD_DEFAULT;
101 if (info) return info_radius(rad);
105 detect_traps(caster_ptr, rad, TRUE);
106 detect_doors(caster_ptr, rad);
107 detect_stairs(caster_ptr, rad);
113 if (name) return _("食糧生成", "Produce Food");
114 if (desc) return _("食料を一つ作り出す。", "Produces a Ration of Food.");
119 object_type forge, *q_ptr = &forge;
120 msg_print(_("食料を生成した。", "A food ration is produced."));
122 /* Create the food ration */
123 object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION));
125 /* Drop the object from heaven */
126 (void)drop_near(caster_ptr, q_ptr, -1, caster_ptr->y, caster_ptr->x);
132 if (name) return _("日の光", "Daylight");
133 if (desc) return _("光源が照らしている範囲か部屋全体を永久に明るくする。", "Lights up nearby area and the inside of a room permanently.");
136 DICE_NUMBER dice = 2;
137 DICE_SID sides = plev / 2;
138 POSITION rad = (plev / 10) + 1;
140 if (info) return info_damage(dice, sides, 0);
144 lite_area(caster_ptr, damroll(dice, sides), rad);
146 if ((is_specific_player_race(caster_ptr, RACE_VAMPIRE) || (caster_ptr->mimic_form == MIMIC_VAMPIRE)) && !caster_ptr->resist_lite)
148 msg_print(_("日の光があなたの肉体を焦がした!", "The daylight scorches your flesh!"));
149 take_hit(caster_ptr, DAMAGE_NOESCAPE, damroll(2, 2), _("日の光", "daylight"), -1);
156 if (name) return _("動物習し", "Animal Taming");
157 if (desc) return _("動物1体を魅了する。抵抗されると無効。", "Attempts to charm an animal.");
162 if (info) return info_power(power);
166 if (!get_aim_dir(caster_ptr, &dir)) return NULL;
168 charm_animal(caster_ptr, dir, plev);
174 if (name) return _("環境への耐性", "Resist Environment");
175 if (desc) return _("一定時間、冷気、炎、電撃に対する耐性を得る。装備による耐性に累積する。",
176 "Gives resistance to fire, cold and electricity for a while. These resistances can be added to those from equipment for more powerful resistances.");
181 if (info) return info_duration(base, base);
185 set_oppose_cold(caster_ptr, randint1(base) + base, FALSE);
186 set_oppose_fire(caster_ptr, randint1(base) + base, FALSE);
187 set_oppose_elec(caster_ptr, randint1(base) + base, FALSE);
193 if (name) return _("傷と毒治療", "Cure Wounds & Poison");
194 if (desc) return _("怪我を全快させ、毒を体から完全に取り除き、体力を少し回復させる。", "Heals all cuts and poisons. Heals HP a little.");
197 DICE_NUMBER dice = 2;
200 if (info) return info_heal(dice, sides, 0);
204 hp_player(caster_ptr, damroll(dice, sides));
205 set_cut(caster_ptr,0);
206 set_poisoned(caster_ptr, 0);
212 if (name) return _("岩石溶解", "Stone to Mud");
213 if (desc) return _("壁を溶かして床にする。", "Turns one rock square to mud.");
216 DICE_NUMBER dice = 1;
220 if (info) return info_damage(dice, sides, base);
224 if (!get_aim_dir(caster_ptr, &dir)) return NULL;
226 wall_to_mud(caster_ptr, dir, 20 + randint1(30));
232 if (name) return _("アイス・ボルト", "Frost Bolt");
233 if (desc) return _("冷気のボルトもしくはビームを放つ。", "Fires a bolt or beam of cold.");
236 DICE_NUMBER dice = 3 + (plev - 5) / 4;
239 if (info) return info_damage(dice, sides, 0);
243 if (!get_aim_dir(caster_ptr, &dir)) return NULL;
244 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_COLD, dir, damroll(dice, sides));
250 if (name) return _("自然の覚醒", "Nature Awareness");
251 if (desc) return _("周辺の地形を感知し、近くの罠、扉、階段、全てのモンスターを感知する。",
252 "Maps nearby area. Detects all monsters, traps, doors and stairs.");
255 int rad1 = DETECT_RAD_MAP;
256 int rad2 = DETECT_RAD_DEFAULT;
258 if (info) return info_radius(MAX(rad1, rad2));
262 map_area(caster_ptr, rad1);
263 detect_traps(caster_ptr, rad2, TRUE);
264 detect_doors(caster_ptr, rad2);
265 detect_stairs(caster_ptr, rad2);
266 detect_monsters_normal(caster_ptr, rad2);
272 if (name) return _("ファイア・ボルト", "Fire Bolt");
273 if (desc) return _("火炎のボルトもしくはビームを放つ。", "Fires a bolt or beam of fire.");
276 DICE_NUMBER dice = 5 + (plev - 5) / 4;
279 if (info) return info_damage(dice, sides, 0);
283 if (!get_aim_dir(caster_ptr, &dir)) return NULL;
284 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_FIRE, dir, damroll(dice, sides));
290 if (name) return _("太陽光線", "Ray of Sunlight");
291 if (desc) return _("光線を放つ。光りを嫌うモンスターに効果がある。", "Fires a beam of light which damages light-sensitive monsters.");
294 DICE_NUMBER dice = 6;
297 if (info) return info_damage(dice, sides, 0);
301 if (!get_aim_dir(caster_ptr, &dir)) return NULL;
302 msg_print(_("太陽光線が現れた。", "A line of sunlight appears."));
303 lite_line(caster_ptr, dir, damroll(6, 8));
309 if (name) return _("足かせ", "Entangle");
310 if (desc) return _("視界内の全てのモンスターを減速させる。抵抗されると無効。", "Attempts to slow all monsters in sight.");
313 if (info) return info_power(power);
314 if (cast) slow_monsters(caster_ptr, plev);
319 if (name) return _("動物召喚", "Summon Animal");
320 if (desc) return _("動物を1体召喚する。", "Summons an animal.");
325 if (!(summon_specific(caster_ptr, -1, caster_ptr->y, caster_ptr->x, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET))))
327 msg_print(_("動物は現れなかった。", "No animals arrive."));
335 if (name) return _("薬草治療", "Herbal Healing");
336 if (desc) return _("体力を大幅に回復させ、負傷、朦朧状態、毒から全快する。", "Heals HP greatly. Completely cures cuts, poisons and being stunned.");
339 if (info) return info_heal(0, 0, heal);
340 if (cast) (void)cure_critical_wounds(caster_ptr, heal);
345 if (name) return _("階段生成", "Stair Building");
346 if (desc) return _("自分のいる位置に階段を作る。", "Creates a staircase which goes down or up.");
351 stair_creation(caster_ptr);
357 if (name) return _("肌石化", "Stone Skin");
358 if (desc) return _("一定時間、ACを上昇させる。", "Gives a bonus to AC for a while.");
364 if (info) return info_duration(base, sides);
368 set_shield(caster_ptr, randint1(sides) + base, FALSE);
374 if (name) return _("真・耐性", "Resistance True");
375 if (desc) return _("一定時間、酸、電撃、炎、冷気、毒に対する耐性を得る。装備による耐性に累積する。",
376 "Gives resistance to fire, cold, electricity, acid and poison for a while. These resistances can be added to those from equipment for more powerful resistances.");
381 if (info) return info_duration(base, base);
385 set_oppose_acid(caster_ptr, randint1(base) + base, FALSE);
386 set_oppose_elec(caster_ptr, randint1(base) + base, FALSE);
387 set_oppose_fire(caster_ptr, randint1(base) + base, FALSE);
388 set_oppose_cold(caster_ptr, randint1(base) + base, FALSE);
389 set_oppose_pois(caster_ptr, randint1(base) + base, FALSE);
395 if (name) return _("森林創造", "Forest Creation");
396 if (desc) return _("周囲に木を作り出す。", "Creates trees in all adjacent squares.");
401 tree_creation(caster_ptr, caster_ptr->y, caster_ptr->x);
407 if (name) return _("動物友和", "Animal Friendship");
408 if (desc) return _("視界内の全ての動物を魅了する。抵抗されると無効。", "Attempts to charm all animals in sight.");
411 int power = plev * 2;
412 if (info) return info_power(power);
413 if (cast) charm_animals(caster_ptr, power);
418 if (name) return _("試金石", "Stone Tell");
419 if (desc) return _("アイテムの持つ能力を完全に知る。", "*Identifies* an item.");
424 if (!identify_fully(caster_ptr, FALSE, 0)) return NULL;
430 if (name) return _("石の壁", "Wall of Stone");
431 if (desc) return _("自分の周囲に花崗岩の壁を作る。", "Creates granite walls in all adjacent squares.");
436 wall_stone(caster_ptr);
442 if (name) return _("腐食防止", "Protect from Corrosion");
443 if (desc) return _("アイテムを酸で傷つかないよう加工する。", "Makes a piece of equipment acid-proof.");
448 if (!rustproof(caster_ptr)) return NULL;
454 if (name) return _("地震", "Earthquake");
455 if (desc) return _("周囲のダンジョンを揺らし、壁と床をランダムに入れ変える。",
456 "Shakes dungeon structure, and results in random swapping of floors and walls.");
461 if (info) return info_radius(rad);
465 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, rad, 0);
471 if (name) return _("カマイタチ", "Whirlwind");
472 if (desc) return _("全方向に向かって攻撃する。", "Attacks all adjacent monsters.");
473 if (cast) massacre(caster_ptr);
477 if (name) return _("ブリザード", "Blizzard");
478 if (desc) return _("巨大な冷気の球を放つ。", "Fires a huge ball of cold.");
481 HIT_POINT dam = 70 + plev * 3 / 2;
482 POSITION rad = plev / 12 + 1;
484 if (info) return info_damage(0, 0, dam);
488 if (!get_aim_dir(caster_ptr, &dir)) return NULL;
490 fire_ball(caster_ptr, GF_COLD, dir, dam, rad);
496 if (name) return _("稲妻嵐", "Lightning Storm");
497 if (desc) return _("巨大な電撃の球を放つ。", "Fires a huge electric ball.");
500 HIT_POINT dam = 90 + plev * 3 / 2;
501 POSITION rad = plev / 12 + 1;
503 if (info) return info_damage(0, 0, dam);
507 if (!get_aim_dir(caster_ptr, &dir)) return NULL;
508 fire_ball(caster_ptr, GF_ELEC, dir, dam, rad);
515 if (name) return _("渦潮", "Whirlpool");
516 if (desc) return _("巨大な水の球を放つ。", "Fires a huge ball of water.");
519 HIT_POINT dam = 100 + plev * 3 / 2;
520 POSITION rad = plev / 12 + 1;
522 if (info) return info_damage(0, 0, dam);
526 if (!get_aim_dir(caster_ptr, &dir)) return NULL;
527 fire_ball(caster_ptr, GF_WATER, dir, dam, rad);
533 if (name) return _("陽光召喚", "Call Sunlight");
534 if (desc) return _("自分を中心とした光の球を発生させる。さらに、その階全体を永久に照らし、ダンジョン内すべてのアイテムを感知する。",
535 "Generates ball of light centered on you. Maps and lights whole dungeon level. Knows all objects location.");
541 if (info) return info_damage(0, 0, dam / 2);
545 fire_ball(caster_ptr, GF_LITE, 0, dam, rad);
546 chg_virtue(caster_ptr, V_KNOWLEDGE, 1);
547 chg_virtue(caster_ptr, V_ENLIGHTEN, 1);
548 wiz_lite(caster_ptr, FALSE);
550 if ((is_specific_player_race(caster_ptr, RACE_VAMPIRE) || (caster_ptr->mimic_form == MIMIC_VAMPIRE)) && !caster_ptr->resist_lite)
552 msg_print(_("日光があなたの肉体を焦がした!", "The sunlight scorches your flesh!"));
553 take_hit(caster_ptr, DAMAGE_NOESCAPE, 50, _("日光", "sunlight"), -1);
560 if (name) return _("精霊の刃", "Elemental Branding");
561 if (desc) return _("武器に炎か冷気の属性をつける。", "Brands current weapon with fire or frost.");
566 brand_weapon(caster_ptr, randint0(2));
572 if (name) return _("自然の脅威", "Nature's Wrath");
573 if (desc) return _("近くの全てのモンスターにダメージを与え、地震を起こし、自分を中心とした分解の球を発生させる。",
574 "Damages all monsters in sight. Makes quake. Generates disintegration ball centered on you.");
577 int d_dam = 4 * plev;
578 int b_dam = (100 + plev) * 2;
579 POSITION b_rad = 1 + plev / 12;
580 POSITION q_rad = 20 + plev / 2;
582 if (info) return format("%s%d+%d", KWD_DAM, d_dam, b_dam / 2);
586 dispel_monsters(caster_ptr, d_dam);
587 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, q_rad, 0);
588 project(caster_ptr, 0, b_rad, caster_ptr->y, caster_ptr->x, b_dam, GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM, -1);