OSDN Git Service

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