git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4129 c06c8d41-db1a-0410-9941-cceddc491573
YGLH2MKT4HM2RF4W6U33ANH7Z32MTWD6WNEL2AUD3B3AGFVJMQGQC
B7MSPF6X2RLGWN4M6ZZF3WSOPKGYPTTD7LIJVST7DXN27DG6JHNAC
PEK4UY66JUZSBSZN55W4MY4ZXI542WEEMKJCGGVJLGECNLZQMBSAC
CMNLYUECIMEZSOYG4KOSINOPER5OM7PPCGIHCM7LQVWEO77XFUYQC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
3KAINFIXO7WNWGUGZB43EUNFRS2ZPBLQZDTY456QACMRHYIJ7WDAC
ZCRK2DJ5VKECRQXZTWT4NUDL2VT5ZHUK7NT6NQPLRJ56TDX5PJSAC
VPZUNOEZYK7HPIB7XIWRBE4UNDIIN3S6STSWNLELVIZPF2GAFEUQC
HW7XKO7HRAUQVDVVKG5GA7PYAEL5J5GKVDPT2CKAD3FLERAY5HLAC
static void _helix_card(int power, deck_rarity_type rarity)
const mutation_type bad_mutations[] = {
MUT_FAST_METABOLISM, MUT_WEAK, MUT_DOPEY, MUT_CLUMSY,
MUT_TELEPORT, MUT_DEFORMED, MUT_SCREAM, MUT_DETERIORATION,
MUT_BLURRY_VISION, MUT_FRAIL
};
bool _has_bad_mutation()
const int power_level = get_power_level(power, rarity);
const mutation_type bad_mutations[] = {
MUT_FAST_METABOLISM, MUT_WEAK, MUT_DOPEY, MUT_CLUMSY,
MUT_TELEPORT, MUT_DEFORMED, MUT_SCREAM, MUT_DETERIORATION,
MUT_BLURRY_VISION, MUT_FRAIL
};
for ( unsigned int i = 0; i < ARRAYSIZE(bad_mutations); ++i )
if (you.mutation[bad_mutations[i]] > you.demon_pow[bad_mutations[i]])
return true;
return false;
}
// Playing with genetics is tricky:
// You always have a 50% chance of losing an extra mutation,
// and a 50% chance of gaining a mutation.
static void _helix_card(int power, deck_rarity_type rarity)
{
const int power_level = get_power_level(power, rarity);
else
mutate( RANDOM_ELEMENT(bad_mutations) );
}
else if ( power_level == 1 )
{
switch ( count_mutations() ? random2(3) : 0 )
{
case 0:
mutate(coinflip() ? RANDOM_GOOD_MUTATION : RANDOM_MUTATION);
break;
case 1:
if ( coinflip() )
_remove_bad_mutation();
else
delete_mutation( RANDOM_MUTATION );
break;
case 2:
if ( coinflip() )
{
if ( coinflip() )
{
_remove_bad_mutation();
mutate(RANDOM_MUTATION);
}
else
{
delete_mutation(RANDOM_MUTATION);
mutate(RANDOM_GOOD_MUTATION);
}
}
else
{
delete_mutation(RANDOM_MUTATION);
mutate(RANDOM_MUTATION);
}
break;
}
}
else
{
switch ( _has_bad_mutation() ? random2(3) : random2(2) + 1 )
{
case 0:
_remove_bad_mutation();
break;
case 1:
mutate(RANDOM_GOOD_MUTATION);
break;
case 2:
if ( coinflip() )
{
// If you get unlucky, you could get here with no bad
// mutations and simply get a mutation effect. Oh well.
_remove_bad_mutation();
mutate(RANDOM_MUTATION);
}
else
{
delete_mutation(RANDOM_MUTATION);
mutate(RANDOM_GOOD_MUTATION);
}
break;
}