OSDN Git Service

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