OSDN Git Service

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