OSDN Git Service

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