OSDN Git Service

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