diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-10-21 15:29:17 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-10-21 15:29:17 +0000 |
commit | e62bf1734dab24f7426cf5357d3d48114748fee7 (patch) | |
tree | 1dc814c1442ea47b78cf538ff9e3707801621ac2 /crawl-ref/source | |
parent | ad4b537375a36b53291b1bfff87c729a983d5417 (diff) | |
download | crawl-ref-e62bf1734dab24f7426cf5357d3d48114748fee7.tar.gz crawl-ref-e62bf1734dab24f7426cf5357d3d48114748fee7.zip |
[1795751] Mutation cleanup, courtesy dolorous.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2506 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/mutation.cc | 168 | ||||
-rw-r--r-- | crawl-ref/source/mutation.h | 7 |
2 files changed, 14 insertions, 161 deletions
diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc index 407dd5855d..fac286c24a 100644 --- a/crawl-ref/source/mutation.cc +++ b/crawl-ref/source/mutation.cc @@ -1476,16 +1476,14 @@ bool mutate(mutation_type which_mutation, bool failMsg, bool force_mutation, // putting boots on after they are forced off. -- bwr if (mutat == MUT_HOOVES - && (you.species == SP_NAGA || you.mutation[MUT_HOOVES] - || you.species == SP_KENKU || player_genus(GENPC_DRACONIAN))) + && (you.species == SP_NAGA || you.species == SP_KENKU + || player_genus(GENPC_DRACONIAN))) { return false; } if (mutat == MUT_FANGS && you.species == SP_KENKU) - { return false; - } if (mutat == MUT_BREATHE_POISON && you.species != SP_NAGA) return false; @@ -1493,6 +1491,9 @@ bool mutate(mutation_type which_mutation, bool failMsg, bool force_mutation, if (mutat == MUT_BIG_WINGS && !player_genus(GENPC_DRACONIAN)) return false; + if (you.mutation[mutat] >= mutation_defs[mutat].levels) + return false; + // find where these things are actually changed // -- do not globally force redraw {dlb} you.redraw_hit_points = 1; @@ -1605,10 +1606,6 @@ bool mutate(mutation_type which_mutation, bool failMsg, bool force_mutation, mpr(gain_mutation[mutat][you.mutation[mutat]], MSGCH_MUTATION); break; - case MUT_SHOCK_RESISTANCE: - mpr(gain_mutation[mutat][you.mutation[mutat]], MSGCH_MUTATION); - break; - case MUT_FAST_METABOLISM: if (you.mutation[MUT_SLOW_METABOLISM] > 0) { @@ -1628,19 +1625,11 @@ bool mutate(mutation_type which_mutation, bool failMsg, bool force_mutation, mpr(gain_mutation[mutat][you.mutation[mutat]], MSGCH_MUTATION); break; - case MUT_TELEPORT_CONTROL: - mpr(gain_mutation[mutat][you.mutation[mutat]], MSGCH_MUTATION); - break; - case MUT_HOOVES: //jmf: like horns mpr(gain_mutation[mutat][you.mutation[mutat]], MSGCH_MUTATION); remove_one_equip(EQ_BOOTS); break; - case MUT_FANGS: - mpr(gain_mutation[mutat][you.mutation[mutat]], MSGCH_MUTATION); - break; - case MUT_CLAWS: mpr((you.species == SP_TROLL ? troll_claw_gain : gain_mutation[mutat])[you.mutation[mutat]], @@ -1720,9 +1709,6 @@ bool mutate(mutation_type which_mutation, bool failMsg, bool force_mutation, case MUT_BLACK_SCALES: case MUT_BONEY_PLATES: modify_stat(STAT_DEXTERITY, -1, true, "gaining a mutation"); - // deliberate fall-through - default: - mpr(gain_mutation[mutat][you.mutation[mutat]], MSGCH_MUTATION); break; case MUT_GREY2_SCALES: @@ -1748,6 +1734,10 @@ bool mutate(mutation_type which_mutation, bool failMsg, bool force_mutation, mpr(gain_mutation[mutat][you.mutation[mutat]], MSGCH_MUTATION); break; + + default: + mpr(gain_mutation[mutat][you.mutation[mutat]], MSGCH_MUTATION); + break; } you.mutation[mutat]++; @@ -1855,22 +1845,6 @@ bool delete_mutation(mutation_type which_mutation, bool force) modify_stat(STAT_DEXTERITY, 1, false, "losing a mutation"); break; - case MUT_SHOCK_RESISTANCE: - mpr(lose_mutation[mutat][you.mutation[mutat] - 1], MSGCH_MUTATION); - break; - - case MUT_FAST_METABOLISM: - mpr(lose_mutation[mutat][you.mutation[mutat] - 1], MSGCH_MUTATION); - break; - - case MUT_SLOW_METABOLISM: - mpr(lose_mutation[mutat][you.mutation[mutat] - 1], MSGCH_MUTATION); - break; - - case MUT_TELEPORT_CONTROL: - mpr(lose_mutation[mutat][you.mutation[mutat] - 1], MSGCH_MUTATION); - break; - case MUT_STRONG_STIFF: modify_stat(STAT_STRENGTH, -1, true, "losing a mutation"); modify_stat(STAT_DEXTERITY, 1, true, "losing a mutation"); @@ -1911,10 +1885,6 @@ bool delete_mutation(mutation_type which_mutation, bool force) MSGCH_MUTATION); break; - default: - mpr(lose_mutation[mutat][you.mutation[mutat] - 1], MSGCH_MUTATION); - break; - case MUT_GREY2_SCALES: if (you.mutation[mutat] != 2) modify_stat(STAT_DEXTERITY, 1, true, "losing a mutation"); @@ -1950,6 +1920,10 @@ bool delete_mutation(mutation_type which_mutation, bool force) } } break; + + default: + mpr(lose_mutation[mutat][you.mutation[mutat] - 1], MSGCH_MUTATION); + break; } // find where these things are actually altered @@ -2023,12 +1997,7 @@ const char *mutation_name(mutation_type which_mutat, int level) return (mut_string); } - // Some mutations only have one "level", and it's better - // to show the first level description than a blank description. - if (mutation_descrip[ which_mutat ][ level - 1 ][0] == 0) - return (mutation_descrip[ which_mutat ][ 0 ]); - else - return (mutation_descrip[ which_mutat ][ level - 1 ]); + return (mutation_descrip[ which_mutat ][ level - 1 ]); } // end mutation_name() /* Use an attribute counter for how many demonic mutations a dspawn has */ @@ -2394,112 +2363,3 @@ bool give_bad_mutation(bool forceMutation, bool failMsg) return mutate(which_bad_one, failMsg, forceMutation); } // end give_bad_mutation() - -//jmf: might be useful somewhere (eg Xom or transmigration effect) -bool give_cosmetic_mutation() -{ - mutation_type mutation = NUM_MUTATIONS; - int how_much = 0; - int counter = 0; - - do - { - mutation = MUT_DEFORMED; - how_much = 1 + random2(3); - - if (one_chance_in(6)) - { - mutation = MUT_ROBUST; - how_much = 1 + random2(3); - } - - if (one_chance_in(6)) - { - mutation = MUT_FRAIL; - how_much = 1 + random2(3); - } - - if (one_chance_in(5)) - { - mutation = MUT_TOUGH_SKIN; - how_much = 1 + random2(3); - } - - if (one_chance_in(4)) - { - mutation = MUT_CLAWS; - how_much = 1 + random2(3); - } - - if (you.species != SP_NAGA && !you.mutation[MUT_HOOVES] - && you.species != SP_KENKU && !player_genus(GENPC_DRACONIAN) - && one_chance_in(5)) - { - mutation = MUT_HOOVES; - how_much = 1; - } - - if (one_chance_in(5)) - { - mutation = MUT_FANGS; - how_much = 1 + random2(3); - } - - if (player_genus(GENPC_DRACONIAN) && one_chance_in(5)) - { - mutation = MUT_BIG_WINGS; - how_much = 1; - } - - if (one_chance_in(5)) - { - mutation = MUT_CARNIVOROUS; - how_much = 1 + random2(3); - } - - if (one_chance_in(6)) - { - mutation = MUT_HORNS; - how_much = 1 + random2(3); - } - - if ((you.species == SP_NAGA || player_genus(GENPC_DRACONIAN)) - && one_chance_in(4)) - { - mutation = MUT_STINGER; - how_much = 1 + random2(3); - } - - if (you.species == SP_NAGA && one_chance_in(6)) - { - mutation = MUT_BREATHE_POISON; - how_much = 1; - } - - if (!(you.species == SP_NAGA || player_genus(GENPC_DRACONIAN)) - && one_chance_in(7)) - { - mutation = MUT_SPIT_POISON; - how_much = 1; - } - - if (!(you.species == SP_NAGA || player_genus(GENPC_DRACONIAN)) - && one_chance_in(8)) - { - mutation = MUT_BREATHE_FLAMES; - how_much = 1 + random2(3); - } - - if (you.mutation[mutation] > 0) - how_much -= you.mutation[mutation]; - - if (how_much < 0) - how_much = 0; - } - while (how_much == 0 && counter++ < 5000); - - if (how_much != 0) - return mutate(mutation); - else - return false; -} // end give_cosmetic_mutation() diff --git a/crawl-ref/source/mutation.h b/crawl-ref/source/mutation.h index ab63d452d1..35419cf737 100644 --- a/crawl-ref/source/mutation.h +++ b/crawl-ref/source/mutation.h @@ -56,13 +56,6 @@ bool delete_mutation(mutation_type which_mutation, bool force = false); // default of level == -1, means to use the player's current level const char *mutation_name( mutation_type which_mutat, int level = -1 ); - -// last updated 12may2000 {dlb} -/* *********************************************************************** - * called from: items - religion - * *********************************************************************** */ -bool give_cosmetic_mutation( void ); - // last updated 12may2000 {dlb} /* *********************************************************************** * called from: items - spells |