diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-12-21 07:04:54 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-12-21 07:04:54 +0000 |
commit | 4caf249f71150e9e083e9c3e5b0f0f046c5ef64f (patch) | |
tree | 6fc6b9b5bd50d0cc432af4e89051a19c52630ed6 /crawl-ref/source/mutation.cc | |
parent | cf72d214ea56a4198e4fd9817cde7c7bef45622f (diff) | |
download | crawl-ref-4caf249f71150e9e083e9c3e5b0f0f046c5ef64f.tar.gz crawl-ref-4caf249f71150e9e083e9c3e5b0f0f046c5ef64f.zip |
You can now request that a spell miscast effect not directly kill the player
and leave him/her with at least N hp (it can still indirectly kill the player
by causing the death of a mummy, giant spore or ball lightning). Doesn't cover
the case of a level 3 transmigration miscast deleting the robust mutation or
giving the frail mutation before causing hp damage.
The Xom bad effects code now requests (unless Xom is being nasty) that spell
miscasts not directly kill the player, rather than avoiding miscasts
alltogether if the player has low HP (which didn't cover things like miscasts
leading to death via XP drain or stat loss, in addition to it avoiding spell
miscasts much too often).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7894 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mutation.cc')
-rw-r--r-- | crawl-ref/source/mutation.cc | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc index ee902d24c2..f531d437f1 100644 --- a/crawl-ref/source/mutation.cc +++ b/crawl-ref/source/mutation.cc @@ -2984,27 +2984,29 @@ int how_mutated(bool all, bool levels) return (j); } -bool give_bad_mutation(bool failMsg, bool force_mutation) +bool give_bad_mutation(bool failMsg, bool force_mutation, bool non_fatal) { mutation_type mutat = NUM_MUTATIONS; - switch (random2(13)) - { - case 0: mutat = MUT_CARNIVOROUS; break; - case 1: mutat = MUT_HERBIVOROUS; break; - case 2: mutat = MUT_FAST_METABOLISM; break; - case 3: mutat = MUT_WEAK; break; - case 4: mutat = MUT_DOPEY; break; - case 5: mutat = MUT_CLUMSY; break; - case 6: mutat = MUT_TELEPORT; break; - case 7: mutat = MUT_DEFORMED; break; - case 8: mutat = MUT_SCREAM; break; - case 9: mutat = MUT_DETERIORATION; break; - case 10: mutat = MUT_BLURRY_VISION; break; - case 11: mutat = MUT_FRAIL; break; - case 12: mutat = MUT_LOW_MAGIC; break; - } - + do { + switch (random2(13)) + { + case 0: mutat = MUT_CARNIVOROUS; break; + case 1: mutat = MUT_HERBIVOROUS; break; + case 2: mutat = MUT_FAST_METABOLISM; break; + case 3: mutat = MUT_WEAK; break; + case 4: mutat = MUT_DOPEY; break; + case 5: mutat = MUT_CLUMSY; break; + case 6: mutat = MUT_TELEPORT; break; + case 7: mutat = MUT_DEFORMED; break; + case 8: mutat = MUT_SCREAM; break; + case 9: mutat = MUT_DETERIORATION; break; + case 10: mutat = MUT_BLURRY_VISION; break; + case 11: mutat = MUT_FRAIL; break; + case 12: mutat = MUT_LOW_MAGIC; break; + } + } while (non_fatal && !accept_mutation(mutat, true, true)); + const bool result = mutate(mutat, failMsg, force_mutation); if (result) learned_something_new(TUT_YOU_MUTATED); |