OSDN Git Service

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