OSDN Git Service

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