OSDN Git Service

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