OSDN Git Service

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