From: Hourier Date: Sat, 1 Aug 2020 02:16:48 +0000 (+0900) Subject: [Refactor] #40574 Separated neutralize_base_status() from gain_mutation() X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=92bb88e6af60da7f15e365eab6d84f412f65deb0;p=hengband%2Fhengband.git [Refactor] #40574 Separated neutralize_base_status() from gain_mutation() --- diff --git a/src/mutation/mutation.c b/src/mutation/mutation.c index 4fb751fc1..edfb76d5c 100644 --- a/src/mutation/mutation.c +++ b/src/mutation/mutation.c @@ -109,6 +109,118 @@ static void race_dependent_mutation(player_type *creature_ptr, gm_type *gm_ptr) } } +static void neutralize_base_status(player_type *creature_ptr, gm_type *gm_ptr) +{ + if (gm_ptr->muta_which == MUT3_PUNY) { + if (creature_ptr->muta3 & MUT3_HYPER_STR) { + msg_print(_("あなたはもう超人的に強くはない!", "You no longer feel super-strong!")); + creature_ptr->muta3 &= ~(MUT3_HYPER_STR); + } + + return; + } + + if (gm_ptr->muta_which == MUT3_HYPER_STR) { + if (creature_ptr->muta3 & MUT3_PUNY) { + msg_print(_("あなたはもう虚弱ではない!", "You no longer feel puny!")); + creature_ptr->muta3 &= ~(MUT3_PUNY); + } + + return; + } + + if (gm_ptr->muta_which == MUT3_MORONIC) { + if (creature_ptr->muta3 & MUT3_HYPER_INT) { + msg_print(_("あなたの脳はもう生体コンピュータではない。", "Your brain is no longer a living computer.")); + creature_ptr->muta3 &= ~(MUT3_HYPER_INT); + } + + return; + } + + if (gm_ptr->muta_which == MUT3_HYPER_INT) { + if (creature_ptr->muta3 & MUT3_MORONIC) { + msg_print(_("あなたはもう精神薄弱ではない。", "You are no longer moronic.")); + creature_ptr->muta3 &= ~(MUT3_MORONIC); + } + + return; + } + + if (gm_ptr->muta_which == MUT3_IRON_SKIN) { + if (creature_ptr->muta3 & MUT3_SCALES) { + msg_print(_("鱗がなくなった。", "You lose your scales.")); + creature_ptr->muta3 &= ~(MUT3_SCALES); + } + + if (creature_ptr->muta3 & MUT3_FLESH_ROT) { + msg_print(_("肉体が腐乱しなくなった。", "Your flesh rots no longer.")); + creature_ptr->muta3 &= ~(MUT3_FLESH_ROT); + } + + if (creature_ptr->muta3 & MUT3_WART_SKIN) { + msg_print(_("肌のイボイボがなくなった。", "You lose your warts.")); + creature_ptr->muta3 &= ~(MUT3_WART_SKIN); + } + + return; + } + + if (gm_ptr->muta_which == MUT3_WART_SKIN || gm_ptr->muta_which == MUT3_SCALES || gm_ptr->muta_which == MUT3_FLESH_ROT) { + if (creature_ptr->muta3 & MUT3_IRON_SKIN) { + msg_print(_("あなたの肌はもう鉄ではない。", "Your skin is no longer made of steel.")); + creature_ptr->muta3 &= ~(MUT3_IRON_SKIN); + } + + return; + } + + if (gm_ptr->muta_which == MUT3_FEARLESS) { + if (creature_ptr->muta2 & MUT2_COWARDICE) { + msg_print(_("臆病でなくなった。", "You are no longer cowardly.")); + creature_ptr->muta2 &= ~(MUT2_COWARDICE); + } + + return; + } + + if (gm_ptr->muta_which == MUT3_FLESH_ROT) { + if (creature_ptr->muta3 & MUT3_REGEN) { + msg_print(_("急速に回復しなくなった。", "You stop regenerating.")); + creature_ptr->muta3 &= ~(MUT3_REGEN); + } + + return; + } + + if (gm_ptr->muta_which == MUT3_REGEN) { + if (creature_ptr->muta3 & MUT3_FLESH_ROT) { + msg_print(_("肉体が腐乱しなくなった。", "Your flesh stops rotting.")); + creature_ptr->muta3 &= ~(MUT3_FLESH_ROT); + } + + return; + } + + if (gm_ptr->muta_which == MUT3_LIMBER) { + if (creature_ptr->muta3 & MUT3_ARTHRITIS) { + msg_print(_("関節が痛くなくなった。", "Your joints stop hurting.")); + creature_ptr->muta3 &= ~(MUT3_ARTHRITIS); + } + + return; + } + + if (gm_ptr->muta_which == MUT3_ARTHRITIS) { + if (creature_ptr->muta3 & MUT3_LIMBER) { + msg_print(_("あなたはしなやかでなくなった。", "You no longer feel limber.")); + creature_ptr->muta3 &= ~(MUT3_LIMBER); + } + + return; + } +} + /*! * @brief プレイヤーに突然変異を与える * @param choose_mut 与えたい突然変異のID、0ならばランダムに選択 @@ -140,72 +252,11 @@ bool gain_mutation(player_type *creature_ptr, MUTATION_IDX choose_mut) race_dependent_mutation(creature_ptr, gm_ptr); msg_print(_("突然変異した!", "You mutate!")); msg_print(gm_ptr->muta_desc); - *gm_ptr->muta_class |= gm_ptr->muta_which; + if (gm_ptr->muta_class != NULL) + *gm_ptr->muta_class |= gm_ptr->muta_which; + if (gm_ptr->muta_class == &(creature_ptr->muta3)) { - if (gm_ptr->muta_which == MUT3_PUNY) { - if (creature_ptr->muta3 & MUT3_HYPER_STR) { - msg_print(_("あなたはもう超人的に強くはない!", "You no longer feel super-strong!")); - creature_ptr->muta3 &= ~(MUT3_HYPER_STR); - } - } else if (gm_ptr->muta_which == MUT3_HYPER_STR) { - if (creature_ptr->muta3 & MUT3_PUNY) { - msg_print(_("あなたはもう虚弱ではない!", "You no longer feel puny!")); - creature_ptr->muta3 &= ~(MUT3_PUNY); - } - } else if (gm_ptr->muta_which == MUT3_MORONIC) { - if (creature_ptr->muta3 & MUT3_HYPER_INT) { - msg_print(_("あなたの脳はもう生体コンピュータではない。", "Your brain is no longer a living computer.")); - creature_ptr->muta3 &= ~(MUT3_HYPER_INT); - } - } else if (gm_ptr->muta_which == MUT3_HYPER_INT) { - if (creature_ptr->muta3 & MUT3_MORONIC) { - msg_print(_("あなたはもう精神薄弱ではない。", "You are no longer moronic.")); - creature_ptr->muta3 &= ~(MUT3_MORONIC); - } - } else if (gm_ptr->muta_which == MUT3_IRON_SKIN) { - if (creature_ptr->muta3 & MUT3_SCALES) { - msg_print(_("鱗がなくなった。", "You lose your scales.")); - creature_ptr->muta3 &= ~(MUT3_SCALES); - } - if (creature_ptr->muta3 & MUT3_FLESH_ROT) { - msg_print(_("肉体が腐乱しなくなった。", "Your flesh rots no longer.")); - creature_ptr->muta3 &= ~(MUT3_FLESH_ROT); - } - if (creature_ptr->muta3 & MUT3_WART_SKIN) { - msg_print(_("肌のイボイボがなくなった。", "You lose your warts.")); - creature_ptr->muta3 &= ~(MUT3_WART_SKIN); - } - } else if (gm_ptr->muta_which == MUT3_WART_SKIN || gm_ptr->muta_which == MUT3_SCALES || gm_ptr->muta_which == MUT3_FLESH_ROT) { - if (creature_ptr->muta3 & MUT3_IRON_SKIN) { - msg_print(_("あなたの肌はもう鉄ではない。", "Your skin is no longer made of steel.")); - creature_ptr->muta3 &= ~(MUT3_IRON_SKIN); - } - } else if (gm_ptr->muta_which == MUT3_FEARLESS) { - if (creature_ptr->muta2 & MUT2_COWARDICE) { - msg_print(_("臆病でなくなった。", "You are no longer cowardly.")); - creature_ptr->muta2 &= ~(MUT2_COWARDICE); - } - } else if (gm_ptr->muta_which == MUT3_FLESH_ROT) { - if (creature_ptr->muta3 & MUT3_REGEN) { - msg_print(_("急速に回復しなくなった。", "You stop regenerating.")); - creature_ptr->muta3 &= ~(MUT3_REGEN); - } - } else if (gm_ptr->muta_which == MUT3_REGEN) { - if (creature_ptr->muta3 & MUT3_FLESH_ROT) { - msg_print(_("肉体が腐乱しなくなった。", "Your flesh stops rotting.")); - creature_ptr->muta3 &= ~(MUT3_FLESH_ROT); - } - } else if (gm_ptr->muta_which == MUT3_LIMBER) { - if (creature_ptr->muta3 & MUT3_ARTHRITIS) { - msg_print(_("関節が痛くなくなった。", "Your joints stop hurting.")); - creature_ptr->muta3 &= ~(MUT3_ARTHRITIS); - } - } else if (gm_ptr->muta_which == MUT3_ARTHRITIS) { - if (creature_ptr->muta3 & MUT3_LIMBER) { - msg_print(_("あなたはしなやかでなくなった。", "You no longer feel limber.")); - creature_ptr->muta3 &= ~(MUT3_LIMBER); - } - } + neutralize_base_status(creature_ptr, gm_ptr); } else if (gm_ptr->muta_class == &(creature_ptr->muta2)) { if (gm_ptr->muta_which == MUT2_COWARDICE) { if (creature_ptr->muta3 & MUT3_FEARLESS) {