OSDN Git Service

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