diff options
-rw-r--r-- | crawl-ref/source/debug.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/mutation.cc | 43 | ||||
-rw-r--r-- | crawl-ref/source/mutation.h | 3 | ||||
-rw-r--r-- | crawl-ref/source/religion.cc | 15 | ||||
-rw-r--r-- | crawl-ref/source/xom.cc | 7 |
5 files changed, 38 insertions, 32 deletions
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc index 474d4f6858..b3dba47d50 100644 --- a/crawl-ref/source/debug.cc +++ b/crawl-ref/source/debug.cc @@ -3969,7 +3969,7 @@ bool wizard_add_mutation() else { for (int i = 0; i < -levels; ++i) - if (delete_mutation(mutat, true, force)) + if (delete_mutation(mutat, true, force, god_gift)) success = true; } } diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc index 650b80dde6..5291cd8d85 100644 --- a/crawl-ref/source/mutation.cc +++ b/crawl-ref/source/mutation.cc @@ -2048,18 +2048,21 @@ bool mutate(mutation_type which_mutation, bool failMsg, if (!force_mutation) { // God gifts override all sources of mutation resistance other - // than the mutation resistance mutation and divine protection, - // and stat gain potions override all sources of mutation - // resistance other than the mutation resistance mutation. - if (wearing_amulet(AMU_RESIST_MUTATION) - && !one_chance_in(10) && !god_gift && !stat_gain_potion - || player_mutation_level(MUT_MUTATION_RESISTANCE) == 3 - || player_mutation_level(MUT_MUTATION_RESISTANCE) - && !one_chance_in(3)) + // than divine protection, and stat gain potions override all + // sources of mutation resistance other than the mutation + // resistance mutation. + if (!god_gift) { - if (failMsg) - mpr("You feel odd for a moment.", MSGCH_MUTATION); - return (false); + if (wearing_amulet(AMU_RESIST_MUTATION) + && !one_chance_in(10) && !stat_gain_potion + || player_mutation_level(MUT_MUTATION_RESISTANCE) == 3 + || player_mutation_level(MUT_MUTATION_RESISTANCE) + && !one_chance_in(3)) + { + if (failMsg) + mpr("You feel odd for a moment.", MSGCH_MUTATION); + return (false); + } } // Zin's protection. @@ -2314,7 +2317,8 @@ bool mutate(mutation_type which_mutation, bool failMsg, } bool delete_mutation(mutation_type which_mutation, bool failMsg, - bool force_mutation, bool non_fatal) + bool force_mutation, bool god_gift, + bool non_fatal) { ASSERT(!non_fatal || _is_random(which_mutation)); @@ -2322,13 +2326,16 @@ bool delete_mutation(mutation_type which_mutation, bool failMsg, if (!force_mutation) { - if (player_mutation_level(MUT_MUTATION_RESISTANCE) > 1 - && (player_mutation_level(MUT_MUTATION_RESISTANCE) == 3 - || coinflip())) + if (!god_gift) { - if (failMsg) - mpr("You feel rather odd for a moment.", MSGCH_MUTATION); - return (false); + if (player_mutation_level(MUT_MUTATION_RESISTANCE) > 1 + && (player_mutation_level(MUT_MUTATION_RESISTANCE) == 3 + || coinflip())) + { + if (failMsg) + mpr("You feel rather odd for a moment.", MSGCH_MUTATION); + return (false); + } } } diff --git a/crawl-ref/source/mutation.h b/crawl-ref/source/mutation.h index 8a33c46f8e..6a1e8fcc10 100644 --- a/crawl-ref/source/mutation.h +++ b/crawl-ref/source/mutation.h @@ -44,7 +44,8 @@ bool mutation_is_fully_active(mutation_type mut); formatted_string describe_mutations(); bool delete_mutation(mutation_type which_mutation, bool failMsg = true, - bool force_mutation = false, bool non_fatal = false); + bool force_mutation = false, bool god_gift = false, + bool non_fatal = false); std::string mutation_name(mutation_type which_mutat, int level = -1, bool colour = false); diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 645ab044bb..d0bc0f64a1 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -4210,7 +4210,7 @@ static bool _tso_retribution() static void _zin_remove_good_mutations() { - if (!how_mutated() || player_mutation_level(MUT_MUTATION_RESISTANCE) == 3) + if (!how_mutated()) return; bool success = false; @@ -4221,8 +4221,11 @@ static void _zin_remove_good_mutations() for (int i = 7; i >= 0; --i) { - if (i <= random2(10) && delete_mutation(RANDOM_GOOD_MUTATION, failMsg)) + if (i <= random2(10) + && delete_mutation(RANDOM_GOOD_MUTATION, failMsg, false, true)) + { success = true; + } else failMsg = false; } @@ -4241,13 +4244,9 @@ static bool _zin_retribution() int punishment = random2(10); - // If not mutated or can't unmutate, do something else instead. - if (punishment > 7 - && (!how_mutated() - || player_mutation_level(MUT_MUTATION_RESISTANCE) == 3)) - { + // If not mutated, do something else instead. + if (punishment > 7 && !how_mutated()) punishment = random2(8); - } switch (punishment) { diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc index 1f1015f774..968e5976c9 100644 --- a/crawl-ref/source/xom.cc +++ b/crawl-ref/source/xom.cc @@ -1459,8 +1459,7 @@ static bool _xom_give_mutations(bool good) { bool rc = false; - if (you.can_safely_mutate() - && player_mutation_level(MUT_MUTATION_RESISTANCE) < 3) + if (you.can_safely_mutate()) { const char* lookup = (good ? "good mutations" : "random mutations"); god_speaks(GOD_XOM, _get_xom_speech(lookup).c_str()); @@ -2859,7 +2858,7 @@ static void _handle_accidental_death(const int orig_hp, mutation_type bad = dex_muts[i]; while (you.dex <= 0 && you.mutation[bad] > orig_mutation[bad]) - delete_mutation(bad, true, true); + delete_mutation(bad, true, true, true); } while (you.dex <= 0 && you.mutation[MUT_FLEXIBLE_WEAK] < @@ -2872,7 +2871,7 @@ static void _handle_accidental_death(const int orig_hp, && you.mutation[MUT_FLEXIBLE_WEAK] > orig_mutation[MUT_FLEXIBLE_WEAK]) { - delete_mutation(MUT_FLEXIBLE_WEAK, true, true); + delete_mutation(MUT_FLEXIBLE_WEAK, true, true, true); } while (you.strength <= 0 && you.mutation[MUT_STRONG_STIFF] < |