OSDN Git Service

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