OSDN Git Service

v3.0.0 Alpha5 OSDN最終版
[hengband/hengband.git] / src / realm-craft.c
1 #include "angband.h"
2 #include "cmd-spell.h"
3 #include "selfinfo.h"
4 #include "projection.h"
5 #include "spells-summon.h"
6 #include "spells-status.h"
7 #include "mutation.h"
8
9
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_craft_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         PLAYER_LEVEL plev = p_ptr->lev;
25
26         switch (spell)
27         {
28         case 0:
29                 if (name) return _("赤外線視力", "Infravision");
30                 if (desc) return _("一定時間、赤外線視力が増強される。", "Gives infravision for a while.");
31
32                 {
33                         int base = 100;
34
35                         if (info) return info_duration(base, base);
36
37                         if (cast)
38                         {
39                                 set_tim_infra(base + randint1(base), FALSE);
40                         }
41                 }
42                 break;
43
44         case 1:
45                 if (name) return _("回復力強化", "Regeneration");
46                 if (desc) return _("一定時間、回復力が増強される。", "Gives regeneration ability for a while.");
47
48                 {
49                         int base = 80;
50
51                         if (info) return info_duration(base, base);
52
53                         if (cast)
54                         {
55                                 set_tim_regen(base + randint1(base), FALSE);
56                         }
57                 }
58                 break;
59
60         case 2:
61                 if (name) return _("空腹充足", "Satisfy Hunger");
62                 if (desc) return _("満腹になる。", "Satisfies hunger.");
63
64                 {
65                         if (cast)
66                         {
67                                 set_food(PY_FOOD_MAX - 1);
68                         }
69                 }
70                 break;
71
72         case 3:
73                 if (name) return _("耐冷気", "Resist Cold");
74                 if (desc) return _("一定時間、冷気への耐性を得る。装備による耐性に累積する。",
75                         "Gives resistance to cold. This resistance can be added to which from equipment for more powerful resistance.");
76
77                 {
78                         int base = 20;
79
80                         if (info) return info_duration(base, base);
81
82                         if (cast)
83                         {
84                                 set_oppose_cold(randint1(base) + base, FALSE);
85                         }
86                 }
87                 break;
88
89         case 4:
90                 if (name) return _("耐火炎", "Resist Fire");
91                 if (desc) return _("一定時間、炎への耐性を得る。装備による耐性に累積する。",
92                         "Gives resistance to fire. This resistance can be added to which from equipment for more powerful resistance.");
93
94                 {
95                         int base = 20;
96
97                         if (info) return info_duration(base, base);
98
99                         if (cast)
100                         {
101                                 set_oppose_fire(randint1(base) + base, FALSE);
102                         }
103                 }
104                 break;
105
106         case 5:
107                 if (name) return _("士気高揚", "Heroism");
108                 if (desc) return _("一定時間、ヒーロー気分になる。", "Removes fear, and gives bonus to hit and 10 more HP for a while.");
109
110                 {
111                         int base = 25;
112
113                         if (info) return info_duration(base, base);
114
115                         if (cast)
116                         {
117                                 (void)heroism(base);
118                         }
119                 }
120                 break;
121
122         case 6:
123                 if (name) return _("耐電撃", "Resist Lightning");
124                 if (desc) return _("一定時間、電撃への耐性を得る。装備による耐性に累積する。",
125                         "Gives resistance to electricity. This resistance can be added to which from equipment for more powerful resistance.");
126
127                 {
128                         int base = 20;
129
130                         if (info) return info_duration(base, base);
131
132                         if (cast)
133                         {
134                                 set_oppose_elec(randint1(base) + base, FALSE);
135                         }
136                 }
137                 break;
138
139         case 7:
140                 if (name) return _("耐酸", "Resist Acid");
141                 if (desc) return _("一定時間、酸への耐性を得る。装備による耐性に累積する。",
142                         "Gives resistance to acid. This resistance can be added to which from equipment for more powerful resistance.");
143
144                 {
145                         int base = 20;
146
147                         if (info) return info_duration(base, base);
148
149                         if (cast)
150                         {
151                                 set_oppose_acid(randint1(base) + base, FALSE);
152                         }
153                 }
154                 break;
155
156         case 8:
157                 if (name) return _("透明視認", "See Invisibility");
158                 if (desc) return _("一定時間、透明なものが見えるようになる。", "Gives see invisible for a while.");
159
160                 {
161                         int base = 24;
162
163                         if (info) return info_duration(base, base);
164
165                         if (cast)
166                         {
167                                 set_tim_invis(randint1(base) + base, FALSE);
168                         }
169                 }
170                 break;
171
172         case 9:
173                 if (name) return _("解呪", "Remove Curse");
174                 if (desc) return _("アイテムにかかった弱い呪いを解除する。", "Removes normal curses from equipped items.");
175
176                 {
177                         if (cast) (void)remove_curse();
178                 }
179                 break;
180
181         case 10:
182                 if (name) return _("耐毒", "Resist Poison");
183                 if (desc) return _("一定時間、毒への耐性を得る。装備による耐性に累積する。",
184                         "Gives resistance to poison. This resistance can be added to which from equipment for more powerful resistance.");
185
186                 {
187                         int base = 20;
188
189                         if (info) return info_duration(base, base);
190
191                         if (cast)
192                         {
193                                 set_oppose_pois(randint1(base) + base, FALSE);
194                         }
195                 }
196                 break;
197
198         case 11:
199                 if (name) return _("狂戦士化", "Berserk");
200                 if (desc) return _("狂戦士化し、恐怖を除去する。", "Gives bonus to hit and HP, immunity to fear for a while. But decreases AC.");
201
202                 {
203                         int base = 25;
204
205                         if (info) return info_duration(base, base);
206
207                         if (cast)
208                         {
209                                 (void)berserk(base + randint1(base));
210                         }
211                 }
212                 break;
213
214         case 12:
215                 if (name) return _("自己分析", "Self Knowledge");
216                 if (desc) return _("現在の自分の状態を完全に知る。",
217                         "Gives you useful info regarding your current resistances, the powers of your weapon and maximum limits of your stats.");
218
219                 {
220                         if (cast)
221                         {
222                                 self_knowledge();
223                         }
224                 }
225                 break;
226
227         case 13:
228                 if (name) return _("対邪悪結界", "Protection from Evil");
229                 if (desc) return _("邪悪なモンスターの攻撃を防ぐバリアを張る。", "Gives aura which protect you from evil monster's physical attack.");
230
231                 {
232                         int base = 3 * plev;
233                         DICE_SID sides = 25;
234
235                         if (info) return info_duration(base, sides);
236
237                         if (cast)
238                         {
239                                 set_protevil(randint1(sides) + base, FALSE);
240                         }
241                 }
242                 break;
243
244         case 14:
245                 if (name) return _("癒し", "Cure");
246                 if (desc) return _("毒、朦朧状態、負傷を全快させ、幻覚を直す。", "Heals poison, stun, cut and hallucination completely.");
247
248                 {
249                         if (cast)
250                         {
251                                 (void)true_healing(0);
252                         }
253                 }
254                 break;
255
256         case 15:
257                 if (name) return _("魔法剣", "Mana Branding");
258                 if (desc) return _("一定時間、武器に冷気、炎、電撃、酸、毒のいずれかの属性をつける。武器を持たないと使えない。",
259                         "Makes current weapon some elemental branded. You must wield weapons.");
260
261                 {
262                         int base = plev / 2;
263
264                         if (info) return info_duration(base, base);
265
266                         if (cast)
267                         {
268                                 if (!choose_ele_attack()) return NULL;
269                         }
270                 }
271                 break;
272
273         case 16:
274                 if (name) return _("テレパシー", "Telepathy");
275                 if (desc) return _("一定時間、テレパシー能力を得る。", "Gives telepathy for a while.");
276
277                 {
278                         int base = 25;
279                         DICE_SID sides = 30;
280
281                         if (info) return info_duration(base, sides);
282
283                         if (cast)
284                         {
285                                 set_tim_esp(randint1(sides) + base, FALSE);
286                         }
287                 }
288                 break;
289
290         case 17:
291                 if (name) return _("肌石化", "Stone Skin");
292                 if (desc) return _("一定時間、ACを上昇させる。", "Gives bonus to AC for a while.");
293
294                 {
295                         int base = 30;
296                         DICE_SID sides = 20;
297
298                         if (info) return info_duration(base, sides);
299
300                         if (cast)
301                         {
302                                 set_shield(randint1(sides) + base, FALSE);
303                         }
304                 }
305                 break;
306
307         case 18:
308                 if (name) return _("全耐性", "Resistance");
309                 if (desc) return _("一定時間、酸、電撃、炎、冷気、毒に対する耐性を得る。装備による耐性に累積する。",
310                         "Gives resistance to fire, cold, electricity, acid and poison for a while. These resistances can be added to which from equipment for more powerful resistances.");
311
312                 {
313                         int base = 20;
314
315                         if (info) return info_duration(base, base);
316
317                         if (cast)
318                         {
319                                 set_oppose_acid(randint1(base) + base, FALSE);
320                                 set_oppose_elec(randint1(base) + base, FALSE);
321                                 set_oppose_fire(randint1(base) + base, FALSE);
322                                 set_oppose_cold(randint1(base) + base, FALSE);
323                                 set_oppose_pois(randint1(base) + base, FALSE);
324                         }
325                 }
326                 break;
327
328         case 19:
329                 if (name) return _("スピード", "Haste Self");
330                 if (desc) return _("一定時間、加速する。", "Hastes you for a while.");
331
332                 {
333                         int base = plev;
334                         DICE_SID sides = 20 + plev;
335
336                         if (info) return info_duration(base, sides);
337
338                         if (cast)
339                         {
340                                 set_fast(randint1(sides) + base, FALSE);
341                         }
342                 }
343                 break;
344
345         case 20:
346                 if (name) return _("壁抜け", "Walk through Wall");
347                 if (desc) return _("一定時間、半物質化し壁を通り抜けられるようになる。", "Gives ability to pass walls for a while.");
348
349                 {
350                         int base = plev / 2;
351
352                         if (info) return info_duration(base, base);
353
354                         if (cast)
355                         {
356                                 set_kabenuke(randint1(base) + base, FALSE);
357                         }
358                 }
359                 break;
360
361         case 21:
362                 if (name) return _("盾磨き", "Polish Shield");
363                 if (desc) return _("盾に反射の属性をつける。", "Makes a shield a shield of reflection.");
364
365                 {
366                         if (cast)
367                         {
368                                 pulish_shield();
369                         }
370                 }
371                 break;
372
373         case 22:
374                 if (name) return _("ゴーレム製造", "Create Golem");
375                 if (desc) return _("1体のゴーレムを製造する。", "Creates a golem.");
376
377                 {
378                         if (cast)
379                         {
380                                 if (summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_GOLEM, PM_FORCE_PET, '\0'))
381                                 {
382                                         msg_print(_("ゴーレムを作った。", "You make a golem."));
383                                 }
384                                 else
385                                 {
386                                         msg_print(_("うまくゴーレムを作れなかった。", "No Golems arrive."));
387                                 }
388                         }
389                 }
390                 break;
391
392         case 23:
393                 if (name) return _("魔法の鎧", "Magical armor");
394                 if (desc) return _("一定時間、魔法防御力とACが上がり、混乱と盲目の耐性、反射能力、麻痺知らず、浮遊を得る。",
395                         "Gives resistance to magic, bonus to AC, resistance to confusion, blindness, reflection, free action and levitation for a while.");
396
397                 {
398                         int base = 20;
399
400                         if (info) return info_duration(base, base);
401
402                         if (cast)
403                         {
404                                 set_magicdef(randint1(base) + base, FALSE);
405                         }
406                 }
407                 break;
408
409         case 24:
410                 if (name) return _("装備無力化", "Remove Enchantment");
411                 if (desc) return _("武器・防具にかけられたあらゆる魔力を完全に解除する。", "Removes all magics completely from any weapon or armor.");
412
413                 {
414                         if (cast)
415                         {
416                                 if (!mundane_spell(TRUE)) return NULL;
417                         }
418                 }
419                 break;
420
421         case 25:
422                 if (name) return _("呪い粉砕", "Remove All Curse");
423                 if (desc) return _("アイテムにかかった強力な呪いを解除する。", "Removes normal and heavy curse from equipped items.");
424
425                 {
426                         if (cast) (void)remove_all_curse();
427                 }
428                 break;
429
430         case 26:
431                 if (name) return _("完全なる知識", "Knowledge True");
432                 if (desc) return _("アイテムの持つ能力を完全に知る。", "*Identifies* an item.");
433
434                 {
435                         if (cast)
436                         {
437                                 if (!identify_fully(FALSE)) return NULL;
438                         }
439                 }
440                 break;
441
442         case 27:
443                 if (name) return _("武器強化", "Enchant Weapon");
444                 if (desc) return _("武器の命中率修正とダメージ修正を強化する。", "Attempts to increase +to-hit, +to-dam of a weapon.");
445
446                 {
447                         if (cast)
448                         {
449                                 if (!enchant_spell(randint0(4) + 1, randint0(4) + 1, 0)) return NULL;
450                         }
451                 }
452                 break;
453
454         case 28:
455                 if (name) return _("防具強化", "Enchant Armor");
456                 if (desc) return _("鎧の防御修正を強化する。", "Attempts to increase +AC of an armor.");
457
458                 {
459                         if (cast)
460                         {
461                                 if (!enchant_spell(0, 0, randint0(3) + 2)) return NULL;
462                         }
463                 }
464                 break;
465
466         case 29:
467                 if (name) return _("武器属性付与", "Brand Weapon");
468                 if (desc) return _("武器にランダムに属性をつける。", "Makes current weapon a random ego weapon.");
469
470                 {
471                         if (cast)
472                         {
473                                 brand_weapon(randint0(18));
474                         }
475                 }
476                 break;
477
478         case 30:
479                 if (name) return _("人間トランプ", "Living Trump");
480                 if (desc) return _("ランダムにテレポートする突然変異か、自分の意思でテレポートする突然変異が身につく。",
481                         "Gives mutation which makes you teleport randomly or makes you able to teleport at will.");
482
483                 {
484                         if (cast)
485                         {
486                                 int mutation;
487
488                                 if (one_in_(7))
489                                         /* Teleport control */
490                                         mutation = 12;
491                                 else
492                                         /* Random teleportation (uncontrolled) */
493                                         mutation = 77;
494
495                                 /* Gain the mutation */
496                                 if (gain_random_mutation(mutation))
497                                 {
498                                         msg_print(_("あなたは生きているカードに変わった。", "You have turned into a Living Trump."));
499                                 }
500                         }
501                 }
502                 break;
503
504         case 31:
505                 if (name) return _("属性への免疫", "Immunity");
506                 if (desc) return _("一定時間、冷気、炎、電撃、酸のいずれかに対する免疫を得る。",
507                         "Gives an immunity to fire, cold, electricity or acid for a while.");
508
509                 {
510                         int base = 13;
511
512                         if (info) return info_duration(base, base);
513
514                         if (cast)
515                         {
516                                 if (!choose_ele_immune(base + randint1(base))) return NULL;
517                         }
518                 }
519                 break;
520         }
521
522         return "";
523 }