OSDN Git Service

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