OSDN Git Service

[Refactor] #37353 wand_effect()のインデント修正。 / Fix indent of wand_effect().
[hengband/hengband.git] / src / realm-trump.c
1 #include "angband.h"
2 #include "cmd-spell.h"
3
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_trump_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         bool fail = (mode == SPELL_FAIL) ? TRUE : FALSE;
18
19         DIRECTION dir;
20         PLAYER_LEVEL plev = p_ptr->lev;
21
22         switch (spell)
23         {
24         case 0:
25                 if (name) return _("ショート・テレポート", "Phase Door");
26                 if (desc) return _("近距離のテレポートをする。", "Teleport short distance.");
27
28                 {
29                         POSITION range = 10;
30
31                         if (info) return info_range(range);
32
33                         if (cast)
34                         {
35                                 teleport_player(range, 0L);
36                         }
37                 }
38                 break;
39
40         case 1:
41                 if (name) return _("蜘蛛のカード", "Trump Spiders");
42                 if (desc) return _("蜘蛛を召喚する。", "Summons spiders.");
43
44                 {
45                         if (cast || fail)
46                         {
47                                 msg_print(_("あなたは蜘蛛のカードに集中する...", "You concentrate on the trump of an spider..."));
48                                 if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, SUMMON_SPIDER, PM_ALLOW_GROUP))
49                                 {
50                                         if (fail)
51                                         {
52                                                 msg_print(_("召喚された蜘蛛は怒っている!", "The summoned spiders get angry!"));
53                                         }
54                                 }
55                         }
56                 }
57                 break;
58
59         case 2:
60                 if (name) return _("シャッフル", "Shuffle");
61                 if (desc) return _("カードの占いをする。", "Causes random effects.");
62
63                 {
64                         if (info) return s_random;
65
66                         if (cast)
67                         {
68                                 cast_shuffle();
69                         }
70                 }
71                 break;
72
73         case 3:
74                 if (name) return _("フロア・リセット", "Reset Recall");
75                 if (desc) return _("最深階を変更する。", "Resets the 'deepest' level for recall spell.");
76
77                 {
78                         if (cast)
79                         {
80                                 if (!reset_recall()) return NULL;
81                         }
82                 }
83                 break;
84
85         case 4:
86                 if (name) return _("テレポート", "Teleport");
87                 if (desc) return _("遠距離のテレポートをする。", "Teleport long distance.");
88
89                 {
90                         POSITION range = plev * 4;
91
92                         if (info) return info_range(range);
93
94                         if (cast)
95                         {
96                                 teleport_player(range, 0L);
97                         }
98                 }
99                 break;
100
101         case 5:
102                 if (name) return _("感知のカード", "Trump Spying");
103                 if (desc) return _("一定時間、テレパシー能力を得る。", "Gives telepathy for a while.");
104
105                 {
106                         int base = 25;
107                         DICE_SID sides = 30;
108
109                         if (info) return info_duration(base, sides);
110
111                         if (cast)
112                         {
113                                 set_tim_esp(randint1(sides) + base, FALSE);
114                         }
115                 }
116                 break;
117
118         case 6:
119                 if (name) return _("テレポート・モンスター", "Teleport Away");
120                 if (desc) return _("モンスターをテレポートさせるビームを放つ。抵抗されると無効。", "Teleports all monsters on the line away unless resisted.");
121
122                 {
123                         int power = plev;
124
125                         if (info) return info_power(power);
126
127                         if (cast)
128                         {
129                                 if (!get_aim_dir(&dir)) return NULL;
130
131                                 fire_beam(GF_AWAY_ALL, dir, power);
132                         }
133                 }
134                 break;
135
136         case 7:
137                 if (name) return _("動物のカード", "Trump Animals");
138                 if (desc) return _("1体の動物を召喚する。", "Summons an animal.");
139
140                 {
141                         if (cast || fail)
142                         {
143                                 int type = (!fail ? SUMMON_ANIMAL_RANGER : SUMMON_ANIMAL);
144                                 msg_print(_("あなたは動物のカードに集中する...", "You concentrate on the trump of an animal..."));
145                                 if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, type, 0L))
146                                 {
147                                         if (fail)
148                                         {
149                                                 msg_print(_("召喚された動物は怒っている!", "The summoned animal gets angry!"));
150                                         }
151                                 }
152                         }
153                 }
154                 break;
155
156         case 8:
157                 if (name) return _("移動のカード", "Trump Reach");
158                 if (desc) return _("アイテムを自分の足元へ移動させる。", "Pulls a distant item close to you.");
159
160                 {
161                         WEIGHT weight = plev * 15;
162
163                         if (info) return info_weight(weight);
164
165                         if (cast)
166                         {
167                                 if (!get_aim_dir(&dir)) return NULL;
168
169                                 fetch(dir, weight, FALSE);
170                         }
171                 }
172                 break;
173
174         case 9:
175                 if (name) return _("カミカゼのカード", "Trump Kamikaze");
176                 if (desc) return _("複数の爆発するモンスターを召喚する。", "Summons monsters which explode by itself.");
177
178                 {
179                         if (cast || fail)
180                         {
181                                 POSITION x, y;
182                                 int type;
183
184                                 if (cast)
185                                 {
186                                         if (!target_set(TARGET_KILL)) return NULL;
187                                         x = target_col;
188                                         y = target_row;
189                                 }
190                                 else
191                                 {
192                                         /* Summons near player when failed */
193                                         x = p_ptr->x;
194                                         y = p_ptr->y;
195                                 }
196
197                                 if (p_ptr->pclass == CLASS_BEASTMASTER)
198                                         type = SUMMON_KAMIKAZE_LIVING;
199                                 else
200                                         type = SUMMON_KAMIKAZE;
201
202                                 msg_print(_("あなたはカミカゼのカードに集中する...", "You concentrate on several trumps at once..."));
203                                 if (trump_summoning(2 + randint0(plev / 7), !fail, y, x, 0, type, 0L))
204                                 {
205                                         if (fail)
206                                         {
207                                                 msg_print(_("召喚されたモンスターは怒っている!", "The summoned creatures get angry!"));
208                                         }
209                                 }
210                         }
211                 }
212                 break;
213
214         case 10:
215                 if (name) return _("幻霊召喚", "Phantasmal Servant");
216                 if (desc) return _("1体の幽霊を召喚する。", "Summons a ghost.");
217
218                 {
219                         /* Phantasmal Servant is not summoned as enemy when failed */
220                         if (cast)
221                         {
222                                 int summon_lev = plev * 2 / 3 + randint1(plev / 2);
223
224                                 if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, (summon_lev * 3 / 2), SUMMON_PHANTOM, 0L))
225                                 {
226                                         msg_print(_("御用でございますか、御主人様?", "'Your wish, master?'"));
227                                 }
228                         }
229                 }
230                 break;
231
232         case 11:
233                 if (name) return _("スピード・モンスター", "Haste Monster");
234                 if (desc) return _("モンスター1体を加速させる。", "Hastes a monster.");
235
236                 {
237                         if (cast)
238                         {
239                                 bool result;
240
241                                 /* Temporary enable target_pet option */
242                                 bool old_target_pet = target_pet;
243                                 target_pet = TRUE;
244
245                                 result = get_aim_dir(&dir);
246
247                                 /* Restore target_pet option */
248                                 target_pet = old_target_pet;
249
250                                 if (!result) return NULL;
251
252                                 speed_monster(dir, plev);
253                         }
254                 }
255                 break;
256
257         case 12:
258                 if (name) return _("テレポート・レベル", "Teleport Level");
259                 if (desc) return _("瞬時に上か下の階にテレポートする。", "Teleport to up or down stairs in a moment.");
260
261                 {
262                         if (cast)
263                         {
264                                 if (!get_check(_("本当に他の階にテレポートしますか?", "Are you sure? (Teleport Level)"))) return NULL;
265                                 teleport_level(0);
266                         }
267                 }
268                 break;
269
270         case 13:
271                 if (name) return _("次元の扉", "Dimension Door");
272                 if (desc) return _("短距離内の指定した場所にテレポートする。", "Teleport to given location.");
273
274                 {
275                         POSITION range = plev / 2 + 10;
276
277                         if (info) return info_range(range);
278
279                         if (cast)
280                         {
281                                 msg_print(_("次元の扉が開いた。目的地を選んで下さい。", "You open a dimensional gate. Choose a destination."));
282                                 if (!dimension_door()) return NULL;
283                         }
284                 }
285                 break;
286
287         case 14:
288                 if (name) return _("帰還の呪文", "Word of Recall");
289                 if (desc) return _("地上にいるときはダンジョンの最深階へ、ダンジョンにいるときは地上へと移動する。",
290                         "Recalls player from dungeon to town, or from town to the deepest level of dungeon.");
291
292                 {
293                         int base = 15;
294                         DICE_SID sides = 20;
295
296                         if (info) return info_delay(base, sides);
297
298                         if (cast)
299                         {
300                                 if (!recall_player(p_ptr, randint0(21) + 15)) return NULL;
301                         }
302                 }
303                 break;
304
305         case 15:
306                 if (name) return _("怪物追放", "Banish");
307                 if (desc) return _("視界内の全てのモンスターをテレポートさせる。抵抗されると無効。", "Teleports all monsters in sight away unless resisted.");
308
309                 {
310                         int power = plev * 4;
311
312                         if (info) return info_power(power);
313
314                         if (cast)
315                         {
316                                 banish_monsters(power);
317                         }
318                 }
319                 break;
320
321         case 16:
322                 if (name) return _("位置交換のカード", "Swap Position");
323                 if (desc) return _("1体のモンスターと位置を交換する。", "Swap positions of you and a monster.");
324
325                 {
326                         if (cast)
327                         {
328                                 bool result;
329
330                                 /* HACK -- No range limit */
331                                 project_length = -1;
332
333                                 result = get_aim_dir(&dir);
334
335                                 /* Restore range to default */
336                                 project_length = 0;
337
338                                 if (!result) return NULL;
339
340                                 teleport_swap(dir);
341                         }
342                 }
343                 break;
344
345         case 17:
346                 if (name) return _("アンデッドのカード", "Trump Undead");
347                 if (desc) return _("1体のアンデッドを召喚する。", "Summons an undead monster.");
348
349                 {
350                         if (cast || fail)
351                         {
352                                 msg_print(_("あなたはアンデッドのカードに集中する...", "You concentrate on the trump of an undead creature..."));
353                                 if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, SUMMON_UNDEAD, 0L))
354                                 {
355                                         if (fail)
356                                         {
357                                                 msg_print(_("召喚されたアンデッドは怒っている!", "The summoned undead creature gets angry!"));
358                                         }
359                                 }
360                         }
361                 }
362                 break;
363
364         case 18:
365                 if (name) return _("爬虫類のカード", "Trump Reptiles");
366                 if (desc) return _("1体のヒドラを召喚する。", "Summons a hydra.");
367
368                 {
369                         if (cast || fail)
370                         {
371                                 msg_print(_("あなたは爬虫類のカードに集中する...", "You concentrate on the trump of a reptile..."));
372                                 if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, SUMMON_HYDRA, 0L))
373                                 {
374                                         if (fail)
375                                         {
376                                                 msg_print(_("召喚された爬虫類は怒っている!", "The summoned reptile gets angry!"));
377                                         }
378                                 }
379                         }
380                 }
381                 break;
382
383         case 19:
384                 if (name) return _("モンスターのカード", "Trump Monsters");
385                 if (desc) return _("複数のモンスターを召喚する。", "Summons some monsters.");
386
387                 {
388                         if (cast || fail)
389                         {
390                                 int type;
391                                 msg_print(_("あなたはモンスターのカードに集中する...", "You concentrate on several trumps at once..."));
392                                 if (p_ptr->pclass == CLASS_BEASTMASTER)
393                                         type = SUMMON_LIVING;
394                                 else
395                                         type = 0;
396
397                                 if (trump_summoning((1 + (plev - 15) / 10), !fail, p_ptr->y, p_ptr->x, 0, type, 0L))
398                                 {
399                                         if (fail)
400                                         {
401                                                 msg_print(_("召喚されたモンスターは怒っている!", "The summoned creatures get angry!"));
402                                         }
403                                 }
404
405                         }
406                 }
407                 break;
408
409         case 20:
410                 if (name) return _("ハウンドのカード", "Trump Hounds");
411                 if (desc) return _("1グループのハウンドを召喚する。", "Summons a group of hounds.");
412
413                 {
414                         if (cast || fail)
415                         {
416                                 msg_print(_("あなたはハウンドのカードに集中する...", "You concentrate on the trump of a hound..."));
417                                 if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, SUMMON_HOUND, PM_ALLOW_GROUP))
418                                 {
419                                         if (fail)
420                                         {
421                                                 msg_print(_("召喚されたハウンドは怒っている!", "The summoned hounds get angry!"));
422                                         }
423                                 }
424                         }
425                 }
426                 break;
427
428         case 21:
429                 if (name) return _("トランプの刃", "Trump Branding");
430                 if (desc) return _("武器にトランプの属性をつける。", "Makes current weapon a Trump weapon.");
431
432                 {
433                         if (cast)
434                         {
435                                 brand_weapon(5);
436                         }
437                 }
438                 break;
439
440         case 22:
441                 if (name) return _("人間トランプ", "Living Trump");
442                 if (desc) return _("ランダムにテレポートする突然変異か、自分の意思でテレポートする突然変異が身につく。",
443                         "Gives mutation which makes you teleport randomly or makes you able to teleport at will.");
444
445                 {
446                         if (cast)
447                         {
448                                 int mutation;
449
450                                 if (one_in_(7))
451                                         /* Teleport control */
452                                         mutation = 12;
453                                 else
454                                         /* Random teleportation (uncontrolled) */
455                                         mutation = 77;
456
457                                 /* Gain the mutation */
458                                 if (gain_random_mutation(mutation))
459                                 {
460                                         msg_print(_("あなたは生きているカードに変わった。", "You have turned into a Living Trump."));
461                                 }
462                         }
463                 }
464                 break;
465
466         case 23:
467                 if (name) return _("サイバーデーモンのカード", "Trump Cyberdemon");
468                 if (desc) return _("1体のサイバーデーモンを召喚する。", "Summons a cyber demon.");
469
470                 {
471                         if (cast || fail)
472                         {
473                                 msg_print(_("あなたはサイバーデーモンのカードに集中する...", "You concentrate on the trump of a Cyberdemon..."));
474                                 if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, SUMMON_CYBER, 0L))
475                                 {
476                                         if (fail)
477                                         {
478                                                 msg_print(_("召喚されたサイバーデーモンは怒っている!", "The summoned Cyberdemon gets angry!"));
479                                         }
480                                 }
481                         }
482                 }
483                 break;
484
485         case 24:
486                 if (name) return _("予見のカード", "Trump Divination");
487                 if (desc) return _("近くの全てのモンスター、罠、扉、階段、財宝、そしてアイテムを感知する。",
488                         "Detects all monsters, traps, doors, stairs, treasures and items in your vicinity.");
489
490                 {
491                         POSITION rad = DETECT_RAD_DEFAULT;
492
493                         if (info) return info_radius(rad);
494
495                         if (cast)
496                         {
497                                 detect_all(rad);
498                         }
499                 }
500                 break;
501
502         case 25:
503                 if (name) return _("知識のカード", "Trump Lore");
504                 if (desc) return _("アイテムの持つ能力を完全に知る。", "*Identifies* an item.");
505
506                 {
507                         if (cast)
508                         {
509                                 if (!identify_fully(FALSE)) return NULL;
510                         }
511                 }
512                 break;
513
514         case 26:
515                 if (name) return _("回復モンスター", "Heal Monster");
516                 if (desc) return _("モンスター1体の体力を回復させる。", "Heal a monster.");
517
518                 {
519                         int heal = plev * 10 + 200;
520
521                         if (info) return info_heal(0, 0, heal);
522
523                         if (cast)
524                         {
525                                 bool result;
526
527                                 /* Temporary enable target_pet option */
528                                 bool old_target_pet = target_pet;
529                                 target_pet = TRUE;
530
531                                 result = get_aim_dir(&dir);
532
533                                 /* Restore target_pet option */
534                                 target_pet = old_target_pet;
535
536                                 if (!result) return NULL;
537
538                                 heal_monster(dir, heal);
539                         }
540                 }
541                 break;
542
543         case 27:
544                 if (name) return _("ドラゴンのカード", "Trump Dragon");
545                 if (desc) return _("1体のドラゴンを召喚する。", "Summons a dragon.");
546
547                 {
548                         if (cast || fail)
549                         {
550                                 msg_print(_("あなたはドラゴンのカードに集中する...", "You concentrate on the trump of a dragon..."));
551                                 if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, SUMMON_DRAGON, 0L))
552                                 {
553                                         if (fail)
554                                         {
555                                                 msg_print(_("召喚されたドラゴンは怒っている!", "The summoned dragon gets angry!"));
556                                         }
557                                 }
558                         }
559                 }
560                 break;
561
562         case 28:
563                 if (name) return _("隕石のカード", "Trump Meteor");
564                 if (desc) return _("自分の周辺に隕石を落とす。", "Makes meteor balls fall down to nearby random locations.");
565
566                 {
567                         HIT_POINT dam = plev * 2;
568                         POSITION rad = 2;
569
570                         if (info) return info_multi_damage(dam);
571
572                         if (cast)
573                         {
574                                 cast_meteor(dam, rad);
575                         }
576                 }
577                 break;
578
579         case 29:
580                 if (name) return _("デーモンのカード", "Trump Demon");
581                 if (desc) return _("1体の悪魔を召喚する。", "Summons a demon.");
582
583                 {
584                         if (cast || fail)
585                         {
586                                 msg_print(_("あなたはデーモンのカードに集中する...", "You concentrate on the trump of a demon..."));
587                                 if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, SUMMON_DEMON, 0L))
588                                 {
589                                         if (fail)
590                                         {
591                                                 msg_print(_("召喚されたデーモンは怒っている!", "The summoned demon gets angry!"));
592                                         }
593                                 }
594                         }
595                 }
596                 break;
597
598         case 30:
599                 if (name) return _("地獄のカード", "Trump Greater Undead");
600                 if (desc) return _("1体の上級アンデッドを召喚する。", "Summons a greater undead.");
601
602                 {
603                         if (cast || fail)
604                         {
605                                 msg_print(_("あなたは強力なアンデッドのカードに集中する...", "You concentrate on the trump of a greater undead being..."));
606                                 /* May allow unique depend on level and dice roll */
607                                 if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, SUMMON_HI_UNDEAD, PM_ALLOW_UNIQUE))
608                                 {
609                                         if (fail)
610                                         {
611                                                 msg_print(_("召喚された上級アンデッドは怒っている!", "The summoned greater undead creature gets angry!"));
612                                         }
613                                 }
614                         }
615                 }
616                 break;
617
618         case 31:
619                 if (name) return _("古代ドラゴンのカード", "Trump Ancient Dragon");
620                 if (desc) return _("1体の古代ドラゴンを召喚する。", "Summons an ancient dragon.");
621
622                 {
623                         if (cast)
624                         {
625                                 int type;
626
627                                 if (p_ptr->pclass == CLASS_BEASTMASTER)
628                                         type = SUMMON_HI_DRAGON_LIVING;
629                                 else
630                                         type = SUMMON_HI_DRAGON;
631
632                                 msg_print(_("あなたは古代ドラゴンのカードに集中する...", "You concentrate on the trump of an ancient dragon..."));
633                                 /* May allow unique depend on level and dice roll */
634                                 if (trump_summoning(1, !fail, p_ptr->y, p_ptr->x, 0, type, PM_ALLOW_UNIQUE))
635                                 {
636                                         if (fail)
637                                         {
638                                                 msg_print(_("召喚された古代ドラゴンは怒っている!", "The summoned ancient dragon gets angry!"));
639                                         }
640                                 }
641                         }
642                 }
643                 break;
644         }
645
646         return "";
647 }