From 32525cca511f64ddc4ef4921f887e64038cdd428 Mon Sep 17 00:00:00 2001 From: dolorous Date: Mon, 28 Apr 2008 15:03:06 +0000 Subject: Allow god gift mutations to override less than 3 levels of the mutation resistance mutation. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4745 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/debug.cc | 2 +- crawl-ref/source/mutation.cc | 21 ++++++++++++--------- crawl-ref/source/mutation.h | 2 +- crawl-ref/source/religion.cc | 2 +- 4 files changed, 15 insertions(+), 12 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc index 98337ae775..6746479c37 100644 --- a/crawl-ref/source/debug.cc +++ b/crawl-ref/source/debug.cc @@ -2454,7 +2454,7 @@ bool debug_add_mutation(void) { for (int i = 0; i < -levels; i++) { - if (delete_mutation(mutat, force)) + if (delete_mutation(mutat, force, god_gift)) success = true; } } diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc index 7dbdfa46b5..d299d3088d 100644 --- a/crawl-ref/source/mutation.cc +++ b/crawl-ref/source/mutation.cc @@ -1662,12 +1662,13 @@ bool mutate(mutation_type which_mutation, bool failMsg, if (!force_mutation) { - // God gifts override amulets of resist mutation. - if ((wearing_amulet(AMU_RESIST_MUTATION) - && !one_chance_in(10) && !god_gift) - || player_mutation_level(MUT_MUTATION_RESISTANCE) == 3 + // God gifts override amulets of resist mutation and less than 3 + // levels of the mutation resistance mutation. + if (player_mutation_level(MUT_MUTATION_RESISTANCE) == 3 + || ((wearing_amulet(AMU_RESIST_MUTATION) + && !one_chance_in(10) || player_mutation_level(MUT_MUTATION_RESISTANCE) - && !one_chance_in(3)) + && !one_chance_in(3)) && !god_gift)) { mpr("You feel odd for a moment.", MSGCH_MUTATION); return false; @@ -2185,15 +2186,17 @@ int how_mutated(bool all, bool levels) } // end how_mutated() bool delete_mutation(mutation_type which_mutation, - bool force_mutation) + bool force_mutation, bool god_gift) { mutation_type mutat = which_mutation; if (!force_mutation) { - if (player_mutation_level(MUT_MUTATION_RESISTANCE) > 1 - && (player_mutation_level(MUT_MUTATION_RESISTANCE) == 3 - || coinflip())) + // God gifts override less than 3 levels of the mutation + // resistance mutation. + if (player_mutation_level(MUT_MUTATION_RESISTANCE) == 3 + || ((player_mutation_level(MUT_MUTATION_RESISTANCE) > 1 + && coinflip()) && !god_gift)) { 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 3b39b95996..09ad80772b 100644 --- a/crawl-ref/source/mutation.h +++ b/crawl-ref/source/mutation.h @@ -56,7 +56,7 @@ formatted_string describe_mutations(); * called from: decks - it_use2 - mutation - spells * *********************************************************************** */ bool delete_mutation(mutation_type which_mutation, - bool force_mutation = false); + bool force_mutation = false, bool god_gift = false); // last updated 12may2000 {dlb} /* *********************************************************************** diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 88b37366ab..b19eb18a6d 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -2955,7 +2955,7 @@ static bool _zin_retribution() bool success = false; for (int i = 0; i < 7; i++) if (random2(10) > i - && delete_mutation(RANDOM_GOOD_MUTATION)) + && delete_mutation(RANDOM_GOOD_MUTATION, false, true)) { success = true; } -- cgit v1.2.3-54-g00ecf