OSDN Git Service

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