OSDN Git Service

[Refactor] #40574 Separated mutation/mutation-investor.c from mutation.c/h
[hengband/hengband.git] / src / mutation / mutation.c
1 /*!
2  * @file mutation.c
3  * @brief 突然変異ルールの実装 / Mutation effects (and racial powers)
4  * @date 2014/01/11
5  * @author
6  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
7  *\n
8  * This software may be copied and distributed for educational, research,\n
9  * and not for profit purposes provided that this copyright and statement\n
10  * are included in all such copies.  Other copyrights may also apply.\n
11  * 2014 Deskull rearranged comment for Doxygen.\n
12  */
13
14 #include "mutation/mutation.h"
15 #include "cmd-io/cmd-dump.h"
16 #include "cmd-item/cmd-throw.h"
17 #include "core/asking-player.h"
18 #include "core/player-update-types.h"
19 #include "core/show-file.h"
20 #include "core/stuff-handler.h"
21 #include "effect/spells-effect-util.h"
22 #include "game-option/play-record-options.h"
23 #include "grid/grid.h"
24 #include "inventory/inventory-slot-types.h"
25 #include "io/write-diary.h"
26 #include "mind/mind-mage.h"
27 #include "mind/mind-warrior.h"
28 #include "monster-floor/monster-remover.h"
29 #include "monster-floor/monster-summon.h"
30 #include "monster-floor/place-monster-types.h"
31 #include "monster-race/monster-race.h"
32 #include "monster-race/race-flags1.h"
33 #include "monster-race/race-flags3.h"
34 #include "monster/monster-describer.h"
35 #include "monster/monster-description-types.h"
36 #include "monster/monster-flag-types.h"
37 #include "monster/monster-info.h"
38 #include "monster/smart-learn-types.h"
39 #include "mutation/gain-mutation-switcher.h"
40 #include "mutation/gain-mutation-util.h"
41 #include "mutation/mutation-flag-types.h"
42 #include "mutation/mutation-investor.h" // todo 相互依存している、このファイルからの依存はOK.
43 #include "mutation/mutation-techniques.h"
44 #include "object-enchant/item-feeling.h"
45 #include "object-hook/hook-checker.h"
46 #include "player/avatar.h"
47 #include "player/player-class.h"
48 #include "player/player-damage.h"
49 #include "player/player-personalities-types.h"
50 #include "player/player-race-types.h"
51 #include "player/selfinfo.h"
52 #include "racial/racial-vampire.h"
53 #include "spell-kind/earthquake.h"
54 #include "spell-kind/spells-charm.h"
55 #include "spell-kind/spells-detection.h"
56 #include "spell-kind/spells-fetcher.h"
57 #include "spell-kind/spells-launcher.h"
58 #include "spell-kind/spells-lite.h"
59 #include "spell-kind/spells-sight.h"
60 #include "spell-kind/spells-teleport.h"
61 #include "spell-kind/spells-world.h"
62 #include "spell-realm/spells-sorcery.h"
63 #include "spell/spell-types.h"
64 #include "spell/spells-status.h"
65 #include "spell/spells-summon.h"
66 #include "status/element-resistance.h"
67 #include "status/shape-changer.h"
68 #include "system/floor-type-definition.h"
69 #include "system/object-type-definition.h"
70 #include "target/target-getter.h"
71 #include "view/display-messages.h"
72
73 /*!
74  * @brief プレイヤーから突然変異を取り除く
75  * @param choose_mut 取り除きたい突然変異のID、0ならばランダムに消去
76  * @return なし
77  */
78 bool lose_mutation(player_type *creature_ptr, MUTATION_IDX choose_mut)
79 {
80     int attempts_left = 20;
81     concptr muta_desc = "";
82     bool muta_chosen = FALSE;
83     int muta_which = 0; // mutation_flag_type_1 とmutation_flag_type_2 の両対応とするため、敢えてint型で定義する
84     BIT_FLAGS *muta_class = NULL;
85     if (choose_mut)
86         attempts_left = 1;
87
88     while (attempts_left--) {
89         switch (choose_mut ? choose_mut : randint1(193)) {
90         case 1:
91         case 2:
92         case 3:
93         case 4:
94             muta_class = &(creature_ptr->muta1);
95             muta_which = MUT1_SPIT_ACID;
96             muta_desc = _("酸を吹きかける能力を失った。", "You lose the ability to spit acid.");
97             break;
98         case 5:
99         case 6:
100         case 7:
101             muta_class = &(creature_ptr->muta1);
102             muta_which = MUT1_BR_FIRE;
103             muta_desc = _("炎のブレスを吐く能力を失った。", "You lose the ability to breathe fire.");
104             break;
105         case 8:
106         case 9:
107             muta_class = &(creature_ptr->muta1);
108             muta_which = MUT1_HYPN_GAZE;
109             muta_desc = _("あなたの目はつまらない目になった。", "Your eyes look uninteresting.");
110             break;
111         case 10:
112         case 11:
113             muta_class = &(creature_ptr->muta1);
114             muta_which = MUT1_TELEKINES;
115             muta_desc = _("念動力で物を動かす能力を失った。", "You lose the ability to move objects telekinetically.");
116             break;
117         case 12:
118         case 13:
119         case 14:
120             muta_class = &(creature_ptr->muta1);
121             muta_which = MUT1_VTELEPORT;
122             muta_desc = _("自分の意思でテレポートする能力を失った。", "You lose the power of teleportation at will.");
123             break;
124         case 15:
125         case 16:
126             muta_class = &(creature_ptr->muta1);
127             muta_which = MUT1_MIND_BLST;
128             muta_desc = _("精神攻撃の能力を失った。", "You lose the power of Mind Blast.");
129             break;
130         case 17:
131         case 18:
132             muta_class = &(creature_ptr->muta1);
133             muta_which = MUT1_RADIATION;
134             muta_desc = _("あなたは放射能を発生しなくなった。", "You stop emitting hard radiation.");
135             break;
136         case 19:
137         case 20:
138             muta_class = &(creature_ptr->muta1);
139             muta_which = MUT1_VAMPIRISM;
140             muta_desc = _("吸血の能力を失った。", "You are no longer vampiric.");
141             break;
142         case 21:
143         case 22:
144         case 23:
145             muta_class = &(creature_ptr->muta1);
146             muta_which = MUT1_SMELL_MET;
147             muta_desc = _("金属の臭いを嗅げなくなった。", "You no longer smell a metallic odor.");
148             break;
149         case 24:
150         case 25:
151         case 26:
152         case 27:
153             muta_class = &(creature_ptr->muta1);
154             muta_which = MUT1_SMELL_MON;
155             muta_desc = _("不潔なモンスターの臭いを嗅げなくなった。", "You no longer smell filthy monsters.");
156             break;
157         case 28:
158         case 29:
159         case 30:
160             muta_class = &(creature_ptr->muta1);
161             muta_which = MUT1_BLINK;
162             muta_desc = _("近距離テレポートの能力を失った。", "You lose the power of minor teleportation.");
163             break;
164         case 31:
165         case 32:
166             muta_class = &(creature_ptr->muta1);
167             muta_which = MUT1_EAT_ROCK;
168             muta_desc = _("壁は美味しそうに見えなくなった。", "The walls look unappetizing.");
169             break;
170         case 33:
171         case 34:
172             muta_class = &(creature_ptr->muta1);
173             muta_which = MUT1_SWAP_POS;
174             muta_desc = _("あなたは自分の靴に留まる感じがする。", "You feel like staying in your own shoes.");
175             break;
176         case 35:
177         case 36:
178         case 37:
179             muta_class = &(creature_ptr->muta1);
180             muta_which = MUT1_SHRIEK;
181             muta_desc = _("あなたの声質は弱くなった。", "Your vocal cords get much weaker.");
182             break;
183         case 38:
184         case 39:
185         case 40:
186             muta_class = &(creature_ptr->muta1);
187             muta_which = MUT1_ILLUMINE;
188             muta_desc = _("部屋を明るく照らすことが出来なくなった。", "You can no longer light up rooms with your presence.");
189             break;
190         case 41:
191         case 42:
192             muta_class = &(creature_ptr->muta1);
193             muta_which = MUT1_DET_CURSE;
194             muta_desc = _("邪悪な魔法を感じられなくなった。", "You can no longer feel evil magics.");
195             break;
196         case 43:
197         case 44:
198         case 45:
199             muta_class = &(creature_ptr->muta1);
200             muta_which = MUT1_BERSERK;
201             muta_desc = _("制御できる激情を感じなくなった。", "You no longer feel a controlled rage.");
202             break;
203         case 46:
204             muta_class = &(creature_ptr->muta1);
205             muta_which = MUT1_POLYMORPH;
206             muta_desc = _("あなたの体は安定したように見える。", "Your body seems stable.");
207             break;
208         case 47:
209         case 48:
210             muta_class = &(creature_ptr->muta1);
211             muta_which = MUT1_MIDAS_TCH;
212             muta_desc = _("ミダスの手の能力を失った。", "You lose the Midas touch.");
213             break;
214         case 49:
215             muta_class = &(creature_ptr->muta1);
216             muta_which = MUT1_GROW_MOLD;
217             muta_desc = _("突然カビが嫌いになった。", "You feel a sudden dislike for mold.");
218             break;
219         case 50:
220         case 51:
221         case 52:
222             muta_class = &(creature_ptr->muta1);
223             muta_which = MUT1_RESIST;
224             muta_desc = _("傷つき易くなった気がする。", "You feel like you might be vulnerable.");
225             break;
226         case 53:
227         case 54:
228         case 55:
229             muta_class = &(creature_ptr->muta1);
230             muta_which = MUT1_EARTHQUAKE;
231             muta_desc = _("ダンジョンを壊す能力を失った。", "You lose the ability to wreck the dungeon.");
232             break;
233         case 56:
234             muta_class = &(creature_ptr->muta1);
235             muta_which = MUT1_EAT_MAGIC;
236             muta_desc = _("魔法のアイテムはもう美味しそうに見えなくなった。", "Your magic items no longer look delicious.");
237             break;
238         case 57:
239         case 58:
240             muta_class = &(creature_ptr->muta1);
241             muta_which = MUT1_WEIGH_MAG;
242             muta_desc = _("魔力を感じられなくなった。", "You no longer sense magic.");
243             break;
244         case 59:
245             muta_class = &(creature_ptr->muta1);
246             muta_which = MUT1_STERILITY;
247             muta_desc = _("たくさんの安堵の吐息が聞こえた。", "You hear a massed sigh of relief.");
248             break;
249         case 60:
250         case 61:
251             muta_class = &(creature_ptr->muta1);
252             muta_which = MUT1_HIT_AND_AWAY;
253             muta_desc = _("あちこちへ跳べる気分がなくなった。", "You no longer feel jumpy.");
254             break;
255         case 62:
256         case 63:
257         case 64:
258             muta_class = &(creature_ptr->muta1);
259             muta_which = MUT1_DAZZLE;
260             muta_desc = _("まばゆい閃光を発する能力を失った。", "You lose the ability to emit dazzling lights.");
261             break;
262         case 65:
263         case 66:
264         case 67:
265             muta_class = &(creature_ptr->muta1);
266             muta_which = MUT1_LASER_EYE;
267             muta_desc = _("眼が少しの間焼き付いて、痛みが和らいだ。", "Your eyes burn for a moment, then feel soothed.");
268             break;
269         case 68:
270         case 69:
271             muta_class = &(creature_ptr->muta1);
272             muta_which = MUT1_RECALL;
273             muta_desc = _("少しの間ホームシックになった。", "You feel briefly homesick.");
274             break;
275         case 70:
276             muta_class = &(creature_ptr->muta1);
277             muta_which = MUT1_BANISH;
278             muta_desc = _("神聖な怒りの力を感じなくなった。", "You no longer feel a holy wrath.");
279             break;
280         case 71:
281         case 72:
282             muta_class = &(creature_ptr->muta1);
283             muta_which = MUT1_COLD_TOUCH;
284             muta_desc = _("手が暖かくなった。", "Your hands warm up.");
285             break;
286         case 73:
287         case 74:
288             muta_class = &(creature_ptr->muta1);
289             muta_which = MUT1_LAUNCHER;
290             muta_desc = _("物を投げる手が弱くなった気がする。", "Your throwing arm feels much weaker.");
291             break;
292         case 75:
293             muta_class = &(creature_ptr->muta2);
294             muta_which = MUT2_BERS_RAGE;
295             muta_desc = _("凶暴化の発作にさらされなくなった!", "You are no longer subject to fits of berserk rage!");
296             break;
297         case 76:
298             muta_class = &(creature_ptr->muta2);
299             muta_which = MUT2_COWARDICE;
300             muta_desc = _("もう信じがたいほど臆病ではなくなった!", "You are no longer an incredible coward!");
301             break;
302         case 77:
303             muta_class = &(creature_ptr->muta2);
304             muta_which = MUT2_RTELEPORT;
305             muta_desc = _("あなたの位置はより確定的になった。", "Your position seems more certain.");
306             break;
307         case 78:
308             muta_class = &(creature_ptr->muta2);
309             muta_which = MUT2_ALCOHOL;
310             muta_desc = _("あなたはアルコールを分泌しなくなった!", "Your body stops producing alcohol!");
311             break;
312         case 79:
313             muta_class = &(creature_ptr->muta2);
314             muta_which = MUT2_HALLU;
315             muta_desc = _("幻覚をひき起こす精神障害を起こさなくなった!", "You are no longer afflicted by a hallucinatory insanity!");
316             break;
317         case 80:
318             muta_class = &(creature_ptr->muta2);
319             muta_which = MUT2_FLATULENT;
320             muta_desc = _("もう強烈な屁はこかなくなった。", "You are no longer subject to uncontrollable flatulence.");
321             break;
322         case 81:
323         case 82:
324             muta_class = &(creature_ptr->muta2);
325             muta_which = MUT2_SCOR_TAIL;
326             muta_desc = _("サソリの尻尾がなくなった!", "You lose your scorpion tail!");
327             break;
328         case 83:
329         case 84:
330             muta_class = &(creature_ptr->muta2);
331             muta_which = MUT2_HORNS;
332             muta_desc = _("額から角が消えた!", "Your horns vanish from your forehead!");
333             break;
334         case 85:
335         case 86:
336             muta_class = &(creature_ptr->muta2);
337             muta_which = MUT2_BEAK;
338             muta_desc = _("口が普通に戻った!", "Your mouth reverts to normal!");
339             break;
340         case 87:
341         case 88:
342             muta_class = &(creature_ptr->muta2);
343             muta_which = MUT2_ATT_DEMON;
344             muta_desc = _("デーモンを引き寄せなくなった。", "You stop attracting demons.");
345             break;
346         case 89:
347             muta_class = &(creature_ptr->muta2);
348             muta_which = MUT2_PROD_MANA;
349             muta_desc = _("制御不能な魔法のエネルギーを発生しなくなった。", "You stop producing magical energy uncontrollably.");
350             break;
351         case 90:
352         case 91:
353             muta_class = &(creature_ptr->muta2);
354             muta_which = MUT2_SPEED_FLUX;
355             muta_desc = _("躁鬱質でなくなった。", "You are no longer manic-depressive.");
356             break;
357         case 92:
358         case 93:
359             muta_class = &(creature_ptr->muta2);
360             muta_which = MUT2_BANISH_ALL;
361             muta_desc = _("背後に恐ろしい力を感じなくなった。", "You no longer feel a terrifying power lurking behind you.");
362             break;
363         case 94:
364             muta_class = &(creature_ptr->muta2);
365             muta_which = MUT2_EAT_LIGHT;
366             muta_desc = _("世界が明るいと感じる。", "You feel the world's a brighter place.");
367             break;
368         case 95:
369         case 96:
370             muta_class = &(creature_ptr->muta2);
371             muta_which = MUT2_TRUNK;
372             muta_desc = _("鼻が普通の長さに戻った。", "Your nose returns to a normal length.");
373             break;
374         case 97:
375             muta_class = &(creature_ptr->muta2);
376             muta_which = MUT2_ATT_ANIMAL;
377             muta_desc = _("動物を引き寄せなくなった。", "You stop attracting animals.");
378             break;
379         case 98:
380             muta_class = &(creature_ptr->muta2);
381             muta_which = MUT2_TENTACLES;
382             muta_desc = _("触手が消えた。", "Your tentacles vanish from your sides.");
383             break;
384         case 99:
385             muta_class = &(creature_ptr->muta2);
386             muta_which = MUT2_RAW_CHAOS;
387             muta_desc = _("周囲の空間が安定した気がする。", "You feel the universe is more stable around you.");
388             break;
389         case 100:
390         case 101:
391         case 102:
392             muta_class = &(creature_ptr->muta2);
393             muta_which = MUT2_NORMALITY;
394             muta_desc = _("普通に奇妙な感じがする。", "You feel normally strange.");
395             break;
396         case 103:
397             muta_class = &(creature_ptr->muta2);
398             muta_which = MUT2_WRAITH;
399             muta_desc = _("あなたは物質世界にしっかり存在している。", "You are firmly in the physical world.");
400             break;
401         case 104:
402             muta_class = &(creature_ptr->muta2);
403             muta_which = MUT2_POLY_WOUND;
404             muta_desc = _("古い傷からカオスの力が去っていった。", "You feel forces of chaos departing your old scars.");
405             break;
406         case 105:
407             muta_class = &(creature_ptr->muta2);
408             muta_which = MUT2_WASTING;
409             muta_desc = _("おぞましい衰弱病が治った!", "You are cured of the horrible wasting disease!");
410             break;
411         case 106:
412             muta_class = &(creature_ptr->muta2);
413             muta_which = MUT2_ATT_DRAGON;
414             muta_desc = _("ドラゴンを引き寄せなくなった。", "You stop attracting dragons.");
415             break;
416         case 107:
417         case 108:
418             muta_class = &(creature_ptr->muta2);
419             muta_which = MUT2_WEIRD_MIND;
420             muta_desc = _("思考が退屈な方向に戻った。", "Your thoughts return to boring paths.");
421             break;
422         case 109:
423             muta_class = &(creature_ptr->muta2);
424             muta_which = MUT2_NAUSEA;
425             muta_desc = _("胃が痙攣しなくなった。", "Your stomach stops roiling.");
426             break;
427         case 110:
428         case 111:
429             muta_class = &(creature_ptr->muta2);
430             muta_which = MUT2_CHAOS_GIFT;
431             muta_desc = _("混沌の神々の興味を惹かなくなった。", "You lose the attention of the chaos deities.");
432             break;
433         case 112:
434             muta_class = &(creature_ptr->muta2);
435             muta_which = MUT2_WALK_SHAD;
436             muta_desc = _("物質世界に捕らわれている気がする。", "You feel like you're trapped in reality.");
437             break;
438         case 113:
439         case 114:
440             muta_class = &(creature_ptr->muta2);
441             muta_which = MUT2_WARNING;
442             muta_desc = _("パラノイアでなくなった。", "You no longer feel paranoid.");
443             break;
444         case 115:
445             muta_class = &(creature_ptr->muta2);
446             muta_which = MUT2_INVULN;
447             muta_desc = _("無敵状態の発作を起こさなくなった。", "You are no longer blessed with fits of invulnerability.");
448             break;
449         case 116:
450         case 117:
451             muta_class = &(creature_ptr->muta2);
452             muta_which = MUT2_SP_TO_HP;
453             muta_desc = _("魔法の治癒の発作に襲われなくなった。", "You are no longer subject to fits of magical healing.");
454             break;
455         case 118:
456             muta_class = &(creature_ptr->muta2);
457             muta_which = MUT2_HP_TO_SP;
458             muta_desc = _("痛みを伴う精神明瞭化の発作に襲われなくなった。", "You are no longer subject to fits of painful clarity.");
459             break;
460         case 119:
461             muta_class = &(creature_ptr->muta2);
462             muta_which = MUT2_DISARM;
463             muta_desc = _("脚が元の大きさに戻った。", "Your feet shrink to their former size.");
464             break;
465         case 120:
466         case 121:
467         case 122:
468             muta_class = &(creature_ptr->muta3);
469             muta_which = MUT3_HYPER_STR;
470             muta_desc = _("筋肉が普通に戻った。", "Your muscles revert to normal.");
471             break;
472         case 123:
473         case 124:
474         case 125:
475             muta_class = &(creature_ptr->muta3);
476             muta_which = MUT3_PUNY;
477             muta_desc = _("筋肉が普通に戻った。", "Your muscles revert to normal.");
478             break;
479         case 126:
480         case 127:
481         case 128:
482             muta_class = &(creature_ptr->muta3);
483             muta_which = MUT3_HYPER_INT;
484             muta_desc = _("脳が普通に戻った。", "Your brain reverts to normal.");
485             break;
486         case 129:
487         case 130:
488         case 131:
489             muta_class = &(creature_ptr->muta3);
490             muta_which = MUT3_MORONIC;
491             muta_desc = _("脳が普通に戻った。", "Your brain reverts to normal.");
492             break;
493         case 132:
494         case 133:
495             muta_class = &(creature_ptr->muta3);
496             muta_which = MUT3_RESILIENT;
497             muta_desc = _("普通の丈夫さに戻った。", "You become ordinarily resilient again.");
498             break;
499         case 134:
500         case 135:
501             muta_class = &(creature_ptr->muta3);
502             muta_which = MUT3_XTRA_FAT;
503             muta_desc = _("奇跡的なダイエットに成功した!", "You benefit from a miracle diet!");
504             break;
505         case 136:
506         case 137:
507             muta_class = &(creature_ptr->muta3);
508             muta_which = MUT3_ALBINO;
509             muta_desc = _("アルビノでなくなった!", "You are no longer an albino!");
510             break;
511         case 138:
512         case 139:
513         case 140:
514             muta_class = &(creature_ptr->muta3);
515             muta_which = MUT3_FLESH_ROT;
516             muta_desc = _("肉体を腐敗させる病気が治った!", "Your flesh is no longer afflicted by a rotting disease!");
517             break;
518         case 141:
519         case 142:
520             muta_class = &(creature_ptr->muta3);
521             muta_which = MUT3_SILLY_VOI;
522             muta_desc = _("声質が普通に戻った。", "Your voice returns to normal.");
523             break;
524         case 143:
525         case 144:
526             muta_class = &(creature_ptr->muta3);
527             muta_which = MUT3_BLANK_FAC;
528             muta_desc = _("顔に目鼻が戻った。", "Your facial features return.");
529             break;
530         case 145:
531             muta_class = &(creature_ptr->muta3);
532             muta_which = MUT3_ILL_NORM;
533             muta_desc = _("心が安らぐ幻影を映し出さなくなった。", "You stop projecting a reassuring image.");
534             break;
535         case 146:
536         case 147:
537         case 148:
538             muta_class = &(creature_ptr->muta3);
539             muta_which = MUT3_XTRA_EYES;
540             muta_desc = _("余分な目が消えてしまった!", "Your extra eyes vanish!");
541             break;
542         case 149:
543         case 150:
544             muta_class = &(creature_ptr->muta3);
545             muta_which = MUT3_MAGIC_RES;
546             muta_desc = _("魔法に弱くなった。", "You become susceptible to magic again.");
547             break;
548         case 151:
549         case 152:
550         case 153:
551             muta_class = &(creature_ptr->muta3);
552             muta_which = MUT3_XTRA_NOIS;
553             muta_desc = _("奇妙な音を立てなくなった!", "You stop making strange noise!");
554             break;
555         case 154:
556         case 155:
557         case 156:
558             muta_class = &(creature_ptr->muta3);
559             muta_which = MUT3_INFRAVIS;
560             muta_desc = _("赤外線視力が落ちた。", "Your infravision is degraded.");
561             break;
562         case 157:
563         case 158:
564             muta_class = &(creature_ptr->muta3);
565             muta_which = MUT3_XTRA_LEGS;
566             muta_desc = _("余分な脚が消えてしまった!", "Your extra legs disappear!");
567             break;
568         case 159:
569         case 160:
570             muta_class = &(creature_ptr->muta3);
571             muta_which = MUT3_SHORT_LEG;
572             muta_desc = _("脚の長さが普通に戻った。", "Your legs lengthen to normal.");
573             break;
574         case 161:
575         case 162:
576             muta_class = &(creature_ptr->muta3);
577             muta_which = MUT3_ELEC_TOUC;
578             muta_desc = _("体を電流が流れなくなった。", "Electricity stops running through you.");
579             break;
580         case 163:
581         case 164:
582             muta_class = &(creature_ptr->muta3);
583             muta_which = MUT3_FIRE_BODY;
584             muta_desc = _("体が炎に包まれなくなった。", "Your body is no longer enveloped in flames.");
585             break;
586         case 165:
587         case 166:
588         case 167:
589             muta_class = &(creature_ptr->muta3);
590             muta_which = MUT3_WART_SKIN;
591             muta_desc = _("イボイボが消えた!", "Your warts disappear!");
592             break;
593         case 168:
594         case 169:
595         case 170:
596             muta_class = &(creature_ptr->muta3);
597             muta_which = MUT3_SCALES;
598             muta_desc = _("鱗が消えた!", "Your scales vanish!");
599             break;
600         case 171:
601         case 172:
602             muta_class = &(creature_ptr->muta3);
603             muta_which = MUT3_IRON_SKIN;
604             muta_desc = _("肌が肉にもどった!", "Your skin reverts to flesh!");
605             break;
606         case 173:
607         case 174:
608             muta_class = &(creature_ptr->muta3);
609             muta_which = MUT3_WINGS;
610             muta_desc = _("背中の羽根が取れ落ちた。", "Your wings fall off.");
611             break;
612         case 175:
613         case 176:
614         case 177:
615             muta_class = &(creature_ptr->muta3);
616             muta_which = MUT3_FEARLESS;
617             muta_desc = _("再び恐怖を感じるようになった。", "You begin to feel fear again.");
618             break;
619         case 178:
620         case 179:
621             muta_class = &(creature_ptr->muta3);
622             muta_which = MUT3_REGEN;
623             muta_desc = _("急速回復しなくなった。", "You stop regenerating.");
624             break;
625         case 180:
626         case 181:
627             muta_class = &(creature_ptr->muta3);
628             muta_which = MUT3_ESP;
629             muta_desc = _("テレパシーの能力を失った!", "You lose your telepathic ability!");
630             break;
631         case 182:
632         case 183:
633         case 184:
634             muta_class = &(creature_ptr->muta3);
635             muta_which = MUT3_LIMBER;
636             muta_desc = _("筋肉が硬くなった。", "Your muscles stiffen.");
637             break;
638         case 185:
639         case 186:
640         case 187:
641             muta_class = &(creature_ptr->muta3);
642             muta_which = MUT3_ARTHRITIS;
643             muta_desc = _("関節が痛くなくなった。", "Your joints stop hurting.");
644             break;
645         case 188:
646             muta_class = &(creature_ptr->muta3);
647             muta_which = MUT3_BAD_LUCK;
648             muta_desc = _("黒いオーラは渦巻いて消えた。", "Your black aura swirls and fades.");
649             break;
650         case 189:
651             muta_class = &(creature_ptr->muta3);
652             muta_which = MUT3_VULN_ELEM;
653             muta_desc = _("無防備な感じはなくなった。", "You feel less exposed.");
654             break;
655         case 190:
656         case 191:
657         case 192:
658             muta_class = &(creature_ptr->muta3);
659             muta_which = MUT3_MOTION;
660             muta_desc = _("動作の正確さがなくなった。", "You move with less assurance.");
661             break;
662         case 193:
663             if (creature_ptr->pseikaku == PERSONALITY_LUCKY)
664                 break;
665             muta_class = &(creature_ptr->muta3);
666             muta_which = MUT3_GOOD_LUCK;
667             muta_desc = _("白いオーラは輝いて消えた。", "Your white aura shimmers and fades.");
668             break;
669         default:
670             muta_class = NULL;
671             muta_which = 0;
672             break;
673         }
674
675         if (muta_class && muta_which) {
676             if (*(muta_class)&muta_which) {
677                 muta_chosen = TRUE;
678             }
679         }
680
681         if (muta_chosen == TRUE)
682             break;
683     }
684
685     if (!muta_chosen)
686         return FALSE;
687
688     msg_print(muta_desc);
689     *muta_class &= ~(muta_which);
690     creature_ptr->update |= PU_BONUS;
691     handle_stuff(creature_ptr);
692     creature_ptr->mutant_regenerate_mod = calc_mutant_regenerate_mod(creature_ptr);
693     return TRUE;
694 }
695
696 void lose_all_mutations(player_type *creature_ptr)
697 {
698     if (creature_ptr->muta1 || creature_ptr->muta2 || creature_ptr->muta3) {
699         chg_virtue(creature_ptr, V_CHANCE, -5);
700         msg_print(_("全ての突然変異が治った。", "You are cured of all mutations."));
701         creature_ptr->muta1 = creature_ptr->muta2 = creature_ptr->muta3 = 0;
702         creature_ptr->update |= PU_BONUS;
703         handle_stuff(creature_ptr);
704         creature_ptr->mutant_regenerate_mod = calc_mutant_regenerate_mod(creature_ptr);
705     }
706 }
707
708 /*!
709  * @brief 現在プレイヤー得ている突然変異の数を返す。
710  * @return 現在得ている突然変異の数
711  */
712 static int count_mutations(player_type *creature_ptr)
713 {
714     return count_bits(creature_ptr->muta1) + count_bits(creature_ptr->muta2) + count_bits(creature_ptr->muta3);
715 }
716
717 /*!
718  * @brief 突然変異による自然回復ペナルティをパーセント値で返す /
719  * Return the modifier to the regeneration rate (in percent)
720  * @return ペナルティ修正(%)
721  * @details
722  * Beastman get 10 "free" mutations and only 5% decrease per additional mutation.
723  * Max 90% decrease in regeneration speed.
724  */
725 int calc_mutant_regenerate_mod(player_type *creature_ptr)
726 {
727     int regen;
728     int mod = 10;
729     int count = count_mutations(creature_ptr);
730     if (creature_ptr->pseikaku == PERSONALITY_LUCKY)
731         count--;
732
733     if (creature_ptr->prace == RACE_BEASTMAN) {
734         count -= 10;
735         mod = 5;
736     }
737
738     if (count <= 0)
739         return 100;
740
741     regen = 100 - count * mod;
742     if (regen < 10)
743         regen = 10;
744
745     return (regen);
746 }
747
748 /*!
749  * @brief 突然変異のレイシャル効果実装
750  * @param creature_ptr プレーヤーへの参照ポインタ
751  * @param power 発動させる突然変異レイシャルのID
752  * @return レイシャルを実行した場合TRUE、キャンセルした場合FALSEを返す
753  */
754 bool exe_mutation_power(player_type *creature_ptr, int power)
755 {
756     DIRECTION dir = 0;
757     PLAYER_LEVEL lvl = creature_ptr->lev;
758     switch (power) {
759     case MUT1_SPIT_ACID:
760         if (!get_aim_dir(creature_ptr, &dir))
761             return FALSE;
762
763         stop_mouth(creature_ptr);
764         msg_print(_("酸を吐きかけた...", "You spit acid..."));
765         fire_ball(creature_ptr, GF_ACID, dir, lvl, 1 + (lvl / 30));
766         return TRUE;
767     case MUT1_BR_FIRE:
768         if (!get_aim_dir(creature_ptr, &dir))
769             return FALSE;
770
771         stop_mouth(creature_ptr);
772         msg_print(_("あなたは火炎のブレスを吐いた...", "You breathe fire..."));
773         fire_breath(creature_ptr, GF_FIRE, dir, lvl * 2, 1 + (lvl / 20));
774         return TRUE;
775     case MUT1_HYPN_GAZE:
776         if (!get_aim_dir(creature_ptr, &dir))
777             return FALSE;
778
779         msg_print(_("あなたの目は幻惑的になった...", "Your eyes look mesmerizing..."));
780         (void)charm_monster(creature_ptr, dir, lvl);
781         return TRUE;
782     case MUT1_TELEKINES:
783         if (!get_aim_dir(creature_ptr, &dir))
784             return FALSE;
785
786         msg_print(_("集中している...", "You concentrate..."));
787         fetch_item(creature_ptr, dir, lvl * 10, TRUE);
788         return TRUE;
789     case MUT1_VTELEPORT:
790         msg_print(_("集中している...", "You concentrate..."));
791         teleport_player(creature_ptr, 10 + 4 * lvl, TELEPORT_SPONTANEOUS);
792         return TRUE;
793     case MUT1_MIND_BLST:
794         if (!get_aim_dir(creature_ptr, &dir))
795             return FALSE;
796
797         msg_print(_("集中している...", "You concentrate..."));
798         fire_bolt(creature_ptr, GF_PSI, dir, damroll(3 + ((lvl - 1) / 5), 3));
799         return TRUE;
800     case MUT1_RADIATION:
801         msg_print(_("体から放射能が発生した!", "Radiation flows from your body!"));
802         fire_ball(creature_ptr, GF_NUKE, 0, (lvl * 2), 3 + (lvl / 20));
803         return TRUE;
804     case MUT1_VAMPIRISM:
805         vampirism(creature_ptr);
806         return TRUE;
807     case MUT1_SMELL_MET:
808         stop_mouth(creature_ptr);
809         (void)detect_treasure(creature_ptr, DETECT_RAD_DEFAULT);
810         return TRUE;
811     case MUT1_SMELL_MON:
812         stop_mouth(creature_ptr);
813         (void)detect_monsters_normal(creature_ptr, DETECT_RAD_DEFAULT);
814         return TRUE;
815     case MUT1_BLINK:
816         teleport_player(creature_ptr, 10, TELEPORT_SPONTANEOUS);
817         return TRUE;
818     case MUT1_EAT_ROCK:
819         return eat_rock(creature_ptr);
820     case MUT1_SWAP_POS:
821         project_length = -1;
822         if (!get_aim_dir(creature_ptr, &dir)) {
823             project_length = 0;
824             return FALSE;
825         }
826
827         (void)teleport_swap(creature_ptr, dir);
828         project_length = 0;
829         return TRUE;
830     case MUT1_SHRIEK:
831         stop_mouth(creature_ptr);
832         (void)fire_ball(creature_ptr, GF_SOUND, 0, 2 * lvl, 8);
833         (void)aggravate_monsters(creature_ptr, 0);
834         return TRUE;
835     case MUT1_ILLUMINE:
836         (void)lite_area(creature_ptr, damroll(2, (lvl / 2)), (lvl / 10) + 1);
837         return TRUE;
838     case MUT1_DET_CURSE:
839         for (int i = 0; i < INVEN_TOTAL; i++) {
840             object_type *o_ptr = &creature_ptr->inventory_list[i];
841             if ((o_ptr->k_idx == 0) || !object_is_cursed(o_ptr))
842                 continue;
843
844             o_ptr->feeling = FEEL_CURSED;
845         }
846
847         return TRUE;
848     case MUT1_BERSERK:
849         (void)berserk(creature_ptr, randint1(25) + 25);
850         return TRUE;
851     case MUT1_POLYMORPH:
852         if (!get_check(_("変身します。よろしいですか?", "You will polymorph your self. Are you sure? ")))
853             return FALSE;
854
855         do_poly_self(creature_ptr);
856         return TRUE;
857     case MUT1_MIDAS_TCH:
858         return alchemy(creature_ptr);
859     case MUT1_GROW_MOLD:
860         for (DIRECTION i = 0; i < 8; i++)
861             summon_specific(creature_ptr, -1, creature_ptr->y, creature_ptr->x, lvl, SUMMON_MOLD, PM_FORCE_PET);
862
863         return TRUE;
864     case MUT1_RESIST: {
865         int num = lvl / 10;
866         TIME_EFFECT dur = randint1(20) + 20;
867         if (randint0(5) < num) {
868             (void)set_oppose_acid(creature_ptr, dur, FALSE);
869             num--;
870         }
871
872         if (randint0(4) < num) {
873             (void)set_oppose_elec(creature_ptr, dur, FALSE);
874             num--;
875         }
876
877         if (randint0(3) < num) {
878             (void)set_oppose_fire(creature_ptr, dur, FALSE);
879             num--;
880         }
881
882         if (randint0(2) < num) {
883             (void)set_oppose_cold(creature_ptr, dur, FALSE);
884             num--;
885         }
886
887         if (num != 0) {
888             (void)set_oppose_pois(creature_ptr, dur, FALSE);
889             num--;
890         }
891
892         return TRUE;
893     }
894     case MUT1_EARTHQUAKE:
895         (void)earthquake(creature_ptr, creature_ptr->y, creature_ptr->x, 10, 0);
896         return TRUE;
897     case MUT1_EAT_MAGIC:
898         return eat_magic(creature_ptr, creature_ptr->lev * 2);
899     case MUT1_WEIGH_MAG:
900         report_magics(creature_ptr);
901         return TRUE;
902     case MUT1_STERILITY:
903         msg_print(_("突然頭が痛くなった!", "You suddenly have a headache!"));
904         take_hit(creature_ptr, DAMAGE_LOSELIFE, randint1(17) + 17, _("禁欲を強いた疲労", "the strain of forcing abstinence"), -1);
905         creature_ptr->current_floor_ptr->num_repro += MAX_REPRO;
906         return TRUE;
907     case MUT1_HIT_AND_AWAY:
908         return hit_and_away(creature_ptr);
909     case MUT1_DAZZLE:
910         stun_monsters(creature_ptr, lvl * 4);
911         confuse_monsters(creature_ptr, lvl * 4);
912         turn_monsters(creature_ptr, lvl * 4);
913         return TRUE;
914     case MUT1_LASER_EYE:
915         if (!get_aim_dir(creature_ptr, &dir))
916             return FALSE;
917
918         fire_beam(creature_ptr, GF_LITE, dir, 2 * lvl);
919         return TRUE;
920     case MUT1_RECALL:
921         return recall_player(creature_ptr, randint0(21) + 15);
922     case MUT1_BANISH: {
923         if (!get_direction(creature_ptr, &dir, FALSE, FALSE))
924             return FALSE;
925
926         POSITION y = creature_ptr->y + ddy[dir];
927         POSITION x = creature_ptr->x + ddx[dir];
928         grid_type *g_ptr;
929         g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
930
931         if (!g_ptr->m_idx) {
932             msg_print(_("邪悪な存在を感じとれません!", "You sense no evil there!"));
933             return TRUE;
934         }
935
936         monster_type *m_ptr;
937         m_ptr = &creature_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
938         monster_race *r_ptr;
939         r_ptr = &r_info[m_ptr->r_idx];
940         if ((r_ptr->flags3 & RF3_EVIL) && !(r_ptr->flags1 & RF1_QUESTOR) && !(r_ptr->flags1 & RF1_UNIQUE) && !creature_ptr->current_floor_ptr->inside_arena
941             && !creature_ptr->current_floor_ptr->inside_quest && (r_ptr->level < randint1(creature_ptr->lev + 50)) && !(m_ptr->mflag2 & MFLAG2_NOGENO)) {
942             if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname) {
943                 GAME_TEXT m_name[MAX_NLEN];
944                 monster_desc(creature_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
945                 exe_write_diary(creature_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
946             }
947
948             delete_monster_idx(creature_ptr, g_ptr->m_idx);
949             msg_print(_("その邪悪なモンスターは硫黄臭い煙とともに消え去った!", "The evil creature vanishes in a puff of sulfurous smoke!"));
950             return TRUE;
951         }
952
953         msg_print(_("祈りは効果がなかった!", "Your invocation is ineffectual!"));
954         if (one_in_(13))
955             m_ptr->mflag2 |= MFLAG2_NOGENO;
956
957         return TRUE;
958     }
959     case MUT1_COLD_TOUCH: {
960         if (!get_direction(creature_ptr, &dir, FALSE, FALSE))
961             return FALSE;
962
963         POSITION y = creature_ptr->y + ddy[dir];
964         POSITION x = creature_ptr->x + ddx[dir];
965         grid_type *g_ptr;
966         g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
967         if (!g_ptr->m_idx) {
968             msg_print(_("あなたは何もない場所で手を振った。", "You wave your hands in the air."));
969             return TRUE;
970         }
971
972         fire_bolt(creature_ptr, GF_COLD, dir, 2 * lvl);
973         return TRUE;
974     }
975     case 3:
976         return do_cmd_throw(creature_ptr, 2 + lvl / 40, FALSE, -1);
977     default:
978         free_turn(creature_ptr);
979         msg_format(_("能力 %s は実装されていません。", "Power %s not implemented. Oops."), power);
980         return TRUE;
981     }
982 }
983
984 void become_living_trump(player_type *creature_ptr)
985 {
986     /* 1/7 Teleport control and 6/7 Random teleportation (uncontrolled) */
987     MUTATION_IDX mutation = one_in_(7) ? 12 : 77;
988     if (gain_mutation(creature_ptr, mutation))
989         msg_print(_("あなたは生きているカードに変わった。", "You have turned into a Living Trump."));
990 }
991
992 void set_mutation_flags(player_type *creature_ptr)
993 {
994     if (creature_ptr->muta3 == 0)
995         return;
996
997     if (creature_ptr->muta3 & MUT3_FLESH_ROT)
998         creature_ptr->regenerate = FALSE;
999
1000     if (creature_ptr->muta3 & MUT3_ELEC_TOUC)
1001         creature_ptr->sh_elec = TRUE;
1002
1003     if (creature_ptr->muta3 & MUT3_FIRE_BODY) {
1004         creature_ptr->sh_fire = TRUE;
1005         creature_ptr->lite = TRUE;
1006     }
1007
1008     if (creature_ptr->muta3 & MUT3_WINGS)
1009         creature_ptr->levitation = TRUE;
1010
1011     if (creature_ptr->muta3 & MUT3_FEARLESS)
1012         creature_ptr->resist_fear = TRUE;
1013
1014     if (creature_ptr->muta3 & MUT3_REGEN)
1015         creature_ptr->regenerate = TRUE;
1016
1017     if (creature_ptr->muta3 & MUT3_ESP)
1018         creature_ptr->telepathy = TRUE;
1019
1020     if (creature_ptr->muta3 & MUT3_MOTION)
1021         creature_ptr->free_act = TRUE;
1022 }