OSDN Git Service

[Refactor] #37353 GRID, GRID_X, GRID_Y を floor.h へ移動.
[hengband/hengband.git] / src / realm-daemon.c
1 
2 #include "angband.h"
3 #include "util.h"
4
5 #include "cmd-spell.h"
6 #include "spells.h"
7 #include "spells-summon.h"
8 #include "spells-floor.h"
9 #include "spells-status.h"
10 #include "player-effects.h"
11 #include "targeting.h"
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_daemon_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 _("マジック・ミサイル", "Magic Missile");
33                 if (desc) return _("弱い魔法の矢を放つ。", "Fires a weak bolt of magic.");
34
35                 {
36                         DICE_NUMBER dice = 3 + (plev - 1) / 5;
37                         DICE_SID sides = 4;
38
39                         if (info) return info_damage(dice, sides, 0);
40
41                         if (cast)
42                         {
43                                 if (!get_aim_dir(&dir)) return NULL;
44
45                                 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir, damroll(dice, sides));
46                         }
47                 }
48                 break;
49
50         case 1:
51                 if (name) return _("無生命感知", "Detect Unlife");
52                 if (desc) return _("近くの生命のないモンスターを感知する。", "Detects all nonliving monsters in your vicinity.");
53
54                 {
55                         POSITION rad = DETECT_RAD_DEFAULT;
56
57                         if (info) return info_radius(rad);
58
59                         if (cast)
60                         {
61                                 detect_monsters_nonliving(rad);
62                         }
63                 }
64                 break;
65
66         case 2:
67                 if (name) return _("邪なる祝福", "Evil Bless");
68                 if (desc) return _("一定時間、命中率とACにボーナスを得る。", "Gives bonus to hit and AC for a few turns.");
69
70                 {
71                         int base = 12;
72
73                         if (info) return info_duration(base, base);
74
75                         if (cast)
76                         {
77                                 set_blessed(randint1(base) + base, FALSE);
78                         }
79                 }
80                 break;
81
82         case 3:
83                 if (name) return _("耐火炎", "Resist Fire");
84                 if (desc) return _("一定時間、炎への耐性を得る。装備による耐性に累積する。",
85                         "Gives resistance to fire, cold and electricity for a while. These resistances can be added to which from equipment for more powerful resistances.");
86
87                 {
88                         int base = 20;
89
90                         if (info) return info_duration(base, base);
91
92                         if (cast)
93                         {
94                                 set_oppose_fire(randint1(base) + base, FALSE);
95                         }
96                 }
97                 break;
98
99         case 4:
100                 if (name) return _("恐慌", "Horrify");
101                 if (desc) return _("モンスター1体を恐怖させ、朦朧させる。抵抗されると無効。", "Attempts to scare and stun a monster.");
102
103                 {
104                         PLAYER_LEVEL power = plev;
105
106                         if (info) return info_power(power);
107
108                         if (cast)
109                         {
110                                 if (!get_aim_dir(&dir)) return NULL;
111
112                                 fear_monster(dir, power);
113                                 stun_monster(dir, power);
114                         }
115                 }
116                 break;
117
118         case 5:
119                 if (name) return _("地獄の矢", "Nether Bolt");
120                 if (desc) return _("地獄のボルトもしくはビームを放つ。", "Fires a bolt or beam of nether.");
121
122                 {
123                         DICE_NUMBER dice = 6 + (plev - 5) / 4;
124                         DICE_SID sides = 8;
125
126                         if (info) return info_damage(dice, sides, 0);
127
128                         if (cast)
129                         {
130                                 if (!get_aim_dir(&dir)) return NULL;
131
132                                 fire_bolt_or_beam(beam_chance(), GF_NETHER, dir, damroll(dice, sides));
133                         }
134                 }
135                 break;
136
137         case 6:
138                 if (name) return _("古代の死霊召喚", "Summon Manes");
139                 if (desc) return _("古代の死霊を召喚する。", "Summons a manes.");
140
141                 {
142                         if (cast)
143                         {
144                                 if (!summon_specific(-1, p_ptr->y, p_ptr->x, (plev * 3) / 2, SUMMON_MANES, (PM_ALLOW_GROUP | PM_FORCE_PET)))
145                                 {
146                                         msg_print(_("古代の死霊は現れなかった。", "No Manes arrive."));
147                                 }
148                         }
149                 }
150                 break;
151
152         case 7:
153                 if (name) return _("地獄の焔", "Hellish Flame");
154                 if (desc) return _("邪悪な力を持つボールを放つ。善良なモンスターには大きなダメージを与える。",
155                         "Fires a ball of evil power. Hurts good monsters greatly.");
156
157                 {
158                         DICE_NUMBER dice = 3;
159                         DICE_SID sides = 6;
160                         POSITION rad = (plev < 30) ? 2 : 3;
161                         int base;
162
163                         if (IS_WIZARD_CLASS())
164                                 base = plev + plev / 2;
165                         else
166                                 base = plev + plev / 4;
167
168
169                         if (info) return info_damage(dice, sides, base);
170
171                         if (cast)
172                         {
173                                 if (!get_aim_dir(&dir)) return NULL;
174
175                                 fire_ball(GF_HELL_FIRE, dir, damroll(dice, sides) + base, rad);
176                         }
177                 }
178                 break;
179
180         case 8:
181                 if (name) return _("デーモン支配", "Dominate Demon");
182                 if (desc) return _("悪魔1体を魅了する。抵抗されると無効", "Attempts to charm a demon.");
183
184                 {
185                         int power = plev;
186
187                         if (info) return info_power(power);
188
189                         if (cast)
190                         {
191                                 if (!get_aim_dir(&dir)) return NULL;
192
193                                 control_one_demon(dir, plev);
194                         }
195                 }
196                 break;
197
198         case 9:
199                 if (name) return _("ビジョン", "Vision");
200                 if (desc) return _("周辺の地形を感知する。", "Maps nearby area.");
201
202                 {
203                         POSITION rad = DETECT_RAD_MAP;
204
205                         if (info) return info_radius(rad);
206
207                         if (cast)
208                         {
209                                 map_area(rad);
210                         }
211                 }
212                 break;
213
214         case 10:
215                 if (name) return _("耐地獄", "Resist Nether");
216                 if (desc) return _("一定時間、地獄への耐性を得る。", "Gives resistance to nether for a while.");
217
218                 {
219                         int base = 20;
220
221                         if (info) return info_duration(base, base);
222
223                         if (cast)
224                         {
225                                 set_tim_res_nether(randint1(base) + base, FALSE);
226                         }
227                 }
228                 break;
229
230         case 11:
231                 if (name) return _("プラズマ・ボルト", "Plasma bolt");
232                 if (desc) return _("プラズマのボルトもしくはビームを放つ。", "Fires a bolt or beam of plasma.");
233
234                 {
235                         DICE_NUMBER dice = 11 + (plev - 5) / 4;
236                         DICE_SID sides = 8;
237
238                         if (info) return info_damage(dice, sides, 0);
239
240                         if (cast)
241                         {
242                                 if (!get_aim_dir(&dir)) return NULL;
243
244                                 fire_bolt_or_beam(beam_chance(), GF_PLASMA, dir, damroll(dice, sides));
245                         }
246                 }
247                 break;
248
249         case 12:
250                 if (name) return _("ファイア・ボール", "Fire Ball");
251                 if (desc) return _("炎の球を放つ。", "Fires a ball of fire.");
252
253                 {
254                         HIT_POINT dam = plev + 55;
255                         POSITION rad = 2;
256
257                         if (info) return info_damage(0, 0, dam);
258
259                         if (cast)
260                         {
261                                 if (!get_aim_dir(&dir)) return NULL;
262
263                                 fire_ball(GF_FIRE, dir, dam, rad);
264                         }
265                 }
266                 break;
267
268         case 13:
269                 if (name) return _("炎の刃", "Fire Branding");
270                 if (desc) return _("武器に炎の属性をつける。", "Makes current weapon fire branded.");
271
272                 {
273                         if (cast)
274                         {
275                                 brand_weapon(1);
276                         }
277                 }
278                 break;
279
280         case 14:
281                 if (name) return _("地獄球", "Nether Ball");
282                 if (desc) return _("大きな地獄の球を放つ。", "Fires a huge ball of nether.");
283
284                 {
285                         HIT_POINT dam = plev * 3 / 2 + 100;
286                         POSITION rad = plev / 20 + 2;
287
288                         if (info) return info_damage(0, 0, dam);
289
290                         if (cast)
291                         {
292                                 if (!get_aim_dir(&dir)) return NULL;
293
294                                 fire_ball(GF_NETHER, dir, dam, rad);
295                         }
296                 }
297                 break;
298
299         case 15:
300                 if (name) return _("デーモン召喚", "Summon Demon");
301                 if (desc) return _("悪魔1体を召喚する。", "Summons a demon.");
302
303                 {
304                         if (cast)
305                         {
306                                 cast_summon_demon(plev * 2 / 3 + randint1(plev / 2));
307                         }
308                 }
309                 break;
310
311         case 16:
312                 if (name) return _("悪魔の目", "Devilish Eye");
313                 if (desc) return _("一定時間、テレパシー能力を得る。", "Gives telepathy for a while.");
314
315                 {
316                         int base = 30;
317                         DICE_SID sides = 25;
318
319                         if (info) return info_duration(base, sides);
320
321                         if (cast)
322                         {
323                                 set_tim_esp(randint1(sides) + base, FALSE);
324                         }
325                 }
326                 break;
327
328         case 17:
329                 if (name) return _("悪魔のクローク", "Devil Cloak");
330                 if (desc) return _("恐怖を取り除き、一定時間、炎と冷気の耐性、炎のオーラを得る。耐性は装備による耐性に累積する。",
331                         "Removes fear. Gives resistance to fire and cold, and aura of fire. These resistances can be added to which from equipment for more powerful resistances.");
332
333                 {
334                         TIME_EFFECT base = 20;
335
336                         if (info) return info_duration(base, base);
337
338                         if (cast)
339                         {
340                                 TIME_EFFECT dur = randint1(base) + base;
341
342                                 set_oppose_fire(dur, FALSE);
343                                 set_oppose_cold(dur, FALSE);
344                                 set_tim_sh_fire(dur, FALSE);
345                                 set_afraid(0);
346                                 break;
347                         }
348                 }
349                 break;
350
351         case 18:
352                 if (name) return _("溶岩流", "The Flow of Lava");
353                 if (desc) return _("自分を中心とした炎の球を作り出し、床を溶岩に変える。",
354                         "Generates a ball of fire centered on you which transforms floors to magma.");
355
356                 {
357                         HIT_POINT dam = (55 + plev) * 2;
358                         POSITION rad = 3;
359
360                         if (info) return info_damage(0, 0, dam / 2);
361
362                         if (cast)
363                         {
364                                 fire_ball(GF_FIRE, 0, dam, rad);
365                                 fire_ball_hide(GF_LAVA_FLOW, 0, 2 + randint1(2), rad);
366                         }
367                 }
368                 break;
369
370         case 19:
371                 if (name) return _("プラズマ球", "Plasma Ball");
372                 if (desc) return _("プラズマの球を放つ。", "Fires a ball of plasma.");
373
374                 {
375                         HIT_POINT dam = plev * 3 / 2 + 80;
376                         POSITION rad = 2 + plev / 40;
377
378                         if (info) return info_damage(0, 0, dam);
379
380                         if (cast)
381                         {
382                                 if (!get_aim_dir(&dir)) return NULL;
383
384                                 fire_ball(GF_PLASMA, dir, dam, rad);
385                         }
386                 }
387                 break;
388
389         case 20:
390                 if (name) return _("悪魔変化", "Polymorph Demon");
391                 if (desc) return _("一定時間、悪魔に変化する。変化している間は本来の種族の能力を失い、代わりに悪魔としての能力を得る。",
392                         "Mimic a demon for a while. Loses abilities of original race and gets abilities as a demon.");
393
394                 {
395                         int base = 10 + plev / 2;
396
397                         if (info) return info_duration(base, base);
398
399                         if (cast)
400                         {
401                                 set_mimic(base + randint1(base), MIMIC_DEMON, FALSE);
402                         }
403                 }
404                 break;
405
406         case 21:
407                 if (name) return _("地獄の波動", "Nather Wave");
408                 if (desc) return _("視界内の全てのモンスターにダメージを与える。善良なモンスターに特に大きなダメージを与える。",
409                         "Damages all monsters in sight. Hurts good monsters greatly.");
410
411                 {
412                         int sides1 = plev * 2;
413                         int sides2 = plev * 2;
414
415                         if (info) return format("%sd%d+d%d", KWD_DAM, sides1, sides2);
416
417                         if (cast)
418                         {
419                                 dispel_monsters(randint1(sides1));
420                                 dispel_good(randint1(sides2));
421                         }
422                 }
423                 break;
424
425         case 22:
426                 if (name) return _("サキュバスの接吻", "Kiss of Succubus");
427                 if (desc) return _("因果混乱の球を放つ。", "Fires a ball of nexus.");
428
429                 {
430                         HIT_POINT dam = 100 + plev * 2;
431                         POSITION rad = 4;
432
433                         if (info) return info_damage(0, 0, dam);
434
435                         if (cast)
436                         {
437                                 if (!get_aim_dir(&dir)) return NULL;
438                                 fire_ball(GF_NEXUS, dir, dam, rad);
439                         }
440                 }
441                 break;
442
443         case 23:
444                 if (name) return _("破滅の手", "Doom Hand");
445                 if (desc) return _("破滅の手を放つ。食らったモンスターはそのときのHPの半分前後のダメージを受ける。", "Attempts to make a monster's HP almost half.");
446
447                 {
448                         if (cast)
449                         {
450                                 if (!get_aim_dir(&dir))
451                                         return NULL;
452                                 else
453                                         msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
454
455                                 fire_ball_hide(GF_HAND_DOOM, dir, plev * 2, 0);
456                         }
457                 }
458                 break;
459
460         case 24:
461                 if (name) return _("士気高揚", "Raise the Morale");
462                 if (desc) return _("一定時間、ヒーロー気分になる。", "Removes fear, and gives bonus to hit and 10 more HP for a while.");
463
464                 {
465                         int base = 25;
466                         if (info) return info_duration(base, base);
467                         if (cast)heroism(base);
468                 }
469                 break;
470
471         case 25:
472                 if (name) return _("不滅の肉体", "Immortal Body");
473                 if (desc) return _("一定時間、時間逆転への耐性を得る。", "Gives resistance to time for a while.");
474
475                 {
476                         int base = 20;
477
478                         if (info) return info_duration(base, base);
479
480                         if (cast)
481                         {
482                                 set_tim_res_time(randint1(base) + base, FALSE);
483                         }
484                 }
485                 break;
486
487         case 26:
488                 if (name) return _("狂気の円環", "Insanity Circle");
489                 if (desc) return _("自分を中心としたカオスの球、混乱の球を発生させ、近くのモンスターを魅了する。",
490                         "Generate balls of chaos, confusion and charm centered on you.");
491
492                 {
493                         HIT_POINT dam = 50 + plev;
494                         int power = 20 + plev;
495                         POSITION rad = 3 + plev / 20;
496
497                         if (info) return format("%s%d+%d", KWD_DAM, dam / 2, dam / 2);
498
499                         if (cast)
500                         {
501                                 fire_ball(GF_CHAOS, 0, dam, rad);
502                                 fire_ball(GF_CONFUSION, 0, dam, rad);
503                                 fire_ball(GF_CHARM, 0, power, rad);
504                         }
505                 }
506                 break;
507
508         case 27:
509                 if (name) return _("ペット爆破", "Explode Pets");
510                 if (desc) return _("全てのペットを強制的に爆破させる。", "Makes all pets explode.");
511
512                 {
513                         if (cast)
514                         {
515                                 discharge_minion();
516                         }
517                 }
518                 break;
519
520         case 28:
521                 if (name) return _("グレーターデーモン召喚", "Summon Greater Demon");
522                 if (desc) return _("上級デーモンを召喚する。召喚するには人間('p','h','t'で表されるモンスター)の死体を捧げなければならない。",
523                         "Summons greater demon. It need to sacrifice a corpse of human ('p','h' or 't').");
524
525                 {
526                         if (cast)
527                         {
528                                 if (!cast_summon_greater_demon()) return NULL;
529                         }
530                 }
531                 break;
532
533         case 29:
534                 if (name) return _("地獄嵐", "Nether Storm");
535                 if (desc) return _("超巨大な地獄の球を放つ。", "Generate a huge ball of nether.");
536
537                 {
538                         HIT_POINT dam = plev * 15;
539                         POSITION rad = plev / 5;
540
541                         if (info) return info_damage(0, 0, dam);
542
543                         if (cast)
544                         {
545                                 if (!get_aim_dir(&dir)) return NULL;
546
547                                 fire_ball(GF_NETHER, dir, dam, rad);
548                         }
549                 }
550                 break;
551
552         case 30:
553                 if (name) return _("血の呪い", "Bloody Curse");
554                 if (desc) return _("自分がダメージを受けることによって対象に呪いをかけ、ダメージを与え様々な効果を引き起こす。",
555                         "Puts blood curse which damages and causes various effects on a monster. You also take damage.");
556
557                 {
558                         HIT_POINT dam = 600;
559                         POSITION rad = 0;
560
561                         if (info) return info_damage(0, 0, dam);
562
563                         if (cast)
564                         {
565                                 if (!get_aim_dir(&dir)) return NULL;
566
567                                 fire_ball_hide(GF_BLOOD_CURSE, dir, dam, rad);
568                                 take_hit(DAMAGE_USELIFE, 20 + randint1(30), _("血の呪い", "Blood curse"), -1);
569                         }
570                 }
571                 break;
572
573         case 31:
574                 if (name) return _("魔王変化", "Polymorph Demonlord");
575                 if (desc) return _("悪魔の王に変化する。変化している間は本来の種族の能力を失い、代わりに悪魔の王としての能力を得、壁を破壊しながら歩く。",
576                         "Mimic a demon lord for a while. Loses abilities of original race and gets great abilities as a demon lord. Even hard walls can't stop your walking.");
577
578                 {
579                         int base = 15;
580
581                         if (info) return info_duration(base, base);
582
583                         if (cast)
584                         {
585                                 set_mimic(base + randint1(base), MIMIC_DEMON_LORD, FALSE);
586                         }
587                 }
588                 break;
589         }
590
591         return "";
592 }
593