OSDN Git Service

[Refactor] #39068 summon_kin_type によるグローバル変数渡しを修正.
[hengband/hengband.git] / src / realm-crusade.c
1 #include "angband.h"
2 #include "util.h"
3
4 #include "cmd-spell.h"
5 #include "floor.h"
6 #include "spells.h"
7 #include "spells-summon.h"
8 #include "spells-status.h"
9 #include "player-effects.h"
10
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_crusade_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
26         DIRECTION dir;
27         PLAYER_LEVEL plev = p_ptr->lev;
28
29         switch (spell)
30         {
31         case 0:
32                 if (name) return _("懲罰", "Punishment");
33                 if (desc) return _("電撃のボルトもしくはビームを放つ。", "Fires a bolt or beam of lightning.");
34                 {
35                         DICE_NUMBER dice = 3 + (plev - 1) / 5;
36                         DICE_SID sides = 4;
37                         if (info) return info_damage(dice, sides, 0);
38                         if (cast)
39                         {
40                                 if (!get_aim_dir(&dir)) return NULL;
41                                 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir, damroll(dice, sides));
42                         }
43                 }
44                 break;
45
46         case 1:
47                 if (name) return _("邪悪存在感知", "Detect Evil");
48                 if (desc) return _("近くの邪悪なモンスターを感知する。", "Detects all evil monsters in your vicinity.");
49                 {
50                         POSITION rad = DETECT_RAD_DEFAULT;
51                         if (info) return info_radius(rad);
52                         if (cast)
53                         {
54                                 detect_monsters_evil(rad);
55                         }
56                 }
57                 break;
58
59         case 2:
60                 if (name) return _("恐怖除去", "Remove Fear");
61                 if (desc) return _("恐怖を取り除く。", "Removes fear.");
62                 {
63                         if (cast) set_afraid(0);
64                 }
65                 break;
66
67         case 3:
68                 if (name) return _("威圧", "Scare Monster");
69                 if (desc) return _("モンスター1体を恐怖させる。抵抗されると無効。", "Attempts to scare a monster.");
70
71                 {
72                         PLAYER_LEVEL power = plev;
73                         if (info) return info_power(power);
74                         if (cast)
75                         {
76                                 if (!get_aim_dir(&dir)) return NULL;
77                                 fear_monster(dir, power);
78                         }
79                 }
80                 break;
81
82         case 4:
83                 if (name) return _("聖域", "Sanctuary");
84                 if (desc) return _("隣接した全てのモンスターを眠らせる。抵抗されると無効。", "Attempts to sleep monsters in the adjacent squares.");
85                 {
86                         PLAYER_LEVEL power = plev;
87                         if (info) return info_power(power);
88                         if (cast) sleep_monsters_touch();
89                 }
90                 break;
91
92         case 5:
93                 if (name) return _("入口", "Portal");
94                 if (desc) return _("中距離のテレポートをする。", "Teleport medium distance.");
95
96                 {
97                         POSITION range = 25 + plev / 2;
98                         if (info) return info_range(range);
99                         if (cast) teleport_player(range, 0L);
100                 }
101                 break;
102
103         case 6:
104                 if (name) return _("スターダスト", "Star Dust");
105                 if (desc) return _("ターゲット付近に閃光のボルトを連射する。", "Fires many bolts of light near the target.");
106
107                 {
108                         DICE_NUMBER dice = 3 + (plev - 1) / 9;
109                         DICE_SID sides = 2;
110                         if (info) return info_multi_damage_dice(dice, sides);
111                         if (cast)
112                         {
113                                 if (!get_aim_dir(&dir)) return NULL;
114                                 fire_blast(GF_LITE, dir, dice, sides, 10, 3);
115                         }
116                 }
117                 break;
118
119         case 7:
120                 if (name) return _("身体浄化", "Purify");
121                 if (desc) return _("傷、毒、朦朧から全快する。", "Heals all cut, stun and poison status.");
122                 {
123                         if (cast)
124                         {
125                                 set_cut(0);
126                                 set_poisoned(0);
127                                 set_stun(0);
128                         }
129                 }
130                 break;
131
132         case 8:
133                 if (name) return _("邪悪飛ばし", "Scatter Evil");
134                 if (desc) return _("邪悪なモンスター1体をテレポートさせる。抵抗されると無効。", "Attempts to teleport an evil monster away.");
135
136                 {
137                         int power = MAX_SIGHT * 5;
138                         if (info) return info_power(power);
139                         if (cast)
140                         {
141                                 if (!get_aim_dir(&dir)) return NULL;
142                                 fire_ball(GF_AWAY_EVIL, dir, power, 0);
143                         }
144                 }
145                 break;
146
147         case 9:
148                 if (name) return _("聖なる光球", "Holy Orb");
149                 if (desc) return _("聖なる力をもつ宝珠を放つ。邪悪なモンスターに対して大きなダメージを与えるが、善良なモンスターには効果がない。",
150                         "Fires a ball with holy power. Hurts evil monsters greatly, but don't effect good monsters.");
151
152                 {
153                         DICE_NUMBER dice = 3;
154                         DICE_SID sides = 6;
155                         POSITION rad = (plev < 30) ? 2 : 3;
156                         int base;
157                         if (p_ptr->pclass == CLASS_PRIEST ||
158                                 p_ptr->pclass == CLASS_HIGH_MAGE ||
159                                 p_ptr->pclass == CLASS_SORCERER)
160                                 base = plev + plev / 2;
161                         else
162                                 base = plev + plev / 4;
163
164
165                         if (info) return info_damage(dice, sides, base);
166
167                         if (cast)
168                         {
169                                 if (!get_aim_dir(&dir)) return NULL;
170
171                                 fire_ball(GF_HOLY_FIRE, dir, damroll(dice, sides) + base, rad);
172                         }
173                 }
174                 break;
175
176         case 10:
177                 if (name) return _("悪魔払い", "Exorcism");
178                 if (desc) return _("視界内の全てのアンデッド及び悪魔にダメージを与え、邪悪なモンスターを恐怖させる。",
179                         "Damages all undead and demons in sight, and scares all evil monsters in sight.");
180                 {
181                         DICE_SID sides = plev;
182                         int power = plev;
183                         if (info) return info_damage(1, sides, 0);
184                         if (cast)
185                         {
186                                 dispel_undead(randint1(sides));
187                                 dispel_demons(randint1(sides));
188                                 turn_evil(power);
189                         }
190                 }
191                 break;
192
193         case 11:
194                 if (name) return _("解呪", "Remove Curse");
195                 if (desc) return _("アイテムにかかった弱い呪いを解除する。", "Removes normal curses from equipped items.");
196                 {
197                         if (cast) (void)remove_curse();
198                 }
199                 break;
200
201         case 12:
202                 if (name) return _("透明視認", "Sense Unseen");
203                 if (desc) return _("一定時間、透明なものが見えるようになる。", "Gives see invisible for a while.");
204
205                 {
206                         int base = 24;
207
208                         if (info) return info_duration(base, base);
209
210                         if (cast)
211                         {
212                                 set_tim_invis(randint1(base) + base, FALSE);
213                         }
214                 }
215                 break;
216
217         case 13:
218                 if (name) return _("対邪悪結界", "Protection from Evil");
219                 if (desc) return _("邪悪なモンスターの攻撃を防ぐバリアを張る。", "Gives aura which protect you from evil monster's physical attack.");
220
221                 {
222                         int base = 25;
223                         DICE_SID sides = 3 * plev;
224
225                         if (info) return info_duration(base, sides);
226
227                         if (cast)
228                         {
229                                 set_protevil(randint1(sides) + base, FALSE);
230                         }
231                 }
232                 break;
233
234         case 14:
235                 if (name) return _("裁きの雷", "Judgment Thunder");
236                 if (desc) return _("強力な電撃のボルトを放つ。", "Fires a powerful bolt of lightning.");
237
238                 {
239                         HIT_POINT dam = plev * 5;
240
241                         if (info) return info_damage(0, 0, dam);
242
243                         if (cast)
244                         {
245                                 if (!get_aim_dir(&dir)) return NULL;
246                                 fire_bolt(GF_ELEC, dir, dam);
247                         }
248                 }
249                 break;
250
251         case 15:
252                 if (name) return _("聖なる御言葉", "Holy Word");
253                 if (desc) return _("視界内の邪悪な存在に大きなダメージを与え、体力を回復し、毒、恐怖、朦朧状態、負傷から全快する。",
254                         "Damages all evil monsters in sight, heals HP somewhat, and completely heals poison, fear, stun and cut status.");
255
256                 {
257                         int dam_sides = plev * 6;
258                         int heal = 100;
259
260                         if (info) return format(_("損:1d%d/回%d", "dam:d%d/h%d"), dam_sides, heal);
261                         if (cast)
262                         {
263                                 dispel_evil(randint1(dam_sides));
264                                 hp_player(heal);
265                                 set_afraid(0);
266                                 set_poisoned(0);
267                                 set_stun(0);
268                                 set_cut(0);
269                         }
270                 }
271                 break;
272
273         case 16:
274                 if (name) return _("開かれた道", "Unbarring Ways");
275                 if (desc) return _("一直線上の全ての罠と扉を破壊する。", "Fires a beam which destroy traps and doors.");
276
277                 {
278                         if (cast)
279                         {
280                                 if (!get_aim_dir(&dir)) return NULL;
281
282                                 destroy_door(dir);
283                         }
284                 }
285                 break;
286
287         case 17:
288                 if (name) return _("封魔", "Arrest");
289                 if (desc) return _("邪悪なモンスターの動きを止める。", "Attempts to paralyze an evil monster.");
290
291                 {
292                         int power = plev * 2;
293
294                         if (info) return info_power(power);
295
296                         if (cast)
297                         {
298                                 if (!get_aim_dir(&dir)) return NULL;
299                                 stasis_evil(dir);
300                         }
301                 }
302                 break;
303
304         case 18:
305                 if (name) return _("聖なるオーラ", "Holy Aura");
306                 if (desc) return _("一定時間、邪悪なモンスターを傷つける聖なるオーラを得る。",
307                         "Gives aura of holy power which injures evil monsters which attacked you for a while.");
308
309                 {
310                         int base = 20;
311
312                         if (info) return info_duration(base, base);
313
314                         if (cast)
315                         {
316                                 set_tim_sh_holy(randint1(base) + base, FALSE);
317                         }
318                 }
319                 break;
320
321         case 19:
322                 if (name) return _("アンデッド&悪魔退散", "Dispel Undead & Demons");
323                 if (desc) return _("視界内の全てのアンデッド及び悪魔にダメージを与える。", "Damages all undead and demons in sight.");
324
325                 {
326                         DICE_SID sides = plev * 4;
327
328                         if (info) return info_damage(1, sides, 0);
329
330                         if (cast)
331                         {
332                                 dispel_undead(randint1(sides));
333                                 dispel_demons(randint1(sides));
334                         }
335                 }
336                 break;
337
338         case 20:
339                 if (name) return _("邪悪退散", "Dispel Evil");
340                 if (desc) return _("視界内の全ての邪悪なモンスターにダメージを与える。", "Damages all evil monsters in sight.");
341
342                 {
343                         DICE_SID sides = plev * 4;
344
345                         if (info) return info_damage(1, sides, 0);
346
347                         if (cast)
348                         {
349                                 dispel_evil(randint1(sides));
350                         }
351                 }
352                 break;
353
354         case 21:
355                 if (name) return _("聖なる刃", "Holy Blade");
356                 if (desc) return _("通常の武器に滅邪の属性をつける。", "Makes current weapon especially deadly against evil monsters.");
357
358                 {
359                         if (cast)
360                         {
361                                 brand_weapon(13);
362                         }
363                 }
364                 break;
365
366         case 22:
367                 if (name) return _("スターバースト", "Star Burst");
368                 if (desc) return _("巨大な閃光の球を放つ。", "Fires a huge ball of powerful light.");
369
370                 {
371                         HIT_POINT dam = 100 + plev * 2;
372                         POSITION rad = 4;
373
374                         if (info) return info_damage(0, 0, dam);
375
376                         if (cast)
377                         {
378                                 if (!get_aim_dir(&dir)) return NULL;
379
380                                 fire_ball(GF_LITE, dir, dam, rad);
381                         }
382                 }
383                 break;
384
385         case 23:
386                 if (name) return _("天使召喚", "Summon Angel");
387                 if (desc) return _("天使を1体召喚する。", "Summons an angel.");
388
389                 {
390                         if (cast)
391                         {
392                                 bool pet = !one_in_(3);
393                                 u32b flg = 0L;
394
395                                 if (pet) flg |= PM_FORCE_PET;
396                                 else flg |= PM_NO_PET;
397                                 if (!(pet && (plev < 50))) flg |= PM_ALLOW_GROUP;
398
399                                 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, (plev * 3) / 2, SUMMON_ANGEL, flg))
400                                 {
401                                         if (pet)
402                                         {
403                                                 msg_print(_("「ご用でございますか、ご主人様」", "'What is thy bidding... Master?'"));
404                                         }
405                                         else
406                                         {
407                                                 msg_print(_("「我は汝の下僕にあらず! 悪行者よ、悔い改めよ!」", "Mortal! Repent of thy impiousness."));
408                                         }
409                                 }
410                         }
411                 }
412                 break;
413
414         case 24:
415                 if (name) return _("士気高揚", "Heroism");
416                 if (desc) return _("一定時間、ヒーロー気分になる。", "Removes fear, and gives bonus to hit and 10 more HP for a while.");
417
418                 {
419                         int base = 25;
420
421                         if (info) return info_duration(base, base);
422
423                         if (cast)
424                         {
425                                 (void)heroism(base);
426                         }
427                 }
428                 break;
429
430         case 25:
431                 if (name) return _("呪い退散", "Dispel Curse");
432                 if (desc) return _("アイテムにかかった強力な呪いを解除する。", "Removes normal and heavy curse from equipped items.");
433
434                 {
435                         if (cast) (void)remove_all_curse();
436                 }
437                 break;
438
439         case 26:
440                 if (name) return _("邪悪追放", "Banish Evil");
441                 if (desc) return _("視界内の全ての邪悪なモンスターをテレポートさせる。抵抗されると無効。",
442                         "Teleports all evil monsters in sight away unless resisted.");
443
444                 {
445                         int power = 100;
446
447                         if (info) return info_power(power);
448
449                         if (cast)
450                         {
451                                 if (banish_evil(power))
452                                 {
453                                         msg_print(_("神聖な力が邪悪を打ち払った!", "The holy power banishes evil!"));
454                                 }
455                         }
456                 }
457                 break;
458
459         case 27:
460                 if (name) return _("ハルマゲドン", "Armageddon");
461                 if (desc) return _("周辺のアイテム、モンスター、地形を破壊する。", "Destroy everything in nearby area.");
462
463                 {
464                         int base = 12;
465                         DICE_SID sides = 4;
466
467                         if (cast)
468                         {
469                                 destroy_area(p_ptr->y, p_ptr->x, base + randint1(sides), FALSE);
470                         }
471                 }
472                 break;
473
474         case 28:
475                 if (name) return _("目には目を", "An Eye for an Eye");
476                 if (desc) return _("一定時間、自分がダメージを受けたときに攻撃を行ったモンスターに対して同等のダメージを与える。",
477                         "Gives special aura for a while. When you are attacked by a monster, the monster are injured with same amount of damage as you take.");
478
479                 {
480                         int base = 10;
481
482                         if (info) return info_duration(base, base);
483
484                         if (cast)
485                         {
486                                 set_tim_eyeeye(randint1(base) + base, FALSE);
487                         }
488                 }
489                 break;
490
491         case 29:
492                 if (name) return _("神の怒り", "Wrath of the God");
493                 if (desc) return _("ターゲットの周囲に分解の球を多数落とす。", "Drops many balls of disintegration near the target.");
494
495                 {
496                         HIT_POINT dam = plev * 3 + 25;
497                         POSITION rad = 2;
498
499                         if (info) return info_multi_damage(dam);
500
501                         if (cast)
502                         {
503                                 if (!cast_wrath_of_the_god(dam, rad)) return NULL;
504                         }
505                 }
506                 break;
507
508         case 30:
509                 if (name) return _("神威", "Divine Intervention");
510                 if (desc) return _("隣接するモンスターに聖なるダメージを与え、視界内のモンスターにダメージ、減速、朦朧、混乱、恐怖、眠りを与える。さらに体力を回復する。",
511                         "Damages all adjacent monsters with holy power. Damages and attempt to slow, stun, confuse, scare and freeze all monsters in sight. And heals HP.");
512
513                 {
514                         int b_dam = plev * 11;
515                         int d_dam = plev * 4;
516                         int heal = 100;
517                         int power = plev * 4;
518
519                         if (info) return format(_("回%d/損%d+%d", "h%d/dm%d+%d"), heal, d_dam, b_dam / 2);
520                         if (cast)
521                         {
522                                 project(0, 1, p_ptr->y, p_ptr->x, b_dam, GF_HOLY_FIRE, PROJECT_KILL, -1);
523                                 dispel_monsters(d_dam);
524                                 slow_monsters(plev);
525                                 stun_monsters(power);
526                                 confuse_monsters(power);
527                                 turn_monsters(power);
528                                 stasis_monsters(power);
529                                 hp_player(heal);
530                         }
531                 }
532                 break;
533
534         case 31:
535                 if (name) return _("聖戦", "Crusade");
536                 if (desc) return _("視界内の善良なモンスターをペットにしようとし、ならなかった場合及び善良でないモンスターを恐怖させる。さらに多数の加速された騎士を召喚し、ヒーロー、祝福、加速、対邪悪結界を得る。",
537                         "Attempts to charm all good monsters in sight, and scare all non-charmed monsters, and summons great number of knights, and gives heroism, bless, speed and protection from evil.");
538
539                 {
540                         if (cast)
541                         {
542                                 int base = 25;
543                                 int sp_sides = 20 + plev;
544                                 int sp_base = plev;
545
546                                 int i;
547                                 crusade();
548                                 for (i = 0; i < 12; i++)
549                                 {
550                                         int attempt = 10;
551                                         POSITION my = 0, mx = 0;
552
553                                         while (attempt--)
554                                         {
555                                                 scatter(&my, &mx, p_ptr->y, p_ptr->x, 4, 0);
556
557                                                 /* Require empty grids */
558                                                 if (cave_empty_bold2(my, mx)) break;
559                                         }
560                                         if (attempt < 0) continue;
561                                         summon_specific(-1, my, mx, plev, SUMMON_KNIGHTS, (PM_ALLOW_GROUP | PM_FORCE_PET | PM_HASTE));
562                                 }
563                                 set_hero(randint1(base) + base, FALSE);
564                                 set_blessed(randint1(base) + base, FALSE);
565                                 set_fast(randint1(sp_sides) + sp_base, FALSE);
566                                 set_protevil(randint1(base) + base, FALSE);
567                                 set_afraid(0);
568                         }
569                 }
570                 break;
571         }
572
573         return "";
574 }
575