OSDN Git Service

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