OSDN Git Service

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