OSDN Git Service

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