OSDN Git Service

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