OSDN Git Service

Merge remote-tracking branch 'remotes/origin/List-Dead-Uniques' into For2.2.2-Refactoring
[hengband/hengband.git] / src / realm / realm-nature.c
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/player-damage.h"
13 #include "player/player-effects.h"
14 #include "player/player-race-types.h"
15 #include "spell-kind/earthquake.h"
16 #include "spell-kind/spells-beam.h"
17 #include "spell-kind/spells-charm.h"
18 #include "spell-kind/spells-detection.h"
19 #include "spell-kind/spells-floor.h"
20 #include "spell-kind/spells-grid.h"
21 #include "spell-kind/spells-launcher.h"
22 #include "spell-kind/spells-lite.h"
23 #include "spell-kind/spells-neighbor.h"
24 #include "spell-kind/spells-sight.h"
25 #include "spell/process-effect.h"
26 #include "spell/spells-diceroll.h"
27 #include "spell/spells-object.h"
28 #include "spell/spells-status.h"
29 #include "spell/spells-summon.h"
30 #include "spell/spell-types.h"
31 #include "spell/spells3.h"
32 #include "sv-definition/sv-food-types.h"
33 #include "view/display-messages.h"
34
35 /*!
36 * @brief 自然領域魔法の各処理を行う
37 * @param caster_ptr プレーヤーへの参照ポインタ
38 * @param spell 魔法ID
39 * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
40 * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
41 */
42 concptr do_nature_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode)
43 {
44         bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
45         bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
46         bool info = (mode == SPELL_INFO) ? TRUE : FALSE;
47         bool cast = (mode == SPELL_CAST) ? TRUE : FALSE;
48
49         DIRECTION dir;
50         PLAYER_LEVEL plev = caster_ptr->lev;
51
52         switch (spell)
53         {
54         case 0:
55                 if (name) return _("モンスター感知", "Detect Creatures");
56                 if (desc) return _("近くの全ての見えるモンスターを感知する。", "Detects all monsters in your vicinity unless invisible.");
57
58                 {
59                         POSITION rad = DETECT_RAD_DEFAULT;
60
61                         if (info) return info_radius(rad);
62
63                         if (cast)
64                         {
65                                 detect_monsters_normal(caster_ptr, rad);
66                         }
67                 }
68                 break;
69
70         case 1:
71                 if (name) return _("稲妻", "Lightning");
72                 if (desc) return _("電撃の短いビームを放つ。", "Fires a short beam of lightning.");
73
74                 {
75                         DICE_NUMBER dice = 3 + (plev - 1) / 5;
76                         DICE_SID sides = 4;
77                         POSITION range = plev / 6 + 2;
78
79                         if (info) return format("%s%dd%d %s%d", KWD_DAM, dice, sides, KWD_RANGE, range);
80
81                         if (cast)
82                         {
83                                 project_length = range;
84
85                                 if (!get_aim_dir(caster_ptr, &dir)) return NULL;
86
87                                 fire_beam(caster_ptr, GF_ELEC, dir, damroll(dice, sides));
88                         }
89                 }
90                 break;
91
92         case 2:
93                 if (name) return _("罠と扉感知", "Detect Doors and Traps");
94                 if (desc) return _("近くの全ての罠と扉を感知する。", "Detects traps, doors, and stairs in your vicinity.");
95
96                 {
97                         POSITION rad = DETECT_RAD_DEFAULT;
98
99                         if (info) return info_radius(rad);
100
101                         if (cast)
102                         {
103                                 detect_traps(caster_ptr, rad, TRUE);
104                                 detect_doors(caster_ptr, rad);
105                                 detect_stairs(caster_ptr, rad);
106                         }
107                 }
108                 break;
109
110         case 3:
111                 if (name) return _("食糧生成", "Produce Food");
112                 if (desc) return _("食料を一つ作り出す。", "Produces a Ration of Food.");
113
114                 {
115                         if (cast)
116                         {
117                                 object_type forge, *q_ptr = &forge;
118                                 msg_print(_("食料を生成した。", "A food ration is produced."));
119
120                                 /* Create the food ration */
121                                 object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION));
122
123                                 /* Drop the object from heaven */
124                                 (void)drop_near(caster_ptr, q_ptr, -1, caster_ptr->y, caster_ptr->x);
125                         }
126                 }
127                 break;
128
129         case 4:
130                 if (name) return _("日の光", "Daylight");
131                 if (desc) return _("光源が照らしている範囲か部屋全体を永久に明るくする。", "Lights up nearby area and the inside of a room permanently.");
132
133                 {
134                         DICE_NUMBER dice = 2;
135                         DICE_SID sides = plev / 2;
136                         POSITION rad = (plev / 10) + 1;
137
138                         if (info) return info_damage(dice, sides, 0);
139
140                         if (cast)
141                         {
142                                 lite_area(caster_ptr, damroll(dice, sides), rad);
143
144                                 if ((is_specific_player_race(caster_ptr, RACE_VAMPIRE) || (caster_ptr->mimic_form == MIMIC_VAMPIRE)) && !caster_ptr->resist_lite)
145                                 {
146                                         msg_print(_("日の光があなたの肉体を焦がした!", "The daylight scorches your flesh!"));
147                                         take_hit(caster_ptr, DAMAGE_NOESCAPE, damroll(2, 2), _("日の光", "daylight"), -1);
148                                 }
149                         }
150                 }
151                 break;
152
153         case 5:
154                 if (name) return _("動物習し", "Animal Taming");
155                 if (desc) return _("動物1体を魅了する。抵抗されると無効。", "Attempts to charm an animal.");
156
157                 {
158                         int power = plev;
159
160                         if (info) return info_power(power);
161
162                         if (cast)
163                         {
164                                 if (!get_aim_dir(caster_ptr, &dir)) return NULL;
165
166                                 charm_animal(caster_ptr, dir, plev);
167                         }
168                 }
169                 break;
170
171         case 6:
172                 if (name) return _("環境への耐性", "Resist Environment");
173                 if (desc) return _("一定時間、冷気、炎、電撃に対する耐性を得る。装備による耐性に累積する。",
174                         "Gives resistance to fire, cold and electricity for a while. These resistances can be added to those from equipment for more powerful resistances.");
175
176                 {
177                         int base = 20;
178
179                         if (info) return info_duration(base, base);
180
181                         if (cast)
182                         {
183                                 set_oppose_cold(caster_ptr, randint1(base) + base, FALSE);
184                                 set_oppose_fire(caster_ptr, randint1(base) + base, FALSE);
185                                 set_oppose_elec(caster_ptr, randint1(base) + base, FALSE);
186                         }
187                 }
188                 break;
189
190         case 7:
191                 if (name) return _("傷と毒治療", "Cure Wounds & Poison");
192                 if (desc) return _("怪我を全快させ、毒を体から完全に取り除き、体力を少し回復させる。", "Heals all cuts and poisons. Heals HP a little.");
193
194                 {
195                         DICE_NUMBER dice = 2;
196                         DICE_SID sides = 8;
197
198                         if (info) return info_heal(dice, sides, 0);
199
200                         if (cast)
201                         {
202                                 hp_player(caster_ptr, damroll(dice, sides));
203                                 set_cut(caster_ptr,0);
204                                 set_poisoned(caster_ptr, 0);
205                         }
206                 }
207                 break;
208
209         case 8:
210                 if (name) return _("岩石溶解", "Stone to Mud");
211                 if (desc) return _("壁を溶かして床にする。", "Turns one rock square to mud.");
212
213                 {
214                         DICE_NUMBER dice = 1;
215                         DICE_SID sides = 30;
216                         int base = 20;
217
218                         if (info) return info_damage(dice, sides, base);
219
220                         if (cast)
221                         {
222                                 if (!get_aim_dir(caster_ptr, &dir)) return NULL;
223
224                                 wall_to_mud(caster_ptr, dir, 20 + randint1(30));
225                         }
226                 }
227                 break;
228
229         case 9:
230                 if (name) return _("アイス・ボルト", "Frost Bolt");
231                 if (desc) return _("冷気のボルトもしくはビームを放つ。", "Fires a bolt or beam of cold.");
232
233                 {
234                         DICE_NUMBER dice = 3 + (plev - 5) / 4;
235                         DICE_SID sides = 8;
236
237                         if (info) return info_damage(dice, sides, 0);
238
239                         if (cast)
240                         {
241                                 if (!get_aim_dir(caster_ptr, &dir)) return NULL;
242                                 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_COLD, dir, damroll(dice, sides));
243                         }
244                 }
245                 break;
246
247         case 10:
248                 if (name) return _("自然の覚醒", "Nature Awareness");
249                 if (desc) return _("周辺の地形を感知し、近くの罠、扉、階段、全てのモンスターを感知する。",
250                         "Maps nearby area. Detects all monsters, traps, doors and stairs.");
251
252                 {
253                         int rad1 = DETECT_RAD_MAP;
254                         int rad2 = DETECT_RAD_DEFAULT;
255
256                         if (info) return info_radius(MAX(rad1, rad2));
257
258                         if (cast)
259                         {
260                                 map_area(caster_ptr, rad1);
261                                 detect_traps(caster_ptr, rad2, TRUE);
262                                 detect_doors(caster_ptr, rad2);
263                                 detect_stairs(caster_ptr, rad2);
264                                 detect_monsters_normal(caster_ptr, rad2);
265                         }
266                 }
267                 break;
268
269         case 11:
270                 if (name) return _("ファイア・ボルト", "Fire Bolt");
271                 if (desc) return _("火炎のボルトもしくはビームを放つ。", "Fires a bolt or beam of fire.");
272
273                 {
274                         DICE_NUMBER dice = 5 + (plev - 5) / 4;
275                         DICE_SID sides = 8;
276
277                         if (info) return info_damage(dice, sides, 0);
278
279                         if (cast)
280                         {
281                                 if (!get_aim_dir(caster_ptr, &dir)) return NULL;
282                                 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_FIRE, dir, damroll(dice, sides));
283                         }
284                 }
285                 break;
286
287         case 12:
288                 if (name) return _("太陽光線", "Ray of Sunlight");
289                 if (desc) return _("光線を放つ。光りを嫌うモンスターに効果がある。", "Fires a beam of light which damages light-sensitive monsters.");
290
291                 {
292                         DICE_NUMBER dice = 6;
293                         DICE_SID sides = 8;
294
295                         if (info) return info_damage(dice, sides, 0);
296
297                         if (cast)
298                         {
299                                 if (!get_aim_dir(caster_ptr, &dir)) return NULL;
300                                 msg_print(_("太陽光線が現れた。", "A line of sunlight appears."));
301                                 lite_line(caster_ptr, dir, damroll(6, 8));
302                         }
303                 }
304                 break;
305
306         case 13:
307                 if (name) return _("足かせ", "Entangle");
308                 if (desc) return _("視界内の全てのモンスターを減速させる。抵抗されると無効。", "Attempts to slow all monsters in sight.");
309                 {
310                         int power = plev;
311                         if (info) return info_power(power);
312                         if (cast) slow_monsters(caster_ptr, plev);
313                 }
314                 break;
315
316         case 14:
317                 if (name) return _("動物召喚", "Summon Animal");
318                 if (desc) return _("動物を1体召喚する。", "Summons an animal.");
319
320                 {
321                         if (cast)
322                         {
323                                 if (!(summon_specific(caster_ptr, -1, caster_ptr->y, caster_ptr->x, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET))))
324                                 {
325                                         msg_print(_("動物は現れなかった。", "No animals arrive."));
326                                 }
327                                 break;
328                         }
329                 }
330                 break;
331
332         case 15:
333                 if (name) return _("薬草治療", "Herbal Healing");
334                 if (desc) return _("体力を大幅に回復させ、負傷、朦朧状態、毒から全快する。", "Heals HP greatly. Completely cures cuts, poisons and being stunned.");
335                 {
336                         int heal = 500;
337                         if (info) return info_heal(0, 0, heal);
338                         if (cast) (void)cure_critical_wounds(caster_ptr, heal);
339                 }
340                 break;
341
342         case 16:
343                 if (name) return _("階段生成", "Stair Building");
344                 if (desc) return _("自分のいる位置に階段を作る。", "Creates a staircase which goes down or up.");
345
346                 {
347                         if (cast)
348                         {
349                                 stair_creation(caster_ptr);
350                         }
351                 }
352                 break;
353
354         case 17:
355                 if (name) return _("肌石化", "Stone Skin");
356                 if (desc) return _("一定時間、ACを上昇させる。", "Gives a bonus to AC for a while.");
357
358                 {
359                         int base = 20;
360                         DICE_SID sides = 30;
361
362                         if (info) return info_duration(base, sides);
363
364                         if (cast)
365                         {
366                                 set_shield(caster_ptr, randint1(sides) + base, FALSE);
367                         }
368                 }
369                 break;
370
371         case 18:
372                 if (name) return _("真・耐性", "Resistance True");
373                 if (desc) return _("一定時間、酸、電撃、炎、冷気、毒に対する耐性を得る。装備による耐性に累積する。",
374                         "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.");
375
376                 {
377                         int base = 20;
378
379                         if (info) return info_duration(base, base);
380
381                         if (cast)
382                         {
383                                 set_oppose_acid(caster_ptr, randint1(base) + base, FALSE);
384                                 set_oppose_elec(caster_ptr, randint1(base) + base, FALSE);
385                                 set_oppose_fire(caster_ptr, randint1(base) + base, FALSE);
386                                 set_oppose_cold(caster_ptr, randint1(base) + base, FALSE);
387                                 set_oppose_pois(caster_ptr, randint1(base) + base, FALSE);
388                         }
389                 }
390                 break;
391
392         case 19:
393                 if (name) return _("森林創造", "Forest Creation");
394                 if (desc) return _("周囲に木を作り出す。", "Creates trees in all adjacent squares.");
395
396                 {
397                         if (cast)
398                         {
399                                 tree_creation(caster_ptr, caster_ptr->y, caster_ptr->x);
400                         }
401                 }
402                 break;
403
404         case 20:
405                 if (name) return _("動物友和", "Animal Friendship");
406                 if (desc) return _("視界内の全ての動物を魅了する。抵抗されると無効。", "Attempts to charm all animals in sight.");
407
408                 {
409                         int power = plev * 2;
410                         if (info) return info_power(power);
411                         if (cast) charm_animals(caster_ptr, power);
412                 }
413                 break;
414
415         case 21:
416                 if (name) return _("試金石", "Stone Tell");
417                 if (desc) return _("アイテムの持つ能力を完全に知る。", "*Identifies* an item.");
418
419                 {
420                         if (cast)
421                         {
422                                 if (!identify_fully(caster_ptr, FALSE, 0)) return NULL;
423                         }
424                 }
425                 break;
426
427         case 22:
428                 if (name) return _("石の壁", "Wall of Stone");
429                 if (desc) return _("自分の周囲に花崗岩の壁を作る。", "Creates granite walls in all adjacent squares.");
430
431                 {
432                         if (cast)
433                         {
434                                 wall_stone(caster_ptr);
435                         }
436                 }
437                 break;
438
439         case 23:
440                 if (name) return _("腐食防止", "Protect from Corrosion");
441                 if (desc) return _("アイテムを酸で傷つかないよう加工する。", "Makes a piece of equipment acid-proof.");
442
443                 {
444                         if (cast)
445                         {
446                                 if (!rustproof(caster_ptr)) return NULL;
447                         }
448                 }
449                 break;
450
451         case 24:
452                 if (name) return _("地震", "Earthquake");
453                 if (desc) return _("周囲のダンジョンを揺らし、壁と床をランダムに入れ変える。",
454                         "Shakes dungeon structure, and results in random swapping of floors and walls.");
455
456                 {
457                         POSITION rad = 10;
458
459                         if (info) return info_radius(rad);
460
461                         if (cast)
462                         {
463                                 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, rad, 0);
464                         }
465                 }
466                 break;
467
468         case 25:
469                 if (name) return _("カマイタチ", "Whirlwind");
470                 if (desc) return _("全方向に向かって攻撃する。", "Attacks all adjacent monsters.");
471                 if (cast) massacre(caster_ptr);
472                 break;
473
474         case 26:
475                 if (name) return _("ブリザード", "Blizzard");
476                 if (desc) return _("巨大な冷気の球を放つ。", "Fires a huge ball of cold.");
477
478                 {
479                         HIT_POINT dam = 70 + plev * 3 / 2;
480                         POSITION rad = plev / 12 + 1;
481
482                         if (info) return info_damage(0, 0, dam);
483
484                         if (cast)
485                         {
486                                 if (!get_aim_dir(caster_ptr, &dir)) return NULL;
487
488                                 fire_ball(caster_ptr, GF_COLD, dir, dam, rad);
489                         }
490                 }
491                 break;
492
493         case 27:
494                 if (name) return _("稲妻嵐", "Lightning Storm");
495                 if (desc) return _("巨大な電撃の球を放つ。", "Fires a huge electric ball.");
496
497                 {
498                         HIT_POINT dam = 90 + plev * 3 / 2;
499                         POSITION rad = plev / 12 + 1;
500
501                         if (info) return info_damage(0, 0, dam);
502
503                         if (cast)
504                         {
505                                 if (!get_aim_dir(caster_ptr, &dir)) return NULL;
506                                 fire_ball(caster_ptr, GF_ELEC, dir, dam, rad);
507                                 break;
508                         }
509                 }
510                 break;
511
512         case 28:
513                 if (name) return _("渦潮", "Whirlpool");
514                 if (desc) return _("巨大な水の球を放つ。", "Fires a huge ball of water.");
515
516                 {
517                         HIT_POINT dam = 100 + plev * 3 / 2;
518                         POSITION rad = plev / 12 + 1;
519
520                         if (info) return info_damage(0, 0, dam);
521
522                         if (cast)
523                         {
524                                 if (!get_aim_dir(caster_ptr, &dir)) return NULL;
525                                 fire_ball(caster_ptr, GF_WATER, dir, dam, rad);
526                         }
527                 }
528                 break;
529
530         case 29:
531                 if (name) return _("陽光召喚", "Call Sunlight");
532                 if (desc) return _("自分を中心とした光の球を発生させる。さらに、その階全体を永久に照らし、ダンジョン内すべてのアイテムを感知する。",
533                         "Generates ball of light centered on you. Maps and lights whole dungeon level. Knows all objects location.");
534
535                 {
536                         HIT_POINT dam = 150;
537                         POSITION rad = 8;
538
539                         if (info) return info_damage(0, 0, dam / 2);
540
541                         if (cast)
542                         {
543                                 fire_ball(caster_ptr, GF_LITE, 0, dam, rad);
544                                 chg_virtue(caster_ptr, V_KNOWLEDGE, 1);
545                                 chg_virtue(caster_ptr, V_ENLIGHTEN, 1);
546                                 wiz_lite(caster_ptr, FALSE);
547
548                                 if ((is_specific_player_race(caster_ptr, RACE_VAMPIRE) || (caster_ptr->mimic_form == MIMIC_VAMPIRE)) && !caster_ptr->resist_lite)
549                                 {
550                                         msg_print(_("日光があなたの肉体を焦がした!", "The sunlight scorches your flesh!"));
551                                         take_hit(caster_ptr, DAMAGE_NOESCAPE, 50, _("日光", "sunlight"), -1);
552                                 }
553                         }
554                 }
555                 break;
556
557         case 30:
558                 if (name) return _("精霊の刃", "Elemental Branding");
559                 if (desc) return _("武器に炎か冷気の属性をつける。", "Brands current weapon with fire or frost.");
560
561                 {
562                         if (cast)
563                         {
564                                 brand_weapon(caster_ptr, randint0(2));
565                         }
566                 }
567                 break;
568
569         case 31:
570                 if (name) return _("自然の脅威", "Nature's Wrath");
571                 if (desc) return _("近くの全てのモンスターにダメージを与え、地震を起こし、自分を中心とした分解の球を発生させる。",
572                         "Damages all monsters in sight. Makes quake. Generates disintegration ball centered on you.");
573
574                 {
575                         int d_dam = 4 * plev;
576                         int b_dam = (100 + plev) * 2;
577                         POSITION b_rad = 1 + plev / 12;
578                         POSITION q_rad = 20 + plev / 2;
579
580                         if (info) return format("%s%d+%d", KWD_DAM, d_dam, b_dam / 2);
581
582                         if (cast)
583                         {
584                                 dispel_monsters(caster_ptr, d_dam);
585                                 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, q_rad, 0);
586                                 project(caster_ptr, 0, b_rad, caster_ptr->y, caster_ptr->x, b_dam, GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM, -1);
587                         }
588                 }
589                 break;
590         }
591
592         return "";
593 }
594