1 #include "mutation/mutation-investor-remover.h"
2 #include "core/player-update-types.h"
3 #include "core/stuff-handler.h"
4 #include "mutation/gain-mutation-switcher.h"
5 #include "mutation/lose-mutation-switcher.h"
6 #include "mutation/mutation-flag-types.h"
7 #include "mutation/mutation-util.h"
8 #include "mutation/mutation-calculator.h" // todo calc_mutant_regenerate_mod() が相互依存している、後で消す.
9 #include "player-info/avatar.h"
10 #include "view/display-messages.h"
12 static void sweep_gain_mutation(player_type *creature_ptr, glm_type *gm_ptr)
14 int attempts_left = 20;
15 if (gm_ptr->choose_mut)
18 while (attempts_left--) {
19 switch_gain_mutation(creature_ptr, gm_ptr);
20 if ((gm_ptr->muta_class != NULL) && (gm_ptr->muta_which != 0) && ((*gm_ptr->muta_class & gm_ptr->muta_which) == 0))
21 gm_ptr->muta_chosen = TRUE;
23 if (gm_ptr->muta_chosen)
28 static void race_dependent_mutation(player_type *creature_ptr, glm_type *gm_ptr)
30 if (gm_ptr->choose_mut != 0)
33 if (creature_ptr->prace == RACE_VAMPIRE && !(creature_ptr->muta1 & MUT1_HYPN_GAZE) && (randint1(10) < 7)) {
34 gm_ptr->muta_class = &(creature_ptr->muta1);
35 gm_ptr->muta_which = MUT1_HYPN_GAZE;
36 gm_ptr->muta_desc = _("眼が幻惑的になった...", "Your eyes look mesmerizing...");
40 if (creature_ptr->prace == RACE_IMP && !(creature_ptr->muta2 & MUT2_HORNS) && (randint1(10) < 7)) {
41 gm_ptr->muta_class = &(creature_ptr->muta2);
42 gm_ptr->muta_which = MUT2_HORNS;
43 gm_ptr->muta_desc = _("角が額から生えてきた!", "Horns pop forth into your forehead!");
47 if (creature_ptr->prace == RACE_YEEK && !(creature_ptr->muta1 & MUT1_SHRIEK) && (randint1(10) < 7)) {
48 gm_ptr->muta_class = &(creature_ptr->muta1);
49 gm_ptr->muta_which = MUT1_SHRIEK;
50 gm_ptr->muta_desc = _("声質がかなり強くなった。", "Your vocal cords get much tougher.");
54 if (creature_ptr->prace == RACE_BEASTMAN && !(creature_ptr->muta1 & MUT1_POLYMORPH) && (randint1(10) < 2)) {
55 gm_ptr->muta_class = &(creature_ptr->muta1);
56 gm_ptr->muta_which = MUT1_POLYMORPH;
57 gm_ptr->muta_desc = _("あなたの肉体は変化できるようになった、", "Your body seems mutable.");
61 if (creature_ptr->prace == RACE_MIND_FLAYER && !(creature_ptr->muta2 & MUT2_TENTACLES) && (randint1(10) < 7)) {
62 gm_ptr->muta_class = &(creature_ptr->muta2);
63 gm_ptr->muta_which = MUT2_TENTACLES;
64 gm_ptr->muta_desc = _("邪悪な触手が口の周りに生えた。", "Evil-looking tentacles sprout from your mouth.");
68 static void neutralize_base_status(player_type *creature_ptr, glm_type *gm_ptr)
70 if (gm_ptr->muta_which == MUT3_PUNY) {
71 if (creature_ptr->muta3 & MUT3_HYPER_STR) {
72 msg_print(_("あなたはもう超人的に強くはない!", "You no longer feel super-strong!"));
73 creature_ptr->muta3 &= ~(MUT3_HYPER_STR);
79 if (gm_ptr->muta_which == MUT3_HYPER_STR) {
80 if (creature_ptr->muta3 & MUT3_PUNY) {
81 msg_print(_("あなたはもう虚弱ではない!", "You no longer feel puny!"));
82 creature_ptr->muta3 &= ~(MUT3_PUNY);
88 if (gm_ptr->muta_which == MUT3_MORONIC) {
89 if (creature_ptr->muta3 & MUT3_HYPER_INT) {
90 msg_print(_("あなたの脳はもう生体コンピュータではない。", "Your brain is no longer a living computer."));
91 creature_ptr->muta3 &= ~(MUT3_HYPER_INT);
97 if (gm_ptr->muta_which == MUT3_HYPER_INT) {
98 if (creature_ptr->muta3 & MUT3_MORONIC) {
99 msg_print(_("あなたはもう精神薄弱ではない。", "You are no longer moronic."));
100 creature_ptr->muta3 &= ~(MUT3_MORONIC);
106 if (gm_ptr->muta_which == MUT3_IRON_SKIN) {
107 if (creature_ptr->muta3 & MUT3_SCALES) {
108 msg_print(_("鱗がなくなった。", "You lose your scales."));
109 creature_ptr->muta3 &= ~(MUT3_SCALES);
112 if (creature_ptr->muta3 & MUT3_FLESH_ROT) {
113 msg_print(_("肉体が腐乱しなくなった。", "Your flesh rots no longer."));
114 creature_ptr->muta3 &= ~(MUT3_FLESH_ROT);
117 if (creature_ptr->muta3 & MUT3_WART_SKIN) {
118 msg_print(_("肌のイボイボがなくなった。", "You lose your warts."));
119 creature_ptr->muta3 &= ~(MUT3_WART_SKIN);
125 if (gm_ptr->muta_which == MUT3_WART_SKIN || gm_ptr->muta_which == MUT3_SCALES || gm_ptr->muta_which == MUT3_FLESH_ROT) {
126 if (creature_ptr->muta3 & MUT3_IRON_SKIN) {
127 msg_print(_("あなたの肌はもう鉄ではない。", "Your skin is no longer made of steel."));
128 creature_ptr->muta3 &= ~(MUT3_IRON_SKIN);
134 if (gm_ptr->muta_which == MUT3_FEARLESS) {
135 if (creature_ptr->muta2 & MUT2_COWARDICE) {
136 msg_print(_("臆病でなくなった。", "You are no longer cowardly."));
137 creature_ptr->muta2 &= ~(MUT2_COWARDICE);
143 if (gm_ptr->muta_which == MUT3_FLESH_ROT) {
144 if (creature_ptr->muta3 & MUT3_REGEN) {
145 msg_print(_("急速に回復しなくなった。", "You stop regenerating."));
146 creature_ptr->muta3 &= ~(MUT3_REGEN);
152 if (gm_ptr->muta_which == MUT3_REGEN) {
153 if (creature_ptr->muta3 & MUT3_FLESH_ROT) {
154 msg_print(_("肉体が腐乱しなくなった。", "Your flesh stops rotting."));
155 creature_ptr->muta3 &= ~(MUT3_FLESH_ROT);
161 if (gm_ptr->muta_which == MUT3_LIMBER) {
162 if (creature_ptr->muta3 & MUT3_ARTHRITIS) {
163 msg_print(_("関節が痛くなくなった。", "Your joints stop hurting."));
164 creature_ptr->muta3 &= ~(MUT3_ARTHRITIS);
170 if (gm_ptr->muta_which == MUT3_ARTHRITIS) {
171 if (creature_ptr->muta3 & MUT3_LIMBER) {
172 msg_print(_("あなたはしなやかでなくなった。", "You no longer feel limber."));
173 creature_ptr->muta3 &= ~(MUT3_LIMBER);
180 static void neutralize_other_status(player_type *creature_ptr, glm_type *gm_ptr)
182 if (gm_ptr->muta_which == MUT2_COWARDICE) {
183 if (creature_ptr->muta3 & MUT3_FEARLESS) {
184 msg_print(_("恐れ知らずでなくなった。", "You no longer feel fearless."));
185 creature_ptr->muta3 &= ~(MUT3_FEARLESS);
189 if (gm_ptr->muta_which == MUT2_BEAK) {
190 if (creature_ptr->muta2 & MUT2_TRUNK) {
191 msg_print(_("あなたの鼻はもう象の鼻のようではなくなった。", "Your nose is no longer elephantine."));
192 creature_ptr->muta2 &= ~(MUT2_TRUNK);
196 if (gm_ptr->muta_which == MUT2_TRUNK) {
197 if (creature_ptr->muta2 & MUT2_BEAK) {
198 msg_print(_("硬いクチバシがなくなった。", "You no longer have a hard beak."));
199 creature_ptr->muta2 &= ~(MUT2_BEAK);
205 * @brief プレイヤーに突然変異を与える
206 * @param choose_mut 与えたい突然変異のID、0ならばランダムに選択
209 bool gain_mutation(player_type *creature_ptr, MUTATION_IDX choose_mut)
212 glm_type *gm_ptr = initialize_glm_type(&tmp_gm, choose_mut);
213 sweep_gain_mutation(creature_ptr, gm_ptr);
214 if (!gm_ptr->muta_chosen) {
215 msg_print(_("普通になった気がする。", "You feel normal."));
219 chg_virtue(creature_ptr, V_CHANCE, 1);
220 race_dependent_mutation(creature_ptr, gm_ptr);
221 msg_print(_("突然変異した!", "You mutate!"));
222 msg_print(gm_ptr->muta_desc);
223 if (gm_ptr->muta_class != NULL)
224 *gm_ptr->muta_class |= gm_ptr->muta_which;
226 if (gm_ptr->muta_class == &(creature_ptr->muta3)) {
227 neutralize_base_status(creature_ptr, gm_ptr);
228 } else if (gm_ptr->muta_class == &(creature_ptr->muta2)) {
229 neutralize_other_status(creature_ptr, gm_ptr);
232 creature_ptr->mutant_regenerate_mod = calc_mutant_regenerate_mod(creature_ptr);
233 creature_ptr->update |= PU_BONUS;
234 handle_stuff(creature_ptr);
238 static void sweep_lose_mutation(player_type *creature_ptr, glm_type *glm_ptr)
240 int attempts_left = 20;
241 if (glm_ptr->choose_mut)
244 while (attempts_left--) {
245 switch_lose_mutation(creature_ptr, glm_ptr);
246 if (glm_ptr->muta_class && glm_ptr->muta_which) {
247 if (*(glm_ptr->muta_class) & glm_ptr->muta_which) {
248 glm_ptr->muta_chosen = TRUE;
252 if (glm_ptr->muta_chosen)
258 * @brief プレイヤーから突然変異を取り除く
259 * @param choose_mut 取り除きたい突然変異のID、0ならばランダムに消去
262 bool lose_mutation(player_type *creature_ptr, MUTATION_IDX choose_mut)
265 glm_type *glm_ptr = initialize_glm_type(&tmp_glm, choose_mut);
266 sweep_lose_mutation(creature_ptr, glm_ptr);
267 if (!glm_ptr->muta_chosen)
270 msg_print(glm_ptr->muta_desc);
271 if (glm_ptr->muta_class != NULL)
272 *glm_ptr->muta_class &= ~(glm_ptr->muta_which);
274 creature_ptr->update |= PU_BONUS;
275 handle_stuff(creature_ptr);
276 creature_ptr->mutant_regenerate_mod = calc_mutant_regenerate_mod(creature_ptr);
280 void lose_all_mutations(player_type *creature_ptr)
282 if (creature_ptr->muta1 || creature_ptr->muta2 || creature_ptr->muta3) {
283 chg_virtue(creature_ptr, V_CHANCE, -5);
284 msg_print(_("全ての突然変異が治った。", "You are cured of all mutations."));
285 creature_ptr->muta1 = creature_ptr->muta2 = creature_ptr->muta3 = 0;
286 creature_ptr->update |= PU_BONUS;
287 handle_stuff(creature_ptr);
288 creature_ptr->mutant_regenerate_mod = calc_mutant_regenerate_mod(creature_ptr);