OSDN Git Service

[Refactor] #38997 set_blessed() に player_type * 引数を追加.
[hengband/hengband.git] / src / realm-life.c
1 #include "angband.h"
2 #include "cmd-spell.h"
3 #include "spells-status.h"
4 #include "spells-floor.h"
5 #include "spells.h"
6 #include "player-status.h"
7 #include "player-effects.h"
8 #include "floor.h"
9 #include "targeting.h"
10
11 /*!
12 * @brief 生命領域魔法の各処理を行う
13 * @param spell 魔法ID
14 * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
15 * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
16 */
17 concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
18 {
19         bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
20         bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
21         bool info = (mode == SPELL_INFO) ? TRUE : FALSE;
22         bool cast = (mode == SPELL_CAST) ? TRUE : FALSE;
23
24         DIRECTION dir;
25         PLAYER_LEVEL plev = p_ptr->lev;
26
27         switch (spell)
28         {
29         case 0:
30                 if (name) return _("軽傷の治癒", "Cure Light Wounds");
31                 if (desc) return _("怪我と体力を少し回復させる。", "Heals cut and HP a little.");
32                 {
33                         DICE_NUMBER dice = 2;
34                         DICE_SID sides = 10;
35                         if (info) return info_heal(dice, sides, 0);
36                         if (cast) (void)cure_light_wounds(dice, sides);                 
37                 }
38                 break;
39
40         case 1:
41                 if (name) return _("祝福", "Bless");
42                 if (desc) return _("一定時間、命中率とACにボーナスを得る。", "Gives bonus to hit and AC for a few turns.");
43                 {
44                         int base = 12;
45
46                         if (info) return info_duration(base, base);
47
48                         if (cast)
49                         {
50                                 set_blessed(p_ptr, randint1(base) + base, FALSE);
51                         }
52                 }
53                 break;
54
55         case 2:
56                 if (name) return _("軽傷", "Cause Light Wounds");
57                 if (desc) return _("1体のモンスターに小ダメージを与える。抵抗されると無効。", "Wounds a monster a little unless resisted.");
58                 {
59                         DICE_NUMBER dice = 3 + (plev - 1) / 5;
60                         DICE_SID sides = 4;
61
62                         if (info) return info_damage(dice, sides, 0);
63
64                         if (cast)
65                         {
66                                 if (!get_aim_dir(&dir)) return NULL;
67                                 fire_ball_hide(GF_WOUNDS, dir, damroll(dice, sides), 0);
68                         }
69                 }
70                 break;
71
72         case 3:
73                 if (name) return _("光の召喚", "Call Light");
74                 if (desc) return _("光源が照らしている範囲か部屋全体を永久に明るくする。", "Lights up nearby area and the inside of a room permanently.");
75                 {
76                         DICE_NUMBER dice = 2;
77                         DICE_SID sides = plev / 2;
78                         POSITION rad = plev / 10 + 1;
79
80                         if (info) return info_damage(dice, sides, 0);
81
82                         if (cast)
83                         {
84                                 lite_area(damroll(dice, sides), rad);
85                         }
86                 }
87                 break;
88
89         case 4:
90                 if (name) return _("罠 & 隠し扉感知", "Detect Doors & Traps");
91                 if (desc) return _("近くの全ての罠と扉と階段を感知する。", "Detects traps, doors, and stairs in your vicinity.");
92                 {
93                         POSITION rad = DETECT_RAD_DEFAULT;
94
95                         if (info) return info_radius(rad);
96
97                         if (cast)
98                         {
99                                 detect_traps(rad, TRUE);
100                                 detect_doors(rad);
101                                 detect_stairs(rad);
102                         }
103                 }
104                 break;
105
106         case 5:
107                 if (name) return _("重傷の治癒", "Cure Medium Wounds");
108                 if (desc) return _("怪我と体力を中程度回復させる。", "Heals cut and HP more.");
109                 {
110                         DICE_NUMBER dice = 4;
111                         DICE_SID sides = 10;
112
113                         if (info) return info_heal(dice, sides, 0);
114                         if (cast) (void)cure_serious_wounds(dice, sides);
115                 }
116                 break;
117
118         case 6:
119                 if (name) return _("解毒", "Cure Poison");
120                 if (desc) return _("体内の毒を取り除く。", "Cure poison status.");
121                 {
122                         if (cast)
123                         {
124                                 set_poisoned(p_ptr, 0);
125                         }
126                 }
127                 break;
128
129         case 7:
130                 if (name) return _("空腹充足", "Satisfy Hunger");
131                 if (desc) return _("満腹にする。", "Satisfies hunger.");
132                 {
133                         if (cast)
134                         {
135                                 set_food(PY_FOOD_MAX - 1);
136                         }
137                 }
138                 break;
139
140         case 8:
141                 if (name) return _("解呪", "Remove Curse");
142                 if (desc) return _("アイテムにかかった弱い呪いを解除する。", "Removes normal curses from equipped items.");
143                 {
144                         if (cast) (void)remove_curse();
145                 }
146                 break;
147
148         case 9:
149                 if (name) return _("重傷", "Cause Medium Wounds");
150                 if (desc) return _("1体のモンスターに中ダメージを与える。抵抗されると無効。", "Wounds a monster unless resisted.");
151                 {
152                         DICE_SID sides = 8 + (plev - 5) / 4;
153                         DICE_NUMBER dice = 8;
154
155                         if (info) return info_damage(dice, sides, 0);
156
157                         if (cast)
158                         {
159                                 if (!get_aim_dir(&dir)) return NULL;
160                                 fire_ball_hide(GF_WOUNDS, dir, damroll(dice, sides), 0);
161                         }
162                 }
163                 break;
164
165         case 10:
166                 if (name) return _("致命傷の治癒", "Cure Critical Wounds");
167                 if (desc) return _("体力を大幅に回復させ、負傷と朦朧状態も全快する。", "Heals cut, stun and HP greatly.");
168                 {
169                         DICE_NUMBER dice = 8;
170                         DICE_SID sides = 10;
171
172                         if (info) return info_heal(dice, sides, 0);
173                         if (cast) (void)cure_critical_wounds(damroll(dice, sides));
174                 }
175                 break;
176
177         case 11:
178                 if (name) return _("耐熱耐寒", "Resist Heat and Cold");
179                 if (desc) return _("一定時間、火炎と冷気に対する耐性を得る。装備による耐性に累積する。",
180                         "Gives resistance to fire and cold. These resistances can be added to which from equipment for more powerful resistances.");
181
182                 {
183                         int base = 20;
184
185                         if (info) return info_duration(base, base);
186
187                         if (cast)
188                         {
189                                 set_oppose_cold(randint1(base) + base, FALSE);
190                                 set_oppose_fire(randint1(base) + base, FALSE);
191                         }
192                 }
193                 break;
194
195         case 12:
196                 if (name) return _("周辺感知", "Sense Surroundings");
197                 if (desc) return _("周辺の地形を感知する。", "Maps nearby area.");
198
199                 {
200                         POSITION rad = DETECT_RAD_MAP;
201
202                         if (info) return info_radius(rad);
203
204                         if (cast)
205                         {
206                                 map_area(rad);
207                         }
208                 }
209                 break;
210
211         case 13:
212                 if (name) return _("パニック・アンデッド", "Turn Undead");
213                 if (desc) return _("視界内のアンデッドを恐怖させる。抵抗されると無効。", "Attempts to scare undead monsters in sight.");
214
215                 {
216                         if (cast)
217                         {
218                                 turn_undead();
219                         }
220                 }
221                 break;
222
223         case 14:
224                 if (name) return _("体力回復", "Healing");
225                 if (desc) return _("極めて強力な回復呪文で、負傷と朦朧状態も全快する。", "Much powerful healing magic, and heals cut and stun completely.");
226
227                 {
228                         int heal = 300;
229                         if (info) return info_heal(0, 0, heal);
230                         if (cast) (void)cure_critical_wounds(heal);
231                 }
232                 break;
233
234         case 15:
235                 if (name) return _("結界の紋章", "Glyph of Warding");
236                 if (desc) return _("自分のいる床の上に、モンスターが通り抜けたり召喚されたりすることができなくなるルーンを描く。",
237                         "Sets a glyph on the floor beneath you. Monsters cannot attack you if you are on a glyph, but can try to break glyph.");
238
239                 {
240                         if (cast)
241                         {
242                                 warding_glyph();
243                         }
244                 }
245                 break;
246
247         case 16:
248                 if (name) return _("*解呪*", "Dispel Curse");
249                 if (desc) return _("アイテムにかかった強力な呪いを解除する。", "Removes normal and heavy curse from equipped items.");
250                 {
251                         if (cast) (void)remove_all_curse();
252                 }
253                 break;
254
255         case 17:
256                 if (name) return _("鑑識", "Perception");
257                 if (desc) return _("アイテムを識別する。", "Identifies an item.");
258
259                 {
260                         if (cast)
261                         {
262                                 if (!ident_spell(FALSE)) return NULL;
263                         }
264                 }
265                 break;
266
267         case 18:
268                 if (name) return _("アンデッド退散", "Dispel Undead");
269                 if (desc) return _("視界内の全てのアンデッドにダメージを与える。", "Damages all undead monsters in sight.");
270
271                 {
272                         DICE_NUMBER dice = 1;
273                         DICE_SID sides = plev * 5;
274
275                         if (info) return info_damage(dice, sides, 0);
276
277                         if (cast)
278                         {
279                                 dispel_undead(damroll(dice, sides));
280                         }
281                 }
282                 break;
283
284         case 19:
285                 if (name) return _("凪の刻", "Day of the Dove");
286                 if (desc) return _("視界内の全てのモンスターを魅了する。抵抗されると無効。", "Attempts to charm all monsters in sight.");
287
288                 {
289                         int power = plev * 2;
290
291                         if (info) return info_power(power);
292
293                         if (cast)
294                         {
295                                 charm_monsters(power);
296                         }
297                 }
298                 break;
299
300         case 20:
301                 if (name) return _("致命傷", "Cause Critical Wounds");
302                 if (desc) return _("1体のモンスターに大ダメージを与える。抵抗されると無効。", "Wounds a monster critically unless resisted.");
303
304                 {
305                         DICE_NUMBER dice = 5 + (plev - 5) / 3;
306                         DICE_SID sides = 15;
307
308                         if (info) return info_damage(dice, sides, 0);
309
310                         if (cast)
311                         {
312                                 if (!get_aim_dir(&dir)) return NULL;
313                                 fire_ball_hide(GF_WOUNDS, dir, damroll(dice, sides), 0);
314                         }
315                 }
316                 break;
317
318         case 21:
319                 if (name) return _("帰還の詔", "Word of Recall");
320                 if (desc) return _("地上にいるときはダンジョンの最深階へ、ダンジョンにいるときは地上へと移動する。", "Recalls player from dungeon to town, or from town to the deepest level of dungeon.");
321
322                 {
323                         int base = 15;
324                         DICE_SID sides = 20;
325
326                         if (info) return info_delay(base, sides);
327
328                         if (cast)
329                         {
330                                 if (!recall_player(p_ptr, randint0(21) + 15)) return NULL;
331                         }
332                 }
333                 break;
334
335         case 22:
336                 if (name) return _("真実の祭壇", "Alter Reality");
337                 if (desc) return _("現在の階を再構成する。", "Recreates current dungeon level.");
338
339                 {
340                         int base = 15;
341                         DICE_SID sides = 20;
342
343                         if (info) return info_delay(base, sides);
344
345                         if (cast)
346                         {
347                                 alter_reality();
348                         }
349                 }
350                 break;
351
352         case 23:
353                 if (name) return _("真・結界", "Warding True");
354                 if (desc) return _("自分のいる床と周囲8マスの床の上に、モンスターが通り抜けたり召喚されたりすることができなくなるルーンを描く。", "Creates glyphs in all adjacent squares and under you.");
355
356                 {
357                         POSITION rad = 1;
358
359                         if (info) return info_radius(rad);
360
361                         if (cast)
362                         {
363                                 warding_glyph();
364                                 glyph_creation();
365                         }
366                 }
367                 break;
368
369         case 24:
370                 if (name) return _("不毛化", "Sterilization");
371                 if (desc) return _("この階の増殖するモンスターが増殖できなくなる。", "Prevents any breeders on current level from breeding.");
372
373                 {
374                         if (cast)
375                         {
376                                 current_floor_ptr->num_repro += MAX_REPRO;
377                         }
378                 }
379                 break;
380
381         case 25:
382                 if (name) return _("全感知", "Detection");
383                 if (desc) return _("近くの全てのモンスター、罠、扉、階段、財宝、そしてアイテムを感知する。", "Detects all monsters, traps, doors, stairs, treasures and items in your vicinity.");
384
385                 {
386                         POSITION rad = DETECT_RAD_DEFAULT;
387
388                         if (info) return info_radius(rad);
389
390                         if (cast)
391                         {
392                                 detect_all(rad);
393                         }
394                 }
395                 break;
396
397         case 26:
398                 if (name) return _("アンデッド消滅", "Annihilate Undead");
399                 if (desc) return _("自分の周囲にいるアンデッドを現在の階から消し去る。抵抗されると無効。",
400                         "Eliminates all nearby undead monsters, exhausting you.  Powerful or unique monsters may be able to resist.");
401
402                 {
403                         int power = plev + 50;
404
405                         if (info) return info_power(power);
406
407                         if (cast)
408                         {
409                                 mass_genocide_undead(power, TRUE);
410                         }
411                 }
412                 break;
413
414         case 27:
415                 if (name) return _("千里眼", "Clairvoyance");
416                 if (desc) return _("その階全体を永久に照らし、ダンジョン内すべてのアイテムを感知する。", "Maps and lights whole dungeon level. Knows all objects location. And gives telepathy for a while.");
417
418                 {
419                         if (cast)
420                         {
421                                 wiz_lite(FALSE);
422                         }
423                 }
424                 break;
425
426         case 28:
427                 if (name) return _("全復活", "Restoration");
428                 if (desc) return _("すべてのステータスと経験値を回復する。", "Restores all stats and experience.");
429
430                 {
431                         if (cast)
432                         {
433                                 (void)restore_all_status();
434                                 restore_level();
435                         }
436                 }
437                 break;
438
439         case 29:
440                 if (name) return _("*体力回復*", "Healing True");
441                 if (desc) return _("最強の治癒の魔法で、負傷と朦朧状態も全快する。", "The greatest healing magic. Heals all HP, cut and stun.");
442
443                 {
444                         int heal = 2000;
445                         if (info) return info_heal(0, 0, heal);
446                         if (cast) (void)cure_critical_wounds(heal);
447                 }
448                 break;
449
450         case 30:
451                 if (name) return _("聖なるビジョン", "Holy Vision");
452                 if (desc) return _("アイテムの持つ能力を完全に知る。", "*Identifies* an item.");
453
454                 {
455                         if (cast)
456                         {
457                                 if (!identify_fully(FALSE)) return NULL;
458                         }
459                 }
460                 break;
461
462         case 31:
463                 if (name) return _("究極の耐性", "Ultimate Resistance");
464                 if (desc) return _("一定時間、あらゆる耐性を付け、ACと魔法防御能力を上昇させる。", "Gives ultimate resistance, bonus to AC and speed.");
465
466                 {
467                         TIME_EFFECT base = (TIME_EFFECT)plev / 2;
468
469                         if (info) return info_duration(base, base);
470
471                         if (cast)
472                         {
473                                 TIME_EFFECT v = randint1(base) + base;
474                                 set_fast(p_ptr, v, FALSE);
475                                 set_oppose_acid(v, FALSE);
476                                 set_oppose_elec(v, FALSE);
477                                 set_oppose_fire(v, FALSE);
478                                 set_oppose_cold(v, FALSE);
479                                 set_oppose_pois(v, FALSE);
480                                 set_ultimate_res(v, FALSE);
481                         }
482                 }
483                 break;
484         }
485
486         return "";
487 }