OSDN Git Service

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