50% chance of removing an extra mutation; 50% chance of adding a mutation. If power is low, this added mutation is likely to be harmful.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4071 c06c8d41-db1a-0410-9941-cceddc491573
PEK4UY66JUZSBSZN55W4MY4ZXI542WEEMKJCGGVJLGECNLZQMBSAC
// Playing with genetics is tricky:
// You always have a 50% chance of losing an extra mutation,
// and a 50% chance of gaining a mutation.
// With power level 2: extra mutation is random
// With power level 1: 50% extra mutation is bad
// With power level 0: 75% extra mutation is bad
if ( coinflip() )
delete_mutation(RANDOM_MUTATION);
if ( coinflip() )
{
if ( (power_level == 0 && one_chance_in(4)) ||
(power_level == 1 && coinflip()) ||
(power_level == 2) )
{
mutate(RANDOM_MUTATION);
}
else
mutate( RANDOM_ELEMENT(bad_mutations) );
}