OSDN Git Service

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