OSDN Git Service

[Refactor] #37353 コメント整理。 / Refactor comments.
[hengband/hengband.git] / src / realm-arcane.c
1 #include "angband.h"
2 #include "cmd-spell.h"
3 #include "spells-summon.h"
4 #include "projection.h"
5 #include "avatar.h"
6
7 /*!
8 * @brief 秘術領域魔法の各処理を行う
9 * @param spell 魔法ID
10 * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
11 * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
12 */
13 concptr do_arcane_spell(SPELL_IDX spell, BIT_FLAGS mode)
14 {
15         bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
16         bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
17         bool info = (mode == SPELL_INFO) ? TRUE : FALSE;
18         bool cast = (mode == SPELL_CAST) ? TRUE : FALSE;
19
20         DIRECTION dir;
21         PLAYER_LEVEL plev = p_ptr->lev;
22
23         switch (spell)
24         {
25         case 0:
26                 if (name) return _("電撃", "Zap");
27                 if (desc) return _("電撃のボルトもしくはビームを放つ。", "Fires a bolt or beam of lightning.");
28
29                 {
30                         DICE_NUMBER dice = 3 + (plev - 1) / 5;
31                         DICE_SID sides = 3;
32
33                         if (info) return info_damage(dice, sides, 0);
34
35                         if (cast)
36                         {
37                                 if (!get_aim_dir(&dir)) return NULL;
38
39                                 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir, damroll(dice, sides));
40                         }
41                 }
42                 break;
43
44         case 1:
45                 if (name) return _("魔法の施錠", "Wizard Lock");
46                 if (desc) return _("扉に鍵をかける。", "Locks a door.");
47
48                 {
49                         if (cast)
50                         {
51                                 if (!get_aim_dir(&dir)) return NULL;
52
53                                 wizard_lock(dir);
54                         }
55                 }
56                 break;
57
58         case 2:
59                 if (name) return _("透明体感知", "Detect Invisibility");
60                 if (desc) return _("近くの透明なモンスターを感知する。", "Detects all invisible monsters in your vicinity.");
61
62                 {
63                         POSITION rad = DETECT_RAD_DEFAULT;
64
65                         if (info) return info_radius(rad);
66
67                         if (cast)
68                         {
69                                 detect_monsters_invis(rad);
70                         }
71                 }
72                 break;
73
74         case 3:
75                 if (name) return _("モンスター感知", "Detect Monsters");
76                 if (desc) return _("近くの全ての見えるモンスターを感知する。", "Detects all monsters in your vicinity unless invisible.");
77
78                 {
79                         POSITION rad = DETECT_RAD_DEFAULT;
80
81                         if (info) return info_radius(rad);
82
83                         if (cast)
84                         {
85                                 detect_monsters_normal(rad);
86                         }
87                 }
88                 break;
89
90         case 4:
91                 if (name) return _("ショート・テレポート", "Blink");
92                 if (desc) return _("近距離のテレポートをする。", "Teleport short distance.");
93
94                 {
95                         POSITION range = 10;
96
97                         if (info) return info_range(range);
98
99                         if (cast)
100                         {
101                                 teleport_player(range, 0L);
102                         }
103                 }
104                 break;
105
106         case 5:
107                 if (name) return _("ライト・エリア", "Light Area");
108                 if (desc) return _("光源が照らしている範囲か部屋全体を永久に明るくする。", "Lights up nearby area and the inside of a room permanently.");
109
110                 {
111                         DICE_NUMBER dice = 2;
112                         DICE_SID sides = plev / 2;
113                         POSITION rad = plev / 10 + 1;
114
115                         if (info) return info_damage(dice, sides, 0);
116
117                         if (cast)
118                         {
119                                 lite_area(damroll(dice, sides), rad);
120                         }
121                 }
122                 break;
123
124         case 6:
125                 if (name) return _("罠と扉 破壊", "Trap & Door Destruction");
126                 if (desc) return _("一直線上の全ての罠と扉を破壊する。", "Fires a beam which destroy traps and doors.");
127
128                 {
129                         if (cast)
130                         {
131                                 if (!get_aim_dir(&dir)) return NULL;
132
133                                 destroy_door(dir);
134                         }
135                 }
136                 break;
137
138         case 7:
139                 if (name) return _("軽傷の治癒", "Cure Light Wounds");
140                 if (desc) return _("怪我と体力を少し回復させる。", "Heals cut and HP a little.");
141
142                 {
143                         DICE_NUMBER dice = 2;
144                         DICE_SID sides = 8;
145
146                         if (info) return info_heal(dice, sides, 0);
147                         if (cast) (void)cure_light_wounds(dice, sides);
148                 }
149                 break;
150
151         case 8:
152                 if (name) return _("罠と扉 感知", "Detect Doors & Traps");
153                 if (desc) return _("近くの全ての罠と扉と階段を感知する。", "Detects traps, doors, and stairs in your vicinity.");
154
155                 {
156                         POSITION rad = DETECT_RAD_DEFAULT;
157
158                         if (info) return info_radius(rad);
159
160                         if (cast)
161                         {
162                                 detect_traps(rad, TRUE);
163                                 detect_doors(rad);
164                                 detect_stairs(rad);
165                         }
166                 }
167                 break;
168
169         case 9:
170                 if (name) return _("燃素", "Phlogiston");
171                 if (desc) return _("光源に燃料を補給する。", "Adds more turns of light to a lantern or torch.");
172
173                 {
174                         if (cast)
175                         {
176                                 phlogiston();
177                         }
178                 }
179                 break;
180
181         case 10:
182                 if (name) return _("財宝感知", "Detect Treasure");
183                 if (desc) return _("近くの財宝を感知する。", "Detects all treasures in your vicinity.");
184
185                 {
186                         POSITION rad = DETECT_RAD_DEFAULT;
187
188                         if (info) return info_radius(rad);
189
190                         if (cast)
191                         {
192                                 detect_treasure(rad);
193                                 detect_objects_gold(rad);
194                         }
195                 }
196                 break;
197
198         case 11:
199                 if (name) return _("魔法 感知", "Detect Enchantment");
200                 if (desc) return _("近くの魔法がかかったアイテムを感知する。", "Detects all magical items in your vicinity.");
201
202                 {
203                         POSITION rad = DETECT_RAD_DEFAULT;
204
205                         if (info) return info_radius(rad);
206
207                         if (cast)
208                         {
209                                 detect_objects_magic(rad);
210                         }
211                 }
212                 break;
213
214         case 12:
215                 if (name) return _("アイテム感知", "Detect Objects");
216                 if (desc) return _("近くの全てのアイテムを感知する。", "Detects all items in your vicinity.");
217
218                 {
219                         POSITION rad = DETECT_RAD_DEFAULT;
220
221                         if (info) return info_radius(rad);
222
223                         if (cast)
224                         {
225                                 detect_objects_normal(rad);
226                         }
227                 }
228                 break;
229
230         case 13:
231                 if (name) return _("解毒", "Cure Poison");
232                 if (desc) return _("毒を体内から完全に取り除く。", "Cures poison status.");
233
234                 {
235                         if (cast)
236                         {
237                                 set_poisoned(0);
238                         }
239                 }
240                 break;
241
242         case 14:
243                 if (name) return _("耐冷", "Resist Cold");
244                 if (desc) return _("一定時間、冷気への耐性を得る。装備による耐性に累積する。", "Gives resistance to cold. This resistance can be added to which from equipment for more powerful resistance.");
245
246                 {
247                         int base = 20;
248
249                         if (info) return info_duration(base, base);
250
251                         if (cast)
252                         {
253                                 set_oppose_cold(randint1(base) + base, FALSE);
254                         }
255                 }
256                 break;
257
258         case 15:
259                 if (name) return _("耐火", "Resist Fire");
260                 if (desc) return _("一定時間、炎への耐性を得る。装備による耐性に累積する。",
261                         "Gives resistance to fire. This resistance can be added to which from equipment for more powerful resistance.");
262
263                 {
264                         int base = 20;
265
266                         if (info) return info_duration(base, base);
267
268                         if (cast)
269                         {
270                                 set_oppose_fire(randint1(base) + base, FALSE);
271                         }
272                 }
273                 break;
274
275         case 16:
276                 if (name) return _("耐電", "Resist Lightning");
277                 if (desc) return _("一定時間、電撃への耐性を得る。装備による耐性に累積する。",
278                         "Gives resistance to electricity. This resistance can be added to which from equipment for more powerful resistance.");
279
280                 {
281                         int base = 20;
282
283                         if (info) return info_duration(base, base);
284
285                         if (cast)
286                         {
287                                 set_oppose_elec(randint1(base) + base, FALSE);
288                         }
289                 }
290                 break;
291
292         case 17:
293                 if (name) return _("耐酸", "Resist Acid");
294                 if (desc) return _("一定時間、酸への耐性を得る。装備による耐性に累積する。",
295                         "Gives resistance to acid. This resistance can be added to which from equipment for more powerful resistance.");
296
297                 {
298                         int base = 20;
299
300                         if (info) return info_duration(base, base);
301
302                         if (cast)
303                         {
304                                 set_oppose_acid(randint1(base) + base, FALSE);
305                         }
306                 }
307                 break;
308
309         case 18:
310                 if (name) return _("重傷の治癒", "Cure Medium Wounds");
311                 if (desc) return _("怪我と体力を中程度回復させる。", "Heals cut and HP more.");
312
313                 {
314                         DICE_NUMBER dice = 4;
315                         DICE_SID sides = 8;
316
317                         if (info) return info_heal(dice, sides, 0);
318                         if (cast) (void)cure_serious_wounds(4, 8);
319                 }
320                 break;
321
322         case 19:
323                 if (name) return _("テレポート", "Teleport");
324                 if (desc) return _("遠距離のテレポートをする。", "Teleport long distance.");
325
326                 {
327                         POSITION range = plev * 5;
328
329                         if (info) return info_range(range);
330
331                         if (cast)
332                         {
333                                 teleport_player(range, 0L);
334                         }
335                 }
336                 break;
337
338         case 20:
339                 if (name) return _("鑑定", "Identify");
340                 if (desc) return _("アイテムを識別する。", "Identifies an item.");
341
342                 {
343                         if (cast)
344                         {
345                                 if (!ident_spell(FALSE)) return NULL;
346                         }
347                 }
348                 break;
349
350         case 21:
351                 if (name) return _("岩石溶解", "Stone to Mud");
352                 if (desc) return _("壁を溶かして床にする。", "Turns one rock square to mud.");
353
354                 {
355                         DICE_NUMBER dice = 1;
356                         DICE_SID sides = 30;
357                         int base = 20;
358
359                         if (info) return info_damage(dice, sides, base);
360
361                         if (cast)
362                         {
363                                 if (!get_aim_dir(&dir)) return NULL;
364
365                                 wall_to_mud(dir, 20 + randint1(30));
366                         }
367                 }
368                 break;
369
370         case 22:
371                 if (name) return _("閃光", "Ray of Light");
372                 if (desc) return _("光線を放つ。光りを嫌うモンスターに効果がある。", "Fires a beam of light which damages to light-sensitive monsters.");
373
374                 {
375                         DICE_NUMBER dice = 6;
376                         DICE_SID sides = 8;
377
378                         if (info) return info_damage(dice, sides, 0);
379
380                         if (cast)
381                         {
382                                 if (!get_aim_dir(&dir)) return NULL;
383
384                                 msg_print(_("光線が放たれた。", "A line of light appears."));
385                                 lite_line(dir, damroll(6, 8));
386                         }
387                 }
388                 break;
389
390         case 23:
391                 if (name) return _("空腹充足", "Satisfy Hunger");
392                 if (desc) return _("満腹にする。", "Satisfies hunger.");
393
394                 {
395                         if (cast)
396                         {
397                                 set_food(PY_FOOD_MAX - 1);
398                         }
399                 }
400                 break;
401
402         case 24:
403                 if (name) return _("透明視認", "See Invisible");
404                 if (desc) return _("一定時間、透明なものが見えるようになる。", "Gives see invisible for a while.");
405
406                 {
407                         int base = 24;
408
409                         if (info) return info_duration(base, base);
410
411                         if (cast)
412                         {
413                                 set_tim_invis(randint1(base) + base, FALSE);
414                         }
415                 }
416                 break;
417
418         case 25:
419                 if (name) return _("エレメンタル召喚", "Conjure Elemental");
420                 if (desc) return _("1体のエレメンタルを召喚する。", "Summons an elemental.");
421
422                 {
423                         if (cast)
424                         {
425                                 if (!summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_ELEMENTAL, (PM_ALLOW_GROUP | PM_FORCE_PET), '\0'))
426                                 {
427                                         msg_print(_("エレメンタルは現れなかった。", "No Elementals arrive."));
428                                 }
429                         }
430                 }
431                 break;
432
433         case 26:
434                 if (name) return _("テレポート・レベル", "Teleport Level");
435                 if (desc) return _("瞬時に上か下の階にテレポートする。", "Teleport to up or down stairs in a moment.");
436
437                 {
438                         if (cast)
439                         {
440                                 if (!get_check(_("本当に他の階にテレポートしますか?", "Are you sure? (Teleport Level)"))) return NULL;
441                                 teleport_level(0);
442                         }
443                 }
444                 break;
445
446         case 27:
447                 if (name) return _("テレポート・モンスター", "Teleport Away");
448                 if (desc) return _("モンスターをテレポートさせるビームを放つ。抵抗されると無効。", "Teleports all monsters on the line away unless resisted.");
449
450                 {
451                         int power = plev;
452
453                         if (info) return info_power(power);
454
455                         if (cast)
456                         {
457                                 if (!get_aim_dir(&dir)) return NULL;
458
459                                 fire_beam(GF_AWAY_ALL, dir, power);
460                         }
461                 }
462                 break;
463
464         case 28:
465                 if (name) return _("元素の球", "Elemental Ball");
466                 if (desc) return _("炎、電撃、冷気、酸のどれかの球を放つ。", "Fires a ball of some elements.");
467
468                 {
469                         HIT_POINT dam = 75 + plev;
470                         POSITION rad = 2;
471
472                         if (info) return info_damage(0, 0, dam);
473
474                         if (cast)
475                         {
476                                 int type;
477
478                                 if (!get_aim_dir(&dir)) return NULL;
479
480                                 switch (randint1(4))
481                                 {
482                                 case 1:  type = GF_FIRE; break;
483                                 case 2:  type = GF_ELEC; break;
484                                 case 3:  type = GF_COLD; break;
485                                 default: type = GF_ACID; break;
486                                 }
487
488                                 fire_ball(type, dir, dam, rad);
489                         }
490                 }
491                 break;
492
493         case 29:
494                 if (name) return _("全感知", "Detection");
495                 if (desc) return _("近くの全てのモンスター、罠、扉、階段、財宝、そしてアイテムを感知する。",
496                         "Detects all monsters, traps, doors, stairs, treasures and items in your vicinity.");
497
498                 {
499                         POSITION rad = DETECT_RAD_DEFAULT;
500
501                         if (info) return info_radius(rad);
502
503                         if (cast)
504                         {
505                                 detect_all(rad);
506                         }
507                 }
508                 break;
509
510         case 30:
511                 if (name) return _("帰還の呪文", "Word of Recall");
512                 if (desc) return _("地上にいるときはダンジョンの最深階へ、ダンジョンにいるときは地上へと移動する。",
513                         "Recalls player from dungeon to town, or from town to the deepest level of dungeon.");
514
515                 {
516                         int base = 15;
517                         DICE_SID sides = 20;
518
519                         if (info) return info_delay(base, sides);
520
521                         if (cast)
522                         {
523                                 if (!recall_player(p_ptr, randint0(21) + 15)) return NULL;
524                         }
525                 }
526                 break;
527
528         case 31:
529                 if (name) return _("千里眼", "Clairvoyance");
530                 if (desc) return _("その階全体を永久に照らし、ダンジョン内すべてのアイテムを感知する。さらに、一定時間テレパシー能力を得る。",
531                         "Maps and lights whole dungeon level. Knows all objects location. And gives telepathy for a while.");
532
533                 {
534                         int base = 25;
535                         DICE_SID sides = 30;
536
537                         if (info) return info_duration(base, sides);
538
539                         if (cast)
540                         {
541                                 chg_virtue(V_KNOWLEDGE, 1);
542                                 chg_virtue(V_ENLIGHTEN, 1);
543
544                                 wiz_lite(FALSE);
545
546                                 if (!p_ptr->telepathy)
547                                 {
548                                         set_tim_esp(randint1(sides) + base, FALSE);
549                                 }
550                         }
551                 }
552                 break;
553         }
554
555         return "";
556 }