OSDN Git Service

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